Merge branch 'demo-double-border-fixes' into 'master'

gtk-demo: Avoid double borders

See merge request GNOME/gtk!2478
This commit is contained in:
Matthias Clasen 2020-08-25 20:19:49 +00:00
commit 42cc15bb74
4 changed files with 35 additions and 22 deletions

View File

@ -8,6 +8,10 @@
<property name="default-height">300</property> <property name="default-height">300</property>
<child> <child>
<object class="GtkGrid"> <object class="GtkGrid">
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="row-spacing">12</property> <property name="row-spacing">12</property>
<property name="column-spacing">12</property> <property name="column-spacing">12</property>
<child> <child>

View File

@ -566,7 +566,6 @@ canvas_new (void)
canvas = gtk_fixed_new (); canvas = gtk_fixed_new ();
gtk_widget_set_hexpand (canvas, TRUE); gtk_widget_set_hexpand (canvas, TRUE);
gtk_widget_set_vexpand (canvas, TRUE); gtk_widget_set_vexpand (canvas, TRUE);
gtk_widget_add_css_class (canvas, "frame");
source = gtk_drag_source_new (); source = gtk_drag_source_new ();
gtk_drag_source_set_actions (source, GDK_ACTION_MOVE); gtk_drag_source_set_actions (source, GDK_ACTION_MOVE);
@ -764,6 +763,8 @@ do_dnd (GtkWidget *do_widget)
y += 100; y += 100;
} }
gtk_box_append (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
sw = gtk_scrolled_window_new (); sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,

View File

@ -198,10 +198,12 @@
</child> </child>
</object> </object>
</child> </child>
<child>
<object class="GtkSeparator"/>
</child>
<child> <child>
<object class="GtkScrolledWindow"> <object class="GtkScrolledWindow">
<property name="propagate-natural-height">1</property> <property name="propagate-natural-height">1</property>
<property name="has-frame">1</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="vexpand">1</property> <property name="vexpand">1</property>
<child> <child>

View File

@ -61,10 +61,6 @@ create_pane_options (GtkPaned *paned,
child2 = gtk_paned_get_end_child (paned); child2 = gtk_paned_get_end_child (paned);
frame = gtk_frame_new (frame_label); frame = gtk_frame_new (frame_label);
gtk_widget_set_margin_start (frame, 4);
gtk_widget_set_margin_end (frame, 4);
gtk_widget_set_margin_top (frame, 4);
gtk_widget_set_margin_bottom (frame, 4);
table = gtk_grid_new (); table = gtk_grid_new ();
gtk_frame_set_child (GTK_FRAME (frame), table); gtk_frame_set_child (GTK_FRAME (frame), table);
@ -110,6 +106,7 @@ do_panes (GtkWidget *do_widget)
GtkWidget *vpaned; GtkWidget *vpaned;
GtkWidget *button; GtkWidget *button;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *box;
if (!window) if (!window)
{ {
@ -120,33 +117,42 @@ do_panes (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets"); gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_widget_set_margin_start (vbox, 8);
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_window_set_child (GTK_WINDOW (window), vbox); gtk_window_set_child (GTK_WINDOW (window), vbox);
frame = gtk_frame_new (NULL);
gtk_box_append (GTK_BOX (vbox), frame);
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL); vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_widget_set_margin_start (vpaned, 5); gtk_frame_set_child (GTK_FRAME (frame), vpaned);
gtk_widget_set_margin_end (vpaned, 5);
gtk_widget_set_margin_top (vpaned, 5);
gtk_widget_set_margin_bottom (vpaned, 5);
gtk_box_append (GTK_BOX (vbox), vpaned);
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_set_start_child (GTK_PANED (vpaned), hpaned); gtk_paned_set_start_child (GTK_PANED (vpaned), hpaned);
frame = gtk_frame_new (NULL); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_size_request (frame, 60, 60); gtk_widget_set_size_request (box, 60, 60);
gtk_paned_set_start_child (GTK_PANED (hpaned), frame); gtk_paned_set_start_child (GTK_PANED (hpaned), box);
button = gtk_button_new_with_mnemonic ("_Hi there"); button = gtk_button_new_with_mnemonic ("_Hi there");
gtk_frame_set_child (GTK_FRAME (frame), button); gtk_widget_set_margin_start (button, 4);
gtk_widget_set_margin_end (button, 4);
gtk_widget_set_margin_top (button, 4);
gtk_widget_set_margin_bottom (button, 4);
gtk_widget_set_hexpand (button, TRUE);
gtk_widget_set_vexpand (button, TRUE);
gtk_box_append (GTK_BOX (box), button);
frame = gtk_frame_new (NULL); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_size_request (frame, 80, 60); gtk_widget_set_size_request (box, 80, 60);
gtk_paned_set_end_child (GTK_PANED (hpaned), frame); gtk_paned_set_end_child (GTK_PANED (hpaned), box);
frame = gtk_frame_new (NULL); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_size_request (frame, 60, 80); gtk_widget_set_size_request (box, 60, 80);
gtk_paned_set_end_child (GTK_PANED (vpaned), frame); gtk_paned_set_end_child (GTK_PANED (vpaned), box);
/* Now create toggle buttons to control sizing */ /* Now create toggle buttons to control sizing */