| 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> | |
| 9 #include <gtk/gtkprivate.h> | |
| 10 | 8 |
| 11 #include <algorithm> | 9 #include <algorithm> |
| 12 | 10 |
| 13 namespace { | 11 namespace { |
| 14 | 12 |
| 15 enum { | 13 enum { |
| 16 SET_FLOATING_POSITION, | 14 SET_FLOATING_POSITION, |
| 17 LAST_SIGNAL | 15 LAST_SIGNAL |
| 18 }; | 16 }; |
| 19 | 17 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 32 GtkFloatingContainerChild* child = | 30 GtkFloatingContainerChild* child = |
| 33 reinterpret_cast<GtkFloatingContainerChild*>(floating_children->data); | 31 reinterpret_cast<GtkFloatingContainerChild*>(floating_children->data); |
| 34 | 32 |
| 35 if (child->widget == widget) | 33 if (child->widget == widget) |
| 36 return child; | 34 return child; |
| 37 } | 35 } |
| 38 | 36 |
| 39 return NULL; | 37 return NULL; |
| 40 } | 38 } |
| 41 | 39 |
| 40 const GParamFlags kStaticReadWriteProp = static_cast<GParamFlags>( |
| 41 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 42 |
| 42 } // namespace | 43 } // namespace |
| 43 | 44 |
| 44 G_BEGIN_DECLS | 45 G_BEGIN_DECLS |
| 45 | 46 |
| 46 static void gtk_floating_container_remove(GtkContainer* container, | 47 static void gtk_floating_container_remove(GtkContainer* container, |
| 47 GtkWidget* widget); | 48 GtkWidget* widget); |
| 48 static void gtk_floating_container_forall(GtkContainer* container, | 49 static void gtk_floating_container_forall(GtkContainer* container, |
| 49 gboolean include_internals, | 50 gboolean include_internals, |
| 50 GtkCallback callback, | 51 GtkCallback callback, |
| 51 gpointer callback_data); | 52 gpointer callback_data); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 91 |
| 91 gtk_container_class_install_child_property( | 92 gtk_container_class_install_child_property( |
| 92 container_class, | 93 container_class, |
| 93 CHILD_PROP_X, | 94 CHILD_PROP_X, |
| 94 g_param_spec_int("x", | 95 g_param_spec_int("x", |
| 95 "X position", | 96 "X position", |
| 96 "X position of child widget", | 97 "X position of child widget", |
| 97 G_MININT, | 98 G_MININT, |
| 98 G_MAXINT, | 99 G_MAXINT, |
| 99 0, | 100 0, |
| 100 static_cast<GParamFlags>(GTK_PARAM_READWRITE))); | 101 kStaticReadWriteProp)); |
| 101 | 102 |
| 102 gtk_container_class_install_child_property( | 103 gtk_container_class_install_child_property( |
| 103 container_class, | 104 container_class, |
| 104 CHILD_PROP_Y, | 105 CHILD_PROP_Y, |
| 105 g_param_spec_int("y", | 106 g_param_spec_int("y", |
| 106 "Y position", | 107 "Y position", |
| 107 "Y position of child widget", | 108 "Y position of child widget", |
| 108 G_MININT, | 109 G_MININT, |
| 109 G_MAXINT, | 110 G_MAXINT, |
| 110 0, | 111 0, |
| 111 static_cast<GParamFlags>(GTK_PARAM_READWRITE))); | 112 kStaticReadWriteProp)); |
| 112 | 113 |
| 113 floating_container_signals[SET_FLOATING_POSITION] = | 114 floating_container_signals[SET_FLOATING_POSITION] = |
| 114 g_signal_new("set-floating-position", | 115 g_signal_new("set-floating-position", |
| 115 G_OBJECT_CLASS_TYPE(object_class), | 116 G_OBJECT_CLASS_TYPE(object_class), |
| 116 static_cast<GSignalFlags>(G_SIGNAL_RUN_FIRST | | 117 static_cast<GSignalFlags>(G_SIGNAL_RUN_FIRST | |
| 117 G_SIGNAL_ACTION), | 118 G_SIGNAL_ACTION), |
| 118 0, | 119 0, |
| 119 NULL, NULL, | 120 NULL, NULL, |
| 120 gtk_marshal_VOID__BOXED, | 121 gtk_marshal_VOID__BOXED, |
| 121 G_TYPE_NONE, 1, | 122 G_TYPE_NONE, 1, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 child_info->x = 0; | 312 child_info->x = 0; |
| 312 child_info->y = 0; | 313 child_info->y = 0; |
| 313 | 314 |
| 314 gtk_widget_set_parent(widget, GTK_WIDGET(container)); | 315 gtk_widget_set_parent(widget, GTK_WIDGET(container)); |
| 315 | 316 |
| 316 container->floating_children = | 317 container->floating_children = |
| 317 g_list_append(container->floating_children, child_info); | 318 g_list_append(container->floating_children, child_info); |
| 318 } | 319 } |
| 319 | 320 |
| 320 G_END_DECLS | 321 G_END_DECLS |
| OLD | NEW |