Top |
char * | accessible-name | Read / Write |
AtkRole | accessible-role | Read / Write |
gboolean | can-focus | Read / Write |
gboolean | hover | Read / Write |
gboolean | important | Read / Write / Construct |
ClutterActor * | label-actor | Read / Write |
char * | pseudo-class | Read / Write |
char * | style | Read / Write |
char * | style-class | Read / Write |
StTheme * | theme | Read / Write |
gboolean | track-hover | Read / Write |
GEnum ╰── StTextDirection GObject ╰── GInitiallyUnowned ╰── ClutterActor ╰── StWidget ├── StBin ├── StViewport ├── StDrawingArea ├── StEntry ├── StGroup ├── StIcon ├── StLabel ├── StScrollBar ╰── StTable
StWidget implements ClutterContainer, ClutterScriptable, ClutterAnimatable and AtkImplementorIface.
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.
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()
.
void st_widget_change_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class
,gboolean add
);
Adds pseudo_class
to actor
's pseudo class list if add
is true,
removes if add
is false.
actor |
a StWidget |
|
pseudo_class |
a pseudo class string |
|
add |
whether to add or remove pseudo class |
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.
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.
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()
.
the pseudo class list string. The string is owned by the StWidget and should not be modified or freed.
gboolean st_widget_has_style_pseudo_class (StWidget *actor
,const gchar *pseudo_class
);
Tests if actor
's pseudo class list includes pseudo_class
.
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()
.
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.
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.
const gchar *
st_widget_get_style_class_name (StWidget *actor
);
Get the current style class name
the class name string. The string is owned by the StWidget and should not be modified or freed.
gboolean st_widget_has_style_class_name (StWidget *actor
,const gchar *style_class
);
Tests if actor
's style class list includes style_class
.
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.
const gchar *
st_widget_get_style (StWidget *actor
);
Get the current inline style string. See st_widget_set_style()
.
The inline style string, or NULL
. The string is owned by the
StWidget and should not be modified or freed.
void st_widget_set_important (StWidget *actor
,gboolean important
);
When an actor is set to important, and the active theme does not account for it, a fallback lookup is made to the default cinnamon theme which (presumably) will always have support for all stock elements of the desktop.
This property is inherited by the actor's children.
gboolean
st_widget_get_important (StWidget *actor
);
Returns if the actor
is flagged set as important
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).
StTheme *
st_widget_get_theme (StWidget *actor
);
Gets the overriding theme set on the actor. See st_widget_set_theme()
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.
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.
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.
void
st_widget_sync_hover (StWidget *widget
);
Sets widget
's hover state according to the current pointer
position. This can be used to ensure that it is correct after
(or during) a pointer grab.
gboolean
st_widget_get_hover (StWidget *widget
);
If “track-hover” is set, this returns whether the pointer is currently over the widget.
void
st_widget_popup_menu (StWidget *self
);
Asks the widget to pop-up a context menu.
void
st_widget_ensure_style (StWidget *widget
);
Ensures that widget
has read its style information.
void st_widget_set_can_focus (StWidget *widget
,gboolean can_focus
);
Marks widget
as being able to receive keyboard focus via
keyboard navigation.
widget |
A StWidget |
|
can_focus |
|
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.
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.
ClutterActor *
st_widget_get_label_actor (StWidget *widget
);
Gets the label that identifies widget
if it is defined
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
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: this should only be called on a widget that has been added to the stage
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]
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.
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]
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
.
void st_widget_paint_background (StWidget *widget
,ClutterPaintContext *paint_context
);
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.
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.
void
st_widget_destroy_children (StWidget *widget
);
st_widget_destroy_children
has been deprecated since version 3.0 and should not be used in newly-written code.
Use clutter_actor_destroy_all_children instead
Destroys all child actors from widget
.
void st_widget_move_before (StWidget *widget
,ClutterActor *actor
,ClutterActor *sibling
);
void st_widget_set_accessible_role (StWidget *widget
,AtkRole role
);
This method sets role
as the accessible role for widget
. This
role describes what kind of user interface element widget
is and
is provided so that assistive technologies know how to present
widget
to the user.
Usually you will have no need to set the accessible role for an object, as this information is extracted from the context of the object (ie: a StButton has by default a push button role). This method is only required when you need to redefine the role currently associated with the widget, for instance if it is being used in an unusual way (ie: a StButton used as a togglebutton), or if a generic object is used directly (ie: a container as a menu item).
If role
is ATK_ROLE_INVALID, the role will not be changed
and the accessible's default role will be used instead.
AtkRole
st_widget_get_accessible_role (StWidget *widget
);
Gets the AtkRole for this widget. See
st_widget_set_accessible_role()
for more information.
void st_widget_add_accessible_state (StWidget *widget
,AtkStateType state
);
This method adds state
as one of the accessible states for
widget
. The list of states of a widget describes the current state
of user interface element widget
and is provided so that assistive
technologies know how to present widget
to the user.
Usually you will have no need to add accessible states for an object, as the accessible object can extract most of the states from the object itself (ie: a StButton knows when it is pressed). This method is only required when one cannot extract the information automatically from the object itself (i.e.: a generic container used as a toggle menu item will not automatically include the toggled state).
void st_widget_remove_accessible_state (StWidget *widget
,AtkStateType state
);
This method removes state
as on of the accessible states for
widget
. See st_widget_add_accessible_state()
for more information.
void st_widget_set_accessible_name (StWidget *widget
,const gchar *name
);
This method sets name
as the accessible name for widget
.
Usually you will have no need to set the accessible name for an
object, as usually there is a label for most of the interface
elements. So in general it is better to just use
st_widget_set_label_actor
. This method is only required when you
need to set an accessible name and there is no available label
object.
const gchar *
st_widget_get_accessible_name (StWidget *widget
);
Gets the accessible name for this widget. See
st_widget_set_accessible_name()
for more information.
void st_widget_set_accessible (StWidget *widget
,AtkObject *accessible
);
This method allows to set a customly created accessible object to this widget. For example if you define a new subclass of StWidgetAccessible at the javascript code.
NULL is a valid value for accessible
. That contemplates the
hypothetical case of not needing anymore a custom accessible object
for the widget. Next call of st_widget_get_accessible()
would
create and return a default accessible.
It assumes that the call to atk_object_initialize that bound the gobject with the custom accessible object was already called, so not a responsibility of this method.
struct StWidget;
Base class for stylable actors. The contents of the StWidget structure are private and should only be accessed through the public API.
“accessible-name”
property “accessible-name” char *
Object instance's name for assistive technology access.
Owner: StWidget
Flags: Read / Write
Default value: NULL
“accessible-role”
property “accessible-role” AtkRole
The accessible role of this object
Owner: StWidget
Flags: Read / Write
Default value: ATK_ROLE_INVALID
“can-focus”
property “can-focus” gboolean
Whether or not the widget can be focused via keyboard navigation.
Owner: StWidget
Flags: Read / Write
Default value: FALSE
“hover”
property “hover” gboolean
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.
Owner: StWidget
Flags: Read / Write
Default value: FALSE
“important”
property “important” gboolean
Whether or not the fallback theme should be used for lookups in case the user theme fails.
Owner: StWidget
Flags: Read / Write / Construct
Default value: FALSE
“label-actor”
property “label-actor” ClutterActor *
Label that identifies this widget.
Owner: StWidget
Flags: Read / Write
“pseudo-class”
property “pseudo-class” char *
The pseudo-class of the actor. Typical values include "hover", "active", "focus".
Owner: StWidget
Flags: Read / Write
Default value: ""
“style”
property “style” char *
Inline style information for the actor as a ';'-separated list of CSS properties.
Owner: StWidget
Flags: Read / Write
Default value: ""
“style-class”
property “style-class” char *
The style-class of the actor for use in styling.
Owner: StWidget
Flags: Read / Write
Default value: ""
“theme”
property“theme” StTheme *
A theme set on this actor overriding the global theming for this actor and its descendants
Owner: StWidget
Flags: Read / Write
“track-hover”
property “track-hover” gboolean
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.
Owner: StWidget
Flags: Read / Write
Default value: FALSE
“popup-menu”
signalvoid user_function (StWidget *widget, gpointer user_data)
Emitted when the user has requested a context menu (eg, via a keybinding)
Flags: Run Last