AG_Icon
— agar
icon widget
#include <agar/core.h>
#include <agar/gui.h>
The AG_Icon
widget is a simple icon
suitable for drag-and-drop. It is commonly used with
AG_Socket(3).
AG_Icon *
AG_IconNew
(void
*parent, Uint
flags);
AG_Icon *
AG_IconFromSurface
(AG_Surface
*s);
AG_Icon *
AG_IconFromBMP
(const
char *filename);
void
AG_IconSetPadding
(AG_Icon
*icon, int left,
int right,
int top,
int bottom);
void
AG_IconSetSurface
(AG_Icon
*icon, AG_Surface
*s);
void
AG_IconSetSurfaceNODUP
(AG_Icon
*icon, AG_Surface
*s);
void
AG_IconSetText
(AG_Icon
*icon, const char
*format, ...);
void
AG_IconSetTextS
(AG_Icon
*icon, const char
*label);
void
AG_IconSetBackgroundFill
(AG_Icon
*icon, int enable,
const AG_Color *c);
The
AG_IconNew
()
function allocates, initializes, and attaches a new
AG_Icon
widget without any associated surface. There
are currently no flags options defined.
The
AG_IconFromSurface
()
variant also assigns a surface s, and
AG_IconFromBMP
() loads the surface from a bitmap
file.
AG_IconSetPadding
()
sets the padding around the surface in pixels.
AG_IconSetSurface
()
changes the surface associated with an icon. The
AG_IconSetSurfaceNODUP
() variant does not create a
copy of the surface.
AG_IconSetText
()
arranges for the specified text string to be displayed under the icon.
AG_IconSetBackgroundFill
()
enables or disables background color fill.
The AG_Icon
widget does not generate any
event.
See tests/sockets.c in the Agar source
distribution.
The AG_Icon
widget first appeared in Agar
1.3.4.