ManaTools::Shared::GUI::Dialog
NAME
SYNOPSIS
DESCRIPTION
SUPPORT
AUTHOR
COPYRIGHT and LICENSE
FUNCTIONS
NAME
ManaTools::Shared::GUI::Dialog − Class to manage a yui YDumbTab properly
SYNOPSIS
use ManaTools::Shared::GUI::Dialog;
my $dlg = ManaTools::Shared::GUI::Dialog−>new(
dialogType => ManaTools::Shared::GUI::Dialog−>mainDialog, ## or popupDialog
title => “New Title”,
icon => $icon,
optFields => [
ManaTools::Shared::GUI::Dialog−>TimeField,
ManaTools::Shared::GUI::Dialog−>DateField,
ManaTools::Shared::GUI::Dialog−>TabField,
],
buttons => [
ManaTools::Shared::GUI::Dialog−>cancelButton,
ManaTools::Shared::GUI::Dialog−>okButton,
],
event_timeout => 0, # event timeout in msec during the waitForEvent()
layout => sub { my $self = shift; my $layoutstart = shift; my $dlg = $self−>dialog(); my $info = $self−>info(); … $self−>addWidget(’button1’, $button, sub{…}, $backendItem1); },
restoreValues => sub { my $self = shift; $info = {}; …; return $info },
result => sub { my $self = shift; … }, );
my $result = $dlg−>call();
## you should call this from the Module, and not directly from here…
DESCRIPTION
This class wraps the most common dialog functionality
SUPPORT
You can find documentation for this module with the perldoc command:
perldoc ManaTools::Shared::GUI::Dialog
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
module: the parent ManaTools::Module
dialogType: ManaTools::Shared::GUI::Dialog−>mainDialog, or popupDialog
title: a title
icon: an icon
layout: a callback that builds the layout of the dialog
restoreValues: an optional callback that restore the values to an $info HashRef
event_timeout: an optional and rw timeout in msec during the waitForEvent()
needs a ManaTools::Shared::GUI::Event to manage the $yui::YEvent::TimeoutEvent
buttons: an optional hashref containing
ManaTools::Shared::GUI::Dialog−>cancelButton and/or
ManaTools::Shared::GUI::Dialog−>okButton
result: an optional callback for returning a result (mostly for popupDialogs)
DESCRIPTION
new is inherited from Moose, to create a Dialog object
checkFields
INPUT
$self: this object
OUTPUT
returns true or false depending on success
DESCRIPTION
helper function to check if the optional factory has the optFields
getButton
INPUT
$self: this object
$buttonType: a buttonType
OUTPUT
returns the CodeRef associated with the buttonType, or undef
DESCRIPTION
gets the CodeRef associated with a buttontype
addButtons
INPUT
$self: this object
$ylayout: a layout widget to base the buttons on
DESCRIPTION
add buttons to the layout according to $self−>buttons()
multipleChanges
INPUT
$self: this object
DESCRIPTION
Start multiple changes (if required)
recalcLayout
INPUT
$self: this object
$force: bool
DESCRIPTION
Recalculates the layout and ends multiple changes (if required or if forced)
call
INPUT
$self: this object
OUTPUT
the result from the dialog
DESCRIPTION
Creates a dialog (either popup or main) and handles it’s events and resturns the proper result.