aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ManaTools/Category.pm
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-12-28 23:17:45 +0100
committerAngelo Naselli <anaselli@linux.it>2015-12-28 23:17:45 +0100
commit08e8f100571f904266437c801a7570f531458cd9 (patch)
treed7860fbae982295c0543f3b6d0652779da34a091 /lib/ManaTools/Category.pm
parentaa5f049ffd9d7d94d7034dc30b1e7e04e8d90a59 (diff)
downloadmanatools-08e8f100571f904266437c801a7570f531458cd9.tar
manatools-08e8f100571f904266437c801a7570f531458cd9.tar.gz
manatools-08e8f100571f904266437c801a7570f531458cd9.tar.bz2
manatools-08e8f100571f904266437c801a7570f531458cd9.tar.xz
manatools-08e8f100571f904266437c801a7570f531458cd9.zip
MainDisplay now use Moose and Shared::GUI::Dialog
Diffstat (limited to 'lib/ManaTools/Category.pm')
-rw-r--r--lib/ManaTools/Category.pm25
1 files changed, 20 insertions, 5 deletions
diff --git a/lib/ManaTools/Category.pm b/lib/ManaTools/Category.pm
index 763d9696..8573f611 100644
--- a/lib/ManaTools/Category.pm
+++ b/lib/ManaTools/Category.pm
@@ -196,8 +196,7 @@ sub moduleLoaded {
=head3 INPUT
$self: this object
- $panel: parent panel layout in which to create buttons
- $factory: yui factory
+ $mainDisplay: main dialog
=head3 DESCRIPTION
@@ -207,16 +206,18 @@ sub moduleLoaded {
#=============================================================
sub addButtons {
- my($self, $panel, $factory) = @_;
+ my($self, $mainDisplay) = @_;
my $tmpButton;
my $currLayout = 0;
my %weights = ();
my $curr;
my $count = 0;
+ my $factory = $mainDisplay->factory();
+
foreach my $mod (@{$self->modules()}) {
if(($count % 2) != 1) {
- $factory->createVSpacing($panel, 0.5);
- $currLayout = $factory->createHBox($panel);
+ $factory->createVSpacing($mainDisplay->rightPane(), 0.5);
+ $currLayout = $factory->createHBox($mainDisplay->rightPane());
$factory->createHSpacing($currLayout, 1);
$currLayout->setWeight($yui::YD_VERT, 10);
}
@@ -233,6 +234,20 @@ sub addButtons {
$mod->setButton($tmpButton);
$tmpButton->setLabel($mod->name);
$tmpButton->setIcon($mod->icon);
+ $mainDisplay->mainWin()->addWidget(
+ $mod->name(),
+ $tmpButton, sub {
+ my $event = shift; ## ManaTools::Shared::GUI::Event
+ my $self = $event->parentDialog()->module(); #this object
+ my $mod = $self->_moduleSelected($event->widget());
+ if ($mod) {
+ $self->selectedModule($mod);
+ return 0;
+ }
+ return 1;
+ }
+ );
+
}
}