![]() |
![]() |
![]() |
St Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
enum StSide; enum StCorner; enum StTextDecoration; enum StTextAlign; enum StGradientType; StThemeNode * st_theme_node_new (StThemeContext *context
,StThemeNode *parent_node
,StTheme *theme
,GType element_type
,const char *element_id
,const char *element_class
,const char *pseudo_class
,const char *inline_style
); StThemeNode * st_theme_node_get_parent (StThemeNode *node
); StTheme * st_theme_node_get_theme (StThemeNode *node
); gboolean st_theme_node_equal (StThemeNode *node_a
,StThemeNode *node_b
); guint st_theme_node_hash (StThemeNode *node
); GType st_theme_node_get_element_type (StThemeNode *node
); const char * st_theme_node_get_element_id (StThemeNode *node
); GStrv st_theme_node_get_element_classes (StThemeNode *node
); GStrv st_theme_node_get_pseudo_classes (StThemeNode *node
); gboolean st_theme_node_lookup_color (StThemeNode *node
,const char *property_name
,gboolean inherit
,ClutterColor *color
); gboolean st_theme_node_lookup_double (StThemeNode *node
,const char *property_name
,gboolean inherit
,double *value
); gboolean st_theme_node_lookup_length (StThemeNode *node
,const char *property_name
,gboolean inherit
,gdouble *length
); gboolean st_theme_node_lookup_time (StThemeNode *node
,const char *property_name
,gboolean inherit
,gdouble *value
); gboolean st_theme_node_lookup_shadow (StThemeNode *node
,const char *property_name
,gboolean inherit
,StShadow **shadow
); gboolean st_theme_node_lookup_url (StThemeNode *node
,const char *property_name
,gboolean inherit
,char **value
); void st_theme_node_get_color (StThemeNode *node
,const char *property_name
,ClutterColor *color
); gdouble st_theme_node_get_double (StThemeNode *node
,const char *property_name
); gdouble st_theme_node_get_length (StThemeNode *node
,const char *property_name
); StShadow * st_theme_node_get_shadow (StThemeNode *node
,const char *property_name
); char * st_theme_node_get_url (StThemeNode *node
,const char *property_name
); void st_theme_node_get_background_color (StThemeNode *node
,ClutterColor *color
); void st_theme_node_get_foreground_color (StThemeNode *node
,ClutterColor *color
); void st_theme_node_get_background_gradient (StThemeNode *node
,StGradientType *type
,ClutterColor *start
,ClutterColor *end
); const char * st_theme_node_get_background_image (StThemeNode *node
); int st_theme_node_get_border_width (StThemeNode *node
,StSide side
); int st_theme_node_get_border_radius (StThemeNode *node
,StCorner corner
); void st_theme_node_get_border_color (StThemeNode *node
,StSide side
,ClutterColor *color
); int st_theme_node_get_outline_width (StThemeNode *node
); void st_theme_node_get_outline_color (StThemeNode *node
,ClutterColor *color
); double st_theme_node_get_padding (StThemeNode *node
,StSide side
); double st_theme_node_get_horizontal_padding (StThemeNode *node
); double st_theme_node_get_vertical_padding (StThemeNode *node
); int st_theme_node_get_width (StThemeNode *node
); int st_theme_node_get_height (StThemeNode *node
); int st_theme_node_get_min_width (StThemeNode *node
); int st_theme_node_get_min_height (StThemeNode *node
); int st_theme_node_get_max_width (StThemeNode *node
); int st_theme_node_get_max_height (StThemeNode *node
); int st_theme_node_get_transition_duration (StThemeNode *node
); StTextDecoration st_theme_node_get_text_decoration (StThemeNode *node
); StTextAlign st_theme_node_get_text_align (StThemeNode *node
); const PangoFontDescription * st_theme_node_get_font (StThemeNode *node
); StBorderImage * st_theme_node_get_border_image (StThemeNode *node
); StShadow * st_theme_node_get_box_shadow (StThemeNode *node
); StShadow * st_theme_node_get_text_shadow (StThemeNode *node
); StShadow * st_theme_node_get_background_image_shadow (StThemeNode *node
); StIconColors * st_theme_node_get_icon_colors (StThemeNode *node
); void st_theme_node_adjust_for_height (StThemeNode *node
,float *for_height
); void st_theme_node_adjust_preferred_width (StThemeNode *node
,float *min_width_p
,float *natural_width_p
); void st_theme_node_adjust_for_width (StThemeNode *node
,float *for_width
); void st_theme_node_adjust_preferred_height (StThemeNode *node
,float *min_height_p
,float *natural_height_p
); void st_theme_node_get_content_box (StThemeNode *node
,const ClutterActorBox *allocation
,ClutterActorBox *content_box
); void st_theme_node_get_paint_box (StThemeNode *node
,const ClutterActorBox *allocation
,ClutterActorBox *paint_box
); void st_theme_node_get_background_paint_box (StThemeNode *node
,const ClutterActorBox *allocation
,ClutterActorBox *paint_box
); gboolean st_theme_node_geometry_equal (StThemeNode *node
,StThemeNode *other
); gboolean st_theme_node_paint_equal (StThemeNode *node
,StThemeNode *other
); void st_theme_node_paint (StThemeNode *node
,const ClutterActorBox *box
,guint8 paint_opacity
); void st_theme_node_copy_cached_paint_state (StThemeNode *node
,StThemeNode *other
); void st_theme_node_invalidate_paint_state (StThemeNode *node
); StThemeNodeClass; StThemeContext; StTheme; StThemeNode;
"application-stylesheet" gchar* : Read / Write / Construct Only "default-stylesheet" gchar* : Read / Write / Construct Only "theme-stylesheet" gchar* : Read / Write / Construct Only
A StThemeNode represents the CSS style information (the set of CSS properties) for one node in a tree of themed objects. In typical usage, it represents the style information for a single ClutterActor. A StThemeNode is immutable: attributes such as the CSS classes for the node are passed in at construction. If the attributes of the node or any parent node change, the node should be discarded and a new node created. StThemeNode has generic accessors to look up properties by name and specific accessors for standard CSS properties that add caching and handling of various details of the CSS specification. StThemeNode also has convenience functions to help in implementing a ClutterActor with borders and padding.
typedef enum { ST_CORNER_TOPLEFT, ST_CORNER_TOPRIGHT, ST_CORNER_BOTTOMRIGHT, ST_CORNER_BOTTOMLEFT } StCorner;
typedef enum { ST_TEXT_DECORATION_UNDERLINE = 1 << 0, ST_TEXT_DECORATION_OVERLINE = 1 << 1, ST_TEXT_DECORATION_LINE_THROUGH = 1 << 2, ST_TEXT_DECORATION_BLINK = 1 << 3 } StTextDecoration;
typedef enum { ST_TEXT_ALIGN_LEFT = PANGO_ALIGN_LEFT, ST_TEXT_ALIGN_CENTER = PANGO_ALIGN_CENTER, ST_TEXT_ALIGN_RIGHT = PANGO_ALIGN_RIGHT, ST_TEXT_ALIGN_JUSTIFY } StTextAlign;
typedef enum { ST_GRADIENT_NONE, ST_GRADIENT_VERTICAL, ST_GRADIENT_HORIZONTAL, ST_GRADIENT_RADIAL } StGradientType;
StThemeNode * st_theme_node_new (StThemeContext *context
,StThemeNode *parent_node
,StTheme *theme
,GType element_type
,const char *element_id
,const char *element_class
,const char *pseudo_class
,const char *inline_style
);
Creates a new StThemeNode. Once created, a node is immutable. Of any
of the attributes of the node (like the element_class
) change the node
and its child nodes must be destroyed and recreated.
|
the context representing global state for this themed tree |
|
the parent node of this node. [allow-none] |
|
a theme (stylesheet set) that overrides the theme inherited from the parent node. [allow-none] |
|
the type of the GObject represented by this node
in the tree (corresponding to an element if we were theming an XML
document. G_TYPE_NONE means this style was created for the stage
actor and matches a selector element name of 'stage'. |
|
the ID to match CSS rules against. [allow-none] |
|
a whitespace-separated list of classes to match CSS rules against. [allow-none] |
|
a whitespace-separated list of pseudo-classes (like 'hover' or 'visited') to match CSS rules against. [allow-none] |
Returns : |
the theme node. [transfer full] |
StThemeNode * st_theme_node_get_parent (StThemeNode *node
);
Gets the parent themed element node.
|
a StThemeNode |
Returns : |
the parent StThemeNode, or NULL if this
is the root node of the tree of theme elements. [transfer none]
|
StTheme * st_theme_node_get_theme (StThemeNode *node
);
Gets the theme stylesheet set that styles this node
|
a StThemeNode |
Returns : |
the theme stylesheet set. [transfer none] |
gboolean st_theme_node_equal (StThemeNode *node_a
,StThemeNode *node_b
);
Compare two StThemeNodes. Two nodes which compare equal will match
the same CSS rules and have the same style properties. However, two
nodes that have ended up with identical style properties do not
necessarily compare equal.
In detail, node_a
and node_b
are considered equal iff
they share the same StTheme and StThemeContext
they have the same parent
they have the same element type
their id, class, pseudo-class and inline-style match
|
first StThemeNode |
|
second StThemeNode |
Returns : |
TRUE if node_a equals node_b
|
GStrv st_theme_node_get_element_classes (StThemeNode *node
);
Returns : |
the element's classes. [transfer none] |
GStrv st_theme_node_get_pseudo_classes (StThemeNode *node
);
Returns : |
the element's pseudo-classes. [transfer none] |
gboolean st_theme_node_lookup_color (StThemeNode *node
,const char *property_name
,gboolean inherit
,ClutterColor *color
);
Generically looks up a property containing a single color value. When
specific getters (like st_theme_node_get_background_color()
) exist, they
should be used instead. They are cached, so more efficient, and have
handling for shortcut properties and other details of CSS.
See also st_theme_node_get_color()
, which provides a simpler API.
|
a StThemeNode |
|
The name of the color property |
|
if TRUE , if a value is not found for the property on the
node, then it will be looked up on the parent node, and then on the
parent's parent, and so forth. Note that if the property has a
value of 'inherit' it will be inherited even if FALSE is passed
in for inherit ; this only affects the default behavior for inheritance. |
|
location to store the color that was determined. If the property is not found, the value in this location will not be changed. [out caller-allocates] |
Returns : |
TRUE if the property was found in the properties for this
theme node (or in the properties of parent nodes when inheriting.) |
gboolean st_theme_node_lookup_double (StThemeNode *node
,const char *property_name
,gboolean inherit
,double *value
);
Generically looks up a property containing a single numeric value without units.
See also st_theme_node_get_double()
, which provides a simpler API.
|
a StThemeNode |
|
The name of the numeric property |
|
if TRUE , if a value is not found for the property on the
node, then it will be looked up on the parent node, and then on the
parent's parent, and so forth. Note that if the property has a
value of 'inherit' it will be inherited even if FALSE is passed
in for inherit ; this only affects the default behavior for inheritance. |
|
location to store the value that was determined. If the property is not found, the value in this location will not be changed. [out] |
Returns : |
TRUE if the property was found in the properties for this
theme node (or in the properties of parent nodes when inheriting.) |
gboolean st_theme_node_lookup_length (StThemeNode *node
,const char *property_name
,gboolean inherit
,gdouble *length
);
Generically looks up a property containing a single length value. When
specific getters (like st_theme_node_get_border_width()
) exist, they
should be used instead. They are cached, so more efficient, and have
handling for shortcut properties and other details of CSS.
See also st_theme_node_get_length()
, which provides a simpler API.
|
a StThemeNode |
|
The name of the length property |
|
if TRUE , if a value is not found for the property on the
node, then it will be looked up on the parent node, and then on the
parent's parent, and so forth. Note that if the property has a
value of 'inherit' it will be inherited even if FALSE is passed
in for inherit ; this only affects the default behavior for inheritance. |
|
location to store the length that was determined. If the property is not found, the value in this location will not be changed. The returned length is resolved to pixels. [out] |
Returns : |
TRUE if the property was found in the properties for this
theme node (or in the properties of parent nodes when inheriting.) |
gboolean st_theme_node_lookup_time (StThemeNode *node
,const char *property_name
,gboolean inherit
,gdouble *value
);
Generically looks up a property containing a single time value, which is converted to milliseconds.
|
a StThemeNode |
|
The name of the time property |
|
if TRUE , if a value is not found for the property on the
node, then it will be looked up on the parent node, and then on the
parent's parent, and so forth. Note that if the property has a
value of 'inherit' it will be inherited even if FALSE is passed
in for inherit ; this only affects the default behavior for inheritance. |
|
location to store the value that was determined. If the property is not found, the value in this location will not be changed. [out] |
Returns : |
TRUE if the property was found in the properties for this
theme node (or in the properties of parent nodes when inheriting.) |
gboolean st_theme_node_lookup_shadow (StThemeNode *node
,const char *property_name
,gboolean inherit
,StShadow **shadow
);
If the property is not found, the value in the shadow variable will not be changed.
Generically looks up a property containing a set of shadow values. When
specific getters (like st_theme_node_get_box_shadow()
) exist, they
should be used instead. They are cached, so more efficient, and have
handling for shortcut properties and other details of CSS.
See also st_theme_node_get_shadow()
, which provides a simpler API.
|
a StThemeNode |
|
The name of the shadow property |
|
if TRUE , if a value is not found for the property on the
node, then it will be looked up on the parent node, and then on the
parent's parent, and so forth. Note that if the property has a
value of 'inherit' it will be inherited even if FALSE is passed
in for inherit ; this only affects the default behavior for inheritance. |
|
location to store the shadow. [out] |
Returns : |
TRUE if the property was found in the properties for this
theme node (or in the properties of parent nodes when inheriting.) |
gboolean st_theme_node_lookup_url (StThemeNode *node
,const char *property_name
,gboolean inherit
,char **value
);
Looks up a property containing a single URL value.
See also st_theme_node_get_url()
, which provides a simpler API.
|
a StThemeNode |
|
The name of the string property |
|
if TRUE , if a value is not found for the property on the
node, then it will be looked up on the parent node, and then on the
parent's parent, and so forth. Note that if the property has a
value of 'inherit' it will be inherited even if FALSE is passed
in for inherit ; this only affects the default behavior for inheritance. |
|
location to store the newly allocated value that was determined. If the property is not found, the value in this location will not be changed. [out] |
Returns : |
TRUE if the property was found in the properties for this
theme node (or in the properties of parent nodes when inheriting.) |
void st_theme_node_get_color (StThemeNode *node
,const char *property_name
,ClutterColor *color
);
Generically looks up a property containing a single color value. When
specific getters (like st_theme_node_get_background_color()
) exist, they
should be used instead. They are cached, so more efficient, and have
handling for shortcut properties and other details of CSS.
If property_name
is not found, a warning will be logged and a
default color returned.
See also st_theme_node_lookup_color()
, which provides more options,
and lets you handle the case where the theme does not specify the
indicated color.
|
a StThemeNode |
|
The name of the color property |
|
location to store the color that was determined. [out caller-allocates] |
gdouble st_theme_node_get_double (StThemeNode *node
,const char *property_name
);
Generically looks up a property containing a single numeric value without units.
See also st_theme_node_lookup_double()
, which provides more options,
and lets you handle the case where the theme does not specify the
indicated value.
|
a StThemeNode |
|
The name of the numeric property |
Returns : |
the value found. If property_name is not
found, a warning will be logged and 0 will be returned. |
gdouble st_theme_node_get_length (StThemeNode *node
,const char *property_name
);
Generically looks up a property containing a single length value. When
specific getters (like st_theme_node_get_border_width()
) exist, they
should be used instead. They are cached, so more efficient, and have
handling for shortcut properties and other details of CSS.
Unlike st_theme_node_get_color()
and st_theme_node_get_double()
,
this does not print a warning if the property is not found; it just
returns 0.
See also st_theme_node_lookup_length()
, which provides more options.
|
a StThemeNode |
|
The name of the length property |
Returns : |
the length, in pixels, or 0 if the property was not found. |
StShadow * st_theme_node_get_shadow (StThemeNode *node
,const char *property_name
);
Generically looks up a property containing a set of shadow values. When
specific getters (like st_theme_node_get_box_shadow()
) exist, they
should be used instead. They are cached, so more efficient, and have
handling for shortcut properties and other details of CSS.
Like st_theme_get_length()
, this does not print a warning if the property is
not found; it just returns NULL
See also st_theme_node_lookup_shadow()
, which provides more options.
|
a StThemeNode |
|
The name of the shadow property |
Returns : |
the shadow, or NULL if the property was not found. [transfer full]
|
char * st_theme_node_get_url (StThemeNode *node
,const char *property_name
);
void st_theme_node_get_background_color (StThemeNode *node
,ClutterColor *color
);
Gets node
's background color.
|
a StThemeNode |
|
location to store the color. [out caller-allocates] |
void st_theme_node_get_foreground_color (StThemeNode *node
,ClutterColor *color
);
Gets node
's foreground color.
|
a StThemeNode |
|
location to store the color. [out caller-allocates] |
void st_theme_node_get_background_gradient (StThemeNode *node
,StGradientType *type
,ClutterColor *start
,ClutterColor *end
);
The start
and end
arguments will only be set if type
is not ST_GRADIENT_NONE.
|
A StThemeNode |
|
Type of gradient. [out] |
|
Color at start of gradient. [out caller-allocates] |
|
Color at end of gradient. [out caller-allocates] |
const char * st_theme_node_get_background_image (StThemeNode *node
);
int st_theme_node_get_border_width (StThemeNode *node
,StSide side
);
int st_theme_node_get_border_radius (StThemeNode *node
,StCorner corner
);
void st_theme_node_get_border_color (StThemeNode *node
,StSide side
,ClutterColor *color
);
Gets the color of node
's border on side
|
a StThemeNode |
|
a StSide |
|
location to store the color. [out caller-allocates] |
void st_theme_node_get_outline_color (StThemeNode *node
,ClutterColor *color
);
Gets the color of node
's outline.
|
a StThemeNode |
|
location to store the color. [out caller-allocates] |
double st_theme_node_get_horizontal_padding
(StThemeNode *node
);
Gets the total horizonal padding (left + right padding)
|
a StThemeNode |
Returns : |
the total horizonal padding in pixels |
double st_theme_node_get_vertical_padding (StThemeNode *node
);
Gets the total vertical padding (top + bottom padding)
|
a StThemeNode |
Returns : |
the total vertical padding in pixels |
int st_theme_node_get_transition_duration
(StThemeNode *node
);
Get the value of the transition-duration property, which
specifies the transition time between the previous StThemeNode
and node
.
|
an StThemeNode |
Returns : |
the node's transition duration in milliseconds |
StTextDecoration st_theme_node_get_text_decoration (StThemeNode *node
);
StBorderImage * st_theme_node_get_border_image (StThemeNode *node
);
Gets the value for the border-image style property
|
a StThemeNode |
Returns : |
the border image, or NULL
if there is no border image. [transfer none]
|
StShadow * st_theme_node_get_box_shadow (StThemeNode *node
);
Gets the value for the box-shadow style property
|
a StThemeNode |
Returns : |
the node's shadow, or NULL
if node has no shadow. [transfer none]
|
StShadow * st_theme_node_get_text_shadow (StThemeNode *node
);
Gets the value for the text-shadow style property
|
a StThemeNode |
Returns : |
the node's text-shadow, or NULL
if node has no text-shadow. [transfer none]
|
StShadow * st_theme_node_get_background_image_shadow
(StThemeNode *node
);
Gets the value for the -st-background-image-shadow style property
|
a StThemeNode |
Returns : |
the node's background image shadow, or NULL
if node has no such shadow. [transfer none]
|
StIconColors * st_theme_node_get_icon_colors (StThemeNode *node
);
Gets the colors that should be used for colorizing symbolic icons according the style of this node.
|
a StThemeNode |
Returns : |
the icon colors to use for this theme node. [transfer none] |
void st_theme_node_adjust_for_height (StThemeNode *node
,float *for_height
);
Adjusts a "for height" passed to clutter_actor_get_preferred_width()
to
account for borders and padding. This is a convenience function meant
to be called from a get_preferred_width()
method of a ClutterActor
subclass. The value after adjustment is the height available for the actor's
content.
|
a StThemeNode |
|
the "for height" to adjust. [inout] |
void st_theme_node_adjust_preferred_width (StThemeNode *node
,float *min_width_p
,float *natural_width_p
);
Adjusts the minimum and natural width computed for an actor by
adding on the necessary space for borders and padding and taking
into account any minimum or maximum width. This is a convenience
function meant to be called from the get_preferred_width()
method
of a ClutterActor subclass
|
a StThemeNode |
|
the minimum width to adjust. [inout][allow-none] |
|
the natural width to adjust. [inout] |
void st_theme_node_adjust_for_width (StThemeNode *node
,float *for_width
);
Adjusts a "for width" passed to clutter_actor_get_preferred_height()
to
account for borders and padding. This is a convenience function meant
to be called from a get_preferred_height()
method of a ClutterActor
subclass. The value after adjustment is the width available for the actor's
content.
|
a StThemeNode |
|
the "for width" to adjust. [inout] |
void st_theme_node_adjust_preferred_height (StThemeNode *node
,float *min_height_p
,float *natural_height_p
);
Adjusts the minimum and natural height computed for an actor by
adding on the necessary space for borders and padding and taking
into account any minimum or maximum height. This is a convenience
function meant to be called from the get_preferred_height()
method
of a ClutterActor subclass
|
a StThemeNode |
|
the minimum height to adjust. [inout][allow-none] |
|
the natural height to adjust. [inout] |
void st_theme_node_get_content_box (StThemeNode *node
,const ClutterActorBox *allocation
,ClutterActorBox *content_box
);
Gets the box within an actor's allocation that contents the content
of an actor (excluding borders and padding). This is a convenience function
meant to be used from the allocate()
or paint()
methods of a ClutterActor
subclass.
|
a StThemeNode |
|
the box allocated to a ClutterAlctor |
|
computed box occupied by the actor's content. [out caller-allocates] |
void st_theme_node_get_paint_box (StThemeNode *node
,const ClutterActorBox *allocation
,ClutterActorBox *paint_box
);
Gets the box used to paint the actor, including the area occupied
by properties which paint outside the actor's assigned allocation.
When painting node
to an offscreen buffer, this function can be
used to determine the necessary size of the buffer.
|
a StThemeNode |
|
the box allocated to a ClutterActor |
|
computed box occupied when painting the actor. [out caller-allocates] |
void st_theme_node_get_background_paint_box (StThemeNode *node
,const ClutterActorBox *allocation
,ClutterActorBox *paint_box
);
Gets the box used to paint the actor's background, including the area occupied by properties which paint outside the actor's assigned allocation.
|
a StThemeNode |
|
the box allocated to a ClutterActor |
|
computed box occupied when painting the actor's background. [out caller-allocates] |
gboolean st_theme_node_geometry_equal (StThemeNode *node
,StThemeNode *other
);
Tests if two theme nodes have the same borders and padding; this can be used to optimize having to relayout when the style applied to a Clutter actor changes colors without changing the geometry.
|
a StThemeNode |
|
a different StThemeNode |
gboolean st_theme_node_paint_equal (StThemeNode *node
,StThemeNode *other
);
Check if st_theme_node_paint()
will paint identically for node
as it does
for other
. Note that in some cases this function may return TRUE
even
if there is no visible difference in the painting.
|
a StThemeNode |
|
a different StThemeNode |
Returns : |
TRUE if the two theme nodes paint identically. FALSE if the
two nodes potentially paint differently. |
void st_theme_node_paint (StThemeNode *node
,const ClutterActorBox *box
,guint8 paint_opacity
);
void st_theme_node_copy_cached_paint_state (StThemeNode *node
,StThemeNode *other
);
Copy cached painting state from other
to node
. This function can be used to
optimize redrawing cached background images when the style on an element changess
in a way that doesn't affect background drawing. This function must only be called
if st_theme_node_paint_equal (node, other) returns TRUE
.
|
a StThemeNode |
|
a different StThemeNode |
void st_theme_node_invalidate_paint_state
(StThemeNode *node
);
"application-stylesheet"
property "application-stylesheet" gchar* : Read / Write / Construct Only
The highest priority stylesheet, representing application-specific styling; this is associated with the CSS "author" stylesheet.
Default value: NULL
"default-stylesheet"
property "default-stylesheet" gchar* : Read / Write / Construct Only
The lowest priority stylesheet, representing global default styling; this is associated with the CSS "user agent" stylesheet.
Default value: NULL
"changed"
signalvoid user_function (StThemeContext *stthemecontext,
gpointer user_data) : Run Last
"custom-stylesheets-changed"
signalvoid user_function (StTheme *sttheme,
gpointer user_data) : Run Last