Add ClutterText::activate()

The clutter_text_activate() function will emit the ::activate
signal if the :activatable property is set.

This function is useful for subclasses or application code, for
example if we are going to use ::captured-event or ::key-press-event
signal handlers to intercept the Return key and emit the ::activate
signal ourselves.
This commit is contained in:
Emmanuele Bassi 2008-12-16 12:02:58 +00:00
parent 87f38475ae
commit 93d96dca52
2 changed files with 36 additions and 0 deletions

View File

@ -2240,6 +2240,41 @@ clutter_text_get_activatable (ClutterText *self)
return self->priv->activatable; return self->priv->activatable;
} }
/**
* clutter_text_activate:
* @self: a #ClutterText
*
* Emits the #ClutterText::activate signal, if @self has been set
* as activatable using clutter_text_set_activatable().
*
* This function can be used to emit the ::activate signal inside
* a #ClutterActor::captured-event or #ClutterActor::key-press-event
* signal handlers before the default signal handler for the
* #ClutterText is invoked.
*
* Return value: %TRUE if the ::activate signal has been emitted,
* and %FALSE otherwise
*
* Since: 1.0
*/
gboolean
clutter_text_activate (ClutterText *self)
{
ClutterTextPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
priv = self->priv;
if (priv->activatable)
{
g_signal_emit (self, text_signals[ACTIVATE], 0);
return TRUE;
}
return FALSE;
}
void void
clutter_text_set_cursor_visible (ClutterText *self, clutter_text_set_cursor_visible (ClutterText *self,
gboolean cursor_visible) gboolean cursor_visible)

View File

@ -187,6 +187,7 @@ gunichar clutter_text_get_invisible_char (ClutterText *self
void clutter_text_set_max_length (ClutterText *self, void clutter_text_set_max_length (ClutterText *self,
gint max); gint max);
gint clutter_text_get_max_length (ClutterText *self); gint clutter_text_get_max_length (ClutterText *self);
gboolean clutter_text_activate (ClutterText *self);
G_END_DECLS G_END_DECLS