OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | 5 #ifndef VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ |
6 #define VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | 6 #define VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Overridden from NativeViewHostWrapper: | 29 // Overridden from NativeViewHostWrapper: |
30 virtual void NativeViewAttached(); | 30 virtual void NativeViewAttached(); |
31 virtual void NativeViewDetaching(); | 31 virtual void NativeViewDetaching(); |
32 virtual void AddedToWidget(); | 32 virtual void AddedToWidget(); |
33 virtual void RemovedFromWidget(); | 33 virtual void RemovedFromWidget(); |
34 virtual void InstallClip(int x, int y, int w, int h); | 34 virtual void InstallClip(int x, int y, int w, int h); |
35 virtual bool HasInstalledClip(); | 35 virtual bool HasInstalledClip(); |
36 virtual void UninstallClip(); | 36 virtual void UninstallClip(); |
37 virtual void ShowWidget(int x, int y, int w, int h); | 37 virtual void ShowWidget(int x, int y, int w, int h); |
38 virtual void HideWidget(); | 38 virtual void HideWidget(); |
39 virtual void SetFocus(); | |
40 | 39 |
41 private: | 40 private: |
42 // Create and Destroy the GtkFixed that performs clipping on our hosted | 41 // Create and Destroy the GtkFixed that performs clipping on our hosted |
43 // GtkWidget. |needs_window| is true when a clip is installed and implies the | 42 // GtkWidget. |needs_window| is true when a clip is installed and implies the |
44 // fixed is backed by a X Window which actually performs the clipping. | 43 // fixed is backed by a X Window which actually performs the clipping. |
45 // It's kind of retarded that Gtk/Cairo doesn't clip painting of child windows | 44 // It's kind of retarded that Gtk/Cairo doesn't clip painting of child windows |
46 // regardless of whether or not there's an X Window. It's not that hard. | 45 // regardless of whether or not there's an X Window. It's not that hard. |
47 void CreateFixed(bool needs_window); | 46 void CreateFixed(bool needs_window); |
48 | 47 |
49 // Destroys the GtkFixed that performs clipping on our hosted GtkWidget. | 48 // Destroys the GtkFixed that performs clipping on our hosted GtkWidget. |
50 void DestroyFixed(); | 49 void DestroyFixed(); |
51 | 50 |
52 WidgetGtk* GetHostWidget() const; | 51 WidgetGtk* GetHostWidget() const; |
53 | 52 |
54 // Invoked from the 'destroy' signal. | 53 // Invoked from the 'destroy' signal. |
55 static void CallDestroy(GtkObject* object, NativeViewHostGtk* host); | 54 static void CallDestroy(GtkObject* object, NativeViewHostGtk* host); |
56 | 55 |
57 // Invoked from the 'focus-in-event' signal. | 56 // Invoked from the 'focus-in-event' signal. |
58 static void CallFocusIn(GtkWidget* widget, | 57 static gboolean CallFocusIn(GtkWidget* widget, |
59 GdkEventFocus* event, | 58 GdkEventFocus* event, |
60 NativeViewHostGtk* button); | 59 NativeViewHostGtk* button); |
61 | 60 |
62 // Our associated NativeViewHost. | 61 // Our associated NativeViewHost. |
63 NativeViewHost* host_; | 62 NativeViewHost* host_; |
64 | 63 |
65 // Have we installed a region on the gfx::NativeView used to clip to only the | 64 // Have we installed a region on the gfx::NativeView used to clip to only the |
66 // visible portion of the gfx::NativeView ? | 65 // visible portion of the gfx::NativeView ? |
67 bool installed_clip_; | 66 bool installed_clip_; |
68 | 67 |
69 // The installed clip rect. InstallClip doesn't actually perform the clipping, | 68 // The installed clip rect. InstallClip doesn't actually perform the clipping, |
70 // a call to ShowWidget will. | 69 // a call to ShowWidget will. |
71 gfx::Rect installed_clip_bounds_; | 70 gfx::Rect installed_clip_bounds_; |
72 | 71 |
73 // Signal handle id for 'destroy' signal. | 72 // Signal handle id for 'destroy' signal. |
74 gulong destroy_signal_id_; | 73 gulong destroy_signal_id_; |
75 | 74 |
76 // Signal handle id for 'focus-in-event' signal. | 75 // Signal handle id for 'focus-in-event' signal. |
77 gulong focus_signal_id_; | 76 gulong focus_signal_id_; |
78 | 77 |
79 // The GtkFixed that contains the attached gfx::NativeView (used for | 78 // The GtkFixed that contains the attached gfx::NativeView (used for |
80 // clipping). | 79 // clipping). |
81 GtkWidget* fixed_; | 80 GtkWidget* fixed_; |
82 | 81 |
83 DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk); | 82 DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk); |
84 }; | 83 }; |
85 | 84 |
86 } // namespace views | 85 } // namespace views |
87 | 86 |
88 #endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | 87 #endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ |
89 | |
OLD | NEW |