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 UI_WAYLAND_WAYLAND_WINDOW_H_ | |
6 #define UI_WAYLAND_WAYLAND_WINDOW_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "ui/gfx/point.h" | |
12 | |
13 struct wl_surface; | |
14 | |
15 namespace ui { | |
16 | |
17 class WaylandDisplay; | |
18 class WaylandWidget; | |
19 | |
20 // WaylandWindow wraps a wl_surface and some basic operations for the surface. | |
21 // WaylandWindow also keeps track of the WaylandWidget that will process all | |
22 // events related to the window. | |
23 class WaylandWindow { | |
24 public: | |
25 // Creates a toplevel window. | |
26 WaylandWindow(WaylandWidget* widget, WaylandDisplay* display); | |
27 // Creates a transient window with an offset of (x,y) from parent. | |
28 WaylandWindow(WaylandWidget* widget, | |
29 WaylandDisplay* display, | |
30 WaylandWindow* parent, | |
31 int32_t x, | |
32 int32_t y); | |
33 | |
34 ~WaylandWindow(); | |
35 | |
36 void SetVisible(bool visible); | |
37 bool IsVisible() const; | |
38 | |
39 // Sets the window to fullscreen if |fullscreen| is true. Otherwise it sets | |
40 // it as a normal window. | |
41 void set_fullscreen(bool fullscreen) { fullscreen_ = fullscreen; } | |
42 bool fullscreen() const { return fullscreen_; } | |
43 | |
44 // Returns a pointer to the parent window. NULL is this window doesn't have | |
45 // a parent. | |
46 WaylandWindow* parent_window() const { return parent_window_; } | |
47 | |
48 WaylandWidget* widget() const { return widget_; } | |
49 | |
50 // Returns the pointer to the surface associated with the window. | |
51 // The WaylandWindow object owns the pointer. | |
52 wl_surface* surface() const { return surface_; } | |
53 | |
54 void Configure(uint32_t time, uint32_t edges, int32_t x, int32_t y, | |
55 int32_t width, int32_t height); | |
56 | |
57 private: | |
58 // The widget that will process events for this window. This is not owned | |
59 // by the window. | |
60 WaylandWidget* widget_; | |
61 | |
62 // Pointer to the display this window is using. This doesn't own the pointer | |
63 // to the display. | |
64 WaylandDisplay* display_; | |
65 | |
66 // When creating a transient window, |parent_window_| is set to point to the | |
67 // parent of this window. We will then use |parent_window_| to align this | |
68 // window at the specified offset in |relative_position_|. | |
69 // |parent_window_| is not owned by this window. | |
70 WaylandWindow* parent_window_; | |
71 | |
72 // Position relative to parent window. This is only used by | |
73 // a transient window. | |
74 gfx::Point relative_position_; | |
75 | |
76 // The native wayland surface associated with this window. | |
77 wl_surface* surface_; | |
78 | |
79 // Whether the window is in fullscreen mode. | |
80 bool fullscreen_; | |
81 | |
82 DISALLOW_COPY_AND_ASSIGN(WaylandWindow); | |
83 }; | |
84 | |
85 } // namespace ui | |
86 | |
87 #endif // UI_WAYLAND_WAYLAND_WINDOW_H_ | |
OLD | NEW |