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_WIDGET_WIDGET_GTK_H_ | 5 #ifndef VIEWS_WIDGET_WIDGET_GTK_H_ |
6 #define VIEWS_WIDGET_WIDGET_GTK_H_ | 6 #define VIEWS_WIDGET_WIDGET_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // A top level window. | 31 // A top level window. |
32 TYPE_WINDOW, | 32 TYPE_WINDOW, |
33 | 33 |
34 // A child widget. | 34 // A child widget. |
35 TYPE_CHILD | 35 TYPE_CHILD |
36 }; | 36 }; |
37 | 37 |
38 explicit WidgetGtk(Type type); | 38 explicit WidgetGtk(Type type); |
39 virtual ~WidgetGtk(); | 39 virtual ~WidgetGtk(); |
40 | 40 |
41 // Initializes this widget. | |
42 void Init(GtkWidget* parent, | |
43 const gfx::Rect& bounds); | |
44 | |
45 // Makes the background of the window totally transparent. This must be | 41 // Makes the background of the window totally transparent. This must be |
46 // invoked before Init. This does a couple of checks and returns true if | 42 // invoked before Init. This does a couple of checks and returns true if |
47 // the window can be made transparent. The actual work of making the window | 43 // the window can be made transparent. The actual work of making the window |
48 // transparent is done by ConfigureWidgetForTransparentBackground. | 44 // transparent is done by ConfigureWidgetForTransparentBackground. |
49 bool MakeTransparent(); | 45 bool MakeTransparent(); |
50 bool is_transparent() const { return transparent_; } | 46 bool is_transparent() const { return transparent_; } |
51 | 47 |
52 // Sets whether or not we are deleted when the widget is destroyed. The | 48 // Sets whether or not we are deleted when the widget is destroyed. The |
53 // default is true. | 49 // default is true. |
54 void set_delete_on_destroy(bool delete_on_destroy) { | 50 void set_delete_on_destroy(bool delete_on_destroy) { |
(...skipping 13 matching lines...) Expand all Loading... |
68 | 64 |
69 // Positions a child GtkWidget at the specified location and bounds. | 65 // Positions a child GtkWidget at the specified location and bounds. |
70 void PositionChild(GtkWidget* child, int x, int y, int w, int h); | 66 void PositionChild(GtkWidget* child, int x, int y, int w, int h); |
71 | 67 |
72 // Parent GtkWidget all children are added to. When this WidgetGtk corresponds | 68 // Parent GtkWidget all children are added to. When this WidgetGtk corresponds |
73 // to a top level window, this is the GtkFixed within the GtkWindow, not the | 69 // to a top level window, this is the GtkFixed within the GtkWindow, not the |
74 // GtkWindow itself. For child widgets, this is the same GtkFixed as | 70 // GtkWindow itself. For child widgets, this is the same GtkFixed as |
75 // |widget_|. | 71 // |widget_|. |
76 GtkWidget* window_contents() const { return window_contents_; } | 72 GtkWidget* window_contents() const { return window_contents_; } |
77 | 73 |
| 74 // Overridden from Widget: |
| 75 virtual void Init(gfx::NativeView parent, const gfx::Rect& bounds); |
78 virtual void SetContentsView(View* view); | 76 virtual void SetContentsView(View* view); |
79 | |
80 // Overridden from Widget: | |
81 virtual void GetBounds(gfx::Rect* out, bool including_frame) const; | 77 virtual void GetBounds(gfx::Rect* out, bool including_frame) const; |
82 virtual void SetBounds(const gfx::Rect& bounds); | 78 virtual void SetBounds(const gfx::Rect& bounds); |
83 virtual void SetShape(const gfx::Path& shape); | 79 virtual void SetShape(const gfx::Path& shape); |
84 virtual void Close(); | 80 virtual void Close(); |
85 virtual void CloseNow(); | 81 virtual void CloseNow(); |
86 virtual void Show(); | 82 virtual void Show(); |
87 virtual void Hide(); | 83 virtual void Hide(); |
88 virtual gfx::NativeView GetNativeView() const; | 84 virtual gfx::NativeView GetNativeView() const; |
89 virtual void PaintNow(const gfx::Rect& update_rect); | 85 virtual void PaintNow(const gfx::Rect& update_rect); |
90 virtual void SetOpacity(unsigned char opacity); | 86 virtual void SetOpacity(unsigned char opacity); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 bool transparent_; | 241 bool transparent_; |
246 | 242 |
247 scoped_ptr<DefaultThemeProvider> default_theme_provider_; | 243 scoped_ptr<DefaultThemeProvider> default_theme_provider_; |
248 | 244 |
249 DISALLOW_COPY_AND_ASSIGN(WidgetGtk); | 245 DISALLOW_COPY_AND_ASSIGN(WidgetGtk); |
250 }; | 246 }; |
251 | 247 |
252 } // namespace views | 248 } // namespace views |
253 | 249 |
254 #endif // VIEWS_WIDGET_WIDGET_GTK_H_ | 250 #endif // VIEWS_WIDGET_WIDGET_GTK_H_ |
OLD | NEW |