AG_Fixed — agar
fixed-position container widget
#include <agar/core.h>
#include <agar/gui.h>
The AG_Fixed container widget positions
and sizes its children at constant positions specified in pixels.
AG_Fixed *
AG_FixedNew(AG_Widget
*parent, Uint
flags);
void
AG_FixedSetStyle(AG_Fixed
*fixed, enum
ag_fixed_style style);
void
AG_FixedSizeHint(AG_Fixed
*fixed, int w,
int h);
The
AG_FixedNew()
function allocates, initializes, and attaches a new
AG_Fixed widget. Accepted
flags options include:
- AG_FIXED_NO_UPDATE
- Don't automatically call
AG_WidgetUpdate(3)
whenever widgets are repositioned. This allows the caller to, as an
optimization use
AG_WidgetUpdate(3)
only once after all widgets have been positioned.
- AG_FIXED_HFILL
- Expand horizontally in parent container.
- AG_FIXED_VFILL
- Expand vertically in parent container.
- AG_FIXED_EXPAND
- Shorthand for
AG_FIXED_HFILL |
AG_FIXED_VFILL.
AG_FixedSetStyle()
selects an alternate background and border style:
AG_FIXED_STYLE_NONE
- No background.
AG_FIXED_STYLE_BOX
- Raised box & border.
AG_FIXED_STYLE_WELL
- 3D well & border (the default).
AG_FIXED_STYLE_PLAIN
- Filled rectangle.
Visible background styles use the style attributes
"background-color", "low-color" and
"high-color".
AG_FixedSizeHint()
requests an initial size of w by
h pixels.
void
AG_FixedPut(AG_Fixed
*fixed, AG_Widget
*child, int x,
int y);
void
AG_FixedDel(AG_Fixed
*fixed, AG_Widget
*child);
void
AG_FixedSize(AG_Fixed
*fixed, AG_Widget
*child, int width,
int height);
void
AG_FixedMove(AG_Fixed
*fixed, AG_Widget
*child, int new_x,
int new_y);
The
AG_FixedPut()
function attaches the widget child and positions it at
the given coordinates. AG_FixedDel() detaches the
given widget.
Alternatively, you can avoid
AG_FixedPut()
and AG_FixedDel() altogether and instead use
AG_ObjectAttach(3)
and
AG_ObjectDetach(3)
followed by calls to AG_FixedSize() and
AG_FixedMove().
Functions
AG_FixedSize()
and AG_FixedMove() set the size and location of a
given widget in pixels.
The AG_Fixed widget does not generate any
event.
For the AG_Fixed object:
- enum ag_fixed_style style
- Background style (see
AG_FixedSetStyle()).
See tests/fixedres.c in the Agar source
distribution.
The AG_Fixed widget first appeared in Agar
1.0. In Agar 1.6.0 the former AG_FIXED_BOX,
AG_FIXED_INVBOX,
AG_FIXED_FRAME and
AG_FIXED_FILLBG flags were replaced by the
AG_FixedSetStyle() and the
style parameter.
AG_FixedSizeHint() appeared in Agar 1.6.0.