forked from AuroraMiddleware/gtk
Use gtk_overlay_set_child throughout
Replace all uses of gtk_container_add on overlays by gtk_overlay_set_child.
This commit is contained in:
parent
53f9737dcf
commit
77af8e303d
@ -204,7 +204,7 @@ blur_overlay_size_allocate (GtkWidget *widget,
|
||||
GtkWidget *child;
|
||||
GtkWidget *main_widget;
|
||||
|
||||
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
|
||||
main_widget = gtk_overlay_get_child (GTK_OVERLAY (overlay));
|
||||
if (main_widget && gtk_widget_get_visible (main_widget))
|
||||
gtk_widget_size_allocate (main_widget,
|
||||
&(GtkAllocation) {
|
||||
|
@ -107,7 +107,7 @@ do_gears (GtkWidget *do_widget)
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), box);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), box);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
|
@ -37,7 +37,7 @@ do_overlay (GtkWidget *do_widget)
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (overlay), grid);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), grid);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
|
||||
|
@ -58,7 +58,7 @@ do_overlay2 (GtkWidget *do_widget)
|
||||
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), overlay);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), text);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
|
@ -58,7 +58,7 @@ do_transparent (GtkWidget *do_widget)
|
||||
blur_overlay_add_overlay (BLUR_OVERLAY (overlay), button, 5.0);
|
||||
|
||||
picture = gtk_picture_new_for_resource ("/transparent/portland-rose.jpg");
|
||||
gtk_container_add (GTK_CONTAINER (overlay), picture);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), picture);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@ -27,7 +27,7 @@ new_window (GApplication *app,
|
||||
view = gtk_text_view_new ();
|
||||
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), scrolled);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), scrolled);
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ gtk_overlay_layout_measure (GtkLayoutManager *layout_manager,
|
||||
int min, nat;
|
||||
GtkWidget *main_widget;
|
||||
|
||||
main_widget = gtk_bin_get_child (GTK_BIN (widget));
|
||||
main_widget = gtk_overlay_get_child (GTK_OVERLAY (widget));
|
||||
|
||||
min = 0;
|
||||
nat = 0;
|
||||
@ -397,7 +397,7 @@ gtk_overlay_layout_allocate (GtkLayoutManager *layout_manager,
|
||||
GtkWidget *child;
|
||||
GtkWidget *main_widget;
|
||||
|
||||
main_widget = gtk_bin_get_child (GTK_BIN (widget));
|
||||
main_widget = gtk_overlay_get_child (GTK_OVERLAY (widget));
|
||||
if (main_widget && gtk_widget_get_visible (main_widget))
|
||||
gtk_widget_size_allocate (main_widget,
|
||||
&(GtkAllocation) { 0, 0, width, height },
|
||||
|
@ -166,7 +166,7 @@ main (int argc, char *argv[])
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), box);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), box);
|
||||
gtk_widget_show (box);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
|
@ -166,7 +166,7 @@ open_control_window (void)
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
|
||||
#define TEST_WIDGET(outer) (gtk_bin_get_child (GTK_BIN (gtk_bin_get_child (GTK_BIN(outer)))))
|
||||
#define TEST_WIDGET(outer) (gtk_overlay_get_child (GTK_OVERLAY (gtk_overlay_get_child (GTK_OVERLAY (outer)))))
|
||||
|
||||
static GtkWidget*
|
||||
create_widget_visible_border (const char *text)
|
||||
|
@ -139,7 +139,7 @@ main (int argc, char *argv[])
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), overlay_draw, label, NULL);
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
gtk_container_add (GTK_CONTAINER (overlay), da);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), da);
|
||||
gtk_widget_set_vexpand (overlay, TRUE);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
|
||||
|
@ -63,7 +63,7 @@ test_nonzerox (void)
|
||||
gtk_widget_set_size_request (text, 200, 200);
|
||||
gtk_widget_set_hexpand (text, TRUE);
|
||||
gtk_widget_set_vexpand (text, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), text);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), text);
|
||||
|
||||
child = gtk_label_new ("I'm the overlay");
|
||||
gtk_widget_set_halign (child, GTK_ALIGN_START);
|
||||
@ -98,7 +98,7 @@ get_child_position (GtkOverlay *overlay,
|
||||
GtkAllocation main_alloc;
|
||||
gint x, y;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (overlay));
|
||||
child = gtk_overlay_get_child (GTK_OVERLAY (overlay));
|
||||
|
||||
gtk_widget_translate_coordinates (relative, child, 0, 0, &x, &y);
|
||||
main_alloc.x = x;
|
||||
@ -138,7 +138,7 @@ test_relative (void)
|
||||
gtk_window_set_child (GTK_WINDOW (win), overlay);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (overlay), grid);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), grid);
|
||||
gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Above"), 1, 0, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Below"), 1, 2, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Left"), 0, 1, 1, 1);
|
||||
@ -196,7 +196,7 @@ test_fullwidth (void)
|
||||
gtk_widget_set_size_request (text, 200, 200);
|
||||
gtk_widget_set_hexpand (text, TRUE);
|
||||
gtk_widget_set_vexpand (text, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), text);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), text);
|
||||
|
||||
child = gtk_label_new ("Fullwidth top overlay");
|
||||
gtk_widget_set_halign (child, GTK_ALIGN_FILL);
|
||||
@ -232,7 +232,7 @@ test_scrolling (void)
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (sw), 200);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 200);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
|
||||
|
||||
text = gtk_text_view_new ();
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
@ -378,7 +378,7 @@ test_chase (void)
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (sw), 200);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 200);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
|
||||
|
||||
text = gtk_text_view_new ();
|
||||
text_buffer = gtk_text_buffer_new (NULL);
|
||||
@ -443,7 +443,7 @@ test_stacking (void)
|
||||
check2 = gtk_check_button_new_with_label ("Show overlay");
|
||||
g_object_bind_property (child, "visible", check2, "active", G_BINDING_BIDIRECTIONAL);
|
||||
gtk_container_add (GTK_CONTAINER (main_child), label);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), main_child);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), main_child);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child);
|
||||
gtk_grid_attach (GTK_GRID (grid), overlay, 1, 0, 1, 3);
|
||||
gtk_window_set_child (GTK_WINDOW (win), grid);
|
||||
@ -473,7 +473,7 @@ test_input_stacking (void)
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (overlay), grid);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), grid);
|
||||
|
||||
for (j = 0; j < 5; j++)
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ main (int argc, char *argv[])
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_ALWAYS,
|
||||
GTK_POLICY_ALWAYS);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
|
||||
|
||||
main_child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), main_child);
|
||||
|
@ -89,7 +89,7 @@ main (int argc, char *argv[])
|
||||
gtk_widget_set_valign (grid, GTK_ALIGN_FILL);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), grid);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), grid);
|
||||
|
||||
label = gtk_label_new ("");
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
|
@ -126,7 +126,7 @@ main (int argc, char *argv[])
|
||||
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (win), overlay);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
|
||||
populate_list (GTK_LIST_BOX (list));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user