From 08e8f100571f904266437c801a7570f531458cd9 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Mon, 28 Dec 2015 23:17:45 +0100 Subject: MainDisplay now use Moose and Shared::GUI::Dialog --- lib/ManaTools/Category.pm | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'lib/ManaTools/Category.pm') 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; + } + ); + } } -- cgit v1.2.1