Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
AG_STYLESHEET(3)	 BSD Library Functions Manual	      AG_STYLESHEET(3)

     AG_StyleSheet -- agar cascading style sheets

     #include <agar/core.h>
     #include <agar/gui.h>

     The AG_StyleSheet interface allows	Agar GUI style attributes to be	loaded
     from a cascading style sheet.  Agar style sheets use a particular syntax.
     Style sheets contain blocks of attributes which are applicable to spe-
     cific Agar	widget classes (and possibly, specific widget states as	well).
     For example:

     AG_Button {
	     # Set colors for default state
	     color: rgb(125,125,125);
	     text-color: rgb(0,0,0);

	     # Set colors for "disabled" state
	     color#disabled: rgb(200,200,200);
	     text-color#disabled: rgb(125,125,125);

	     # Set colors for mouse hover state
	     color#hover: rgb(200,250,200);
	     text-color#hover: rgb(125,150,125);

     By	default, a widget instance inherits its	style attributes from its par-
     ent.  The syntax allows certain attributes, such as "font-size" and
     "color" to	be specified in	relation to the	parent.	 For example:

	     font-size:	50%;		     # Half of parent font size
	     color: hsv(100%,50%,100%);	     # Half of parent saturation
	     color: hsv(100%,100%,75%);	     # 3/4 of parent value

     The generic AG_Widget class defines the basic attributes "font-family",
     "font-size", "font-weight", "font-style", "color",	"text-color", "line-
     color", "shape-color" and "border-color".	For a full description of
     those attributes, refer to	the "STYLE PROPERTIES" of the AG_Widget(3)
     manual page.  Other Agar widget classes may define	their own style	at-
     tributes (these should be documented under	the "STYLE PROPERTIES" section
     of	the widget's manual page).

     void AG_InitStyleSheet(AG_StyleSheet *ss)

     void AG_DestroyStyleSheet(AG_StyleSheet *css)

     AG_StyleSheet * AG_LoadStyleSheet(AG_StyleSheet *css, const char *path)

     int AG_LookupStyleSheet(AG_StyleSheet *css, void *widget, const char
     *key, char	**rv)

     The AG_InitStyleSheet() function initializes the given AG_StyleSheet as
     an	empty style sheet.  AG_DestroyStyleSheet() releases all	resources al-
     located by	a style	sheet.

     The AG_LoadStyleSheet() function loads a style sheet from path.  On suc-
     cess, a newly allocated AG_StyleSheet is returned.	 If path begins	with a
     "_" character, AG_LoadStyleSheet()	will search for	a statically-compiled
     stylesheet	(i.e., "_agStyleDefault" is always available).

     The AG_LookupStyleSheet() routine searches	the style sheet	for the	speci-
     fied attribute (identified	by key).  If the style sheet defines an	attri-
     bute applicable to	the specified widget instance (the widget argument),
     its value is returned into	rv.

     AG_Intro(3), AG_Widget(3),	AG_Window(3)

     The AG_StyleSheet interface first appeared	in Agar	1.5.0.

BSD				April 12, 2014				   BSD


Want to link to this manual page? Use this URL:

home | help