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 |
| 11 #include "ui/base/gtk/gtk_compat.h" |
| 12 |
11 namespace { | 13 namespace { |
12 | 14 |
13 enum { | 15 enum { |
14 CHILD_SIZE_REQUEST, | 16 CHILD_SIZE_REQUEST, |
15 LAST_SIGNAL | 17 LAST_SIGNAL |
16 }; | 18 }; |
17 | 19 |
18 guint expanded_container_signals[LAST_SIGNAL] = { 0 }; | 20 guint expanded_container_signals[LAST_SIGNAL] = { 0 }; |
19 | 21 |
20 struct SizeAllocateData { | 22 struct SizeAllocateData { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE); | 138 GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE); |
137 } | 139 } |
138 | 140 |
139 static void gtk_expanded_container_init(GtkExpandedContainer* container) { | 141 static void gtk_expanded_container_init(GtkExpandedContainer* container) { |
140 } | 142 } |
141 | 143 |
142 static void gtk_expanded_container_size_allocate(GtkWidget* widget, | 144 static void gtk_expanded_container_size_allocate(GtkWidget* widget, |
143 GtkAllocation* allocation) { | 145 GtkAllocation* allocation) { |
144 widget->allocation = *allocation; | 146 widget->allocation = *allocation; |
145 | 147 |
146 if (!GTK_WIDGET_NO_WINDOW(widget) && GTK_WIDGET_REALIZED(widget)) { | 148 if (!GTK_WIDGET_NO_WINDOW(widget) && gtk_widget_get_realized(widget)) { |
147 gdk_window_move_resize(widget->window, | 149 gdk_window_move_resize(widget->window, |
148 allocation->x, | 150 allocation->x, |
149 allocation->y, | 151 allocation->y, |
150 allocation->width, | 152 allocation->width, |
151 allocation->height); | 153 allocation->height); |
152 } | 154 } |
153 | 155 |
154 SizeAllocateData data; | 156 SizeAllocateData data; |
155 data.container = widget; | 157 data.container = widget; |
156 data.allocation = allocation; | 158 data.allocation = allocation; |
(...skipping 16 matching lines...) Expand all Loading... |
173 void gtk_expanded_container_move(GtkExpandedContainer* container, | 175 void gtk_expanded_container_move(GtkExpandedContainer* container, |
174 GtkWidget* widget, gint x, gint y) { | 176 GtkWidget* widget, gint x, gint y) { |
175 g_return_if_fail(GTK_IS_EXPANDED_CONTAINER(container)); | 177 g_return_if_fail(GTK_IS_EXPANDED_CONTAINER(container)); |
176 g_return_if_fail(GTK_IS_WIDGET(widget)); | 178 g_return_if_fail(GTK_IS_WIDGET(widget)); |
177 gtk_fixed_move(GTK_FIXED(container), widget, x, y); | 179 gtk_fixed_move(GTK_FIXED(container), widget, x, y); |
178 } | 180 } |
179 | 181 |
180 void gtk_expanded_container_set_has_window(GtkExpandedContainer* container, | 182 void gtk_expanded_container_set_has_window(GtkExpandedContainer* container, |
181 gboolean has_window) { | 183 gboolean has_window) { |
182 g_return_if_fail(GTK_IS_EXPANDED_CONTAINER(container)); | 184 g_return_if_fail(GTK_IS_EXPANDED_CONTAINER(container)); |
183 g_return_if_fail(!GTK_WIDGET_REALIZED(container)); | 185 g_return_if_fail(!gtk_widget_get_realized(GTK_WIDGET(container))); |
184 gtk_fixed_set_has_window(GTK_FIXED(container), has_window); | 186 gtk_fixed_set_has_window(GTK_FIXED(container), has_window); |
185 } | 187 } |
186 | 188 |
187 gboolean gtk_expanded_container_get_has_window( | 189 gboolean gtk_expanded_container_get_has_window( |
188 GtkExpandedContainer* container) { | 190 GtkExpandedContainer* container) { |
189 g_return_val_if_fail(GTK_IS_EXPANDED_CONTAINER(container), FALSE); | 191 g_return_val_if_fail(GTK_IS_EXPANDED_CONTAINER(container), FALSE); |
190 return gtk_fixed_get_has_window(GTK_FIXED(container)); | 192 return gtk_fixed_get_has_window(GTK_FIXED(container)); |
191 } | 193 } |
192 | 194 |
193 G_END_DECLS | 195 G_END_DECLS |
OLD | NEW |