diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ManaTools/Shared/GUI/ActionList.pm | 13 | ||||
-rw-r--r-- | lib/ManaTools/Shared/GUI/EventHandlerRole.pm | 2 | ||||
-rw-r--r-- | lib/ManaTools/Shared/GUI/ExtWidget.pm | 10 | ||||
-rw-r--r-- | lib/ManaTools/Shared/GUI/Properties.pm | 13 |
4 files changed, 27 insertions, 11 deletions
diff --git a/lib/ManaTools/Shared/GUI/ActionList.pm b/lib/ManaTools/Shared/GUI/ActionList.pm index 77c2b49e..2c3bba51 100644 --- a/lib/ManaTools/Shared/GUI/ActionList.pm +++ b/lib/ManaTools/Shared/GUI/ActionList.pm @@ -83,9 +83,9 @@ use ManaTools::Shared::GUI::ReplacePoint; #============================================================= -has 'parentDialog' => ( +has 'eventHandler' => ( is => 'ro', - isa => 'ManaTools::Shared::GUI::Dialog', + does => 'ManaTools::Shared::GUI::EventHandlerRole', required => 1, ); @@ -109,7 +109,11 @@ has 'replacepoint' => ( lazy => 1, default => sub { my $self = shift; - my $rpl = ManaTools::Shared::GUI::ReplacePoint->new(eventHandler => $self->parentDialog(), parentWidget => $self->parentWidget()); + my $eventHandler = $self->eventHandler(); + my $dialog = $eventHandler->parentDialog(); + my $factory = $dialog->factory(); + my $rpl = ManaTools::Shared::GUI::ReplacePoint->new(eventHandler => $self->eventHandler(), parentWidget => $self->parentWidget()); + $factory->createVStretch($rpl->container()); $rpl->finished(); return $rpl; }, @@ -132,7 +136,8 @@ has 'replacepoint' => ( #============================================================= sub refresh { my $self = shift; - my $dialog = $self->parentDialog(); + my $eventHandler = $self->eventHandler(); + my $dialog = $eventHandler->parentDialog(); my $factory = $dialog->factory(); my $parentWidget = $self->parentWidget(); my $replacepoint = $self->replacepoint(); diff --git a/lib/ManaTools/Shared/GUI/EventHandlerRole.pm b/lib/ManaTools/Shared/GUI/EventHandlerRole.pm index 09e18e47..515112ec 100644 --- a/lib/ManaTools/Shared/GUI/EventHandlerRole.pm +++ b/lib/ManaTools/Shared/GUI/EventHandlerRole.pm @@ -65,12 +65,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use Moose::Role; +# parent event handler has 'parentEventHandler' => ( is => 'rw', isa => 'Maybe[ManaTools::Shared::GUI::EventHandlerRole]', default => undef, ); +# child event handlers has 'eventHandlers' => ( is => 'ro', isa => 'ArrayRef[ManaTools::Shared::GUI::EventHandlerRole]', diff --git a/lib/ManaTools/Shared/GUI/ExtWidget.pm b/lib/ManaTools/Shared/GUI/ExtWidget.pm index 2c886427..cb8c961e 100644 --- a/lib/ManaTools/Shared/GUI/ExtWidget.pm +++ b/lib/ManaTools/Shared/GUI/ExtWidget.pm @@ -147,6 +147,7 @@ has 'itemEventType' => ( default => $yui::YEvent::MenuEvent, ); +# TODO: eventHandler from event Role should react with replacepoint!!! has 'replacepoint' => ( is => 'rw', isa => 'Maybe[ManaTools::Shared::GUI::ReplacePoint]', @@ -232,9 +233,12 @@ sub buildSelectionWidget { # create a replacepoint on the selectionWidget $self->{replacepoint} = ManaTools::Shared::GUI::ReplacePoint->new(parentWidget => $parentWidget); - # parentEventHandler must be set directly, because we don't add the - # eventHandler to a parentEventHandler, instead the events are processed - # through the selectorWidget's EventRole processEvent function + # because this Event's processEvent also takes care of the replacepoints + # processEvents, it means we cannot set the replacepoint's (being an + # eventHandler) eventHandler -- which would add (next to setting the + # parentEventHandler) the replacepoint as a child, and thus also call + # processEvents from the parent down. Therefor, we'll set the + # parentEventHandler directly, so that any parent referrals still work. $self->{replacepoint}->parentEventHandler($self->{eventHandler}); # don't add any children right away diff --git a/lib/ManaTools/Shared/GUI/Properties.pm b/lib/ManaTools/Shared/GUI/Properties.pm index 79278b5a..3f9aad39 100644 --- a/lib/ManaTools/Shared/GUI/Properties.pm +++ b/lib/ManaTools/Shared/GUI/Properties.pm @@ -87,9 +87,9 @@ use ManaTools::Shared::GUI::ReplacePoint; #============================================================= -has 'parentDialog' => ( +has 'eventHandler' => ( is => 'ro', - isa => 'ManaTools::Shared::GUI::Dialog', + does => 'ManaTools::Shared::GUI::EventHandlerRole', required => 1, ); @@ -121,7 +121,11 @@ has 'replacepoint' => ( lazy => 1, default => sub { my $self = shift; - my $rpl = ManaTools::Shared::GUI::ReplacePoint->new(eventHandler => $self->parentDialog(), parentWidget => $self->parentWidget()); + my $eventHandler = $self->eventHandler(); + my $dialog = $eventHandler->parentDialog(); + my $factory = $dialog->factory(); + my $rpl = ManaTools::Shared::GUI::ReplacePoint->new(eventHandler => $self->eventHandler(), parentWidget => $self->parentWidget()); + $factory->createVStretch($rpl->container()); $rpl->finished(); return $rpl; }, @@ -144,7 +148,8 @@ has 'replacepoint' => ( #============================================================= sub refresh { my $self = shift; - my $dialog = $self->parentDialog(); + my $eventHandler = $self->eventHandler(); + my $dialog = $eventHandler->parentDialog(); my $factory = $dialog->factory(); my $parentWidget = $self->parentWidget(); my $replacepoint = $self->replacepoint(); |