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(); |
39 | 40 |
40 private: | 41 private: |
41 // Create and Destroy the GtkFixed that performs clipping on our hosted | 42 // Create and Destroy the GtkFixed that performs clipping on our hosted |
42 // GtkWidget. |needs_window| is true when a clip is installed and implies the | 43 // GtkWidget. |needs_window| is true when a clip is installed and implies the |
43 // fixed is backed by a X Window which actually performs the clipping. | 44 // fixed is backed by a X Window which actually performs the clipping. |
44 // It's kind of retarded that Gtk/Cairo doesn't clip painting of child windows | 45 // It's kind of retarded that Gtk/Cairo doesn't clip painting of child windows |
45 // regardless of whether or not there's an X Window. It's not that hard. | 46 // regardless of whether or not there's an X Window. It's not that hard. |
46 void CreateFixed(bool needs_window); | 47 void CreateFixed(bool needs_window); |
47 | 48 |
48 // Destroys the GtkFixed that performs clipping on our hosted GtkWidget. | 49 // Destroys the GtkFixed that performs clipping on our hosted GtkWidget. |
49 void DestroyFixed(); | 50 void DestroyFixed(); |
50 | 51 |
51 WidgetGtk* GetHostWidget() const; | 52 WidgetGtk* GetHostWidget() const; |
52 | 53 |
53 // Invoked from the 'destroy' signal. | 54 // Invoked from the 'destroy' signal. |
54 static void CallDestroy(GtkObject* object, NativeViewHostGtk* host); | 55 static void CallDestroy(GtkObject* object, NativeViewHostGtk* host); |
55 | 56 |
56 // Invoked from the 'focus-in-event' signal. | 57 // Invoked from the 'focus-in-event' signal. |
57 static gboolean CallFocusIn(GtkWidget* widget, | 58 static void CallFocusIn(GtkWidget* widget, |
58 GdkEventFocus* event, | 59 GdkEventFocus* event, |
59 NativeViewHostGtk* button); | 60 NativeViewHostGtk* button); |
60 | 61 |
61 // Our associated NativeViewHost. | 62 // Our associated NativeViewHost. |
62 NativeViewHost* host_; | 63 NativeViewHost* host_; |
63 | 64 |
64 // Have we installed a region on the gfx::NativeView used to clip to only the | 65 // Have we installed a region on the gfx::NativeView used to clip to only the |
65 // visible portion of the gfx::NativeView ? | 66 // visible portion of the gfx::NativeView ? |
66 bool installed_clip_; | 67 bool installed_clip_; |
67 | 68 |
68 // The installed clip rect. InstallClip doesn't actually perform the clipping, | 69 // The installed clip rect. InstallClip doesn't actually perform the clipping, |
69 // a call to ShowWidget will. | 70 // a call to ShowWidget will. |
70 gfx::Rect installed_clip_bounds_; | 71 gfx::Rect installed_clip_bounds_; |
71 | 72 |
72 // Signal handle id for 'destroy' signal. | 73 // Signal handle id for 'destroy' signal. |
73 gulong destroy_signal_id_; | 74 gulong destroy_signal_id_; |
74 | 75 |
75 // Signal handle id for 'focus-in-event' signal. | 76 // Signal handle id for 'focus-in-event' signal. |
76 gulong focus_signal_id_; | 77 gulong focus_signal_id_; |
77 | 78 |
78 // The GtkFixed that contains the attached gfx::NativeView (used for | 79 // The GtkFixed that contains the attached gfx::NativeView (used for |
79 // clipping). | 80 // clipping). |
80 GtkWidget* fixed_; | 81 GtkWidget* fixed_; |
81 | 82 |
82 DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk); | 83 DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk); |
83 }; | 84 }; |
84 | 85 |
85 } // namespace views | 86 } // namespace views |
86 | 87 |
87 #endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | 88 #endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ |
| 89 |
OLD | NEW |