forked from enlightenment/efl
elementary/elm_main : Add elm_object_tree_unfocusable_set/get. This
API will set an object and its child objects to be unfocusable/focusable. SVN revision: 61838
This commit is contained in:
parent
3012836567
commit
73057c35bd
|
@ -1135,6 +1135,40 @@ extern "C" {
|
|||
EAPI void elm_object_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_object_focus_direction_go(Evas_Object *obj, int x, int y) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Make the elementary object and its children to be unfocusable (or focusable).
|
||||
*
|
||||
* @param obj The Elementary object to operate on
|
||||
* @param tree_unfocusable @c EINA_TRUE for unfocusable,
|
||||
* @c EINA_FALSE for focusable.
|
||||
*
|
||||
* This sets whether the object @p obj and its children objects
|
||||
* able to take focus or not. If the tree is set as unfocusable,
|
||||
* newest focused object which is not in this tree will get focus.
|
||||
* This API can be helpful for an object to be deleted.
|
||||
* When an object will be deleted soon, it and its children may not
|
||||
* want to get focus (by focus reverting or by other focus controls).
|
||||
* Then, just use this API before deleting.
|
||||
*
|
||||
* @see elm_object_tree_unfocusable_get()
|
||||
*
|
||||
* @ingroup Focus
|
||||
*/
|
||||
EAPI void elm_object_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable); EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get whether an Elementary object and its children are unfocusable or not.
|
||||
*
|
||||
* @param obj The Elementary object to get the information from
|
||||
* @return @c EINA_TRUE, if the tree is unfocussable,
|
||||
* @c EINA_FALSE if not (and on errors).
|
||||
*
|
||||
* @see elm_object_tree_unfocusable_set()
|
||||
*
|
||||
* @ingroup Focus
|
||||
*/
|
||||
EAPI Eina_Bool elm_object_tree_unfocusable_get(const Evas_Object *obj); EINA_ARG_NONNULL(1);
|
||||
|
||||
EAPI Eina_Bool elm_scroll_bounce_enabled_get(void);
|
||||
EAPI void elm_scroll_bounce_enabled_set(Eina_Bool enabled);
|
||||
EAPI void elm_scroll_bounce_enabled_all_set(Eina_Bool enabled);
|
||||
|
|
|
@ -2422,6 +2422,21 @@ elm_object_focus_direction_go(Evas_Object *obj,
|
|||
elm_widget_focus_direction_go(obj, x, y);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_object_tree_unfocusable_set(Evas_Object *obj,
|
||||
Eina_Bool tree_unfocusable)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(obj);
|
||||
elm_widget_tree_unfocusable_set(obj, tree_unfocusable);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_object_tree_unfocusable_get(const Evas_Object *obj)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
|
||||
return elm_widget_tree_unfocusable_get(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the enable status of the focus highlight
|
||||
*
|
||||
|
|
|
@ -103,6 +103,7 @@ struct _Smart_Data
|
|||
Eina_Bool can_focus : 1;
|
||||
Eina_Bool child_can_focus : 1;
|
||||
Eina_Bool focused : 1;
|
||||
Eina_Bool tree_unfocusable : 1;
|
||||
Eina_Bool highlight_ignore : 1;
|
||||
Eina_Bool highlight_in_theme : 1;
|
||||
Eina_Bool disabled : 1;
|
||||
|
@ -1089,6 +1090,49 @@ elm_widget_child_can_focus_get(const Evas_Object *obj)
|
|||
return sd->child_can_focus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* This API makes the widget object and its children to be unfocusable.
|
||||
*
|
||||
* This API can be helpful for an object to be deleted.
|
||||
* When an object will be deleted soon, it and its children may not
|
||||
* want to get focus (by focus reverting or by other focus controls).
|
||||
* Then, just use this API before deleting.
|
||||
*
|
||||
* @param obj The widget root of sub-tree
|
||||
* @param tree_unfocusable If true, set the object sub-tree as unfocusable
|
||||
*
|
||||
* @ingroup Widget
|
||||
*/
|
||||
EAPI void
|
||||
elm_widget_tree_unfocusable_set(Evas_Object *obj,
|
||||
Eina_Bool tree_unfocusable)
|
||||
{
|
||||
API_ENTRY return;
|
||||
|
||||
if (sd->tree_unfocusable == tree_unfocusable) return;
|
||||
sd->tree_unfocusable = !!tree_unfocusable;
|
||||
elm_widget_focus_tree_unfocusable_handle(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* This returns true, if the object sub-tree is unfocusable.
|
||||
*
|
||||
* @param obj The widget root of sub-tree
|
||||
* @return EINA_TRUE if the object sub-tree is unfocusable
|
||||
*
|
||||
* @ingroup Widget
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_widget_tree_unfocusable_get(const Evas_Object *obj)
|
||||
{
|
||||
API_ENTRY return EINA_FALSE;
|
||||
return sd->tree_unfocusable;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_widget_highlight_ignore_set(Evas_Object *obj,
|
||||
Eina_Bool ignore)
|
||||
|
@ -1479,7 +1523,9 @@ elm_widget_focus_next_get(const Evas_Object *obj,
|
|||
API_ENTRY return EINA_FALSE;
|
||||
|
||||
/* Ignore if disabled */
|
||||
if ((!evas_object_visible_get(obj)) || (elm_widget_disabled_get(obj)))
|
||||
if ((!evas_object_visible_get(obj))
|
||||
|| (elm_widget_disabled_get(obj))
|
||||
|| (elm_widget_tree_unfocusable_get(obj)))
|
||||
return EINA_FALSE;
|
||||
|
||||
/* Try use hook */
|
||||
|
@ -1780,13 +1826,14 @@ elm_widget_focus_steal(Evas_Object *obj)
|
|||
if (sd->focused) return;
|
||||
if (sd->disabled) return;
|
||||
if (!sd->can_focus) return;
|
||||
if (sd->tree_unfocusable) return;
|
||||
parent = obj;
|
||||
for (;;)
|
||||
{
|
||||
o = elm_widget_parent_get(parent);
|
||||
if (!o) break;
|
||||
sd = evas_object_smart_data_get(o);
|
||||
if (sd->disabled) return;
|
||||
if (sd->disabled || sd->tree_unfocusable) return;
|
||||
if (sd->focused) break;
|
||||
parent = o;
|
||||
}
|
||||
|
@ -2334,7 +2381,7 @@ elm_widget_focus_mouse_down_handle(Evas_Object *obj)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
elm_widget_focus_disabled_handle(Evas_Object *obj)
|
||||
elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj)
|
||||
{
|
||||
API_ENTRY return;
|
||||
|
||||
|
@ -2344,6 +2391,14 @@ elm_widget_focus_disabled_handle(Evas_Object *obj)
|
|||
_if_focused_revert(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_widget_focus_disabled_handle(Evas_Object *obj)
|
||||
{
|
||||
API_ENTRY return;
|
||||
|
||||
elm_widget_focus_tree_unfocusable_handle(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
|
@ -2864,7 +2919,9 @@ _newest_focus_order_get(Evas_Object *obj,
|
|||
|
||||
API_ENTRY return NULL;
|
||||
|
||||
if ((!evas_object_visible_get(obj)) || (elm_widget_disabled_get(obj)))
|
||||
if (!evas_object_visible_get(obj)
|
||||
|| (elm_widget_disabled_get(obj))
|
||||
|| (elm_widget_tree_unfocusable_get(obj)))
|
||||
return NULL;
|
||||
|
||||
best = NULL;
|
||||
|
|
|
@ -246,6 +246,8 @@ EAPI void *elm_widget_signal_callback_del(Evas_Object *obj, const cha
|
|||
EAPI void elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus);
|
||||
EAPI Eina_Bool elm_widget_can_focus_get(const Evas_Object *obj);
|
||||
EAPI Eina_Bool elm_widget_child_can_focus_get(const Evas_Object *obj);
|
||||
EAPI void elm_widget_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
|
||||
EAPI Eina_Bool elm_widget_tree_unfocusable_get(const Evas_Object *obj);
|
||||
EAPI void elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Bool ignore);
|
||||
EAPI Eina_Bool elm_widget_highlight_ignore_get(const Evas_Object *obj);
|
||||
EAPI void elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
|
||||
|
@ -313,6 +315,7 @@ EAPI Eina_List *elm_widget_stringlist_get(const char *str);
|
|||
EAPI void elm_widget_stringlist_free(Eina_List *list);
|
||||
EAPI void elm_widget_focus_hide_handle(Evas_Object *obj);
|
||||
EAPI void elm_widget_focus_mouse_down_handle(Evas_Object *obj);
|
||||
EAPI void elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj);
|
||||
EAPI void elm_widget_focus_disabled_handle(Evas_Object *obj);
|
||||
EAPI void elm_widget_text_part_set(Evas_Object *obj, const char *item, const char *label);
|
||||
EAPI const char *elm_widget_text_part_get(const Evas_Object *obj, const char *item);
|
||||
|
|
Loading…
Reference in New Issue