ManaTools::Shared::GUI::ExtWidget
NAME
SYNOPSIS
DESCRIPTION
SUPPORT
SEE ALSO
AUTHOR
COPYRIGHT and LICENSE
FUNCTIONS
NAME
ManaTools::Shared::GUI::ExtWidget − Class to manage a selection widget which has different controls
SYNOPSIS
use ManaTools::Shared::GUI::ExtWidget;
my $extwidget = ManaTools::Shared::GUI::ExtWidget−>new(name => “Selection1”, eventHandler => $dialog, parentWidget => $widget, callback => { my $self = shift; my $yevent = shift; my $backenditem = $_; … });
$extwidget−>addSelectorItem(“Label 1”, $backenditem1, sub {
my ($self, $parent, $backendItem) = @_;
my $dialog = $self−>parentDialog();
my $factory = $dialog−>factory();
my $vbox = $factory−>createVBox($parent);
my $button1 = $self−>addWidget($backendItem−>label() .’_button1’, $factory−>createPushButton(’Button 1’, $vbox), sub {
my $self = shift;
my $yevent = shift;
my $backendItem = shift;
my $selectorWidget = $self−>eventHandler();
…
}, $backendItem);
my $button2 = $self−>addWidget($backendItem−>label() .’_button2’, $factory−>createPushButton(’Button 2’, $vbox), sub {…}, $backendItem);
… }); $extwidget−>addSelectorItem(“Label 2”, $backenditem2, sub { my ($self, $parent, $backendItem) = @_; my $factory = $self−>parentDialog()−>factory(); my $vbox = $factory−>createVBox($parent); … } ); $extwidget−>addSelectorItem(“Label 3”, $backenditem3, sub { my ($self, $parent, $backendItem) = @_; my $factory = $self−>parentDialog()−>factory(); my $vbox = $factory−>createVBox($parent); … } ); $extwidget−>addSelectorItem(“Label 4”, $backenditem4, sub { my ($self, $parent, $backendItem) = @_; my $factory = $self−>parentDialog()−>factory(); my $vbox = $factory−>createVBox($parent); … } ); $extwidget−>finishedSelectorItems();
DESCRIPTION
This class wraps a selector Widget with backend items to handle
SUPPORT
You can find documentation for this module with the perldoc command:
perldoc ManaTools::Shared::GUI::ExtWidget
SEE ALSO
yui::YSelectionWidget
AUTHOR
Maarten Vanraes
COPYRIGHT and LICENSE
Copyright (C) 2015−2017, Maarten Vanraes.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place − Suite 330, Boston, MA 02111−1307, USA
FUNCTIONS
new
INPUT
hash ref containing
name: a name for the widget to add event to the eventHandler
eventHandler: the parent that does eventHandlerRole
parentWidget: the parent widget
callback: optional parameter to execute a callback when an item has changed
DESCRIPTION
new is inherited from Moose, to create a ExtWidget object
_buildSelectorWidget
INPUT
$self: this object
$parentWidget: yui:YWidget as parent
OUTPUT
($selector, $parent): $selector is the YSelectionWidget; $parent is the replacepoint’s parent
DESCRIPTION
builds the selection widget, needs to be overridden in subclasses
_finishSelectorWidget
INPUT
$self: this object
DESCRIPTION
finalizes the selection widget, needs to be overridden in subclasses
buildSelectionWidget
INPUT
$self: this object
DESCRIPTION
builds the selection widget
_selectorItem
INPUT
$self: this object
$yevent: yui::YEvent
OUTPUT
YItem: the selected item
DESCRIPTION
returns the items that is selected when an event fires
processEvent
INPUT
$self: this object
$yevent: yui::YEvent
DESCRIPTION
handles the SelectorWidget events and executes callback if necessary
addSelectorItem
INPUT
$self: this object
$label: a label for the YItem
$backendItem: a backendItem needed to identify and/or handle the event
$buildWidget: a CodeRef to rebuild the widget when required
OUTPUT
the created ManaTools::Shared::GUI::ExtWidget::Item
DESCRIPTION
Creates an item and adds it to the ExtWidget. Internally, it creates a
yui::YItem and adds it to the YItemCollection. If it’s the first item,
mark it as the lastitem.
findSelectorItem
INPUT
$self: this object
$yitem: the YItem to be found
DESCRIPTION
returns a ManaTools::Shared::GUI::ExtWidget::Item that has the YItem
buildSelectorItem
INPUT
$self: this object
$item: the item to be built (child widgets from this SelectorWidget will be recreated inside the associated replacepoint)
DESCRIPTION
builds an item on the internal replace point
clearSelectorItems
INPUT
$self: this object
DESCRIPTION
clears the selectorWidget of items to prepare for re−adding new items, call finishedSelectorItems() afterwards
finishedSelectorItems
INPUT
$self: this object
DESCRIPTION
finalizes the items on the ExtWidget