OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/gtk_preserve_window.h" | 5 #include "ui/gfx/gtk_preserve_window.h" |
6 | 6 |
7 #include <gdk/gdkwindow.h> | 7 #include <gdk/gdkwindow.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <gtk/gtkwidget.h> | 9 #include <gtk/gtkwidget.h> |
10 #include <gtk/gtkfixed.h> | 10 #include <gtk/gtkfixed.h> |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 widget->window, allocation->x, allocation->y, | 201 widget->window, allocation->x, allocation->y, |
202 allocation->width, allocation->height); | 202 allocation->width, allocation->height); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 // Propagate resize to children | 206 // Propagate resize to children |
207 guint16 border_width = GTK_CONTAINER(widget)->border_width; | 207 guint16 border_width = GTK_CONTAINER(widget)->border_width; |
208 GList *children = GTK_FIXED(widget)->children; | 208 GList *children = GTK_FIXED(widget)->children; |
209 while (children) { | 209 while (children) { |
210 GtkFixedChild *child = reinterpret_cast<GtkFixedChild*>(children->data); | 210 GtkFixedChild *child = reinterpret_cast<GtkFixedChild*>(children->data); |
211 if (GTK_WIDGET_VISIBLE(child->widget)) { | 211 if (gtk_widget_get_visible(child->widget)) { |
212 GtkRequisition child_requisition; | 212 GtkRequisition child_requisition; |
213 gtk_widget_get_child_requisition(child->widget, &child_requisition); | 213 gtk_widget_get_child_requisition(child->widget, &child_requisition); |
214 | 214 |
215 GtkAllocation child_allocation; | 215 GtkAllocation child_allocation; |
216 child_allocation.x = child->x + border_width; | 216 child_allocation.x = child->x + border_width; |
217 child_allocation.y = child->y + border_width; | 217 child_allocation.y = child->y + border_width; |
218 child_allocation.width = child_requisition.width; | 218 child_allocation.width = child_requisition.width; |
219 child_allocation.height = child_requisition.height; | 219 child_allocation.height = child_requisition.height; |
220 | 220 |
221 gtk_widget_size_allocate(child->widget, &child_allocation); | 221 gtk_widget_size_allocate(child->widget, &child_allocation); |
222 } | 222 } |
223 children = children->next; | 223 children = children->next; |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 void gtk_preserve_window_delegate_resize(GtkPreserveWindow* widget, | 227 void gtk_preserve_window_delegate_resize(GtkPreserveWindow* widget, |
228 gboolean delegate) { | 228 gboolean delegate) { |
229 GtkPreserveWindowPrivate* priv = GTK_PRESERVE_WINDOW_GET_PRIVATE(widget); | 229 GtkPreserveWindowPrivate* priv = GTK_PRESERVE_WINDOW_GET_PRIVATE(widget); |
230 priv->delegate_resize = delegate; | 230 priv->delegate_resize = delegate; |
231 } | 231 } |
232 | 232 |
233 G_END_DECLS | 233 G_END_DECLS |
OLD | NEW |