AG_Toolbar *
AG_ToolbarNew
(AG_Widget
*parent, enum
ag_toolbar_type, int
nRows, Uint flags);
void
AG_ToolbarRow
(AG_Toolbar
*toolbar, int
row_name);
AG_Button *
AG_ToolbarButton
(AG_Toolbar
*toolbar, const char
*text, int
enable_default, void
(*fn)(AG_Event *), const
char *fnArgs,
...);
AG_Button *
AG_ToolbarButtonIcon
(AG_Toolbar
*toolbar, AG_Surface
*icon, int
enable_default, void
(*fn)(AG_Event *), const
char *fnArgs,
...);
void
AG_ToolbarSeparator
(AG_Toolbar
*toolbar);
void
AG_ToolbarSelect
(AG_Toolbar
*toolbar, AG_Button
*button);
void
AG_ToolbarDeselect
(AG_Toolbar
*toolbar, AG_Button
*button);
void
AG_ToolbarSelectOnly
(AG_Toolbar
*toolbar, AG_Button
*button);
void
AG_ToolbarSelectAll
(AG_Toolbar
*toolbar);
void
AG_ToolbarDeselectAll
(AG_Toolbar
*toolbar); The AG_ToolbarNew
() function
allocates, initializes, and attaches a new
AG_Toolbar
widget. Acceptable
flags include:
- AG_TOOLBAR_HOMOGENOUS
- Scale the buttons so that they cover the whole toolbar area, instead of
using their preferred sizes.
- AG_TOOLBAR_STICKY
- Buttons should preserve their state, and only one button can be selected
at any given time.
- AG_TOOLBAR_MULTI_STICKY
- Button should preserve their state but multiple buttons can be
selected.
- AG_TOOLBAR_HFILL
- Expand horizontally in parent (equivalent to invoking
AG_ExpandHoriz(3)).
- AG_TOOLBAR_VFILL
- Expand vertically in parent (equivalent to invoking
AG_ExpandVert(3)).
- AG_TOOLBAR_EXPAND
- Shorthand for
AG_TOOLBAR_HFILL|AG_TOOLBAR_VFILL
.
NOTE: It is not necessary to invoke
AG_ExpandHoriz(3)
on horizontal toolbars or
AG_ExpandVert(3)
on vertical toolbars, they are expanded by default.
AG_ToolbarRow
() specifies the row number
for all subsequent operations.
The AG_ToolbarButton
() function creates a
new button displaying the given text and attaches it
to the current row. If the enable_default argument is
1, the button is enabled by default. The arguments fn
and fnArg specify the event handler function (see
AG_Event(3)
for details). The callback function will be invoked whenever the user clicks
on the button.
The AG_ToolbarButtonIcon
() variant creates
a button displaying a given surface instead of a label, usually an icon.
AG_ToolbarSeparator
() creates a separator
of appropriate orientation in the current row.
The functions AG_ToolbarSelect
() and
AG_ToolbarDeselect
() are used to enable or disable a
given button. AG_ToolbarSelectOnly
() enables the
given button, disabling any other button that is currently active.
AG_ToolbarSelectAll
() enables all attached buttons
and AG_ToolbarDeselectAll
() disables all attached
buttons.