![]() |
![]() |
![]() |
St Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
enum StTextDirection; struct StWidget; struct StWidgetClass; char * st_describe_actor (ClutterActor *actor
); gfloat st_get_slow_down_factor (void
); void st_set_slow_down_factor (gfloat factor
); void st_widget_add_style_class_name (StWidget *actor
,const gchar *style_class
); void st_widget_add_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class
); void st_widget_ensure_style (StWidget *widget
); gboolean st_widget_get_can_focus (StWidget *widget
); StTextDirection st_widget_get_default_direction (void
); StTextDirection st_widget_get_direction (StWidget *self
); GList * st_widget_get_focus_chain (StWidget *widget
); gboolean st_widget_get_hover (StWidget *widget
); ClutterActor * st_widget_get_label_actor (StWidget *widget
); const gchar * st_widget_get_style (StWidget *actor
); const gchar * st_widget_get_style_class_name (StWidget *actor
); const gchar * st_widget_get_style_pseudo_class (StWidget *actor
); StTheme * st_widget_get_theme (StWidget *actor
); StThemeNode * st_widget_get_theme_node (StWidget *widget
); gboolean st_widget_get_track_hover (StWidget *widget
); gboolean st_widget_has_style_class_name (StWidget *actor
,const gchar *style_class
); gboolean st_widget_has_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class
); gboolean st_widget_navigate_focus (StWidget *widget
,ClutterActor *from
,GtkDirectionType direction
,gboolean wrap_around
); void st_widget_paint_background (StWidget *widget
); StThemeNode * st_widget_peek_theme_node (StWidget *widget
); void st_widget_remove_style_class_name (StWidget *actor
,const gchar *style_class
); void st_widget_remove_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class
); void st_widget_set_can_focus (StWidget *widget
,gboolean can_focus
); void st_widget_set_default_direction (StTextDirection dir
); void st_widget_set_direction (StWidget *self
,StTextDirection dir
); void st_widget_set_hover (StWidget *widget
,gboolean hover
); void st_widget_set_label_actor (StWidget *widget
,ClutterActor *label
); void st_widget_set_style (StWidget *actor
,const gchar *style
); void st_widget_set_style_class_name (StWidget *actor
,const gchar *style_class_list
); void st_widget_set_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class_list
); void st_widget_set_theme (StWidget *actor
,StTheme *theme
); void st_widget_set_track_hover (StWidget *widget
,gboolean track_hover
); void st_widget_style_changed (StWidget *widget
); void st_widget_sync_hover (StWidget *widget
);
GObject +----GInitiallyUnowned +----ClutterActor +----StWidget +----StBin +----StContainer +----StDrawingArea +----StEntry +----StIcon +----StLabel +----StScrollBar
StWidget implements ClutterContainer, ClutterScriptable, ClutterAnimatable and AtkImplementorIface.
"can-focus" gboolean : Read / Write "hover" gboolean : Read / Write "label-actor" ClutterActor* : Read / Write "pseudo-class" gchar* : Read / Write "stylable" gboolean : Read / Write "style" gchar* : Read / Write "style-class" gchar* : Read / Write "theme" StTheme* : Read / Write "track-hover" gboolean : Read / Write
StWidget is a simple abstract class on top of ClutterActor. It provides basic themeing properties.
Actors in the St library should subclass StWidget if they plan to obey to a certain StStyle.
typedef enum { ST_TEXT_DIRECTION_NONE, ST_TEXT_DIRECTION_LTR, ST_TEXT_DIRECTION_RTL } StTextDirection;
struct StWidget;
Base class for stylable actors. The contents of the StWidget structure are private and should only be accessed through the public API.
char * st_describe_actor (ClutterActor *actor
);
Creates a string describing actor
, for use in debugging. This
includes the class name and actor name (if any), plus if actor
is an StWidget, its style class and pseudo class names.
|
a ClutterActor |
Returns : |
the debug name. |
gfloat st_get_slow_down_factor (void
);
Returns : |
the global factor applied to all animation durations |
void st_set_slow_down_factor (gfloat factor
);
factor
: new slow-down factor
Set a global factor applied to all animation durations
void st_widget_add_style_class_name (StWidget *actor
,const gchar *style_class
);
Adds style_class
to actor
's style class name list, if it is not
already present.
|
a StWidget |
|
a style class name string |
void st_widget_add_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class
);
Adds pseudo_class
to actor
's pseudo class list, if it is not
already present.
|
a StWidget |
|
a pseudo class string |
void st_widget_ensure_style (StWidget *widget
);
Ensures that widget
has read its style information.
|
A StWidget |
gboolean st_widget_get_can_focus (StWidget *widget
);
Returns the current value of the can-focus property. See
st_widget_set_can_focus()
for more information.
|
A StWidget |
Returns : |
current value of can-focus on widget
|
GList * st_widget_get_focus_chain (StWidget *widget
);
Gets a list of the focusable children of widget
, in "Tab"
order. By default, this returns all visible
(as in CLUTTER_ACTOR_IS_VISIBLE()
) children of widget
.
|
An StWidget |
Returns : |
widget 's focusable children. [element-type Clutter.Actor][transfer container]
|
gboolean st_widget_get_hover (StWidget *widget
);
If "track-hover" is set, this returns whether the pointer is currently over the widget.
|
A StWidget |
Returns : |
current value of hover on widget
|
ClutterActor * st_widget_get_label_actor (StWidget *widget
);
Gets the label that identifies widget
if it is defined
|
a StWidget |
Returns : |
the label that identifies the widget. [transfer none] |
const gchar * st_widget_get_style (StWidget *actor
);
Get the current inline style string. See st_widget_set_style()
.
const gchar * st_widget_get_style_class_name (StWidget *actor
);
Get the current style class name
const gchar * st_widget_get_style_pseudo_class (StWidget *actor
);
Get the current style pseudo class list.
Note that an actor can have multiple pseudo classes; if you just
want to test for the presence of a specific pseudo class, use
st_widget_has_style_pseudo_class()
.
StTheme * st_widget_get_theme (StWidget *actor
);
Gets the overriding theme set on the actor. See st_widget_set_theme()
StThemeNode * st_widget_get_theme_node (StWidget *widget
);
Gets the theme node holding style information for the widget. The theme node is used to access standard and custom CSS properties of the widget.
Note: it is a fatal error to call this on a widget that is not been added to a stage.
|
a StWidget |
Returns : |
the theme node for the widget. This is owned by the widget. When attributes of the widget or the environment that affect the styling change (for example the style_class property of the widget), it will be recreated, and the ::style-changed signal will be emitted on the widget. [transfer none] |
gboolean st_widget_get_track_hover (StWidget *widget
);
Returns the current value of the track-hover property. See
st_widget_set_track_hover()
for more information.
|
A StWidget |
Returns : |
current value of track-hover on widget
|
gboolean st_widget_has_style_class_name (StWidget *actor
,const gchar *style_class
);
Tests if actor
's style class list includes style_class
.
|
a StWidget |
|
a style class string |
Returns : |
whether or not actor 's style class list includes
style_class . |
gboolean st_widget_has_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class
);
Tests if actor
's pseudo class list includes pseudo_class
.
|
a StWidget |
|
a pseudo class string |
Returns : |
whether or not actor 's pseudo class list includes
pseudo_class . |
gboolean st_widget_navigate_focus (StWidget *widget
,ClutterActor *from
,GtkDirectionType direction
,gboolean wrap_around
);
Tries to update the keyboard focus within widget
in response to a
keyboard event.
If from
is a descendant of widget
, this attempts to move the
keyboard focus to the next descendant of widget
(in the order
implied by direction
) that has the "can-focus" property
set. If from
is NULL
, or outside of widget
, this attempts to
focus either widget
itself, or its first descendant in the order
implied by direction
.
If a container type is marked "can-focus", the expected behavior is that it will only take up a single slot on the focus chain as a whole, rather than allowing navigation between its child actors (or having a distinction between itself being focused and one of its children being focused).
Some widget classes might have slightly different behavior from the above, where that would make more sense.
If wrap_around
is TRUE
and from
is a child of widget
, but the
widget has no further children that can accept the focus in the
given direction, then st_widget_navigate_focus()
will try a second
time, using a NULL
from
, which should cause it to reset the focus
to the first available widget in the given direction.
|
the "top level" container |
|
the actor that the focus is coming from. [allow-none] |
|
the direction focus is moving in |
|
whether focus should wrap around |
Returns : |
TRUE if clutter_actor_grab_key_focus() has been
called on an actor. FALSE if not. |
void st_widget_paint_background (StWidget *widget
);
Paint the background of the widget. This is meant to be called by subclasses of StWiget that need to paint the background without painting children.
|
The StWidget |
StThemeNode * st_widget_peek_theme_node (StWidget *widget
);
Returns the theme node for the widget if it has already been
computed, NULL
if the widget hasn't been added to a stage or the theme
node hasn't been computed. If NULL
is returned, then ::style-changed
will be reliably emitted before the widget is allocated or painted.
|
a StWidget |
Returns : |
the theme node for the widget. This is owned by the widget. When attributes of the widget or the environment that affect the styling change (for example the style_class property of the widget), it will be recreated, and the ::style-changed signal will be emitted on the widget. [transfer none] |
void st_widget_remove_style_class_name (StWidget *actor
,const gchar *style_class
);
Removes style_class
from actor
's style class name, if it is
present.
|
a StWidget |
|
a style class name string |
void st_widget_remove_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class
);
Removes pseudo_class
from actor
's pseudo class, if it is present.
|
a StWidget |
|
a pseudo class string |
void st_widget_set_can_focus (StWidget *widget
,gboolean can_focus
);
Marks widget
as being able to receive keyboard focus via
keyboard navigation.
|
A StWidget |
|
TRUE if the widget can receive keyboard focus
via keyboard navigation |
void st_widget_set_hover (StWidget *widget
,gboolean hover
);
Sets widget
's hover property and adds or removes "hover" from its
pseudo class accordingly.
If you have set "track-hover", you should not need to call
this directly. You can call st_widget_sync_hover()
if the hover
state might be out of sync due to another actor's pointer grab.
|
A StWidget |
|
whether the pointer is hovering over the widget |
void st_widget_set_label_actor (StWidget *widget
,ClutterActor *label
);
Sets label
as the ClutterActor that identifies (labels)
widget
. label
can be NULL
to indicate that widget
is not
labelled any more
|
a StWidget |
|
a ClutterActor |
void st_widget_set_style (StWidget *actor
,const gchar *style
);
Set the inline style string for this widget. The inline style string is an optional ';'-separated list of CSS properties that override the style as determined from the stylesheets of the current theme.
void st_widget_set_style_class_name (StWidget *actor
,const gchar *style_class_list
);
Set the style class name list. style_class_list
can either be
NULL
, for no classes, or a space-separated list of style class
names. See also st_widget_add_style_class_name()
and
st_widget_remove_style_class_name()
.
|
a StWidget |
|
a new style class list string. [allow-none] |
void st_widget_set_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class_list
);
Set the style pseudo class list. pseudo_class_list
can either be
NULL
, for no classes, or a space-separated list of pseudo class
names. See also st_widget_add_style_pseudo_class()
and
st_widget_remove_style_pseudo_class()
.
|
a StWidget |
|
a new pseudo class list string. [allow-none] |
void st_widget_set_theme (StWidget *actor
,StTheme *theme
);
Overrides the theme that would be inherited from the actor's parent or the stage with an entirely new theme (set of stylesheets).
|
a StWidget |
|
a new style class string |
void st_widget_set_track_hover (StWidget *widget
,gboolean track_hover
);
Enables hover tracking on the StWidget.
If hover tracking is enabled, and the widget is visible and
reactive, then widget
's "hover" property will be updated
automatically to reflect whether the pointer is in widget
(or one
of its children), and widget
's "pseudo-class" will have
the "hover" class added and removed from it accordingly.
Note that currently it is not possible to correctly track the hover
state when another actor has a pointer grab. You can use
st_widget_sync_hover()
to update the property manually in this
case.
|
A StWidget |
|
TRUE if the widget should track the pointer hover state |
"can-focus"
property "can-focus" gboolean : Read / Write
Whether or not the widget can be focused via keyboard navigation.
Default value: FALSE
"hover"
property "hover" gboolean : Read / Write
Whether or not the pointer is currently hovering over the widget. This is
only tracked automatically if "track-hover" is TRUE
, but you can
adjust it manually in any case.
Default value: FALSE
"label-actor"
property "label-actor" ClutterActor* : Read / Write
Label that identifies this widget.
"pseudo-class"
property "pseudo-class" gchar* : Read / Write
The pseudo-class of the actor. Typical values include "hover", "active", "focus".
Default value: ""
"stylable"
property "stylable" gboolean : Read / Write
Enable or disable styling of the widget
Default value: TRUE
"style"
property "style" gchar* : Read / Write
Inline style information for the actor as a ';'-separated list of CSS properties.
Default value: ""
"style-class"
property "style-class" gchar* : Read / Write
The style-class of the actor for use in styling.
Default value: ""
"theme"
property"theme" StTheme* : Read / Write
A theme set on this actor overriding the global theming for this actor and its descendants
"track-hover"
property "track-hover" gboolean : Read / Write
Determines whether the widget tracks pointer hover state. If
TRUE
(and the widget is visible and reactive), the
"hover" property and "hover" style pseudo class will be
adjusted automatically as the pointer moves in and out of the
widget.
Default value: FALSE