OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PLATFORM_WINDOW_PLATFORM_WINDOW_H_ | 5 #ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_H_ |
6 #define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_H_ | 6 #define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 | 9 |
10 namespace gfx { | 10 namespace gfx { |
11 class Rect; | 11 class Rect; |
12 } | 12 } |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 | 15 |
16 #if defined(USE_X11) | 16 #if defined(USE_X11) |
17 typedef unsigned long PlatformCursor; | 17 typedef unsigned long PlatformCursor; |
18 #else | 18 #else |
19 typedef void* PlatformCursor; | 19 typedef void* PlatformCursor; |
20 #endif | 20 #endif |
| 21 |
21 | 22 |
22 class PlatformWindowDelegate; | 23 class PlatformWindowDelegate; |
23 | 24 |
24 // Platform window. | 25 // Platform window. |
25 // | 26 // |
26 // Each instance of PlatformWindow represents a single window in the | 27 // Each instance of PlatformWindow represents a single window in the |
27 // underlying platform windowing system (i.e. X11/Win/OSX). | 28 // underlying platform windowing system (i.e. X11/Win/OSX). |
28 class PlatformWindow { | 29 class PlatformWindow { |
29 public: | 30 public: |
30 virtual ~PlatformWindow() {} | 31 virtual ~PlatformWindow() {} |
31 | 32 |
32 virtual void Show() = 0; | 33 virtual void Show() = 0; |
33 virtual void Hide() = 0; | 34 virtual void Hide() = 0; |
34 virtual void Close() = 0; | 35 virtual void Close() = 0; |
35 | 36 |
36 // Sets and gets the bounds of the platform-window. Note that the bounds is in | 37 // Sets and gets the bounds of the platform-window. Note that the bounds is in |
37 // physical pixel coordinates. | 38 // physical pixel coordinates. |
38 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 39 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
39 virtual gfx::Rect GetBounds() = 0; | 40 virtual gfx::Rect GetBounds() = 0; |
40 | 41 |
41 virtual void SetCapture() = 0; | 42 virtual void SetCapture() = 0; |
42 virtual void ReleaseCapture() = 0; | 43 virtual void ReleaseCapture() = 0; |
43 | 44 |
44 virtual void ToggleFullscreen() = 0; | 45 virtual void ToggleFullscreen() = 0; |
45 virtual void Maximize() = 0; | 46 virtual void Maximize() = 0; |
46 virtual void Minimize() = 0; | 47 virtual void Minimize() = 0; |
47 virtual void Restore() = 0; | 48 virtual void Restore() = 0; |
48 | 49 |
49 virtual void SetCursor(PlatformCursor cursor) = 0; | 50 virtual void SetCursor(PlatformCursor cursor) = 0; |
| 51 |
| 52 // Moves the cursor to |location|. Location is in platform window coordinates. |
50 virtual void MoveCursorTo(const gfx::Point& location) = 0; | 53 virtual void MoveCursorTo(const gfx::Point& location) = 0; |
| 54 |
| 55 // Confines the cursor to |bounds| when it is in the platform window. |bounds| |
| 56 // is in platform window coordinates. |
| 57 virtual void ConfineCursorToBounds(const gfx::Rect& bounds) = 0; |
51 }; | 58 }; |
52 | 59 |
53 } // namespace ui | 60 } // namespace ui |
54 | 61 |
55 #endif // UI_PLATFORM_WINDOW_PLATFORM_WINDOW_H_ | 62 #endif // UI_PLATFORM_WINDOW_PLATFORM_WINDOW_H_ |
OLD | NEW |