| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_WM_PANELS_PANEL_WINDOW_RESIZER_H_ | 5 #ifndef ASH_WM_PANELS_PANEL_WINDOW_RESIZER_H_ |
| 6 #define ASH_WM_PANELS_PANEL_WINDOW_RESIZER_H_ | 6 #define ASH_WM_PANELS_PANEL_WINDOW_RESIZER_H_ |
| 7 | 7 |
| 8 #include "ash/wm/window_resizer.h" | 8 #include "ash/wm/window_resizer.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 class Rect; | 12 class Rect; |
| 13 class Point; | 13 class Point; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace aura { |
| 17 class RootWindow; |
| 18 } |
| 19 |
| 16 namespace ash { | 20 namespace ash { |
| 17 | 21 |
| 18 // PanelWindowResizer is used by ToplevelWindowEventFilter to handle dragging, | 22 // PanelWindowResizer is used by ToplevelWindowEventFilter to handle dragging, |
| 19 // moving or resizing panel window. These can be attached and detached from the | 23 // moving or resizing panel window. These can be attached and detached from the |
| 20 // launcher. | 24 // launcher. |
| 21 class ASH_EXPORT PanelWindowResizer : public WindowResizer { | 25 class ASH_EXPORT PanelWindowResizer : public WindowResizer { |
| 22 public: | 26 public: |
| 23 virtual ~PanelWindowResizer(); | 27 virtual ~PanelWindowResizer(); |
| 24 | 28 |
| 25 // Creates a new PanelWindowResizer. The caller takes ownership of the | 29 // Creates a new PanelWindowResizer. The caller takes ownership of the |
| 26 // returned object. The ownership of |next_window_resizer| is taken by the | 30 // returned object. The ownership of |next_window_resizer| is taken by the |
| 27 // returned object. Returns NULL if not resizable. | 31 // returned object. Returns NULL if not resizable. |
| 28 static PanelWindowResizer* Create(WindowResizer* next_window_resizer, | 32 static PanelWindowResizer* Create(WindowResizer* next_window_resizer, |
| 29 aura::Window* window, | 33 aura::Window* window, |
| 30 const gfx::Point& location, | 34 const gfx::Point& location, |
| 31 int window_component); | 35 int window_component); |
| 32 | 36 |
| 33 // WindowResizer overides: | 37 // WindowResizer: |
| 34 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; | 38 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; |
| 35 virtual void CompleteDrag(int event_flags) OVERRIDE; | 39 virtual void CompleteDrag(int event_flags) OVERRIDE; |
| 36 virtual void RevertDrag() OVERRIDE; | 40 virtual void RevertDrag() OVERRIDE; |
| 37 virtual aura::Window* GetTarget() OVERRIDE; | 41 virtual aura::Window* GetTarget() OVERRIDE; |
| 38 | 42 |
| 39 const gfx::Point& GetInitialLocationInParentForTest() const { | 43 const gfx::Point& GetInitialLocationInParentForTest() const { |
| 40 return details_.initial_location_in_parent; | 44 return details_.initial_location_in_parent; |
| 41 } | 45 } |
| 42 | 46 |
| 43 private: | 47 private: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 | 62 |
| 59 // Informs the PanelLayoutManager that the drag is complete if it was informed | 63 // Informs the PanelLayoutManager that the drag is complete if it was informed |
| 60 // of the drag start. | 64 // of the drag start. |
| 61 void FinishDragging(); | 65 void FinishDragging(); |
| 62 | 66 |
| 63 // Updates the dragged panel's index in the launcher. | 67 // Updates the dragged panel's index in the launcher. |
| 64 void UpdateLauncherPosition(); | 68 void UpdateLauncherPosition(); |
| 65 | 69 |
| 66 const Details details_; | 70 const Details details_; |
| 67 | 71 |
| 72 gfx::Point last_mouse_location_; |
| 73 |
| 68 // Wraps a window resizer and adds panel detaching / reattaching and snapping | 74 // Wraps a window resizer and adds panel detaching / reattaching and snapping |
| 69 // to launcher behavior during drags. | 75 // to launcher behavior during drags. |
| 70 scoped_ptr<WindowResizer> next_window_resizer_; | 76 scoped_ptr<WindowResizer> next_window_resizer_; |
| 71 | 77 |
| 72 // Panel container window. | 78 // Panel container window. |
| 73 aura::Window* panel_container_; | 79 aura::Window* panel_container_; |
| 74 | 80 |
| 81 // Cached root window when drag started |
| 82 aura::RootWindow* root_window_; |
| 83 |
| 75 // Set to true once Drag() is invoked and the bounds of the window change. | 84 // Set to true once Drag() is invoked and the bounds of the window change. |
| 76 bool did_move_or_resize_; | 85 bool did_move_or_resize_; |
| 77 | 86 |
| 78 // True if the window started attached to the launcher. | 87 // True if the window started attached to the launcher. |
| 79 const bool was_attached_; | 88 const bool was_attached_; |
| 80 | 89 |
| 81 // True if the window should attach to the launcher after releasing. | 90 // True if the window should attach to the launcher after releasing. |
| 82 bool should_attach_; | 91 bool should_attach_; |
| 83 | 92 |
| 84 // If non-NULL the destructor sets this to true. Used to determine if this has | 93 // If non-NULL the destructor sets this to true. Used to determine if this has |
| 85 // been deleted. | 94 // been deleted. |
| 86 bool* destroyed_; | 95 bool* destroyed_; |
| 87 | 96 |
| 88 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizer); | 97 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizer); |
| 89 }; | 98 }; |
| 90 | 99 |
| 91 } // namespace aura | 100 } // namespace ash |
| 92 | 101 |
| 93 #endif // ASH_WM_PANELS_PANEL_WINDOW_RESIZER_H_ | 102 #endif // ASH_WM_PANELS_PANEL_WINDOW_RESIZER_H_ |
| OLD | NEW |