AG_PANE(3)

NAME
AG_Pane - agar paned container widget

SYNOPSIS

    #include <agar/core.h>
    #include <agar/gui.h>

DESCRIPTION
The AG_Pane container divides its allocated space into two partitions (general-purpose AG_Box(3) containers), horizontally or vertically.

INHERITANCE HIERARCHY
AG_Object(3) -> AG_Widget(3) -> AG_Pane.

INITIALIZATION
AG_Pane * AG_PaneNewHoriz(AG_Widget *parent, Uint flags)

AG_Pane * AG_PaneNewVert(AG_Widget *parent, Uint flags)

void AG_PaneAttachBox(AG_Pane *pane, int which, AG_Box *box)

void AG_PaneAttachBoxes(AG_Pane *pane, AG_Box *box1, AG_Box *box2)

void AG_PaneSetDividerWidth(AG_Pane *pane, int pixels)

void AG_PaneSetDivisionMin(AG_Pane *pane, int which, int min_w, int min_h)

int AG_PaneMoveDivider(AG_Pane *pane, int x)

int AG_PaneMoveDividerPct(AG_Pane *pane, int pct)

void AG_PaneResizeAction(AG_Pane *pane, enum ag_pane_resize_action resizeAction)

The AG_PaneNewHoriz() and AG_PaneNewVert() functions allocate, initialize, and attach a new AG_Pane container, dividing space in the specified orientation.

Acceptable flags include:

AG_PANE_DIV1FILL
    By default, the size of the first (left or top) division is computed from its child widgets, and the second division is sized to use the remaining space. This flag arranges for the first division to be sized from the remaining space instead.

AG_PANE_FRAME
    Render decorative frames.

AG_PANE_UNMOVABLE
    Do not allow the user to move the divider.

AG_PANE_HFILL
    Expand horizontally in parent (equivalent to invoking AG_ExpandHoriz(3)).

AG_PANE_VFILL
    Expand vertically in parent (equivalent to invoking AG_ExpandVert(3)).

AG_PANE_EXPAND
    Shorthand for AG_PANE_HFILL|AG_PANE_VFILL.

If AG_PANE_FRAME is set, the depth of the frame can be adjusted by invoking AG_BoxSetDepth(3) on the partitions.

By default, the two AG_Box(3) sub-containers of AG_Pane are created automatically. AG_PaneAttachBox() allows existing boxes to be attached and re-used. which must be 0 or 1. AG_PaneAttachBoxes() is a variant that accepts two box arguments.

AG_PaneSetDividerWidth() sets the width of the divider widget in pixels. If an argument of 0 is given, no divider is drawn.

By default, the user is allowed to move the separator such that one of the two partitions can be shrunk to zero. AG_PaneSetDivisionMin() prevents this by setting a minimal geometry in pixels for the given partition which (which must be either 0 or 1). If the value -1 is given, no minimum is set.

The separator can also be moved programmatically with the AG_PaneMoveDivider() function. AG_PaneMoveDivider() tries to move the divider to the specified position x (in pixels) and returns the actual new position. Note that AG_PaneMoveDivider() will not have any effect if any of the AG_PANE_FORCE_* options are set.

The AG_PaneMoveDividerPct() variant accepts an argument in % of total available size. If AG_PaneResizeAction() is used with AG_PANE_DIVIDE_PCT, this percentage is preserved through resizing.

AG_PaneResizeAction() specifies the behavior of AG_Pane following a resize of the parent container widget. Possible arguments include:

AG_PANE_EXPAND_DIV1
    Expand or shrink the left/upper division (default).
AG_PANE_EXPAND_DIV2
    Expand or shrink the right/lower division.
AG_PANE_DIVIDE_EVEN
    Divide the space evenly in two.
AG_PANE_DIVIDE_PCT
    Divide the space by the percentage value specified in AG_PaneMoveDividerPct().

EVENTS
The AG_Pane widget does not generate any event.

STRUCTURE DATA
For the AG_Pane object:

AG_Box *div[2]
    Division containers (assuming that AG_PaneAttachBox() was not used).

int dmoving
    Divider is currently being moved by the user (read-only).

int dx
    Actual divider position (read-only)

EXAMPLES
The following code fragment displays two expanded, multi-line AG_Textbox(3) widgets, separated horizontally by a AG_Pane.

    AG_Window *win;
    AG_Pane *pane;
    AG_Textbox *textbox[2];
    win = AG_WindowNew(0);
    pane = AG_PaneNewVert(win, AG_PANE_EXPAND);
    textbox[0] = AG_TextboxNew(pane->div[0],
        AG_TEXTBOX_MULTILINE|AG_TEXTBOX_EXPAND,
        NULL);
    textbox[1] = AG_TextboxNew(pane->div[1],
        AG_TEXTBOX_MULTILINE|AG_TEXTBOX_EXPAND,
        NULL);
    AG_PaneMoveDividerPct(pane, 50);
    AG_WindowShow(win);

SEE ALSO
AG_Box(3), AG_Intro(3), AG_MPane(3), AG_Widget(3), AG_Window(3)

HISTORY
The AG_Pane widget first appeared in Agar 1.0.