actor: Add a method for querying key focus

A simple convenience method on Clutter.Actor for checking whether
it has key focus assigned on the Stage to which it belongs.
This commit is contained in:
Emmanuele Bassi 2010-09-10 11:42:11 +01:00
parent 71a4db6135
commit 01362effca
3 changed files with 27 additions and 0 deletions

View File

@ -11643,3 +11643,27 @@ clutter_actor_clear_effects (ClutterActor *self)
_clutter_meta_group_clear_metas (self->priv->effects); _clutter_meta_group_clear_metas (self->priv->effects);
} }
/**
* clutter_actor_has_key_focus:
* @self: a #ClutterActor
*
* Checks whether @self is the #ClutterActor that has key focus
*
* Return value: %TRUE if the actor has key focus, and %FALSE otherwise
*
* Since: 1.4
*/
gboolean
clutter_actor_has_key_focus (ClutterActor *self)
{
ClutterActor *stage;
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
stage = clutter_actor_get_stage_internal (self);
if (stage == NULL)
return FALSE;
return clutter_stage_get_key_focus (CLUTTER_STAGE (stage)) == self;
}

View File

@ -585,6 +585,8 @@ gboolean clutter_actor_has_allocation (ClutterActor *sel
AtkObject * clutter_actor_get_accessible (ClutterActor *self); AtkObject * clutter_actor_get_accessible (ClutterActor *self);
gboolean clutter_actor_has_key_focus (ClutterActor *self);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_ACTOR_H__ */ #endif /* __CLUTTER_ACTOR_H__ */

View File

@ -403,6 +403,7 @@ clutter_actor_set_shader_param_float
clutter_actor_set_shader_param_int clutter_actor_set_shader_param_int
<SUBSECTION> <SUBSECTION>
clutter_actor_has_key_focus
clutter_actor_grab_key_focus clutter_actor_grab_key_focus
clutter_actor_get_pango_context clutter_actor_get_pango_context
clutter_actor_create_pango_context clutter_actor_create_pango_context