ManaTools::Shared::GUI

Section: User Contributed Perl Documentation (3)
Updated: 2017-07-06
Page Index
 

NAME

Shared::GUI - Shared graphic routines  

SYNOPSIS

    my $gui = ManaTools::Shared::GUI->new();
    my $yesPressed = $gui->ask_YesOrNo($title, $text);

 

DESCRIPTION

    This module contains a collection of dialogs or widgets that can be used in more
    graphics modules.

 

EXPORT

exported  

SUPPORT

You can find documentation for this module with the perldoc command:

perldoc Shared::GUI  

AUTHOR

Angelo Naselli <anaselli@linux.it>  

COPYRIGHT and LICENSE

Copyright (C) 2014-2016, Angelo Naselli. Copyright (C) 2015-2016, Matteo Pasotti <matteo.pasotti@gmail.com>.

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  

METHODS

 

warningMsgBox

INPUT

    $info: HASH, information to be passed to the dialog.
            title     =>     dialog title
            text      =>     string to be swhon into the dialog
            richtext =>     1 if using rich text

DESCRIPTION

    This function creates an Warning dialog and show the message
    passed as input.

 

infoMsgBox

INPUT

    $info: HASH, information to be passed to the dialog.
                title     =>     dialog title
                text      =>     string to be swhon into the dialog
                richtext =>     1 if using rich text

DESCRIPTION

    This function creates an Info dialog and show the message
    passed as input.

 

msgBox

INPUT

    $info: HASH, information to be passed to the dialog.
                title     =>     dialog title
                text      =>     string to be swhon into the dialog
                richtext =>     1 if using rich text

DESCRIPTION

    This function creates a dialog and show the message passed as input.

 

ask_OkCancel

INPUT

    $info: HASH, information to be passed to the dialog.
                title     =>     dialog title
                text      =>     string to be swhon into the dialog
                richtext =>     1 if using rich text

OUTPUT

    0: Cancel button has been pressed
    1: Ok button has been pressed

DESCRIPTION

    This function create an OK-Cancel dialog with a 'title' and a
    'text' passed as parameters.

 

ask_YesOrNo

INPUT

    $info: HASH, information to be passed to the dialog.
                title     =>     dialog title
                text      =>     string to be swhon into the dialog
                richtext =>     1 if using rich text
                default_button => (optional) 1: "Yes" (any other values "No")

OUTPUT

    0: "No" button has been pressed
    1: "Yes" button has been pressed

DESCRIPTION

    This function create a Yes-No dialog with a 'title' and a
    question 'text' passed as parameters.

 

ask_TwoConfigurableButtons

INPUT

$info: HASH, information to be passed to the dialog.
            title     =>     dialog title
            text      =>     string to be swhon into the dialog
            richtext =>     1 if using rich text
            button_one  => caption for the first button
            button_two  => caption for the second button
            default_button => (optional) 1: ``First button''

OUTPUT

    0: "Button One Caption" button has been pressed
    1: "Button Two Caption" button has been pressed

DESCRIPTION

This function create a two-buttons dialog with a 'title', a question 'text' and a label for each button passed as parameters.  

arrayListToYItemCollection

INPUT

    $listInfo: HASH reference containing
            default_item => Selected item (if any)
            item_list    => ARRAY reference containing the item list

OUTPUT

    $itemList: YItemCollection containing the item list passed

DESCRIPTION

    This method returns a YItemCollection containing the item list passed with default item
    the "default_item"

 

ask_fromList

INPUT

    $info: HASH, information to be passed to the dialog.
                title          =>     dialog title
                header         =>     combobox header
                default_item   =>     selected item if any
                list           =>     item list
                default_button =>     (optional) 1: Select (any other values Cancel)

OUTPUT

    undef:          if Cancel button has been pressed
    selected item:  if Select button has been pressed

DESCRIPTION

    This function create a dialog with a combobox in which to
    choose an item from a given list.

 

ask_multiple_fromList

INPUT

$info: HASH, information to be passed to the dialog.
            title          =>     dialog title
            header         =>     combobox header
            default_item   =>     selected item if any
            list           =>     item list
            default_button =>     (optional) 1: Select (any other values Cancel)

LIST

list is an array of hashes like this

    {
        id => unique identifier for this particular item,
        text => "descriptive text"
        val => reference to the boolean value
    }

OUTPUT

    undef:          if Cancel button has been pressed
    selected items: ArrayRef of the selected ids, if Select button has been pressed

DESCRIPTION

This function create a dialog with variable checkboxes in which to choose the items from a given list.

Warning: to use only for a reduced set of items because of no scroll available  

AboutDialog

INPUT

    $info: HASH containing optional information needed to get info for dialog.
            name        => the application name
            version     =>  the application version
            license     =>  the application license, the short length one (e.g. GPLv2, GPLv3, LGPLv2+, etc)
            authors     =>  the string providing the list of authors; it could be html-formatted
            description =>  the string providing a brief description of the application
            logo        => the string providing the file path for the application logo (high-res image)
            icon        => the string providing the file path for the application icon (low-res image)
            credits     => the application credits, they can be html-formatted
            information => other extra informations, they can be html-formatted
            dialog_mode => 1: classic style dialog, any other as tabbed style dialog

DESCRIPTION

    About dialog implementation, this dialog can be used by
    modules, to show authors, license, credits, etc.

 

hashTreeToYItemCollection

INPUT

    $treeInfo: HASH reference containing
            parent       ==> YItem parent (if not root object)
            collection   ==> YItemCollection (mandatory)
            default_item ==> Selected item (if any)
  default_item_separator ==> If default item is passed and is a path like string
                             the separator is needed to match the selected item, using
                             the full pathname instead leaf (e.g. root/subroot/leaf).
                             Default separator is also needed if '$treeInfo->{icons} entry is passed
                             to match the right icon to set (e.g. using the full pathname).
            hash_tree    ==> HASH reference containing the path tree representation
            icons        ==> HASH reference containing item icons e.g.
                             {
                                 root         => 'root_icon_pathname',
                                 root/subroot => 'root_subroot_icon_pathname',
                                 ....
                             }
                             Do not add it if no icons are wanted.
            default_icon ==> icon pathname to a default icon for all the items that are
                             not into $treeInfo->{icons} or if $treeInfo->{icons} is not
                             defined. Leave undef if no default icon is wanted

DESCRIPTION

    This function add to the given $treeInfo->{collection} new tree items from
    the the given $treeInfo->{hash_tree}

 

ask_fromTreeList

INPUT

    $info: HASH, information to be passed to the dialog.
            title          =>     dialog title
            header         =>     TreeView header
            list           =>     path item list
            min_size       =>     minimum dialog size in the libYUI meaning
                                  HASH {width => w, height => h}
            default_item   =>     selected item if any
            item_separator =>     item separator default "/"
            skip_path      =>     if set item is returned without its original path,
                                  just as a leaf (default use full path)
            any_item_selection => allow to select any item, not just leaves (default just leaves)
            default_button =>     (optional) 1: Select (any other values Cancel)

OUTPUT

    undef:          if Cancel button has been pressed
    selected item:  if Select button has been pressed

DESCRIPTION

    This function create a dialog with a combobox in which to
    choose an item from a given list.

 

select_fromList

INPUT

    $info: HASH, information to be passed to the dialog.
                title  => dialog title
                info_label => optional info text
                header => column header hash reference{
                    text_column  => text column header
                    check_column =>
                }
                list   => item list hash reference
                          containing {
                    text     => item text
                    selected => 0 ur undefined means unchecked
                }

OUTPUT

    selection:  list of selected items

DESCRIPTION

    This function create a dialog cotaining a table with a list of
    items to be checked. The list of the checked items is returned.


 

Index

NAME
SYNOPSIS
DESCRIPTION
EXPORT
SUPPORT
AUTHOR
COPYRIGHT and LICENSE
METHODS
warningMsgBox
infoMsgBox
msgBox
ask_OkCancel
ask_YesOrNo
ask_TwoConfigurableButtons
arrayListToYItemCollection
ask_fromList
ask_multiple_fromList
AboutDialog
hashTreeToYItemCollection
ask_fromTreeList
select_fromList