diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 22:30:48 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 22:30:48 +0000 |
commit | b0fcb0e709bc2731e6e71fbee0eb31b8a1ba7213 (patch) | |
tree | 091b318d966de6961cca373b1aef6dc79e1301bd /ash/wm/resize_shadow_controller.h | |
parent | 6f98f122e37c62262d9547a91d28b1bbaa6b90d2 (diff) | |
download | chromium_src-b0fcb0e709bc2731e6e71fbee0eb31b8a1ba7213.zip chromium_src-b0fcb0e709bc2731e6e71fbee0eb31b8a1ba7213.tar.gz chromium_src-b0fcb0e709bc2731e6e71fbee0eb31b8a1ba7213.tar.bz2 |
Ash: Add resize border shadow effect
* Add ResizeShadow that uses solid-color layers to draw the resize border shadow effect.
* Add ResizeShadowController to create ResizeShadows and track bounds changes for windows.
* Wire both into ToplevelWindowEventFilter to track mouse move/enter events near (but not inside) the window frame.
BUG=118325
TEST=visual, hover mouse near window edges, drag windows
Review URL: https://chromiumcodereview.appspot.com/9677070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127268 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/resize_shadow_controller.h')
-rw-r--r-- | ash/wm/resize_shadow_controller.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/ash/wm/resize_shadow_controller.h b/ash/wm/resize_shadow_controller.h new file mode 100644 index 0000000..08294d0 --- /dev/null +++ b/ash/wm/resize_shadow_controller.h @@ -0,0 +1,61 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_WM_RESIZE_SHADOW_CONTROLLER_H_ +#define ASH_WM_RESIZE_SHADOW_CONTROLLER_H_ +#pragma once + +#include <map> + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "base/memory/linked_ptr.h" +#include "ui/aura/window_observer.h" + +namespace aura { +class Window; +} + +namespace ash { +namespace internal { + +class ResizeShadow; + +// ResizeShadowController observes changes to resizable windows and shows +// a resize handle visual effect when the cursor is near the edges. +class ResizeShadowController : public aura::WindowObserver { + public: + ResizeShadowController(); + virtual ~ResizeShadowController(); + + // Shows the appropriate shadow for a given |window| and |hit_test| location. + void ShowShadow(aura::Window* window, int hit_test); + + // Hides the shadow for a |window|, if it has one. + void HideShadow(aura::Window* window); + + // aura::WindowObserver overrides: + virtual void OnWindowBoundsChanged( + aura::Window* window, const gfx::Rect& bounds) OVERRIDE; + virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + + private: + typedef std::map<aura::Window*, linked_ptr<ResizeShadow> > WindowShadowMap; + + // Creates a shadow for a given window and returns it. |window_shadows_| + // owns the memory. + ResizeShadow* CreateShadow(aura::Window* window); + + // Returns the resize shadow for |window| or NULL if no shadow exists. + ResizeShadow* GetShadowForWindow(aura::Window* window); + + WindowShadowMap window_shadows_; + + DISALLOW_COPY_AND_ASSIGN(ResizeShadowController); +}; + +} // namespace internal +} // namespace ash + +#endif // ASH_WM_RESIZE_SHADOW_CONTROLLER_H_ |