SOLVED [was Re: Howto set horiz space/padding between vbox and statusbar?]

2015-12-08 Thread David C. Rankin

On 12/07/2015 11:13 PM, David C. Rankin wrote:

All,

   I have been pulling my hair out trying to tweak the padding between a GtkVBox
and a GtkStatusbar. I have the following main window layout:

   main window
   vbox = gtk_vbox_new (FALSE, 0);
   menubar
   scrolled-window
   textview
   statusbar

The problem is the scrolled-window and textview widgets provide a nice 10 pixel
border created with:

 gtk_text_view_set_left_margin (GTK_TEXT_VIEW (app->view), 5);
 ...
 gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 5);

The statusbar however, is positioned snugly against the left border of the main
window and vbox at the bottom. I would like to move the statusbar display to the
right (pad it on the left) by 10 pixels to match the textview.

I have tried adjusting the padding with the following:

 /* create/pack statusbar at end */
 app->statusbar = gtk_statusbar_new ();

 gboolean expand = 0;
 gboolean fill = 0;
 guint pad = 0;
 GtkPackType packtype = 0;

 gtk_box_query_child_packing (GTK_BOX (vbox), app->statusbar, &expand,
&fill, &pad, &packtype);
 pad += 10;
 gtk_box_set_child_packing (GTK_BOX (vbox), app->statusbar, expand, fill,
pad, packtype);

 status_set_default (app);
 gtk_box_pack_end (GTK_BOX (vbox), app->statusbar, FALSE, FALSE, 0);

However, there is no change in the statusbar display. What say the experts? What
part of the object hierarchy am I missing/screwing up? Thanks.

p.s. sorry if you get 2 copies, the first went to the 'requests' list by 
mistake.



gtk_alignment_new was the key:

/* create/pack statusbar at end within gtk_alignment */
guint ptop;
guint pbot;
guint pleft;
guint pright;

GtkWidget *sbalign = gtk_alignment_new (0, .5, 1, 1);
gtk_alignment_get_padding (GTK_ALIGNMENT (sbalign), &ptop, &pbot, &pleft, 
&pright);
gtk_alignment_set_padding (GTK_ALIGNMENT (sbalign), ptop, pbot, pleft + 10, 
pright);


app->statusbar = gtk_statusbar_new ();
status_set_default (app);

gtk_container_add (GTK_CONTAINER (sbalign), app->statusbar);
gtk_box_pack_end (GTK_BOX (vbox), sbalign, FALSE, FALSE, 0);


Now all things are nice and aligned at the same 10 pixel border.

--
David C. Rankin, J.D.,P.E.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Howto set horiz space/padding between vbox and statusbar?

2015-12-07 Thread Chris Moller
Kinda guessing--I've never used it--but maybe try setting the child 
margin-start property?



On 12/08/15 00:13, David C. Rankin wrote:

All,

  I have been pulling my hair out trying to tweak the padding between 
a GtkVBox and a GtkStatusbar. I have the following main window layout:


  main window
  vbox = gtk_vbox_new (FALSE, 0);
  menubar
  scrolled-window
  textview
  statusbar

The problem is the scrolled-window and textview widgets provide a nice 
10 pixel border created with:


gtk_text_view_set_left_margin (GTK_TEXT_VIEW (app->view), 5);
...
gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 5);

The statusbar however, is positioned snugly against the left border of 
the main window and vbox at the bottom. I would like to move the 
statusbar display to the right (pad it on the left) by 10 pixels to 
match the textview.


I have tried adjusting the padding with the following:

/* create/pack statusbar at end */
app->statusbar = gtk_statusbar_new ();

gboolean expand = 0;
gboolean fill = 0;
guint pad = 0;
GtkPackType packtype = 0;

gtk_box_query_child_packing (GTK_BOX (vbox), app->statusbar, 
&expand, &fill, &pad, &packtype);

pad += 10;
gtk_box_set_child_packing (GTK_BOX (vbox), app->statusbar, expand, 
fill, pad, packtype);


status_set_default (app);
gtk_box_pack_end (GTK_BOX (vbox), app->statusbar, FALSE, FALSE, 0);

However, there is no change in the statusbar display. What say the 
experts? What part of the object hierarchy am I missing/screwing up? 
Thanks.


p.s. sorry if you get 2 copies, the first went to the 'requests' list 
by mistake.




___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Howto set horiz space/padding between vbox and statusbar?

2015-12-07 Thread David C. Rankin

All,

  I have been pulling my hair out trying to tweak the padding between a GtkVBox 
and a GtkStatusbar. I have the following main window layout:


  main window
  vbox = gtk_vbox_new (FALSE, 0);
  menubar
  scrolled-window
  textview
  statusbar

The problem is the scrolled-window and textview widgets provide a nice 10 pixel 
border created with:


gtk_text_view_set_left_margin (GTK_TEXT_VIEW (app->view), 5);
...
gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 5);

The statusbar however, is positioned snugly against the left border of the main 
window and vbox at the bottom. I would like to move the statusbar display to the 
right (pad it on the left) by 10 pixels to match the textview.


I have tried adjusting the padding with the following:

/* create/pack statusbar at end */
app->statusbar = gtk_statusbar_new ();

gboolean expand = 0;
gboolean fill = 0;
guint pad = 0;
GtkPackType packtype = 0;

gtk_box_query_child_packing (GTK_BOX (vbox), app->statusbar, &expand, 
&fill, &pad, &packtype);

pad += 10;
gtk_box_set_child_packing (GTK_BOX (vbox), app->statusbar, expand, fill, 
pad, packtype);


status_set_default (app);
gtk_box_pack_end (GTK_BOX (vbox), app->statusbar, FALSE, FALSE, 0);

However, there is no change in the statusbar display. What say the experts? What 
part of the object hierarchy am I missing/screwing up? Thanks.


p.s. sorry if you get 2 copies, the first went to the 'requests' list by 
mistake.

--
David C. Rankin, J.D.,P.E.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list