Gtk2::Ex::Dialogs - Useful tools for Gnome2/Gtk2 Perl GUI design.
use Gtk2::Ex::Dialogs ( destroy_with_parent => TRUE, modal => TRUE, no_separator => FALSE ); # do some stuff like creating your app's main $window then, # to ensure that all messages use the right parent, set it: Gtk2::Ex::Dialogs->set_parent_window( $window ); # now popup a new dialog my $r = ask Gtk2::Ex::Dialogs::Question ( "Is Perl only hacker's glue?" ); if ( $r ) { # end-user thinks so } else { # end-user does not think so } # now popup a new dialog ( blocking the main loop if there is one ) new_and_run Gtk2::Ex::Dialogs::Message ( title => "Dialog Title", text => "This is a simple message" ); # now popup a new dialog ( blocking the main loop if there is one ) new_and_run Gtk2::Ex::Dialogs::ErrorMsg ( "Simple error message." );
This module provides the Gtk2::Ex::Dialogs::Message, Gtk2::Ex::Dialogs::ErrorMsg and Gtk2::Ex::Dialogs::Question classes to the main application while setting the initial defaults to those specified upon using Gtk2::Ex::Dialogs.
Gtk2::Ex::Dialogs supports the following options:
The title of the dialog window. Defaults to an empty string.
The text to be displayed. This is the core purpose of the module and is the only mandatory argument.
The dialog-sized image to place to the left of the text. Note: there are five aliased stock-ids which correspond to the five gtk-dialog-* ids, "warning", "question", "info", "error" and "authentication". Defaults to the stock-id "gtk-dialog-question".
Reference to the main application window.
When the parent_window is destroyed, what do we do? Defaults to FALSE.
Does this message make the parent_window freeze while the message exists. Defaults to FALSE.
Draw the horizontal separator between the content area and the button area below. Defaults to FALSE.
Autofocus on the "YES" button. Defaults to FALSE.
The end-user must supply a path to an existing file or directory. Should the end-user provide a non-existant path, the dialog will be respawned until an existing file is chosen. Defaults to FALSE.
This module provides a "set_" function for all options that takes a signle argument that is then used as the default for all three modules Gtk2::Ex::Dialogs::Message, Gtk2::Ex::Dialogs::ErrorMsg and Gtk2::Ex::Dialogs::Question. For clarity, the function names are as follows:
Gtk2::Dialog Gtk2::MessageDialog Gtk2::Ex::Dialogs::ChooseDirectory Gtk2::Ex::Dialogs::ChooseFile Gtk2::Ex::Dialogs::ChoosePreviewFile Gtk2::Ex::Dialogs::Message Gtk2::Ex::Dialogs::ErrorMsg Gtk2::Ex::Dialogs::Question
Please report any bugs to the mailing list.
http://odsgnulinux.com/lists/gtk2-ex-list gtk2-ex-list@odsgnulinux.com
Kevin C. Krinke, <kckrinke@opendoorsoftware.com> James Greenhalgh, <jgreenhalgh@opendoorsoftware.com>
Gtk2::Ex::Dialogs - Useful tools for Gnome2/Gtk2 Perl GUI design. Copyright (C) 2005 Open Door Software Inc. <ods@opendoorsoftware.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
To install Gtk2::Ex::Dialogs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2::Ex::Dialogs
CPAN shell
perl -MCPAN -e shell install Gtk2::Ex::Dialogs
For more information on module installation, please visit the detailed CPAN module installation guide.