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_COMMON_WM_WINDOW_RESIZER_H_ | 5 #ifndef ASH_COMMON_WM_WINDOW_RESIZER_H_ |
6 #define ASH_COMMON_WM_WINDOW_RESIZER_H_ | 6 #define ASH_COMMON_WM_WINDOW_RESIZER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/common/wm/drag_details.h" | 11 #include "ash/common/wm/drag_details.h" |
12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "ui/wm/public/window_move_client.h" | 14 #include "ui/wm/public/window_move_client.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Rect; | 17 class Rect; |
18 } | 18 } |
19 | 19 |
20 namespace ash { | 20 namespace ash { |
21 namespace wm { | 21 |
22 class WmWindow; | 22 class WmWindow; |
23 } | |
24 | 23 |
25 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving | 24 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving |
26 // or resizing a window. All coordinates passed to this are in the parent | 25 // or resizing a window. All coordinates passed to this are in the parent |
27 // windows coordinates. | 26 // windows coordinates. |
28 class ASH_EXPORT WindowResizer { | 27 class ASH_EXPORT WindowResizer { |
29 public: | 28 public: |
30 // Constants to identify the type of resize. | 29 // Constants to identify the type of resize. |
31 static const int kBoundsChange_None; | 30 static const int kBoundsChange_None; |
32 static const int kBoundsChange_Repositions; | 31 static const int kBoundsChange_Repositions; |
33 static const int kBoundsChange_Resizes; | 32 static const int kBoundsChange_Resizes; |
(...skipping 17 matching lines...) Expand all Loading... |
51 // flags from the event. | 50 // flags from the event. |
52 virtual void Drag(const gfx::Point& location, int event_flags) = 0; | 51 virtual void Drag(const gfx::Point& location, int event_flags) = 0; |
53 | 52 |
54 // Invoked to complete the drag. | 53 // Invoked to complete the drag. |
55 virtual void CompleteDrag() = 0; | 54 virtual void CompleteDrag() = 0; |
56 | 55 |
57 // Reverts the drag. | 56 // Reverts the drag. |
58 virtual void RevertDrag() = 0; | 57 virtual void RevertDrag() = 0; |
59 | 58 |
60 // Returns the target window the resizer was created for. | 59 // Returns the target window the resizer was created for. |
61 wm::WmWindow* GetTarget() const { | 60 WmWindow* GetTarget() const { |
62 return window_state_ ? window_state_->window() : nullptr; | 61 return window_state_ ? window_state_->window() : nullptr; |
63 } | 62 } |
64 // See comment for |DragDetails::initial_location_in_parent|. | 63 // See comment for |DragDetails::initial_location_in_parent|. |
65 const gfx::Point& GetInitialLocation() const { | 64 const gfx::Point& GetInitialLocation() const { |
66 return window_state_->drag_details()->initial_location_in_parent; | 65 return window_state_->drag_details()->initial_location_in_parent; |
67 } | 66 } |
68 | 67 |
69 // Drag parameters established when drag starts. | 68 // Drag parameters established when drag starts. |
70 const DragDetails& details() const { return *window_state_->drag_details(); } | 69 const DragDetails& details() const { return *window_state_->drag_details(); } |
71 | 70 |
(...skipping 22 matching lines...) Expand all Loading... |
94 | 93 |
95 // Returns the height of the drag. | 94 // Returns the height of the drag. |
96 int GetHeightForDrag(int min_height, int* delta_y); | 95 int GetHeightForDrag(int min_height, int* delta_y); |
97 | 96 |
98 DISALLOW_COPY_AND_ASSIGN(WindowResizer); | 97 DISALLOW_COPY_AND_ASSIGN(WindowResizer); |
99 }; | 98 }; |
100 | 99 |
101 // Creates a WindowResizer for |window|. Returns a unique_ptr with null if | 100 // Creates a WindowResizer for |window|. Returns a unique_ptr with null if |
102 // |window| should not be resized nor dragged. | 101 // |window| should not be resized nor dragged. |
103 ASH_EXPORT std::unique_ptr<WindowResizer> CreateWindowResizer( | 102 ASH_EXPORT std::unique_ptr<WindowResizer> CreateWindowResizer( |
104 wm::WmWindow* window, | 103 WmWindow* window, |
105 const gfx::Point& point_in_parent, | 104 const gfx::Point& point_in_parent, |
106 int window_component, | 105 int window_component, |
107 aura::client::WindowMoveSource source); | 106 aura::client::WindowMoveSource source); |
108 | 107 |
109 } // namespace ash | 108 } // namespace ash |
110 | 109 |
111 #endif // ASH_COMMON_WM_WINDOW_RESIZER_H_ | 110 #endif // ASH_COMMON_WM_WINDOW_RESIZER_H_ |
OLD | NEW |