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" |
11 #include "views/window/native_window.h" | 11 #include "views/window/native_window.h" |
12 #include "views/window/window.h" | |
13 | |
14 namespace gfx { | |
15 class Point; | |
16 class Size; | |
17 }; | |
18 | 12 |
19 namespace views { | 13 namespace views { |
20 namespace internal { | 14 namespace internal { |
21 class NativeWindowDelegate; | 15 class NativeWindowDelegate; |
22 } | 16 } |
23 | 17 |
24 class Client; | |
25 class WindowDelegate; | |
26 | |
27 // Window implementation for Gtk. | 18 // Window implementation for Gtk. |
28 class NativeWindowGtk : public NativeWidgetGtk, public NativeWindow { | 19 class NativeWindowGtk : public NativeWidgetGtk, public NativeWindow { |
29 public: | 20 public: |
30 explicit NativeWindowGtk(internal::NativeWindowDelegate* delegate); | 21 explicit NativeWindowGtk(internal::NativeWindowDelegate* delegate); |
31 virtual ~NativeWindowGtk(); | 22 virtual ~NativeWindowGtk(); |
32 | 23 |
33 virtual Window* GetWindow() OVERRIDE; | 24 virtual Window* GetWindow() OVERRIDE; |
34 virtual const Window* GetWindow() const OVERRIDE; | 25 virtual const Window* GetWindow() const OVERRIDE; |
35 | 26 |
36 // Overridden from NativeWidgetGtk: | |
37 virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event); | |
38 virtual gboolean OnConfigureEvent(GtkWidget* widget, | |
39 GdkEventConfigure* event); | |
40 virtual gboolean OnMotionNotify(GtkWidget* widget, GdkEventMotion* event); | |
41 virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); | |
42 virtual gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event); | |
43 | |
44 protected: | 27 protected: |
45 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; | |
46 | |
47 // Overridden from NativeWindow: | 28 // Overridden from NativeWindow: |
48 virtual NativeWidget* AsNativeWidget() OVERRIDE; | 29 virtual NativeWidget* AsNativeWidget() OVERRIDE; |
49 virtual const NativeWidget* AsNativeWidget() const OVERRIDE; | 30 virtual const NativeWidget* AsNativeWidget() const OVERRIDE; |
50 virtual void BecomeModal() OVERRIDE; | |
51 | |
52 // Overridden from NativeWidgetGtk: | |
53 virtual gboolean OnWindowStateEvent(GtkWidget* widget, | |
54 GdkEventWindowState* event) OVERRIDE; | |
55 | 31 |
56 // For the constructor. | 32 // For the constructor. |
57 friend class Window; | 33 friend class Window; |
58 | 34 |
59 private: | 35 private: |
60 static gboolean CallConfigureEvent(GtkWidget* widget, | |
61 GdkEventConfigure* event, | |
62 NativeWindowGtk* window_gtk); | |
63 | |
64 // Asks the delegate if any to save the window's location and size. | |
65 void SaveWindowPosition(); | |
66 | |
67 // A delegate implementation that handles events received here. | 36 // A delegate implementation that handles events received here. |
68 internal::NativeWindowDelegate* delegate_; | 37 internal::NativeWindowDelegate* delegate_; |
69 | 38 |
70 // Our window delegate. | |
71 WindowDelegate* window_delegate_; | |
72 | |
73 // The View that provides the non-client area of the window (title bar, | |
74 // window controls, sizing borders etc). To use an implementation other than | |
75 // the default, this class must be subclassed and this value set to the | |
76 // desired implementation before calling |Init|. | |
77 NonClientView* non_client_view_; | |
78 | |
79 // Set to true if the window is in the process of closing. | |
80 bool window_closed_; | |
81 | |
82 DISALLOW_COPY_AND_ASSIGN(NativeWindowGtk); | 39 DISALLOW_COPY_AND_ASSIGN(NativeWindowGtk); |
83 }; | 40 }; |
84 | 41 |
85 } // namespace views | 42 } // namespace views |
86 | 43 |
87 #endif // VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_ | 44 #endif // VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_ |
OLD | NEW |