Add st_widget_peek_theme_node()
Sometimes it's useful to get the theme node if there is one and do nothing and wait for the ::style-changed signal if there is no theme node. Add st_widget_peek_theme_node() that just gets the current theme node if available. The caller must handle a %NULL return. https://bugzilla.gnome.org/show_bug.cgi?id=633865
This commit is contained in:
parent
4917c79d09
commit
8d6ab6fe84
@ -522,6 +522,9 @@ get_root_theme_node (ClutterStage *stage)
|
||||
* 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.
|
||||
*
|
||||
* Return value: (transfer none): 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
|
||||
@ -570,6 +573,29 @@ st_widget_get_theme_node (StWidget *widget)
|
||||
return priv->theme_node;
|
||||
}
|
||||
|
||||
/**
|
||||
* st_widget_peek_theme_node:
|
||||
* @widget: a #StWidget
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Return value: (transfer none): 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.
|
||||
*/
|
||||
StThemeNode *
|
||||
st_widget_peek_theme_node (StWidget *widget)
|
||||
{
|
||||
StWidgetPrivate *priv = widget->priv;
|
||||
|
||||
return priv->theme_node;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
st_widget_enter (ClutterActor *actor,
|
||||
ClutterCrossingEvent *event)
|
||||
|
@ -151,6 +151,7 @@ gboolean st_widget_navigate_focus (StWidget *widg
|
||||
/* Only to be used by sub-classes of StWidget */
|
||||
void st_widget_style_changed (StWidget *widget);
|
||||
StThemeNode * st_widget_get_theme_node (StWidget *widget);
|
||||
StThemeNode * st_widget_peek_theme_node (StWidget *widget);
|
||||
|
||||
/* debug methods */
|
||||
char *st_describe_actor (ClutterActor *actor);
|
||||
|
Loading…
Reference in New Issue
Block a user