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