AG_Window *
AG_WindowNew
(Uint
flags);
AG_Window *
AG_WindowNewNamed
(Uint
flags, const char
*format, ...);
AG_Window *
AG_WindowNewNamedS
(Uint
flags, const char
*name);
AG_Window *
AG_WindowNewSw
(AG_DriverSw
*drv, Uint
flags);
void
AG_WindowSetCaption
(AG_Window
*win, const char
*format, ...);
void
AG_WindowSetCaptionS
(AG_Window
*win, const char
*text);
void
AG_WindowSetIcon
(AG_Window
*win, AG_Surface
*surface);
void
AG_WindowSetIconNODUP
(AG_Window
*win, AG_Surface
*surface);
void
AG_WindowSetCloseAction
(AG_Window
*win, eum
ag_window_close_action action);
void
AG_WindowSetPadding
(AG_Window
*win, int
paddingLeft, int
paddingRight, int
paddingTop, int
paddingBottom);
void
AG_WindowSetSpacing
(AG_Window
*win, int
spacing);
void
AG_WindowSetSideBorders
(AG_Window
*win, int
pixels);
void
AG_WindowSetBottomBorder
(AG_Window
*win, int
pixels);
void
AG_WindowSetPosition
(AG_Window
*win, enum
ag_window_alignment alignment,
int tiling);
void
AG_WindowSetGeometry
(AG_Window
*win, int x,
int y,
int w,
int h);
void
AG_WindowSetGeometryRect
(AG_Window
*win, AG_Rect rect,
int bounded);
void
AG_WindowSetGeometryAligned
(AG_Window
*win, enum
ag_window_alignment alignment,
int w,
int h);
void
AG_WindowSetGeometryAlignedPct
(AG_Window
*win, enum
ag_window_alignment alignment,
int wPct,
int hPct);
void
AG_WindowSetGeometryBounded
(AG_Window
*win, int x,
int y,
int w,
int h);
void
AG_WindowSetGeometryMax
(AG_Window
*win);
void
AG_WindowSetMinSize
(AG_Window
*win, int w,
int h);
void
AG_WindowSetMinSizePct
(AG_Window
*win, int pct);
int
AG_WindowSetOpacity
(AG_Window
*win, float
opacity);
void
AG_WindowSetFadeIn
(AG_Window
*win, float
fadeTime, float
fadeIncr);
void
AG_WindowSetFadeOut
(AG_Window
*win, float
fadeTime, float
fadeIncr);
void
AG_WindowSetZoom
(AG_Window
*win, int
zoomLvl);
void
AG_ZoomIn
(void);
void
AG_ZoomOut
(void);
void
AG_ZoomReset
(void);
void
AG_WindowMaximize
(AG_Window
*win);
void
AG_WindowUnmaximize
(AG_Window
*win);
void
AG_WindowMinimize
(AG_Window
*win);
void
AG_WindowUnminimize
(AG_Window
*win);
void
AG_WindowAttach
(AG_Window
*winParent, AG_Window
*winChld);
void
AG_WindowDetach
(AG_Window
*winParent, AG_Window
*winChld);
void
AG_WindowMakeTransient
(AG_Window
*winParent, AG_Window
*winTrans);
void
AG_WindowPin
(AG_Window
*winParent, AG_Window
*winToPin);
void
AG_WindowUnpin
(AG_Window
*win);
void
AG_WindowUpdate
(AG_Window
*win);
The AG_WindowNew
() function creates a new
Agar window using the default
AG_Driver(3),
returning a pointer to the newly created AG_Window
or NULL on failure. If the default driver is a single-window driver, the new
Agar window is attached to the AG_Driver object. If
the default driver is a multiple-window driver, a new
AG_Driver object instance is created for the new
window. See the FLAGS section below for a
description of the available flags options.
The AG_WindowNewNamed
() variant creates an
Agar window with a unique name identifier. If a window of the same name
exists, AG_WindowNewNamed
() only moves the focus to
that window, and returns NULL. The name may contain any printable character,
except ‘/’.
The AG_WindowNewSw
() variant creates a new
window and attaches it to the specified
AG_DriverSw(3)
object. This function is only useful to applications that wish to use
multiple single-window drivers concurrently.
The AG_WindowSetCaption
() function sets
the text displayed by the titlebar (if there is one). If the string exceeds
AG_LABEL_MAX
bytes in length, it is truncated.
The AG_WindowSetIcon
() function configures
an alternate icon for the window. This icon will be used by Agar's internal
window manager whenever the window is minimized. The given surface will be
duplicated and rescaled if necessary. The
AG_WindowSetIconNODUP
() variant does not duplicate
the provided surface, which must remain valid until the window is
destroyed.
The AG_WindowSetCloseAction
() function
specifies the action to perform when the window is requested to be closed.
Accepted arguments include:
- AG_WINDOW_HIDE
- Hide the window. This is the default action for windows created with
AG_WindowNewNamed
().
- AG_WINDOW_DETACH
- Detach and destroy the window. This is the default action for windows
created with
AG_WindowNew
().
- AG_WINDOW_IGNORE
- Ignore the close request.
To perform a different action, an event handler can be configured
for the ‘window-close’ and ‘window-modal-close’
events (see the EVENTS section).
The AG_WindowSetPadding
() function defines
the space in pixels separating the widgets from the edges of the window.
The AG_WindowSetSpacing
() function defines
the space separating the widgets from each other. The default is 2
pixels.
Note that AG_WindowSetSpacing
() only
affects the widgets which are directly attached to the window. For widgets
that are attached to container widgets, it is the container widgets that
define spacing, as well as other aspects of widget organization. For
instance, the
AG_Box(3)
container widget provides a AG_BoxSetSpacing
()
function .
AG_WindowSetSideBorders
() sets the
thickness of the left and right window borders in pixels.
AG_WindowSetBottomBorder
() sets the thickness of the
bottom border. The exact interpretation of this setting is theme-specific.
The default for side borders is 0 (no side borders). If the
win argument is NULL, the defaults are set.
The AG_WindowSetPosition
() function moves
a window to a standard position, per the specified alignment. Possible
values for the alignment argument are:
AG_WINDOW_TL AG_WINDOW_TC AG_WINDOW_TR
AG_WINDOW_ML AG_WINDOW_MC AG_WINDOW_MR
AG_WINDOW_BL AG_WINDOW_BC AG_WINDOW_BR
The special value AG_WINDOW_ALIGNMENT_NONE
leaves the choice of the initial window position up to the underlying window
manager (possibly Agar itself, or an external window manager).
If the tiling argument is 1, the
AG_WINDOW_TILING
flag is set (see
FLAGS section). With tiling enabled, the
window manager will attempt to avoid overlap between existing windows.
The AG_WindowSetGeometry
() function
moves/resizes a window to the specific position and geometry, given in
pixels. If a value of -1 is passed for w or
h, the window's default (or current) geometry is
preserved.
The AG_WindowSetGeometryRect
() variant of
AG_WindowSetGeometry
() accepts a
AG_Rect(3)
argument. The bounded argument specifies whether the
window should be limited to the available view area.
The AG_WindowSetGeometryAligned
() variant
assigns the window a specific size in pixels and positions it according to
the specified window alignment (see description of
AG_WindowSetPosition
() for the possible values). The
parameters of AG_WindowSetGeometryAlignedPct
() are
given in percentage of current view area instead of pixels. Calling these
functions with an argument of
AG_WINDOW_ALIGNMENT_NONE
is a no-op.
The AG_WindowSetGeometryBounded
() variant
limits the window to the view area (by default, windows can lie outside of
the visible area).
The AG_WindowSetGeometryMax
() variant sets
the geometry to the size of the display (without setting the
AG_WINDOW_MAXIMIZED
flag).
The AG_WindowSetMinSize
() routine sets the
minimum window size in pixels.
AG_WindowSetMinSizePct
() sets the minimum window
size in percentage of the requested (computed) size.
AG_WindowSetOpacity
() configures an
overall per-window opacity (for compositing window managers). The argument
can range from 0.0 (transparent) to 1.0 (opaque).
For windows with the AG_WINDOW_FADEIN
or
AG_WINDOW_FADEOUT
flags,
AG_WindowSetFadeIn
() and
AG_WindowSetFadeOut
() can be used to configure the
fade timing parameters. During fade-in, the window opacity will be
repeatedly incremented by fadeIncr, over a total
period of fadeTime (in seconds).
The AG_WindowSetZoom
() function sets the
zoom level of the window. The AG_ZoomIn
(),
AG_ZoomOut
() and
AG_ZoomReset
() functions set the zoom level for the
currently focused window. It is customary to assign
AG_GlobalKeys(3)
shortcuts to these functions.
AG_WindowMaximize
() and
AG_WindowMinimize
() maximizes and minimizes the
window, respectively. AG_WindowUnmaximize
() and
AG_WindowUnminimize
() does the opposite.
The AG_WindowAttach
() function registers
winChld as a child window dependent of
winParent. Detaching the parent window (using
AG_ObjectDetach(3))
will cause dependent child windows to be detached implicitely. Child windows
also inherit the style properties from their parent. The
AG_WindowDetach
() function detaches the window from
its parent window.
AG_WindowMakeTransient
() registers
winTrans as a dependent and transient window for
winParent. The effects of transient window state are
dependent on the underlying window system and window manager. Under Motif,
transient windows have no titlebar buttons. Under TWM, transient windows are
created without requesting that the user select an initial geometry.
Detaching winParent (using
AG_ObjectDetach(3))
will cause winTrans to be detached implicitely.
The AG_WindowPin
() function
"pins" winToPin to the parent window
winParent. If the parent window is moved, the pinned
window will be displaced along with it.
AG_WindowUnpin
() unpins the given window.
The AG_WindowUpdate
() function updates the
coordinates and geometries of all widgets attached to
win. AG_WindowUpdate
() should
be called following
AG_ObjectAttach(3)
or
AG_ObjectDetach(3)
calls made in event context, or manual modifications of the
x, y, w,
h fields of the AG_Window
structure. Note: In widget implementation code, one should use
AG_WidgetUpdate(3)
instead of this function.