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