Gtk2::Ex::FormFactory
Makes building complex GUI's easy
- Provided by: libgtk2-ex-formfactory-perl (Version: 0.67-0ubuntu1)
- Source: gtk2-ex-formfactory
- Report a bug
Makes building complex GUI's easy
#-- Refer to http://www.exit1.org/ for
#-- a comprehensive online documentation.
#-- Read Gtk2::Ex::FormFactory::Intro
use Gtk2::Ex::FormFactory;
my $context = Gtk2::Ex::FormFactory::Context->new;
$context->add_object (
name => "worksheet",
object => My::Worksheet->new,
);
# derived from Gtk2::Ex::FormFactory::Layout
my $layouter = My::Layout->new;
# derived from Gtk2::Ex::FormFactory::Rules
my $rule_checker = My::Rules->new;
my $ff = Gtk2::Ex::FormFactory->new (
context => $context,
layouter => $layouter,
rule_checker => $rule_checker,
content => [
Gtk2::Ex::FormFactory::Window->new (
title => "Worksheet Editor",
content => [
Gtk2::Ex::FormFactory::Form->new (
title => "Main data",
content => [
Gtk2::Ex::FormFactory::Entry->new (
label => "Worksheet title",
attr => "worksheet.title",
tip => "Title of this worksheet",
),
#-- More widgets...
],
),
Gtk2::Ex::FormFactory->DialogButtons->new,
],
),
],
);
$ff->open;
$ff->update;
Gtk2->main;
With Gtk2::Ex::FormFactory you can build a GUI which consistently represents the data of your application.
This is a framework which tries to make building complex GUI's easy, by offering these two main features:
* Consistent looking GUI without the need to code resp. tune
each widget by hand. Instead you declare the structure of your
GUI, connect it to the data of your program (which should be
a well defined set of objects) and control how this structure
is transformed into a specific layout in a very generic way.
* Automatically keep widget and object states in sync (in both
directions), even with complex data structures with a lot of
internal dependencies, object nesting etc.
This manpage describes the facilities of Gtk2::Ex::FormFactory objects which are only a small part of the whole framework. To get a full introduction and overview of how this framework works refer to Gtk2::Ex::FormFactory::Intro.
Gtk2::Ex::FormFactory::Widget
+--- Gtk2::Ex::FormFactory::Container
+--- Gtk2::Ex::FormFactory
Attributes are handled through the common get_ATTR(), set_ATTR() style accessors, but they are mostly passed once to the object constructor and must not be altered after the associated FormFactory was built.
If you omit this option in the new() object constructor an empty Context is created which can be accessed with get_context.
If you omit this option in the new() object constructor a default Gtk2::Ex::FormFactory::Layout object is created which can be accessed with get_layouter.
Refer to Gtk2::Ex::FormFactory::Rules for details, if you're interested in writing your own rule checker module.
If you omit this option in the new() object constructor a default Gtk2::Ex::FormFactory::Rules object is created which can be accessed with get_rule_checker.
But note that asynchronous dialogs are static. Dependencies between objects and attributes, which are defined in the associated Gtk2::Ex::FormFactory::Context, don't work on widget/GUI level. That's why automatic dependency resolution / widget updating only works for FormFactory's with sync set to TRUE.
If you set hide you need to call $form_factory->show later, otherwise all widgets will keep invisible.
No object data will be transfered to the GUI, so it will be more or less empty. Call update to put data into the GUI.
Useful only in a FormFactory with sync=FALSE.
Attempt to free unreferenced scalar: SV 0x85d7374
during global destruction.
That's because circular references are necessary between Gtk2 and Gtk2::Ex::FormFactory widgets. These references need first to be deleted until Perl can exit the program cleanly.
message The message resp. question, HTML markup allowed
position Position of the dialog. Defaults to 'center-on-parent'.
Other known values are: 'none', 'center', 'mouse'
and 'center-always'
yes_callback Code reference to be called if the user
answered your question with "Yes"
no_callback Code reference to be called if the user
answered your question with "No"
yes_label (Stock-)Label for the yes button. Default 'gtk-yes'
no_label (Stock-)Label for the no button. Default 'gtk-no'
type Type of the dialog. Defaults to 'info'.
Other known values are: 'warning', 'question' and 'error'
message The message, HTML markup allowed
position Position of the dialog. Defaults to 'center-on-parent'.
Other known values are: 'none', 'center', 'mouse'
and 'center-always'
Joern Reder <joern at zyn dot de>
Copyright 2004-2006 by Joern Reder.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details.
You should have received a copy of the GNU Library 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.