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_floating_container.h" | 5 #include "ui/base/gtk/gtk_floating_container.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <gtk/gtkmarshal.h> | 8 #include <gtk/gtkmarshal.h> |
9 #include <gtk/gtkprivate.h> | 9 #include <gtk/gtkprivate.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 | 12 |
| 13 #include "ui/base/gtk/gtk_compat.h" |
| 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 enum { | 17 enum { |
16 SET_FLOATING_POSITION, | 18 SET_FLOATING_POSITION, |
17 LAST_SIGNAL | 19 LAST_SIGNAL |
18 }; | 20 }; |
19 | 21 |
20 enum { | 22 enum { |
21 CHILD_PROP_0, | 23 CHILD_PROP_0, |
22 CHILD_PROP_X, | 24 CHILD_PROP_X, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } else { | 200 } else { |
199 requisition->width = 0; | 201 requisition->width = 0; |
200 requisition->height = 0; | 202 requisition->height = 0; |
201 } | 203 } |
202 } | 204 } |
203 | 205 |
204 static void gtk_floating_container_size_allocate(GtkWidget* widget, | 206 static void gtk_floating_container_size_allocate(GtkWidget* widget, |
205 GtkAllocation* allocation) { | 207 GtkAllocation* allocation) { |
206 widget->allocation = *allocation; | 208 widget->allocation = *allocation; |
207 | 209 |
208 if (!GTK_WIDGET_NO_WINDOW(widget) && GTK_WIDGET_REALIZED(widget)) { | 210 if (gtk_widget_get_has_window(widget) && gtk_widget_get_realized(widget)) { |
209 gdk_window_move_resize(widget->window, | 211 gdk_window_move_resize(widget->window, |
210 allocation->x, | 212 allocation->x, |
211 allocation->y, | 213 allocation->y, |
212 allocation->width, | 214 allocation->width, |
213 allocation->height); | 215 allocation->height); |
214 } | 216 } |
215 | 217 |
216 // Give the same allocation to our GtkBin component. | 218 // Give the same allocation to our GtkBin component. |
217 GtkBin* bin = GTK_BIN(widget); | 219 GtkBin* bin = GTK_BIN(widget); |
218 if (bin->child) { | 220 if (bin->child) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 child_info->x = 0; | 313 child_info->x = 0; |
312 child_info->y = 0; | 314 child_info->y = 0; |
313 | 315 |
314 gtk_widget_set_parent(widget, GTK_WIDGET(container)); | 316 gtk_widget_set_parent(widget, GTK_WIDGET(container)); |
315 | 317 |
316 container->floating_children = | 318 container->floating_children = |
317 g_list_append(container->floating_children, child_info); | 319 g_list_append(container->floating_children, child_info); |
318 } | 320 } |
319 | 321 |
320 G_END_DECLS | 322 G_END_DECLS |
OLD | NEW |