OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_ | 5 #ifndef VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_ |
6 #define VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_ | 6 #define VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "views/widget/native_widget_gtk.h" | 10 #include "views/widget/native_widget_gtk.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 virtual Window* GetWindow() OVERRIDE; | 33 virtual Window* GetWindow() OVERRIDE; |
34 virtual const Window* GetWindow() const OVERRIDE; | 34 virtual const Window* GetWindow() const OVERRIDE; |
35 | 35 |
36 // Overridden from NativeWidgetGtk: | 36 // Overridden from NativeWidgetGtk: |
37 virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event); | 37 virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event); |
38 virtual gboolean OnConfigureEvent(GtkWidget* widget, | 38 virtual gboolean OnConfigureEvent(GtkWidget* widget, |
39 GdkEventConfigure* event); | 39 GdkEventConfigure* event); |
40 virtual gboolean OnMotionNotify(GtkWidget* widget, GdkEventMotion* event); | 40 virtual gboolean OnMotionNotify(GtkWidget* widget, GdkEventMotion* event); |
41 virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); | 41 virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); |
| 42 virtual gboolean OnWindowStateEvent(GtkWidget* widget, |
| 43 GdkEventWindowState* event); |
42 virtual gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event); | 44 virtual gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event); |
43 virtual void IsActiveChanged(); | 45 virtual void IsActiveChanged(); |
44 | 46 |
45 protected: | 47 protected: |
46 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; | 48 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; |
47 | 49 |
48 // Overridden from NativeWindow: | 50 // Overridden from NativeWindow: |
49 virtual NativeWidget* AsNativeWidget() OVERRIDE; | 51 virtual NativeWidget* AsNativeWidget() OVERRIDE; |
50 virtual const NativeWidget* AsNativeWidget() const OVERRIDE; | 52 virtual const NativeWidget* AsNativeWidget() const OVERRIDE; |
51 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | 53 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
52 virtual void ShowNativeWindow(ShowState state) OVERRIDE; | 54 virtual void ShowNativeWindow(ShowState state) OVERRIDE; |
53 virtual void BecomeModal() OVERRIDE; | 55 virtual void BecomeModal() OVERRIDE; |
54 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; | 56 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; |
55 virtual void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, | 57 virtual void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, |
56 bool* maximized) const OVERRIDE; | 58 bool* maximized) const OVERRIDE; |
57 virtual void EnableClose(bool enable) OVERRIDE; | 59 virtual void EnableClose(bool enable) OVERRIDE; |
58 virtual void SetWindowTitle(const std::wstring& title) OVERRIDE; | 60 virtual void SetWindowTitle(const std::wstring& title) OVERRIDE; |
59 virtual void SetWindowIcons(const SkBitmap& window_icon, | 61 virtual void SetWindowIcons(const SkBitmap& window_icon, |
60 const SkBitmap& app_icon) OVERRIDE; | 62 const SkBitmap& app_icon) OVERRIDE; |
61 virtual void SetAccessibleName(const std::wstring& name) OVERRIDE; | 63 virtual void SetAccessibleName(const std::wstring& name) OVERRIDE; |
62 virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE; | 64 virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE; |
63 virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE; | 65 virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE; |
64 virtual void SetWindowBounds(const gfx::Rect& bounds, | 66 virtual void SetWindowBounds(const gfx::Rect& bounds, |
65 gfx::NativeWindow other_window) OVERRIDE; | 67 gfx::NativeWindow other_window) OVERRIDE; |
| 68 virtual void HideWindow() OVERRIDE; |
| 69 virtual void Activate() OVERRIDE; |
| 70 virtual void Deactivate() OVERRIDE; |
| 71 virtual void Maximize() OVERRIDE; |
| 72 virtual void Minimize() OVERRIDE; |
| 73 virtual void Restore() OVERRIDE; |
| 74 virtual bool IsActive() const OVERRIDE; |
| 75 virtual bool IsVisible() const OVERRIDE; |
| 76 virtual bool IsMaximized() const OVERRIDE; |
| 77 virtual bool IsMinimized() const OVERRIDE; |
66 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 78 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
67 virtual bool IsFullscreen() const OVERRIDE; | 79 virtual bool IsFullscreen() const OVERRIDE; |
| 80 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; |
68 virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; | 81 virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; |
69 virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; | 82 virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; |
70 virtual void UpdateFrameAfterFrameChange() OVERRIDE; | 83 virtual void UpdateFrameAfterFrameChange() OVERRIDE; |
| 84 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; |
71 virtual bool ShouldUseNativeFrame() const OVERRIDE; | 85 virtual bool ShouldUseNativeFrame() const OVERRIDE; |
72 virtual void FrameTypeChanged() OVERRIDE; | 86 virtual void FrameTypeChanged() OVERRIDE; |
73 | 87 |
74 // Overridden from NativeWidgetGtk: | |
75 virtual void Restore() OVERRIDE; | |
76 virtual gboolean OnWindowStateEvent(GtkWidget* widget, | |
77 GdkEventWindowState* event) OVERRIDE; | |
78 | |
79 // For the constructor. | 88 // For the constructor. |
80 friend class Window; | 89 friend class Window; |
81 | 90 |
82 virtual void OnDestroy(GtkWidget* widget); | 91 virtual void OnDestroy(GtkWidget* widget); |
83 | 92 |
84 private: | 93 private: |
85 static gboolean CallConfigureEvent(GtkWidget* widget, | 94 static gboolean CallConfigureEvent(GtkWidget* widget, |
86 GdkEventConfigure* event, | 95 GdkEventConfigure* event, |
87 NativeWindowGtk* window_gtk); | 96 NativeWindowGtk* window_gtk); |
| 97 static gboolean CallWindowStateEvent(GtkWidget* widget, |
| 98 GdkEventWindowState* event, |
| 99 NativeWindowGtk* window_gtk); |
88 | 100 |
89 // Asks the delegate if any to save the window's location and size. | 101 // Asks the delegate if any to save the window's location and size. |
90 void SaveWindowPosition(); | 102 void SaveWindowPosition(); |
91 | 103 |
92 // A delegate implementation that handles events received here. | 104 // A delegate implementation that handles events received here. |
93 internal::NativeWindowDelegate* delegate_; | 105 internal::NativeWindowDelegate* delegate_; |
94 | 106 |
95 // Our window delegate. | 107 // Our window delegate. |
96 WindowDelegate* window_delegate_; | 108 WindowDelegate* window_delegate_; |
97 | 109 |
98 // The View that provides the non-client area of the window (title bar, | 110 // The View that provides the non-client area of the window (title bar, |
99 // window controls, sizing borders etc). To use an implementation other than | 111 // window controls, sizing borders etc). To use an implementation other than |
100 // the default, this class must be subclassed and this value set to the | 112 // the default, this class must be subclassed and this value set to the |
101 // desired implementation before calling |Init|. | 113 // desired implementation before calling |Init|. |
102 NonClientView* non_client_view_; | 114 NonClientView* non_client_view_; |
103 | 115 |
| 116 // State of the window, such as fullscreen, hidden... |
| 117 GdkWindowState window_state_; |
| 118 |
104 // Set to true if the window is in the process of closing. | 119 // Set to true if the window is in the process of closing. |
105 bool window_closed_; | 120 bool window_closed_; |
106 | 121 |
107 DISALLOW_COPY_AND_ASSIGN(NativeWindowGtk); | 122 DISALLOW_COPY_AND_ASSIGN(NativeWindowGtk); |
108 }; | 123 }; |
109 | 124 |
110 } // namespace views | 125 } // namespace views |
111 | 126 |
112 #endif // VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_ | 127 #endif // VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_ |
OLD | NEW |