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 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);
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
*
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;
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)
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 */
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;
}
if (sd->disabled == disabled) return;
sd->disabled = !!disabled;
- if (sd->focused)
- {
- Evas_Object *o, *parent;
- parent = obj;
- o = elm_widget_parent_get(parent);
- if (!o)
- elm_widget_focused_object_clear(parent);
- else
- {
- parent = o;
- for (;;)
- {
- o = elm_widget_parent_get(parent);
- if (!o) break;
- parent = o;
- }
- elm_widget_focus_cycle(parent, ELM_FOCUS_NEXT);
- }
- }
+ elm_widget_focus_disabled_handle(obj);
if (sd->disable_func) sd->disable_func(obj);
}
elm_widget_focus_steal(o);
}
+EAPI void
+elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj)
+{
+ API_ENTRY return;
+
+ if (!elm_widget_parent_get(obj))
+ elm_widget_focused_object_clear(obj);
+ else
+ _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
*
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;
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);
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);