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 #include "chrome/browser/gtk/gtk_chrome_button.h" | 5 #include "chrome/browser/gtk/gtk_chrome_button.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/gfx/gtk_util.h" | 8 #include "base/gfx/gtk_util.h" |
9 #include "chrome/browser/gtk/nine_box.h" | 9 #include "chrome/browser/gtk/nine_box.h" |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 NineBox* nine_box = NULL; | 110 NineBox* nine_box = NULL; |
111 if (paint_state == GTK_STATE_PRELIGHT) | 111 if (paint_state == GTK_STATE_PRELIGHT) |
112 nine_box = g_nine_box_prelight; | 112 nine_box = g_nine_box_prelight; |
113 else if (paint_state == GTK_STATE_ACTIVE) | 113 else if (paint_state == GTK_STATE_ACTIVE) |
114 nine_box = g_nine_box_active; | 114 nine_box = g_nine_box_active; |
115 | 115 |
116 // Only draw theme graphics if we have some. | 116 // Only draw theme graphics if we have some. |
117 if (nine_box) | 117 if (nine_box) |
118 nine_box->RenderToWidget(widget); | 118 nine_box->RenderToWidget(widget); |
119 | 119 |
120 gtk_container_propagate_expose(GTK_CONTAINER(widget), | 120 // If we have a child widget, draw it. |
121 gtk_bin_get_child(GTK_BIN(widget)), | 121 if (gtk_bin_get_child(GTK_BIN(widget))) { |
122 event); | 122 gtk_container_propagate_expose(GTK_CONTAINER(widget), |
| 123 gtk_bin_get_child(GTK_BIN(widget)), |
| 124 event); |
| 125 } |
123 } | 126 } |
124 | 127 |
125 return TRUE; // Don't propagate, we are the default handler. | 128 return TRUE; // Don't propagate, we are the default handler. |
126 } | 129 } |
127 | 130 |
128 GtkWidget* gtk_chrome_button_new(void) { | 131 GtkWidget* gtk_chrome_button_new(void) { |
129 return GTK_WIDGET(g_object_new(GTK_TYPE_CHROME_BUTTON, NULL)); | 132 return GTK_WIDGET(g_object_new(GTK_TYPE_CHROME_BUTTON, NULL)); |
130 } | 133 } |
131 | 134 |
132 void gtk_chrome_button_set_paint_state(GtkChromeButton* button, | 135 void gtk_chrome_button_set_paint_state(GtkChromeButton* button, |
(...skipping 16 matching lines...) Expand all Loading... |
149 } | 152 } |
150 | 153 |
151 void gtk_chrome_button_set_use_gtk_rendering(GtkChromeButton* button, | 154 void gtk_chrome_button_set_use_gtk_rendering(GtkChromeButton* button, |
152 gboolean value) { | 155 gboolean value) { |
153 g_return_if_fail(GTK_IS_CHROME_BUTTON(button)); | 156 g_return_if_fail(GTK_IS_CHROME_BUTTON(button)); |
154 GtkChromeButtonPrivate *priv = GTK_CHROME_BUTTON_GET_PRIVATE(button); | 157 GtkChromeButtonPrivate *priv = GTK_CHROME_BUTTON_GET_PRIVATE(button); |
155 priv->use_gtk_rendering = value; | 158 priv->use_gtk_rendering = value; |
156 } | 159 } |
157 | 160 |
158 G_END_DECLS | 161 G_END_DECLS |
OLD | NEW |