void test_focus_style(void *data, Evas_Object *obj, void *event_info);
void test_focus_part(void *data, Evas_Object *obj, void *event_info);
void test_focus3(void *data, Evas_Object *obj, void *event_info);
+void test_focus_object_style(void *data, Evas_Object *obj, void *event_info);
void test_flipselector(void *data, Evas_Object *obj, void *event_info);
void test_diskselector(void *data, Evas_Object *obj, void *event_info);
void test_colorselector(void *data, Evas_Object *obj, void *event_info);
ADD_TEST(NULL, "Focus", "Focus Style", test_focus_style);
ADD_TEST(NULL, "Focus", "Focus On Part", test_focus_part);
ADD_TEST(NULL, "Focus", "Focus 3", test_focus3);
-
+ ADD_TEST(NULL, "Focus", "Focus Object Style", test_focus_object_style);
+
//------------------------------//
ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
ADD_TEST(NULL, "Naviframe", "Naviframe 2", test_naviframe2);
evas_object_resize(win, 320, 320);
evas_object_show(win);
}
+
+void
+test_focus_object_style(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *fr, *bx, *bt;
+ char win_focus_theme[PATH_MAX] = { 0 };
+
+ snprintf(win_focus_theme, sizeof(win_focus_theme), "%s/objects/test_focus_custom.edj", elm_app_data_dir_get());
+ elm_theme_extension_add(NULL, win_focus_theme);
+
+ win = elm_win_util_standard_add("object-focus-style", "Object Focus Style");
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+ elm_win_focus_highlight_animate_set(win, EINA_TRUE);
+
+ fr = elm_frame_add(win);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, fr);
+ elm_object_style_set(fr, "pad_large");
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Button 1");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Button 2");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Button Glow In Focus Style");
+ elm_object_focus_highlight_style_set(bt, "glow");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Button 4");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+}
* @ingroup Focus
*/
EAPI Eina_Bool elm_object_tree_focus_allow_get(const Evas_Object *obj);
+
+/**
+ * Set the focus highlight style to be used by a given widget.
+ *
+ * @param obj The Elementary widget for which focus style needs to be set.
+ * @param style The name of the focus style to use on it.
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ *
+ * @note This overrides the style which is set
+ * by elm_win_focus_highlight_style_set().
+ *
+ * @see elm_object_focus_highlight_style_get
+ *
+ * @since 1.9
+ *
+ * @ingroup Focus
+ */
+EAPI Eina_Bool elm_object_focus_highlight_style_set(Evas_Object *obj, const char *style);
+
+/**
+ * Get the focus highlight style to be used by a given widget.
+ *
+ * @param obj The Elementary widget to query for its focus highlight style.
+ * @return The focus highlight style name used by widget.
+ *
+ * @see elm_object_focus_highlight_style_set()
+ *
+ * @since 1.9
+ *
+ * @ingroup Focus
+ */
+EAPI const char *elm_object_focus_highlight_style_get(const Evas_Object *obj);
+
return elm_widget_style_set(obj, style);
}
+EAPI Eina_Bool
+elm_object_focus_highlight_style_set(Evas_Object *obj,
+ const char *style)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+ return elm_widget_focus_highlight_style_set(obj, style);
+}
+
+EAPI const char *
+elm_object_focus_highlight_style_get(const Evas_Object *obj)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
+ return elm_widget_focus_highlight_style_get(obj);
+}
+
EAPI const char *
elm_object_style_get(const Evas_Object *obj)
{
}
}
+EAPI Eina_Bool
+elm_widget_focus_highlight_style_set(Evas_Object *obj, const char *style)
+{
+ ELM_WIDGET_CHECK(obj) EINA_FALSE;
+ Eina_Bool ret = EINA_FALSE;
+ eo_do(obj, elm_wdg_focus_highlight_style_set(style, &ret));
+ return ret;
+}
+
+static void
+_elm_widget_focus_highlight_style_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+ const char *style = va_arg(*list, const char *);
+ Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+ if (ret) *ret = EINA_FALSE;
+ Elm_Widget_Smart_Data *sd = _pd;
+ if (eina_stringshare_replace(&sd->focus_highlight_style, style))
+ {
+ if (ret) *ret = EINA_TRUE;
+ return;
+ }
+}
+
+EAPI const char *
+elm_widget_focus_highlight_style_get(const Evas_Object *obj)
+{
+ ELM_WIDGET_CHECK(obj) NULL;
+ const char *ret = NULL;
+ eo_do((Eo *) obj, elm_wdg_focus_highlight_style_get(&ret));
+ return ret;
+}
+
+static void
+_elm_widget_focus_highlight_style_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+ const char **ret = va_arg(*list, const char **);
+ Elm_Widget_Smart_Data *sd = _pd;
+ *ret = sd->focus_highlight_style;
+}
+
static void
_parent_focus(Evas_Object *obj)
{
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_ORDER_GET), _elm_widget_focus_order_get),
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_REGION_GET), _elm_widget_focus_region_get),
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_REGION_SHOW), _elm_widget_focus_region_show),
+ EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET), _elm_widget_focus_highlight_style_set),
+ EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET), _elm_widget_focus_highlight_style_get),
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME_OBJECT_SET), _elm_widget_theme_object_set),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_NEXT, "'Virtual' function handling passing focus to sub-objects."),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS, "'Virtual' function which checks if handling of passing focus to sub-objects in given direction is supported by widget."),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION,"'Virtual' function handling passing focus to sub-objects given a direction, in degrees."),
- EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_SUB_OBJECT_ADD, "'Virtual' function handling sub objects being added."),
+ EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_SUB_OBJECT_ADD, "'Virtual' function handling sub objects being added."),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_SUB_OBJECT_DEL, "'Virtual' function handling sub objects being removed."),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_ACCESS, "'Virtual' function on the widget being set access."),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_PARENT_SET, "'Virtual' function handling parent widget attachment to new object."),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_ORDER_GET, "description here"),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_REGION_GET, "Get the focus region of the given widget."),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_REGION_SHOW, "Show the focus region of the given widget."),
+ EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET, "Function to set the focus highlight style."),
+ EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET, "Function to get the focus highlight style."),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_THEME_OBJECT_SET, "description here"),
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_ORIENTATION_SET, "description here"),
double scale;
Elm_Theme *theme;
const char *style;
+ const char *focus_highlight_style; /**< custom focus style for a widget */
const char *access_info;
unsigned int focus_order;
Eina_Bool focus_order_on_calc;
EAPI Eina_Bool elm_widget_focus_list_next_get(const Evas_Object *obj, const Eina_List *items, void *(*list_data_get)(const Eina_List *list), Elm_Focus_Direction dir, Evas_Object **next);
EAPI Evas_Object *elm_widget_focus_next_object_get(const Evas_Object *obj, Elm_Focus_Direction dir);
EAPI void elm_widget_focus_next_object_set(Evas_Object *obj, Evas_Object *next, Elm_Focus_Direction dir);
+EAPI Eina_Bool elm_widget_focus_highlight_style_set(Evas_Object *obj, const char *style);
+EAPI const char *elm_widget_focus_highlight_style_get(const Evas_Object *obj);
EAPI void elm_widget_parent_highlight_set(Evas_Object *obj, Eina_Bool highlighted);
EAPI void elm_widget_focus_set(Evas_Object *obj, Eina_Bool focus);
EAPI void elm_widget_focused_object_clear(Evas_Object *obj);
ELM_WIDGET_SUB_ID_FOCUS_ORDER_GET,
ELM_WIDGET_SUB_ID_FOCUS_REGION_GET,
ELM_WIDGET_SUB_ID_FOCUS_REGION_SHOW,
+ ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET,
+ ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET,
ELM_WIDGET_SUB_ID_THEME_OBJECT_SET,
ELM_WIDGET_SUB_ID_ORIENTATION_SET,
#define elm_wdg_focus_region_show() ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_REGION_SHOW)
/**
+ * @def elm_wdg_focus_highlight_style_set
+ * @since 1.9
+ *
+ * This function set the widget focus highlight style.
+ *
+ * @param[in] style
+ * @param[out] ret
+ */
+#define elm_wdg_focus_highlight_style_set(style, ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET), EO_TYPECHECK(const char *, style), EO_TYPECHECK(Eina_Bool *, ret)
+
+/**
+ * @def elm_wdg_focus_highlight_style_get
+ * @since 1.9
+ *
+ * This function returns the widget focus highlight style.
+ *
+ * @param[out] ret
+ */
+#define elm_wdg_focus_highlight_style_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET), EO_TYPECHECK(const char **, ret)
+
+/**
* @def elm_wdg_theme_object_set
* @since 1.8
*
Eina_Bool visible_changed;
Eina_Bool common_visible;
const char *sig = NULL;
+ const char *focus_style_target = NULL;
+ const char *focus_style_previous = NULL;
_elm_win_focus_highlight_reconfigure_job_stop(sd);
if ((!target) || (!common_visible) || (sd->focus_highlight.cur.in_theme))
goto the_end;
- if (sd->focus_highlight.theme_changed)
+ focus_style_previous = elm_widget_focus_highlight_style_get(previous);
+ focus_style_target = elm_widget_focus_highlight_style_get(target);
+
+ if (sd->focus_highlight.theme_changed ||
+ (focus_style_target != focus_style_previous))
{
const char *str;
- if (sd->focus_highlight.style)
+
+ if (focus_style_target)
+ str = focus_style_target;
+ else if (sd->focus_highlight.style)
str = sd->focus_highlight.style;
else
str = "default";
+
elm_widget_theme_object_set
(sd->obj, fobj, "focus_highlight", "top", str);
sd->focus_highlight.theme_changed = EINA_FALSE;