|
NAMEGtk2::Ex::FormFactory::Table - Complex table layouts made easySYNOPSISGtk2::Ex::FormFactory::Table->new ( layout => "+-------%------+>>>>>>>>>>>>>>>+ | Name | | +--------------~ Image | | Keywords | | +-------+------+[--------------+ ^ ' More | Something | ^ | +-----+--------]+ _ Notes | | | Foo | +-------+------+-----+---------+ ^ Bar | Baz | +--------------+---------------+", content => [ Gtk2::Ex::FormFactory::Entry->new ( ... ), Gtk2::Ex::FormFactory::Image->new ( ... ), Gtk2::Ex::FormFactory::Entry->new ( ... ), ... ], ... Gtk2::Ex::FormFactory::Container attributes Gtk2::Ex::FormFactory::Widget attributes ); DESCRIPTIONThis module implements a simple way of defining complex table layouts inside a Gtk2::Ex::FormFactory environment.OBJECT HIERARCHYGtk2::Ex::FormFactory::Intro Gtk2::Ex::FormFactory::Widget +--- Gtk2::Ex::FormFactory::Container +--- Gtk2::Ex::FormFactory::Table Gtk2::Ex::FormFactory::Layout Gtk2::Ex::FormFactory::Rules Gtk2::Ex::FormFactory::Context Gtk2::Ex::FormFactory::Proxy LAYOUT DEFINITIONTake a look at the example in the SYNPOSIS. You see, you simply draw the layout of your table. But how does this work exactly?Each table is based on a straight two dimensional grid, no matter how complicated the cells span over one or more rows or columns. You see the grid when you extend all lines (horizontal and vertical) up to the borders of the table. The following graphic shows the grid by marking the imaginary lines with · characters: +-------+------+>>>>>+>>>>>+ | Name · | Img · | +-------+------+·····+·····| | Keyw · | · | +-------+------+-----+-----+ ^ Notes | More | Som · | ^·······|····· +-----+-----+ ^ | | | Foo | +-------+------+-----+-----+ ^ Bar · | Baz · | +-------+------+-----+-----+ All cells of the table are attached to this grid. Gtk2::Ex::FormFactory::Table distinguishes empty and non empty cells. If only whitespace is inside the cell, it's empty, otherwise it has a widget inside. Since Gtk2::Ex::FormFactory::Table is a Gtk2::Ex::FormFactory::Container it has a simple list of widgets as children. So how are these widgets assigned to the cells of the table? Short answer: from left/top to the right/bottom. Gtk2::Ex::FormFactory::Table scans your layout drawing in this direction and once it sees a new cell, it's counted as the next child of the table. Our example has this child order: +--------------+>>>>>>>>>>>+ | 1 | 2 | +--------------+ | | 3 | | +-------+------+-----------+ ^ 4 | 5 | 6 | ^ | +-----+>>>>>+ ^ | | | 7 | +-------+------+-----+-----+ ^ 8 | 9 | +--------------+-----------+ So the content attribute of this table must list exactly nine widgets, otherwise you would get a runtime exception, when it comes to building the table. Ok, now it's clear how the table cells are attached to the grid of the table. But what about the size of the cells resp. their widgets and the alignment of widgets inside their cells? This answer is about funny characters ;) Cell / Widget expansionBy default all cells and their widgets doesn't expand if the table expands. But you recognized the > and ^ characters? They say, that the cell and its widget should both resize with the table, by allocating all space available (> for horizontal expansion and ^ for vertical). If you want to resize just the cell, but not its widget, refer to the next chapter about widget alignments.In our example cell 2, 7 and 9 resize horizontal with the table, cell 4, 5, 6, 7, 8 and 9 vertical. Cell 1 and 3 don't resize at all, they fill the cell but stay at the cell's size, no matter how the table resizes. Widget alignmentBy default widgets fill their cell completely. If the cell expands the widgets expands as well. But you may want to align the widget on the left or right side, or in the middle, resp. at the top and the bottom. Once you define an alignment, the widget doesn't fill the cell anymore. Again there are some funny characters defining the alignment.For horizontal alignments the characters must be used in the top border of the cell. For vertical alignment it needs to be the left border of the cell. Horinzontal alignment is controlled with these characters: [ left, ] right and % middle. Vertical alignment is controlled with these characters: ' top, _ bottom and ~ middle. In the SYNPOSIS example "Image" is attached in the middle (vertical), "Notes" at the bottom and "More" at the top. "Something" is attached left, "Foo" right and "Name" centered (horizontal). Complete list of special charactersThis is the complete list of recognized characters and their meaning:
NotesSome additional notes about the layout definition string.
ATTRIBUTESAttributes 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.
For more attributes refer to Gtk2::Ex::FormFactory::Container. AUTHORSJörn Reder <joern at zyn dot de> COPYRIGHT AND LICENSECopyright 2004-2006 by Jörn 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. POD ERRORSHey! The above document had some coding errors, which are explained below:
Visit the GSP FreeBSD Man Page Interface. |