40.3.2.3. Rozdělení plochy formuláře

40.3.2.3.1. Fox::FXHorizontalFrame
40.3.2.3.2. Fox::FXVerticalFrame
40.3.2.3.3. Fox::FXMatrix

section id="fxruby.layout" xreflabel="Správci rozvržení"

Odkazy a zdroje:

Jednou z důležitých komponenet je správce rozložení plochy formuláře Layout Manager. Ten určuje přesné umístněnní jednotlivých prvků na formuláři podle námi zadaných kritérií. Co to znamená si ukážme na jednotlivých příkladech.

Na výběr máme řadu správců, v krátkosti jsou to

para condition="author" Následující texty jsou převzaty z dokumentace a Layout Managers

Správci rozvržení

Fox::FX4Splitter

The four-way splitter is a layout manager which manages four children like four panes in a window. You can use a four-way splitter for example in a CAD program where you may want to maintain three orthographic views, and one oblique view of a model. The four-way splitter allows interactive repartitioning of the panes by means of moving the central splitter bars. When the four-way splitter is itself resized, each child is proportionally resized, maintaining the same split-percentage.

The four-way splitter is a layout manager which manages four children like four panes in a window. You can use a four-way splitter for example in a CAD program where you may want to maintain three orthographic views, and one oblique view of a model. The four-way splitter allows interactive repartitioning of the panes by means of moving the central splitter bars. When the four-way splitter is itself resized, each child is proportionally resized, maintaining the same split-percentage. The four-way splitter widget sends a SEL_CHANGED to its target during the resizing of the panes; at the end of the resize interaction, it sends a SEL_COMMAND to signify that the resize operation is complete.

Fox::FXGroupBox

An FXGroupBox widget provides a nice raised or sunken border around a group of widgets, providing a visual delineation. Typically, a title is placed over the border to provide some clarification. Radio buttons placed inside a group box automatically assume mutually exclusive behaviour, i.e. at most one radio button will be checked at any one time.

The GroupBox is a layout manager that provides identical layout facilities as the Packer. In addition, the GroupBox draws an attractive border around its contents, and provides an optional caption. Finally, if its children are RadioButtons, it forces at most one of these to be checked.

Fox::FXHorizontalFrame

The HorizontalFrame layout manager packs its children horizontally from left to right (or right to left).

The horizontal frame layout manager widget is used to automatically place child-windows horizontally from left-to-right, or right-to-left, depending on the child windows? layout hints.

Fox::FXMatrix

The FXMatrix layout manager automatically arranges its child windows in rows and columns. If the matrix style is MATRIX_BY_ROWS, then the matrix will have the given number of rows and the number of columns grows as more child windows are added; if the matrix style is MATRIX_BY_COLUMNS, then the number of columns is fixed and the number of rows grows as more children are added. If all children in a row (column) have the LAYOUT_FILL_ROW (LAYOUT_FILL_COLUMN) hint set, then the row (column) will be stretchable as the matrix layout manager itself is resized. If more than one row (column) is stretchable, the space is apportioned to each stretchable row (column) proportionally. Within each cell of the matrix, all other layout hints are observed. For example, a child having LAYOUT_CENTER_Y and LAYOUT_FILL_X hints will be centered in the Y-direction, while being stretched in the X-direction. Empty cells can be obtained by simply placing a borderless FXFrame widget as a space-holder.

The Matrix layout manager arranges its children in rows and columns. An FXMatrix widget can operate in both column-oriented as well as row-oriented mode. Normally, the Matrix layout manager operates row-wise. Based on the number of rows, the Matrix layout determines the width of each column and the height of each row, then arranges the children in the space allotted, observing the child's layout hints as much as possible.

Fox::FXPacker

FXPacker is a layout manager which automatically places child windows inside its area against the left, right, top, or bottom side. Each time a child is placed, the remaining space is decreased by the amount of space taken by the child window. The side against which a child is placed is determined by the LAYOUT_SIDE_TOP, LAYOUT_SIDE_BOTTOM, LAYOUT_SIDE_LEFT, and LAYOUT_SIDE_RIGHT hints given by the child window. Other layout hints from the child are observed as far as sensible. So for example, a child placed against the right edge can still have LAYOUT_FILL_Y or LAYOUT_TOP, and so on. The last child may have both LAYOUT_FILL_X and LAYOUT_FILL_Y, in which case it will be placed to take all remaining space.

The Packer layout widget places its GUI elements in its interior rectangle, placing each child against one of the four sides. As each child is placed, the size of the rectangle is reduced by the space taken up by the child. If a child is placed against the left or right, the interior rectangle's width is reduced; if the child is placed against the top or bottom, the height is reduced. Children may be of any type, including other layout managers.

Fox::FXSplitter

The Splitter layout manager divides some area of the screen horizontally or vertically. The divider bars can be repositioned by the user, so that depending on what the user is doing, he or she may give one or the other partition more screen space.

Splitter window is used to interactively repartition two or more subpanes. Space may be subdivided horizontally or vertically. When the splitter is itself resized, the right-most (bottom-most) child window will be resized unless the splitter window is reversed; if the splitter is reversed, the left-most (top-most) child window will be resized instead. The splitter widget sends a SEL_CHANGED to its target during the resizing of the panes; at the end of the resize interaction, it sends a SEL_COMMAND to signify that the resize operation is complete. Normally, children are resizable from 0 upwards; however, if the child in a horizontally oriented splitter has LAYOUT_FILL_X in combination with LAYOUT_FIX_WIDTH, it will not be made smaller than its default width, except when the child is the last visible widget (or first when the option SPLITTER_REVERSED has been passed to the splitter). In a vertically oriented splitter, children with LAYOUT_FILL_Y and LAYOUT_FIX_HEIGHT behave analogously. These options only affect interactive resizing.

Fox::FXSwitcher

The FXSwitcher layout manager automatically arranges its child windows such that one of them is placed on top; all other child windows are hidden. Switcher provides a convenient method to conserve screen real-estate by arranging several GUI panels to appear in the same space, depending on context. Switcher ignores all layout hints from its children; all children are stretched according to the switcher layout managers own size. When the SWITCHER_HCOLLAPSE or SWITCHER_VCOLLAPSE options are used, the switcher?s default size is based on the width or height of the current child, instead of the maximum width or height of all of the children.

The Switcher layout manager places its children exactly on top of each other; it ignores most of the layout hints provided by each child. You typically use a layout manager like the switcher to save screen real-estate, by placing for example several control panels on top of each other, and bringing the right one on top depending on the context.

Fox::FXTopWindow

TopWindow operates like an FXPacker window. For simple dialogs and toplevel windows, no additional layout managers may be needed in many cases, as the TopWindow's layout characteristics may be sufficient.

Abstract base class for all top-level windows.

Fox::FXVerticalFrame

The VerticalFrame layout manager packs its children vertically, from top to bottom or vice versa. It behaves similar to the HorizontalFrame layout manager.

Vertical frame layout manager widget is used to automatically place child-windows vertically from top-to-bottom, or bottom-to-top, depending on the child window's layout hints.

Licence Creative Commons
Tento dokument Ruby, jehož autorem je Radek Hnilica, podléhá licenci Creative Commons Uveďte autora-Nevyužívejte dílo komerčně-Zachovejte licenci 3.0 Česká republika .