| 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/base/gtk/gtk_expanded_container.h" | 5 #include "ui/base/gtk/gtk_expanded_container.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (child_allocation.height < 0) | 61 if (child_allocation.height < 0) |
| 62 child_allocation.height = child_requisition.height; | 62 child_allocation.height = child_requisition.height; |
| 63 } | 63 } |
| 64 | 64 |
| 65 int x, y; | 65 int x, y; |
| 66 GetChildPosition(data->container, child, &x, &y); | 66 GetChildPosition(data->container, child, &x, &y); |
| 67 | 67 |
| 68 child_allocation.x = x + data->border_width; | 68 child_allocation.x = x + data->border_width; |
| 69 child_allocation.y = y + data->border_width; | 69 child_allocation.y = y + data->border_width; |
| 70 | 70 |
| 71 if (GTK_WIDGET_NO_WINDOW(data->container)) { | 71 if (!gtk_widget_get_has_window(data->container)) { |
| 72 child_allocation.x += data->allocation->x; | 72 child_allocation.x += data->allocation->x; |
| 73 child_allocation.y += data->allocation->y; | 73 child_allocation.y += data->allocation->y; |
| 74 } | 74 } |
| 75 gtk_widget_size_allocate(child, &child_allocation); | 75 gtk_widget_size_allocate(child, &child_allocation); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void Marshal_VOID__OBJECT_BOXED(GClosure* closure, | 78 void Marshal_VOID__OBJECT_BOXED(GClosure* closure, |
| 79 GValue* return_value G_GNUC_UNUSED, | 79 GValue* return_value G_GNUC_UNUSED, |
| 80 guint n_param_values, | 80 guint n_param_values, |
| 81 const GValue* param_values, | 81 const GValue* param_values, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 G_TYPE_NONE, 2, | 136 G_TYPE_NONE, 2, |
| 137 GTK_TYPE_WIDGET, | 137 GTK_TYPE_WIDGET, |
| 138 GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE); | 138 GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE); |
| 139 } | 139 } |
| 140 | 140 |
| 141 static void gtk_expanded_container_init(GtkExpandedContainer* container) { | 141 static void gtk_expanded_container_init(GtkExpandedContainer* container) { |
| 142 } | 142 } |
| 143 | 143 |
| 144 static void gtk_expanded_container_size_allocate(GtkWidget* widget, | 144 static void gtk_expanded_container_size_allocate(GtkWidget* widget, |
| 145 GtkAllocation* allocation) { | 145 GtkAllocation* allocation) { |
| 146 widget->allocation = *allocation; | 146 gtk_widget_set_allocation(widget, allocation); |
| 147 | 147 |
| 148 if (!GTK_WIDGET_NO_WINDOW(widget) && gtk_widget_get_realized(widget)) { | 148 if (gtk_widget_get_has_window(widget) && gtk_widget_get_realized(widget)) { |
| 149 gdk_window_move_resize(widget->window, | 149 gdk_window_move_resize(gtk_widget_get_window(widget), |
| 150 allocation->x, | 150 allocation->x, |
| 151 allocation->y, | 151 allocation->y, |
| 152 allocation->width, | 152 allocation->width, |
| 153 allocation->height); | 153 allocation->height); |
| 154 } | 154 } |
| 155 | 155 |
| 156 SizeAllocateData data; | 156 SizeAllocateData data; |
| 157 data.container = widget; | 157 data.container = widget; |
| 158 data.allocation = allocation; | 158 data.allocation = allocation; |
| 159 data.border_width = gtk_container_get_border_width(GTK_CONTAINER(widget)); | 159 data.border_width = gtk_container_get_border_width(GTK_CONTAINER(widget)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 176 GtkWidget* widget, gint x, gint y) { | 176 GtkWidget* widget, gint x, gint y) { |
| 177 g_return_if_fail(GTK_IS_EXPANDED_CONTAINER(container)); | 177 g_return_if_fail(GTK_IS_EXPANDED_CONTAINER(container)); |
| 178 g_return_if_fail(GTK_IS_WIDGET(widget)); | 178 g_return_if_fail(GTK_IS_WIDGET(widget)); |
| 179 gtk_fixed_move(GTK_FIXED(container), widget, x, y); | 179 gtk_fixed_move(GTK_FIXED(container), widget, x, y); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void gtk_expanded_container_set_has_window(GtkExpandedContainer* container, | 182 void gtk_expanded_container_set_has_window(GtkExpandedContainer* container, |
| 183 gboolean has_window) { | 183 gboolean has_window) { |
| 184 g_return_if_fail(GTK_IS_EXPANDED_CONTAINER(container)); | 184 g_return_if_fail(GTK_IS_EXPANDED_CONTAINER(container)); |
| 185 g_return_if_fail(!gtk_widget_get_realized(GTK_WIDGET(container))); | 185 g_return_if_fail(!gtk_widget_get_realized(GTK_WIDGET(container))); |
| 186 gtk_fixed_set_has_window(GTK_FIXED(container), has_window); | 186 gtk_widget_set_has_window(GTK_WIDGET(container), has_window); |
| 187 } | 187 } |
| 188 | 188 |
| 189 gboolean gtk_expanded_container_get_has_window( | 189 gboolean gtk_expanded_container_get_has_window( |
| 190 GtkExpandedContainer* container) { | 190 GtkExpandedContainer* container) { |
| 191 g_return_val_if_fail(GTK_IS_EXPANDED_CONTAINER(container), FALSE); | 191 g_return_val_if_fail(GTK_IS_EXPANDED_CONTAINER(container), FALSE); |
| 192 return gtk_fixed_get_has_window(GTK_FIXED(container)); | 192 return gtk_widget_get_has_window(GTK_WIDGET(container)); |
| 193 } | 193 } |
| 194 | 194 |
| 195 G_END_DECLS | 195 G_END_DECLS |
| OLD | NEW |