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 CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ |
6 #define CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ | 6 #define CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 int width() const { return widget_.get()->allocation.width; } | 71 int width() const { return widget_.get()->allocation.width; } |
72 | 72 |
73 // Set the state to draw. We will paint the widget as if it were in this | 73 // Set the state to draw. We will paint the widget as if it were in this |
74 // state. | 74 // state. |
75 void SetPaintOverride(GtkStateType state); | 75 void SetPaintOverride(GtkStateType state); |
76 | 76 |
77 // Resume normal drawing of the widget's state. | 77 // Resume normal drawing of the widget's state. |
78 void UnsetPaintOverride(); | 78 void UnsetPaintOverride(); |
79 | 79 |
80 // This is a convenience function for creating a widget that closes | 80 // Returns a standard close button. |
81 // a bar (find bar, download shelf, info bars). The button will be packed in | 81 static CustomDrawButton* CloseButton(); |
82 // |hbox|. | |
83 // The caller is responsible for destroying the returned CustomDrawButton. | |
84 static CustomDrawButton* AddBarCloseButton(GtkWidget* hbox, int padding); | |
85 | 82 |
86 private: | 83 private: |
87 // Callback for expose, used to draw the custom graphics. | 84 // Callback for expose, used to draw the custom graphics. |
88 static gboolean OnExpose(GtkWidget* widget, | 85 static gboolean OnExpose(GtkWidget* widget, |
89 GdkEventExpose* e, | 86 GdkEventExpose* e, |
90 CustomDrawButton* obj); | 87 CustomDrawButton* obj); |
91 | 88 |
92 // The actual button widget. | 89 // The actual button widget. |
93 OwnedWidgetGtk widget_; | 90 OwnedWidgetGtk widget_; |
94 | 91 |
95 CustomDrawButtonBase button_base_; | 92 CustomDrawButtonBase button_base_; |
96 | 93 |
97 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); | 94 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); |
98 }; | 95 }; |
99 | 96 |
100 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ | 97 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ |
OLD | NEW |