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