[gtk: 1/5] gtk-demo: Avoid double borders in the panes demo




commit d9e8223b038d5a865c7752cc162706f1cccac080
Author: nana-4 <hnmaigo gmail com>
Date:   Fri Aug 7 00:54:42 2020 +0900

    gtk-demo: Avoid double borders in the panes demo
    
    Using frames for the children of the panes looks bad.

 demos/gtk-demo/panes.c | 50 ++++++++++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 22 deletions(-)
---
diff --git a/demos/gtk-demo/panes.c b/demos/gtk-demo/panes.c
index 134d3bea97..e6312054f1 100644
--- a/demos/gtk-demo/panes.c
+++ b/demos/gtk-demo/panes.c
@@ -61,10 +61,6 @@ create_pane_options (GtkPaned    *paned,
   child2 = gtk_paned_get_end_child (paned);
 
   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 ();
   gtk_frame_set_child (GTK_FRAME (frame), table);
@@ -110,6 +106,7 @@ do_panes (GtkWidget *do_widget)
   GtkWidget *vpaned;
   GtkWidget *button;
   GtkWidget *vbox;
+  GtkWidget *box;
 
   if (!window)
     {
@@ -120,33 +117,42 @@ do_panes (GtkWidget *do_widget)
 
       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);
 
+      frame = gtk_frame_new (NULL);
+      gtk_box_append (GTK_BOX (vbox), frame);
+
       vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
-      gtk_widget_set_margin_start (vpaned, 5);
-      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);
+      gtk_frame_set_child (GTK_FRAME (frame), vpaned);
 
       hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
       gtk_paned_set_start_child (GTK_PANED (vpaned), hpaned);
 
-      frame = gtk_frame_new (NULL);
-      gtk_widget_set_size_request (frame, 60, 60);
-      gtk_paned_set_start_child (GTK_PANED (hpaned), frame);
+      box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+      gtk_widget_set_size_request (box, 60, 60);
+      gtk_paned_set_start_child (GTK_PANED (hpaned), box);
 
       button = gtk_button_new_with_mnemonic ("_Hi there");
-      gtk_frame_set_child (GTK_FRAME (frame), button);
-
-      frame = gtk_frame_new (NULL);
-      gtk_widget_set_size_request (frame, 80, 60);
-      gtk_paned_set_end_child (GTK_PANED (hpaned), frame);
-
-      frame = gtk_frame_new (NULL);
-      gtk_widget_set_size_request (frame, 60, 80);
-      gtk_paned_set_end_child (GTK_PANED (vpaned), frame);
+      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);
+
+      box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+      gtk_widget_set_size_request (box, 80, 60);
+      gtk_paned_set_end_child (GTK_PANED (hpaned), box);
+
+      box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+      gtk_widget_set_size_request (box, 60, 80);
+      gtk_paned_set_end_child (GTK_PANED (vpaned), box);
 
       /* Now create toggle buttons to control sizing */
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]