OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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 VIEWS_WIDGET_WINDOW_MANAGER_H_ | |
6 #define VIEWS_WIDGET_WINDOW_MANAGER_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "ui/base/events.h" | |
11 #include "views/views_export.h" | |
12 | |
13 namespace gfx { | |
14 class Point; | |
15 } | |
16 | |
17 namespace views { | |
18 class KeyEvent; | |
19 class MouseEvent; | |
20 class TouchEvent; | |
21 class Widget; | |
22 | |
23 // A interface to WindowManager. | |
24 class VIEWS_EXPORT WindowManager { | |
25 public: | |
26 WindowManager(); | |
27 virtual ~WindowManager(); | |
28 | |
29 // Starts moving window given by |widget|. |point| represents the | |
30 // initial location of the mouse pointer. | |
31 virtual void StartMoveDrag(Widget* widget, const gfx::Point& point) = 0; | |
32 | |
33 // Starts resizing window give by |widget|. |point| represents the | |
34 // initial location of the mouse pointer and |hittest_code| represents | |
35 // the edge of the window a user selected to resize the window. See | |
36 // ui/base/hit_test.h for the hittest_code definition. | |
37 virtual void StartResizeDrag( | |
38 Widget* widget, const gfx::Point& point, int hittest_code) = 0; | |
39 | |
40 // Sets mouse capture on |widget|. Returns false if other widget | |
41 // already has mouse capture. | |
42 virtual bool SetMouseCapture(Widget* widget) = 0; | |
43 | |
44 // Releases the mouse capture on |widget|. Returns false if |widget| | |
45 // haven't capture the mouse. | |
46 virtual bool ReleaseMouseCapture(Widget* widget) = 0; | |
47 | |
48 // Checks if the |widget| has mouse capture. | |
49 virtual bool HasMouseCapture(const Widget* widget) const = 0; | |
50 | |
51 // WindowManager handles mouse event first. It may reisze/move window, | |
52 // or send the event to widget that has mouse capture. | |
53 virtual bool HandleKeyEvent(Widget* widget, const KeyEvent& event) = 0; | |
54 | |
55 // WindowManager handles mouse event first. It may resize/move window, | |
56 // or send the event to widget that has mouse capture. | |
57 virtual bool HandleMouseEvent(Widget* widget, const MouseEvent& event) = 0; | |
58 | |
59 // WindowManager handles touch event first. It is currently used only to | |
60 // activate windows. But it can also be used to move/resize windows. | |
61 virtual ui::TouchStatus HandleTouchEvent(Widget* widget, | |
62 const TouchEvent& event) = 0; | |
63 | |
64 // Register widget to the window manager. | |
65 virtual void Register(Widget* widget) = 0; | |
66 | |
67 // Installs window manager. | |
68 static void Install(WindowManager* wm); | |
69 | |
70 // Returns installed WindowManager. | |
71 static WindowManager* Get(); | |
72 | |
73 private: | |
74 DISALLOW_COPY_AND_ASSIGN(WindowManager); | |
75 }; | |
76 | |
77 } // namespace views | |
78 | |
79 #endif // VIEWS_WIDGET_WINDOW_MANAGER_H_ | |
OLD | NEW |