| 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 "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" | 5 #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 gtk_widget_show(child); | 44 gtk_widget_show(child); |
| 45 ++(*reinterpret_cast<int*>(userdata)); | 45 ++(*reinterpret_cast<int*>(userdata)); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 void ChildSizeAllocate(GtkWidget* child, gpointer userdata) { | 49 void ChildSizeAllocate(GtkWidget* child, gpointer userdata) { |
| 50 if (!gtk_widget_get_visible(child)) | 50 if (!gtk_widget_get_visible(child)) |
| 51 return; | 51 return; |
| 52 | 52 |
| 53 SizeAllocateData* data = reinterpret_cast<SizeAllocateData*>(userdata); | 53 SizeAllocateData* data = reinterpret_cast<SizeAllocateData*>(userdata); |
| 54 GtkAllocation child_allocation = child->allocation; | 54 GtkAllocation child_allocation; |
| 55 gtk_widget_get_allocation(child, &child_allocation); |
| 55 | 56 |
| 56 if (data->homogeneous) { | 57 if (data->homogeneous) { |
| 57 // Make sure the child is not overlapped with others' boundary. | 58 // Make sure the child is not overlapped with others' boundary. |
| 58 if (child_allocation.width > data->homogeneous_child_width) { | 59 if (child_allocation.width > data->homogeneous_child_width) { |
| 59 child_allocation.x += | 60 child_allocation.x += |
| 60 (child_allocation.width - data->homogeneous_child_width) / 2; | 61 (child_allocation.width - data->homogeneous_child_width) / 2; |
| 61 child_allocation.width = data->homogeneous_child_width; | 62 child_allocation.width = data->homogeneous_child_width; |
| 62 } | 63 } |
| 63 } else { | 64 } else { |
| 64 guint padding; | 65 guint padding; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 281 |
| 281 gint gtk_chrome_shrinkable_hbox_get_visible_child_count( | 282 gint gtk_chrome_shrinkable_hbox_get_visible_child_count( |
| 282 GtkChromeShrinkableHBox* box) { | 283 GtkChromeShrinkableHBox* box) { |
| 283 gint visible_children_count = 0; | 284 gint visible_children_count = 0; |
| 284 gtk_container_foreach(GTK_CONTAINER(box), CountVisibleChildren, | 285 gtk_container_foreach(GTK_CONTAINER(box), CountVisibleChildren, |
| 285 &visible_children_count); | 286 &visible_children_count); |
| 286 return visible_children_count; | 287 return visible_children_count; |
| 287 } | 288 } |
| 288 | 289 |
| 289 G_END_DECLS | 290 G_END_DECLS |
| OLD | NEW |