1Gtk2::Ex::FormFactory::ULsaeyrouCto(n3t)ributed Perl DocGutmke2n:t:aEtxi:o:nFormFactory::Layout(3)
2
3
4

NAME

6       Gtk2::Ex::FormFactory::Layout - Do layout in a FormFactory framework
7

SYNOPSIS

9         package My::Layout;
10
11         use base qw/Gtk2::Ex::FormFactory::Layout/;
12
13         sub build_form         { ... }
14         sub add_widget_to_form { ... }
15         ...
16
17         package main;
18
19         $ff = Gtk2::Ex::FormFactory->new (
20           layouter => My::Layout->new(),
21           ...
22         );
23

DESCRIPTION

25       This class implements the layout of Containers and their Widgets in a
26       Gtk2::Ex::FormFactory framework. "Layout" means, how are the widgets
27       aligned to each other, how much space is between them, how are titles
28       rendered, how labels, etc.
29
30       The idea behind Gtk2::Ex::FormFactory::Layout is to have a unique point
31       in a GUI application which actually implements these things. The
32       advantage of this approach is obvious: the implementation is very
33       generic and if you want to change layout things you subclass from
34       Gtk2::Ex::FormFactory::Layout and implement your changes there, and not
35       at hundreds of spots distributed over the source code of your
36       application.
37
38       The natural result: a consistent looking GUI.
39

SUBCLASSING

41       As described above implementing your own layout module starts with
42       subclassing from Gtk2::Ex::FormFactory::Layout. To use your layout
43       implementation set an object of your class as layouter in your
44       Gtk2::Ex::FormFactory objects.
45
46       Gtk2::Ex::FormFactory::Layout mainly defines two sorts of methods.
47
48   BUILD METHODS
49       The names of the methods are derived from the Widget's short names
50       (which can be retrieved with $widget->get_type), with a prepended
51       build_, e.g.:
52
53         build_form  ( ... )
54         build_label ( ... )
55         build_table ( ... )
56
57       The method prototype looks like this:
58
59       $layout->build_TYPE ($widget)
60           $widget is the actual Gtk2::Ex::FormFactory::Widget, e.g.
61           Gtk2::Ex::FormFactory::Form for build_form($form).
62
63       The build_TYPE method actually creates the necessary Gtk2 widgets, e.g.
64       a Gtk2::Table for a Gtk2::Ex::FormFactory::Form and adds these to the
65       FormFactory's widget instance using the set_gtk_widget() and
66       set_gtk_parent_widget() methods of Gtk2::Ex::FormFactory::Widget.
67
68       Call $widget->set_gtk_widget($gtk_widget) for the primary Gtk2 widget
69       which directly displays the value in question, e.g. a Gtk2::Entry if
70       you're dealing with a Gtk2::Ex::FormFactory::Entry.
71
72       If you like to do more layout things which require to add the primary
73       Gtk2 widget to a container, e.g. a Gtk2::Frame, you must call
74       $widget->set_gtk_parent_widget($gtk_parent_widget) with the most top
75       level container widget.
76
77       Note: the implemenations of all the FormFactory's widgets expect a
78       specific gtk_widget to be set. If you like to change the primary Gtk
79       widget you need to create your own Gtk2::Ex::FormFactory::Widget for
80       this, because the default implemention most probably won't work with a
81       another Gtk2::Widget.
82
83   ADD...TO... METHODS
84       The second type of methods are so called add-to methods, which place a
85       widget inside a container. The prototye is as follows:
86
87       $layout->add_TYPE_to_TYPE ($widget, $container)
88           $widget is the actual Gtk2::Ex::FormFactory::Widget, e.g.
89           Gtk2::Ex::FormFactory::Form for build_form($form).
90
91       Examples:
92
93         add_form_to_window ( ... )
94         add_table_to_form  ( ... )
95
96       This way you can adjust layout at a very detailed level, but you need
97       not. E.g. the implementation of these methods is most likely the same:
98
99         add_entry_to_form ( ... )
100         add_popup_to_form ( ... )
101
102       because the implemenation mainly depends on the form (the container
103       widget) and not on the widget which is added to the form.
104
105       That's why Gtk2::Ex::FormFactory::Layout knows a default mechanism: if
106       no add-to method is found for a specific widget/container pair, a
107       generic default implementation is used instead. These are named as
108       follows:
109
110         add_widget_to_window ( ... )
111         add_widget_to_form   ( ... )
112         add_widget_to_table  ( ... )
113         add_widget_to_vbox   ( ... )
114         ...
115
116       For a new Container you just need to implement the generic
117       add_widget_to_TYPE method, and everything will work. If you want to
118       slightly modify the implementation for specific child widgets, you
119       implement only the methods for these and you're done.
120
121       For a example for such a specific add-to message refer to
122       add_menu_to_window() which attaches the menu without any space around
123       it. The default of a Gtk2::Ex::FormFactory::Window is to have some
124       spacing, which looks ugly around a menu.
125

OBJECT HIERARCHY

127         Gtk2::Ex::FormFactory::Layout
128

ATTRIBUTES

130       This class has not attributes.
131

AUTHORS

133        Jörn Reder <joern at zyn dot de>
134
136       Copyright 2004-2006 by Jörn Reder.
137
138       This library is free software; you can redistribute it and/or modify it
139       under the terms of the GNU Library General Public License as published
140       by the Free Software Foundation; either version 2.1 of the License, or
141       (at your option) any later version.
142
143       This library is distributed in the hope that it will be useful, but
144       WITHOUT ANY WARRANTY; without even the implied warranty of
145       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
146       Library General Public License for more details.
147
148       You should have received a copy of the GNU Library General Public
149       License along with this library; if not, write to the Free Software
150       Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307
151       USA.
152

POD ERRORS

154       Hey! The above document had some coding errors, which are explained
155       below:
156
157       Around line 1275:
158           Non-ASCII character seen before =encoding in 'Jörn'. Assuming UTF-8
159
160
161
162perl v5.28.1                      2011-08-10  Gtk2::Ex::FormFactory::Layout(3)
Impressum