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, WaylandDisplay* display, |
| 29 WaylandWindow* parent, int32_t x, int32_t y); |
| 30 ~WaylandWindow(); |
| 31 |
| 32 void SetVisible(bool visible); |
| 33 bool IsVisible() const; |
| 34 |
| 35 // Sets the window to fullscreen if 'fullscreen' is true. Otherwise it sets |
| 36 // it as a normal window. |
| 37 void SetFullscreen(bool fullscreen) { fullscreen_ = fullscreen; } |
| 38 bool IsFullscreen() const { return fullscreen_; } |
| 39 |
| 40 // Returns a pointer to the parent window. NULL is this window doesn't have |
| 41 // a parent. |
| 42 WaylandWindow* GetParentWindow() const { return parent_window_; } |
| 43 |
| 44 WaylandWidget* GetWidget() const { return widget_; } |
| 45 |
| 46 // Returns the pointer to the surface associated with the window. |
| 47 // The WaylandWindow object owns the pointer. |
| 48 wl_surface* GetSurface() const { return surface_; } |
| 49 |
| 50 void Configure(uint32_t time, uint32_t edges, int32_t x, int32_t y, |
| 51 int32_t width, int32_t height); |
| 52 |
| 53 private: |
| 54 // The widget that will process events for this window. This is not owned |
| 55 // by the window. |
| 56 WaylandWidget* widget_; |
| 57 |
| 58 // Pointer to the display this window is using. This doesn't own the pointer |
| 59 // to the display. |
| 60 WaylandDisplay* display_; |
| 61 |
| 62 // When creating a transient window, parent_window_ is set to point to the |
| 63 // parent of this window. We will then use parent_window_ to align this |
| 64 // window at the specified offset in relative_position_. |
| 65 // parent_window_ is not owned by this window. |
| 66 WaylandWindow* parent_window_; |
| 67 |
| 68 // Position relative to parent window. This is only used by |
| 69 // a transient window. |
| 70 gfx::Point relative_position_; |
| 71 |
| 72 // The native wayland surface associated with this window. |
| 73 wl_surface* surface_; |
| 74 |
| 75 // Whether the window is in fullscreen mode. |
| 76 bool fullscreen_; |
| 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(WaylandWindow); |
| 79 }; |
| 80 |
| 81 } // namespace ui |
| 82 |
| 83 #endif // UI_WAYLAND_WAYLAND_WINDOW_H_ |
OLD | NEW |