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 UI_AURA_CLIENT_WINDOW_MOVE_CLIENT_H_ | 5 #ifndef UI_AURA_CLIENT_WINDOW_MOVE_CLIENT_H_ |
6 #define UI_AURA_CLIENT_WINDOW_MOVE_CLIENT_H_ | 6 #define UI_AURA_CLIENT_WINDOW_MOVE_CLIENT_H_ |
7 | 7 |
8 #include "ui/aura/aura_export.h" | 8 #include "ui/aura/aura_export.h" |
| 9 #include "ui/gfx/vector2d.h" |
9 | 10 |
10 namespace gfx { | 11 namespace gfx { |
11 class Point; | 12 class Point; |
12 } | 13 } |
13 | 14 |
14 namespace aura { | 15 namespace aura { |
15 class Window; | 16 class Window; |
16 namespace client { | 17 namespace client { |
17 | 18 |
18 enum WindowMoveResult { | 19 enum WindowMoveResult { |
19 MOVE_SUCCESSFUL, // Moving window was successful. | 20 MOVE_SUCCESSFUL, // Moving window was successful. |
20 MOVE_CANCELED // Moving window was canceled. | 21 MOVE_CANCELED // Moving window was canceled. |
21 }; | 22 }; |
22 | 23 |
23 // An interface implemented by an object that manages programatically keyed | 24 // An interface implemented by an object that manages programatically keyed |
24 // window moving. | 25 // window moving. |
25 class AURA_EXPORT WindowMoveClient { | 26 class AURA_EXPORT WindowMoveClient { |
26 public: | 27 public: |
27 // Starts a nested message loop for moving the window. |drag_offset| is the | 28 // Starts a nested message loop for moving the window. |drag_offset| is the |
28 // offset from the window origin to the cursor when the drag was started. | 29 // offset from the window origin to the cursor when the drag was started. |
29 // Returns MOVE_SUCCESSFUL if the move has completed successfully, or | 30 // Returns MOVE_SUCCESSFUL if the move has completed successfully, or |
30 // MOVE_CANCELED otherwise. | 31 // MOVE_CANCELED otherwise. |
31 virtual WindowMoveResult RunMoveLoop(Window* window, | 32 virtual WindowMoveResult RunMoveLoop(Window* window, |
32 const gfx::Point& drag_offset) = 0; | 33 const gfx::Vector2d& drag_offset) = 0; |
33 | 34 |
34 // Ends a previously started move loop. | 35 // Ends a previously started move loop. |
35 virtual void EndMoveLoop() = 0; | 36 virtual void EndMoveLoop() = 0; |
36 | 37 |
37 protected: | 38 protected: |
38 virtual ~WindowMoveClient() {} | 39 virtual ~WindowMoveClient() {} |
39 }; | 40 }; |
40 | 41 |
41 // Sets/Gets the activation client for the specified window. | 42 // Sets/Gets the activation client for the specified window. |
42 AURA_EXPORT void SetWindowMoveClient(Window* window, | 43 AURA_EXPORT void SetWindowMoveClient(Window* window, |
43 WindowMoveClient* client); | 44 WindowMoveClient* client); |
44 AURA_EXPORT WindowMoveClient* GetWindowMoveClient(Window* window); | 45 AURA_EXPORT WindowMoveClient* GetWindowMoveClient(Window* window); |
45 | 46 |
46 } // namespace client | 47 } // namespace client |
47 } // namespace aura | 48 } // namespace aura |
48 | 49 |
49 #endif // UI_AURA_CLIENT_WINDOW_MOVE_CLIENT_H_ | 50 #endif // UI_AURA_CLIENT_WINDOW_MOVE_CLIENT_H_ |
OLD | NEW |