From cd375baf24bade48b3444a1e29df886f7f777ca4 Mon Sep 17 00:00:00 2001 From: Maarten Vanraes Date: Sun, 24 Apr 2016 21:26:18 +0200 Subject: Properties GUI helper is better aligned --- lib/ManaTools/Shared/GUI/Properties.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/ManaTools/Shared/GUI/Properties.pm b/lib/ManaTools/Shared/GUI/Properties.pm index ab86f4a7..79278b5a 100644 --- a/lib/ManaTools/Shared/GUI/Properties.pm +++ b/lib/ManaTools/Shared/GUI/Properties.pm @@ -108,6 +108,12 @@ has 'properties' => ( default => undef, ); +has 'labelWeight' => ( + is => 'rw', + isa => 'Int', + default => 25, +); + has 'replacepoint' => ( is => 'ro', isa => 'ManaTools::Shared::GUI::ReplacePoint', @@ -152,13 +158,16 @@ sub refresh { for my $key (sort $properties->properties()) { # $properties->prop($key) my $hbox = $factory->createHBox($vbox); - $factory->createLabel($hbox, $key .': '); + my $align = $factory->createRight($hbox); + my $label = $factory->createLabel($align, $key .': '); + $align->setWeight(0, $self->labelWeight()); my $val = $properties->prop($key); $val = '' if (!defined($val)); $val = '' if (ref($val) ne ''); $val = ''. $val; - $factory->createOutputField($hbox, $val); - $factory->createHStretch($hbox); + my $field = $factory->createOutputField($hbox, $val); + $field->setWeight(0, 100 - $self->labelWeight()); + $factory->createHSpacing($hbox, 3); } } # finished -- cgit v1.2.1