Commit 6efa6234 authored by Curtis Gedak's avatar Curtis Gedak Committed by Mike Fleetwood

Add optional yalign argument to Utils::mk_label() method

As part of the work on bug 652044 - uses deprecated APIs, selectable
vertical alignment was defaulted to ALIGN_CENTER for all labels.  The
relevant commits can be viewed in comment 26 of said bug report.
https://bugzilla.gnome.org/show_bug.cgi?id=652044#c26

For multi-line labels a vertical ALIGN_CENTER value is not
consistently aesthetically pleasing.  This becomes obvious when a
single-line heading label is paired with a multi-line value label.
To improve the aesthetics, a vertical alignment of ALIGN_TOP is
preferred.

Hence re-add the ability to optionally specify a vertical alignment for
labels.  If a yalign value is not specified a default vertical alignment
of ALIGN_CENTER is used.
parent e075ab00
......@@ -162,6 +162,7 @@ public:
, bool use_markup = true
, bool wrap = false
, bool selectable = false
, float yalign = 0.5 /* ALIGN_CENTER */
) ;
static Glib::ustring num_to_str( Sector number ) ;
static Glib::ustring get_color( FILESYSTEM filesystem ) ;
......
......@@ -46,12 +46,15 @@ Gtk::Label * Utils::mk_label( const Glib::ustring & text
, bool use_markup
, bool wrap
, bool selectable
, float yalign
)
{
//xalign 0.0 == Gtk::ALIGN_LEFT (gtkmm <= 2.22)
// == Gtk::ALIGN_START (gtkmm >= 2.24)
//yalign 0.5 == Gtk::ALIGN_CENTER
Gtk::Label * label = manage( new Gtk::Label( text, 0.0, 0.5 ) ) ;
// 0.0 == Gtk::ALIGN_TOP (gtkmm <= 2.22)
// Gtk::ALIGN_START (gtkmm >= 2.24)
Gtk::Label * label = manage( new Gtk::Label( text, 0.0, yalign ) ) ;
label ->set_use_markup( use_markup ) ;
label ->set_line_wrap( wrap ) ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment