fidel Newbie

Joined: 06 Mar 2010 Posts: 2
|
Posted: Tue Mar 09, 2010 1:19 pm Post subject: [GTK+] How to achieve precise alignment & standard spaci |
|
|
If you put various widgets in a VBox, they don't line up. Some widgets seem to have internal spacing that prevents them from sitting flush on the borders of their containers. For example, buttons have 1 pixel of extra space around them, checkboxes have 2 pixels of extra space, etc.
If a person wanted to follow the GNOME Human Interface Guidelines, and use absolutely precise alignment and standard spacing in multiples of 6 pixels, what would be the cleanest way to do that? At the moment all I can think of is to calculate border widths and spacing using magic numbers that are based either on observed behavior or on reading source files like button.c, checkbutton.c, etc.
If you want to see a quick example of this issue, have a look at the Find dialog in gedit. Things don't line up on either the left or the right margin, the vertical spacing is inconsistent, and the observed space between buttons in the dialog's action area is 2 pixels larger than what the programmer specified.
Ordinarily I wouldn't be so picky, but I'm working on a layout tutorial which was supposed to make gtkmm programming look simple and hack-free. Is there a clean way to work around this?
Thanks.
Last edited by fidel on Thu Mar 11, 2010 1:44 pm; edited 1 time in total |
|
fidel Newbie

Joined: 06 Mar 2010 Posts: 2
|
Posted: Thu Mar 11, 2010 1:43 pm Post subject: |
|
|
| I've concluded that the extra spacing around checkbuttons and buttons is just part of the de facto GNOME style. It's obviously not the same as (cough) Qt or .NET widgets, which align flush by default. But since it traces back to a decision by the GTK+ designers then it's just "the way life should be" in GNOME, sweet GNOME. |
|