diff options
author | Angelo Naselli <anaselli@linux.it> | 2014-12-09 12:08:06 +0100 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2014-12-09 12:08:06 +0100 |
commit | 4442bfd562ddf0a525daa6aef3e3873ecae88165 (patch) | |
tree | 570d4eac90adfe26e5fc93e2a8b2b45886dbe1be /lib/AdminPanel/Category.pm | |
parent | 31f2f8882d59a3593507efafe6389428bb042eb8 (diff) | |
download | manatools-4442bfd562ddf0a525daa6aef3e3873ecae88165.tar manatools-4442bfd562ddf0a525daa6aef3e3873ecae88165.tar.gz manatools-4442bfd562ddf0a525daa6aef3e3873ecae88165.tar.bz2 manatools-4442bfd562ddf0a525daa6aef3e3873ecae88165.tar.xz manatools-4442bfd562ddf0a525daa6aef3e3873ecae88165.zip |
Given a better mpan layout
Diffstat (limited to 'lib/AdminPanel/Category.pm')
-rw-r--r-- | lib/AdminPanel/Category.pm | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/lib/AdminPanel/Category.pm b/lib/AdminPanel/Category.pm index 63c23b1f..5448f1a3 100644 --- a/lib/AdminPanel/Category.pm +++ b/lib/AdminPanel/Category.pm @@ -132,13 +132,13 @@ sub moduleLoaded { return $present; } - foreach my $mod (@{$self->{modules}}) { + foreach my $mod (@{$self->{modules}}) { if (exists $params{-CLASS} && ref($mod) eq $params{-CLASS}) { - $present = 1; + $present = 1; last; } elsif ($mod->{name} eq $module_name) { - $present = 1; + $present = 1; last; } } @@ -159,33 +159,38 @@ sub moduleLoaded { =head3 DESCRIPTION Creates and adds buttons for each module_name - + =cut #============================================================= sub addButtons { my($self, $panel, $factory) = @_; - my $count = 0; my $tmpButton; my $currLayout = 0; - $factory->createVSpacing($panel, 2); + my %weights = (); + my $curr; + my $count = 0; foreach my $mod (@{$self->{modules}}) { if(($count % 2) != 1) { + $factory->createVSpacing($panel, 0.5); $currLayout = $factory->createHBox($panel); - $factory->createHStretch($currLayout); + $factory->createHSpacing($currLayout, 1); + $currLayout->setWeight($yui::YD_VERT, 10); } + + $tmpButton = $factory->createPushButton( + $currLayout, + $mod->name + ); $count++; - $tmpButton = $factory->createPushButton($currLayout, - $mod->name); + if (($count < scalar @{$self->{modules}}) || (($count >= scalar @{$self->{modules}}) && ($count % 2) == 0)) { + $tmpButton->setWeight($yui::YD_HORIZ, 20); + } + $factory->createHSpacing($currLayout, 1); $mod->setButton($tmpButton); $tmpButton->setLabel($mod->name); $tmpButton->setIcon($mod->icon); - $factory->createHStretch($currLayout); - if(($count % 2) != 1) { - $factory->createVSpacing($panel, 2); - } } - $factory->createVStretch($panel); } #============================================================= @@ -194,11 +199,11 @@ sub addButtons { =head3 INPUT -$self: this object + $self: this object =head3 DESCRIPTION -Delete the module buttons + Delete the module buttons =cut @@ -233,17 +238,17 @@ sub setIcon { } 1; -__END__ +__END__ =pod =head1 NAME - Category - add new category to window + Category - add new category to window =head1 SYNOPSIS - - $category = new Category('Category Name'); + + $category = new Category('Category Name'); =head1 USAGE |