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.
This commit is contained in:
parent
e075ab006e
commit
6efa623401
|
@ -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 ) ;
|
||||
|
|
Loading…
Reference in New Issue