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