Note: The Agar manual pages follow certain conventions, notably
concerning function return values. Please read
AG_Intro(3)
first.
SYNOPSIS
#include <agar/core.h>
#include <agar/gui.h>
|
DESCRIPTION
|
The
AG_Console widget displays a set of messages in log format, where a number of
attributes may be associated with individual messages.
The display is automatically scrolled to display new messages.
|
INHERITANCE HIERARCHY
INITIALIZATION
AG_Console * AG_ConsoleNew (AG_Widget *parent, Uint flags)
void AG_ConsoleSetPadding (AG_Console *cons, int padding)
void AG_ConsoleSetFont (AG_Console *cons, AG_Font *font)
|
The
AG_ConsoleNew() function allocates, initializes, and attaches a new
AG_Console widget.
Acceptable
flags include:
| AG_CONSOLE_HFILL | Expand horizontally in parent (equivalent to invoking
AG_ExpandHoriz(3)). | | AG_CONSOLE_VFILL | Expand vertically in parent (equivalent to invoking
AG_ExpandVert(3)). | | AG_CONSOLE_EXPAND | Shorthand for
AG_CONSOLE_HFILL|AG_CONSOLE_VFILL. |
The
AG_ConsoleSetPadding() function sets the padding around messages in pixels.
AG_ConsoleSetFont() configures an alternate font for the
AG_Console messages (see
AG_FetchFont(3)). |
MESSAGES
AG_ConsoleLine * AG_ConsoleMsg (AG_Console *cons, const char *format, ...)
AG_ConsoleLine * AG_ConsoleMsgS (AG_Console *cons, const char *text)
void AG_ConsoleMsgPtr (AG_ConsoleLine *line, void *ptr)
void AG_ConsoleMsgIcon (AG_ConsoleLine *line, int surface)
void AG_ConsoleClear (AG_Console *cons)
|
The
AG_ConsoleMsg() function appends a new message to the console log and returns a pointer to
the newly created
AG_ConsoleLine structure, useful for tweaking attributes specific to the message.
The
AG_ConsoleMsgS() variant accepts a plain C string.
Either function may fail and return NULL if there is insufficient memory
for the new message.
As a special case, if a
cons argument of NULL is passed to
AG_ConsoleMsg() or
AG_ConsoleMsgS(), the function prints the message with
AG_Verbose(3) before returning NULL.
AG_ConsoleMsgPtr() associates an arbitrary user pointer with the given line entry.
AG_ConsoleMsgIcon() sets an icon to display left of the message
(see
AG_IconMgr(3)).
AG_ConsoleClear() removes all entries.
|
EVENTS
The
AG_Console widget reacts to the following events:
| mouse-motion | | | mouse-button-up | | | mouse-button-down | | | key-up | | | key-down | Scroll display.
|
The
AG_Console widget does not generate any event.
|
STRUCTURE DATA
For the
AG_Console object:
| AG_Mutex lock | Lock on buffer contents.
| | AG_ConsoleLine *lines | Lines in buffer.
| | Uint nLines | Line count.
|
For the
AG_ConsoleLine structure:
| char *text | Text string.
| | size_t len | Length of string, not including NUL.
| | int selected | Line selection flag.
| | int icon | Icon surface to display.
| | AG_Font *font | Alternate font (if NULL, the default font is used).
If calling
AG_ConsoleSetFont() is not convenient, it is legal to modify this pointer at run time (but
due to caching, only newly entered lines will use the new font).
| | Uint32 cFg | Foreground color (in
agDisplayFmt format).
| | Uint32 cBg | Background color (in
agDisplayFmt format).
| | void *p | User pointer
|
|
SEE ALSO
HISTORY
|
The
AG_Console widget first appeared in
Agar 1.3.
|