2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
|
|
|
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
|
|
|
|
|
2016-04-11 09:51:15 -07:00
|
|
|
#define ELM_WIDGET_PROTECTED
|
2014-09-27 22:14:00 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2008-12-08 01:24:46 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
2016-10-18 03:34:12 -07:00
|
|
|
#include "elm_hoversel.eo.h"
|
|
|
|
#include "elm_hoversel_item.eo.h"
|
2012-08-01 14:04:20 -07:00
|
|
|
#include "elm_widget_hoversel.h"
|
2008-12-08 01:24:46 -08:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_HOVERSEL_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Hoversel"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_hoversel"
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2011-04-15 10:01:39 -07:00
|
|
|
static const char SIG_SELECTED[] = "selected";
|
|
|
|
static const char SIG_DISMISSED[] = "dismissed";
|
2013-12-28 00:48:11 -08:00
|
|
|
static const char SIG_EXPANDED[] = "expanded";
|
2014-02-18 19:36:35 -08:00
|
|
|
static const char SIG_ITEM_FOCUSED[] = "item,focused";
|
|
|
|
static const char SIG_ITEM_UNFOCUSED[] = "item,unfocused";
|
2016-10-14 03:37:46 -07:00
|
|
|
static const char SIG_CLICKED[] = "clicked";
|
2014-02-18 19:36:35 -08:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2011-04-15 10:01:39 -07:00
|
|
|
{SIG_SELECTED, ""},
|
|
|
|
{SIG_DISMISSED, ""},
|
2013-12-28 00:48:11 -08:00
|
|
|
{SIG_EXPANDED, ""},
|
2014-02-18 19:36:35 -08:00
|
|
|
{SIG_ITEM_FOCUSED, ""},
|
|
|
|
{SIG_ITEM_UNFOCUSED, ""},
|
2016-10-14 03:37:46 -07:00
|
|
|
{SIG_CLICKED, ""}, /**< handled by parent button class */
|
2014-01-23 03:07:20 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2011-04-15 10:01:39 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2014-04-14 22:40:38 -07:00
|
|
|
static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
|
2015-07-29 13:23:00 -07:00
|
|
|
static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params);
|
2016-02-02 02:57:20 -08:00
|
|
|
static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
|
2014-04-14 22:40:38 -07:00
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"move", _key_action_move},
|
2015-07-29 13:23:00 -07:00
|
|
|
{"activate", _key_action_activate},
|
2016-02-02 02:57:20 -08:00
|
|
|
{"escape", _key_action_escape},
|
2014-04-14 22:40:38 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2017-08-30 02:47:21 -07:00
|
|
|
EOLIAN static void
|
2017-09-21 23:13:16 -07:00
|
|
|
_elm_hoversel_efl_ui_translatable_translation_update(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
|
2013-04-23 04:30:15 -07:00
|
|
|
{
|
2014-09-27 22:14:00 -07:00
|
|
|
Eo *it;
|
2013-04-23 04:30:15 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->items, l, it)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_translate(it);
|
2013-04-23 04:30:15 -07:00
|
|
|
|
2017-09-21 23:13:16 -07:00
|
|
|
efl_ui_translatable_translation_update(efl_super(obj, MY_CLASS));
|
2013-04-23 04:30:15 -07:00
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_elm_widget_theme_apply(Eo *obj, Elm_Hoversel_Data *sd)
|
2009-11-13 14:22:05 -08:00
|
|
|
{
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
|
2015-11-09 12:18:49 -08:00
|
|
|
Eina_List *l;
|
|
|
|
Elm_Object_Item *eo_item;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
char buf[4096];
|
|
|
|
const char *style;
|
2008-12-08 01:24:46 -08:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
style = eina_stringshare_add(elm_widget_style_get(obj));
|
2011-02-10 07:13:05 -08:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
if (sd->horizontal)
|
|
|
|
snprintf(buf, sizeof(buf), "hoversel_horizontal/%s", style);
|
2010-01-18 02:28:00 -08:00
|
|
|
else
|
2012-05-03 15:43:00 -07:00
|
|
|
snprintf(buf, sizeof(buf), "hoversel_vertical/%s", style);
|
2010-10-05 12:09:52 -07:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
/* hoversel's style has an extra bit: orientation */
|
2012-11-25 22:32:53 -08:00
|
|
|
eina_stringshare_replace(&(wd->style), buf);
|
2012-05-02 09:59:40 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
int_ret = elm_obj_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2017-08-09 00:13:06 -07:00
|
|
|
if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
|
2012-05-02 09:59:40 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
eina_stringshare_replace(&(wd->style), style);
|
2012-05-02 09:59:40 -07:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
if (sd->hover)
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_set(sd->hover, efl_ui_mirrored_get(obj));
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2015-11-09 12:18:49 -08:00
|
|
|
if (sd->horizontal)
|
|
|
|
snprintf(buf, sizeof(buf), "hoversel_horizontal_entry/%s", style);
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "hoversel_vertical_entry/%s", style);
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
|
|
|
{
|
|
|
|
ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
|
|
|
|
elm_object_style_set(VIEW(item), buf);
|
|
|
|
elm_object_text_set(VIEW(item), item->label);
|
2015-11-10 15:15:29 -08:00
|
|
|
elm_widget_disabled_set
|
2016-03-02 04:10:48 -08:00
|
|
|
(VIEW(item), elm_wdg_item_disabled_get(eo_item));
|
2015-11-09 12:18:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
eina_stringshare_del(style);
|
2012-05-03 15:43:00 -07:00
|
|
|
elm_hoversel_hover_end(obj);
|
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2008-12-08 01:24:46 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_hover_clicked(void *data, const Efl_Event *event)
|
2008-12-08 01:24:46 -08:00
|
|
|
{
|
2015-10-12 13:22:26 -07:00
|
|
|
const char *dismissstr;
|
|
|
|
|
2016-05-18 08:17:36 -07:00
|
|
|
dismissstr = elm_layout_data_get(event->object, "dismiss");
|
2015-10-12 13:22:26 -07:00
|
|
|
|
|
|
|
if (!dismissstr || strcmp(dismissstr, "on"))
|
|
|
|
elm_hoversel_hover_end(data); // for backward compatibility
|
2008-12-08 01:24:46 -08:00
|
|
|
}
|
|
|
|
|
2016-01-04 15:17:23 -08:00
|
|
|
static void
|
|
|
|
_auto_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2008-12-15 16:15:34 -08:00
|
|
|
{
|
2014-09-27 22:14:00 -07:00
|
|
|
Elm_Hoversel_Item_Data *item = data;
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj2 = WIDGET(item);
|
2009-09-27 13:10:03 -07:00
|
|
|
|
2015-10-04 06:09:22 -07:00
|
|
|
ELM_HOVERSEL_DATA_GET(obj2, sd);
|
|
|
|
|
2015-10-19 11:41:14 -07:00
|
|
|
if (sd->auto_update)
|
2015-10-04 06:09:22 -07:00
|
|
|
{
|
|
|
|
Evas_Object *ic;
|
|
|
|
|
|
|
|
ic = elm_object_part_content_unset(obj2, "icon");
|
|
|
|
ELM_SAFE_FREE(ic, evas_object_del);
|
|
|
|
|
|
|
|
if (item->icon_file)
|
|
|
|
{
|
|
|
|
ic = elm_icon_add(obj2);
|
|
|
|
elm_image_resizable_set(ic, EINA_FALSE, EINA_TRUE);
|
|
|
|
if (item->icon_type == ELM_ICON_FILE)
|
|
|
|
elm_image_file_set(ic, item->icon_file, item->icon_group);
|
|
|
|
else if (item->icon_type == ELM_ICON_STANDARD)
|
|
|
|
elm_icon_standard_set(ic, item->icon_file);
|
|
|
|
elm_object_part_content_set(obj2, "icon", ic);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(item->label)
|
|
|
|
elm_object_text_set(obj2, item->label);
|
2017-04-19 10:41:08 -07:00
|
|
|
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Object_Item *eo_item;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
|
|
|
{
|
|
|
|
if (eo_item == EO_OBJ(item))
|
|
|
|
elm_wdg_item_signal_emit(eo_item, "elm,state,selected", "elm");
|
|
|
|
else
|
|
|
|
elm_wdg_item_signal_emit(eo_item, "elm,state,unselected", "elm");
|
|
|
|
}
|
2015-10-04 06:09:22 -07:00
|
|
|
}
|
2016-01-04 15:17:23 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_item_clicked(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
2016-01-04 15:17:23 -08:00
|
|
|
{
|
|
|
|
Elm_Hoversel_Item_Data *item = data;
|
|
|
|
Evas_Object *obj2 = WIDGET(item);
|
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(item);
|
|
|
|
|
|
|
|
ELM_HOVERSEL_DATA_GET(obj2, sd);
|
|
|
|
|
|
|
|
if (item->func) item->func((void *)WIDGET_ITEM_DATA_GET(eo_it), obj2, eo_it);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj2, EFL_UI_EVENT_SELECTED, eo_it);
|
2016-01-04 15:17:23 -08:00
|
|
|
|
|
|
|
evas_object_event_callback_add(sd->hover, EVAS_CALLBACK_DEL, _auto_update, item);
|
2015-10-04 06:09:22 -07:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
elm_hoversel_hover_end(obj2);
|
2008-12-15 16:15:34 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_item_focused_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
2014-02-18 19:36:35 -08:00
|
|
|
{
|
2014-09-27 22:14:00 -07:00
|
|
|
Elm_Hoversel_Item_Data *it = data;
|
2014-02-18 19:36:35 -08:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_HOVERSEL_EVENT_ITEM_FOCUSED, EO_OBJ(it));
|
2014-02-18 19:36:35 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_item_unfocused_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
2014-02-18 19:36:35 -08:00
|
|
|
{
|
2014-09-27 22:14:00 -07:00
|
|
|
Elm_Hoversel_Item_Data *it = data;
|
2014-02-18 19:36:35 -08:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_HOVERSEL_EVENT_ITEM_UNFOCUSED, EO_OBJ(it));
|
2014-02-18 19:36:35 -08:00
|
|
|
}
|
|
|
|
|
2015-10-04 05:55:21 -07:00
|
|
|
static void
|
|
|
|
_create_scroller(Evas_Object *obj, Elm_Hoversel_Data *sd)
|
|
|
|
{
|
|
|
|
//table
|
|
|
|
sd->tbl = elm_table_add(obj);
|
2016-01-20 04:29:12 -08:00
|
|
|
evas_object_size_hint_align_set(sd->tbl, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_weight_set(sd->tbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2015-10-04 05:55:21 -07:00
|
|
|
|
|
|
|
//spacer
|
|
|
|
sd->spacer = evas_object_rectangle_add(evas_object_evas_get(obj));
|
2016-01-20 04:29:12 -08:00
|
|
|
evas_object_size_hint_align_set(sd->spacer, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_weight_set(sd->spacer, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2015-10-04 05:55:21 -07:00
|
|
|
evas_object_color_set(sd->spacer, 0, 0, 0, 0);
|
|
|
|
elm_table_pack(sd->tbl, sd->spacer, 0, 0, 1, 1);
|
|
|
|
|
|
|
|
//Scroller
|
|
|
|
sd->scr = elm_scroller_add(sd->tbl);
|
|
|
|
elm_object_style_set(sd->scr, "popup/no_inset_shadow");
|
|
|
|
evas_object_size_hint_weight_set(sd->scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(sd->scr, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
|
|
|
elm_scroller_policy_set(sd->scr, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
|
|
|
|
elm_scroller_content_min_limit(sd->scr, EINA_FALSE, EINA_TRUE);
|
|
|
|
elm_scroller_bounce_set(sd->scr, EINA_TRUE, EINA_FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_scroller_policy_set(sd->scr, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
|
|
|
|
elm_scroller_content_min_limit(sd->scr, EINA_TRUE, EINA_FALSE);
|
|
|
|
elm_scroller_bounce_set(sd->scr, EINA_FALSE, EINA_TRUE);
|
|
|
|
}
|
|
|
|
elm_table_pack(sd->tbl, sd->scr, 0, 0, 1, 1);
|
|
|
|
evas_object_show(sd->scr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-06-11 23:27:23 -07:00
|
|
|
_sizing_eval(void *data)
|
2015-10-04 05:55:21 -07:00
|
|
|
{
|
2017-06-11 23:27:23 -07:00
|
|
|
Evas_Object *obj = data;
|
2015-10-04 05:55:21 -07:00
|
|
|
const char *max_size_str;
|
|
|
|
int max_size = 0;
|
|
|
|
char buf[128];
|
|
|
|
Evas_Coord box_w = -1, box_h = -1;
|
2017-06-11 23:55:25 -07:00
|
|
|
Eina_Rectangle base, adjusted, parent;
|
2015-10-04 05:55:21 -07:00
|
|
|
|
2017-06-11 23:27:23 -07:00
|
|
|
ELM_HOVERSEL_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->resize_job)
|
|
|
|
sd->resize_job = NULL;
|
|
|
|
|
2016-01-20 04:29:12 -08:00
|
|
|
if ((!sd->expanded) || (!sd->bx)) return;
|
2015-10-04 05:55:21 -07:00
|
|
|
|
2017-01-12 16:30:28 -08:00
|
|
|
elm_layout_signal_emit(sd->hover, "elm,state,align,default", "elm");
|
|
|
|
edje_object_message_signal_process(elm_layout_edje_get(sd->hover));
|
|
|
|
|
2016-01-20 04:29:12 -08:00
|
|
|
elm_box_recalculate(sd->bx);
|
2017-09-18 00:22:01 -07:00
|
|
|
evas_object_size_hint_combined_min_get(sd->bx, &box_w, &box_h);
|
2015-10-04 05:55:21 -07:00
|
|
|
|
2015-11-09 12:23:18 -08:00
|
|
|
max_size_str = elm_layout_data_get(sd->hover, "max_size");
|
2015-10-04 05:55:21 -07:00
|
|
|
if (max_size_str)
|
|
|
|
max_size = (int)(atoi(max_size_str)
|
|
|
|
* elm_config_scale_get()
|
|
|
|
* elm_object_scale_get(obj))
|
|
|
|
/ edje_object_base_scale_get(elm_layout_edje_get(sd->hover));
|
|
|
|
|
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
2017-06-11 23:55:25 -07:00
|
|
|
adjusted.w = (max_size > 0) ? MIN(box_w, max_size) : box_w ;
|
|
|
|
adjusted.h = box_h;
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-06-11 23:55:25 -07:00
|
|
|
adjusted.w = box_w;
|
|
|
|
adjusted.h = (max_size > 0) ? MIN(box_h, max_size) : box_h ;
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
|
|
|
|
2017-06-11 23:55:25 -07:00
|
|
|
evas_object_size_hint_min_set(sd->spacer, adjusted.w, adjusted.h);
|
|
|
|
if (!sd->last_location)
|
|
|
|
sd->last_location = elm_hover_best_content_location_get(sd->hover, !sd->horizontal + 1);
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->hover_parent, &parent.x, &parent.y, &parent.w, &parent.h);
|
2016-08-15 06:44:41 -07:00
|
|
|
if (efl_isa(sd->hover_parent, EFL_UI_WIN_CLASS))
|
2015-10-04 05:55:21 -07:00
|
|
|
{
|
2017-06-11 23:55:25 -07:00
|
|
|
parent.x = 0;
|
|
|
|
parent.y = 0;
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", sd->last_location);
|
2017-06-11 23:55:25 -07:00
|
|
|
edje_object_part_geometry_get(elm_layout_edje_get(sd->hover), buf, &adjusted.x, &adjusted.y, NULL, NULL);
|
|
|
|
adjusted.x += parent.x;
|
|
|
|
adjusted.y += parent.y;
|
2015-10-04 05:55:21 -07:00
|
|
|
|
2017-06-11 23:55:25 -07:00
|
|
|
evas_object_geometry_get(obj, &base.x, &base.y, &base.w, NULL);
|
2016-01-20 04:29:12 -08:00
|
|
|
|
2015-10-04 05:55:21 -07:00
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
2016-12-16 15:02:06 -08:00
|
|
|
if (!strcmp(sd->last_location, "left"))
|
2015-10-04 05:55:21 -07:00
|
|
|
{
|
2017-06-11 23:55:25 -07:00
|
|
|
adjusted.x = parent.x;
|
|
|
|
if ((adjusted.x + adjusted.w) > base.x)
|
|
|
|
adjusted.w = base.x - adjusted.x;
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-06-11 23:55:25 -07:00
|
|
|
if ((adjusted.x + adjusted.w) > (parent.x + parent.w))
|
|
|
|
adjusted.w = (parent.x + parent.w) - adjusted.x;
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
|
|
|
|
2017-06-11 23:55:25 -07:00
|
|
|
if (adjusted.y < 0) adjusted.y = parent.y;
|
|
|
|
if ((adjusted.y + adjusted.h) > (parent.y + parent.h))
|
|
|
|
adjusted.h = (parent.y + parent.h) - adjusted.y;
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-12-16 15:02:06 -08:00
|
|
|
if (!strcmp(sd->last_location, "top"))
|
2015-10-04 05:55:21 -07:00
|
|
|
{
|
2017-06-11 23:55:25 -07:00
|
|
|
adjusted.y = parent.y;
|
|
|
|
if ((adjusted.y + adjusted.h) > base.y)
|
|
|
|
adjusted.h = base.y - adjusted.y;
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-06-11 23:55:25 -07:00
|
|
|
if ((adjusted.y + adjusted.h) > (parent.y + parent.h))
|
|
|
|
adjusted.h = (parent.y + parent.h) - adjusted.y;
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
|
|
|
|
2017-06-11 23:55:25 -07:00
|
|
|
if (adjusted.x < 0) adjusted.x = parent.x;
|
|
|
|
if ((adjusted.x + adjusted.w) > (parent.x + parent.w))
|
2016-01-04 15:08:49 -08:00
|
|
|
{
|
2017-09-25 02:21:58 -07:00
|
|
|
if ((base.x + base.w) > (parent.x + parent.w))
|
2016-01-04 15:08:49 -08:00
|
|
|
{
|
2017-06-13 03:41:15 -07:00
|
|
|
if (efl_ui_mirrored_get(obj))
|
2017-06-11 23:55:25 -07:00
|
|
|
elm_object_signal_emit(sd->hover, "elm,state,align,right", "elm");
|
2017-04-06 14:28:43 -07:00
|
|
|
else
|
2017-06-11 23:55:25 -07:00
|
|
|
elm_object_signal_emit(sd->hover, "elm,state,align,default", "elm");
|
2017-04-06 14:28:43 -07:00
|
|
|
|
2017-06-11 23:55:25 -07:00
|
|
|
if ((base.x + base.w - adjusted.w) < parent.x)
|
|
|
|
adjusted.w = base.x + base.w - parent.x;
|
2016-01-04 15:08:49 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-06-13 03:41:15 -07:00
|
|
|
if (efl_ui_mirrored_get(obj))
|
2017-06-11 23:55:25 -07:00
|
|
|
elm_object_signal_emit(sd->hover, "elm,state,align,default", "elm");
|
2017-04-06 14:28:43 -07:00
|
|
|
else
|
2017-06-11 23:55:25 -07:00
|
|
|
elm_object_signal_emit(sd->hover, "elm,state,align,right", "elm");
|
2017-04-06 14:28:43 -07:00
|
|
|
|
2017-06-11 23:55:25 -07:00
|
|
|
adjusted.w = (parent.x + parent.w) - adjusted.x;
|
2016-01-04 15:08:49 -08:00
|
|
|
}
|
|
|
|
}
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
2017-06-11 23:55:25 -07:00
|
|
|
evas_object_size_hint_min_set(sd->spacer, adjusted.w, adjusted.h);
|
2015-10-04 05:55:21 -07:00
|
|
|
}
|
|
|
|
|
2015-11-09 16:05:05 -08:00
|
|
|
static void
|
|
|
|
_hover_del(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_item;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
ELM_HOVERSEL_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
sd->expanded = EINA_FALSE;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
|
|
|
{
|
|
|
|
ELM_HOVERSEL_ITEM_DATA_GET(eo_item, it);
|
|
|
|
elm_box_unpack(sd->bx, VIEW(it));
|
|
|
|
evas_object_hide(VIEW(it));
|
|
|
|
}
|
|
|
|
ELM_SAFE_FREE(sd->hover, evas_object_del);
|
|
|
|
sd->bx = NULL;
|
|
|
|
sd->scr = NULL;
|
|
|
|
sd->last_location = NULL;
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_HOVERSEL_EVENT_DISMISSED, NULL);
|
2015-11-09 16:05:05 -08:00
|
|
|
}
|
|
|
|
|
2015-10-12 13:22:26 -07:00
|
|
|
static void
|
|
|
|
_hover_end_finished(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
const char *dismissstr;
|
|
|
|
|
|
|
|
ELM_HOVERSEL_DATA_GET(data, sd);
|
|
|
|
|
2015-11-09 12:23:18 -08:00
|
|
|
dismissstr = elm_layout_data_get(sd->hover, "dismiss");
|
2015-10-12 13:22:26 -07:00
|
|
|
|
|
|
|
if (dismissstr && !strcmp(dismissstr, "on"))
|
|
|
|
{
|
2015-11-09 16:05:05 -08:00
|
|
|
_hover_del(data);
|
2015-10-12 13:22:26 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-25 13:33:36 -07:00
|
|
|
static char *
|
|
|
|
_access_info_cb(void *data, Evas_Object *obj)
|
|
|
|
{
|
|
|
|
const char *txt;
|
|
|
|
Elm_Hoversel_Item_Data *it;
|
|
|
|
|
|
|
|
if (data != NULL)
|
|
|
|
{
|
|
|
|
it = (Elm_Hoversel_Item_Data *)data;
|
|
|
|
if (it->label) return strdup(it->label);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
txt = elm_widget_access_info_get(obj);
|
|
|
|
if (!txt) txt = elm_layout_text_get(obj, NULL);
|
|
|
|
if (txt) return strdup(txt);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_widget_item_register(Elm_Hoversel_Data *sd)
|
|
|
|
{
|
|
|
|
const Eina_List *l;
|
|
|
|
Elm_Object_Item *eo_item;
|
|
|
|
Elm_Access_Info *ai;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
|
|
|
{
|
|
|
|
ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
|
|
|
|
_elm_access_widget_item_register(item->base);
|
|
|
|
ai = _elm_access_info_get(item->base->access_obj);
|
|
|
|
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_access_state_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
|
|
|
{
|
|
|
|
if (elm_widget_disabled_get(obj))
|
|
|
|
return strdup(E_("State: Disabled"));
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-12-09 22:33:24 -08:00
|
|
|
static void
|
2009-03-19 06:36:46 -07:00
|
|
|
_activate(Evas_Object *obj)
|
2008-12-09 22:33:24 -08:00
|
|
|
{
|
2014-09-27 22:14:00 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
2009-09-02 05:48:00 -07:00
|
|
|
char buf[4096];
|
2009-02-25 11:50:45 -08:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
ELM_HOVERSEL_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->expanded)
|
2010-09-22 10:45:49 -07:00
|
|
|
{
|
|
|
|
elm_hoversel_hover_end(obj);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-09-27 13:10:03 -07:00
|
|
|
if (elm_widget_disabled_get(obj)) return;
|
2016-01-08 03:50:01 -08:00
|
|
|
if (!sd->items) return;
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2016-06-30 11:12:52 -07:00
|
|
|
sd->expanded = EINA_TRUE;
|
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
sd->hover = elm_hover_add(sd->hover_parent);
|
2013-04-02 11:11:34 -07:00
|
|
|
elm_widget_sub_object_add(obj, sd->hover);
|
2016-02-24 12:02:11 -08:00
|
|
|
evas_object_layer_set(sd->hover, evas_object_layer_get(sd->hover_parent));
|
2012-05-03 15:43:00 -07:00
|
|
|
|
|
|
|
if (sd->horizontal)
|
|
|
|
snprintf(buf, sizeof(buf), "hoversel_horizontal/%s",
|
|
|
|
elm_widget_style_get(obj));
|
2010-01-18 02:28:00 -08:00
|
|
|
else
|
2012-05-03 15:43:00 -07:00
|
|
|
snprintf(buf, sizeof(buf), "hoversel_vertical/%s",
|
|
|
|
elm_widget_style_get(obj));
|
2008-12-09 22:33:24 -08:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
elm_object_style_set(sd->hover, buf);
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-06-10 01:29:40 -07:00
|
|
|
(sd->hover, EFL_UI_EVENT_CLICKED, _on_hover_clicked, obj);
|
2015-10-12 13:22:26 -07:00
|
|
|
elm_layout_signal_callback_add
|
|
|
|
(sd->hover, "elm,action,hide,finished", "elm", _hover_end_finished, obj);
|
2012-05-03 15:43:00 -07:00
|
|
|
elm_hover_target_set(sd->hover, obj);
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
/* hover's content */
|
2015-11-09 12:18:49 -08:00
|
|
|
sd->bx = elm_box_add(sd->hover);
|
|
|
|
elm_box_homogeneous_set(sd->bx, EINA_TRUE);
|
|
|
|
elm_box_horizontal_set(sd->bx, sd->horizontal);
|
2016-01-20 04:29:12 -08:00
|
|
|
evas_object_size_hint_align_set(sd->bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_weight_set(sd->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
2008-12-15 16:15:34 -08:00
|
|
|
{
|
2014-09-27 22:14:00 -07:00
|
|
|
ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
|
2015-11-09 12:18:49 -08:00
|
|
|
evas_object_show(VIEW(item));
|
|
|
|
elm_box_pack_end(sd->bx, VIEW(item));
|
2008-12-15 16:15:34 -08:00
|
|
|
}
|
2008-12-09 22:33:24 -08:00
|
|
|
|
2015-10-29 20:09:28 -07:00
|
|
|
_create_scroller(obj, sd);
|
2015-11-09 12:18:49 -08:00
|
|
|
elm_object_content_set(sd->scr, sd->bx);
|
2015-08-04 06:51:36 -07:00
|
|
|
|
2017-06-11 23:27:23 -07:00
|
|
|
if (sd->resize_job)
|
|
|
|
ELM_SAFE_FREE(sd->resize_job, ecore_job_del);
|
|
|
|
_sizing_eval(obj);
|
2015-10-29 20:09:28 -07:00
|
|
|
elm_object_part_content_set(sd->hover, sd->last_location, sd->tbl);
|
2010-09-22 10:45:43 -07:00
|
|
|
|
2016-10-25 13:33:36 -07:00
|
|
|
if (_elm_config->access_mode) _access_widget_item_register(sd);
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_HOVERSEL_EVENT_EXPANDED, NULL);
|
2012-05-03 15:43:00 -07:00
|
|
|
evas_object_show(sd->hover);
|
2008-12-09 22:33:24 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_clicked(void *data, const Efl_Event *event EINA_UNUSED)
|
2008-12-08 01:24:46 -08:00
|
|
|
{
|
2012-05-02 18:19:05 -07:00
|
|
|
_activate(data);
|
2011-06-29 22:43:56 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_parent_del(void *data, const Efl_Event *ev EINA_UNUSED)
|
2011-06-29 22:43:56 -07:00
|
|
|
{
|
2012-05-24 07:08:18 -07:00
|
|
|
elm_hoversel_hover_parent_set(data, NULL);
|
2011-12-19 18:44:46 -08:00
|
|
|
}
|
|
|
|
|
2015-11-10 15:15:29 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_hoversel_item_elm_widget_item_disable(Eo *eo_hoversel_it,
|
|
|
|
Elm_Hoversel_Item_Data *hoversel_it EINA_UNUSED)
|
|
|
|
{
|
|
|
|
elm_widget_disabled_set
|
2016-03-02 04:10:48 -08:00
|
|
|
(VIEW(hoversel_it), elm_wdg_item_disabled_get(eo_hoversel_it));
|
2015-11-10 15:15:29 -08:00
|
|
|
}
|
|
|
|
|
2015-09-15 18:44:45 -07:00
|
|
|
static void
|
|
|
|
_elm_hoversel_item_elm_widget_item_part_text_set(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Hoversel_Item_Data *it,
|
|
|
|
const char *part,
|
|
|
|
const char *label)
|
|
|
|
{
|
|
|
|
if (part && strcmp(part, "default")) return;
|
|
|
|
eina_stringshare_replace(&it->label, label);
|
|
|
|
|
|
|
|
if (VIEW(it))
|
|
|
|
elm_object_text_set(VIEW(it), label);
|
|
|
|
}
|
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
static const char *
|
2014-09-27 22:14:00 -07:00
|
|
|
_elm_hoversel_item_elm_widget_item_part_text_get(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Hoversel_Item_Data *it,
|
|
|
|
const char *part)
|
2011-12-19 18:44:46 -08:00
|
|
|
{
|
2012-05-03 15:43:00 -07:00
|
|
|
if (part && strcmp(part, "default")) return NULL;
|
2014-09-27 22:14:00 -07:00
|
|
|
return it->label;
|
2011-12-19 18:44:46 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_hoversel_item_elm_widget_item_signal_emit(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Hoversel_Item_Data *it,
|
|
|
|
const char *emission,
|
|
|
|
const char *source)
|
2013-10-13 21:53:27 -07:00
|
|
|
{
|
2014-02-02 21:58:08 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), emission, source);
|
2013-10-13 21:53:27 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_hoversel_item_elm_widget_item_style_set(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Hoversel_Item_Data *it,
|
|
|
|
const char *style)
|
2013-12-27 03:00:03 -08:00
|
|
|
{
|
2014-02-02 21:58:08 -08:00
|
|
|
elm_object_style_set(VIEW(it), style);
|
2013-12-27 03:00:03 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
EOLIAN static const char *
|
|
|
|
_elm_hoversel_item_elm_widget_item_style_get(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Hoversel_Item_Data *it)
|
2013-12-27 03:00:03 -08:00
|
|
|
{
|
2014-02-02 21:58:08 -08:00
|
|
|
return elm_object_style_get(VIEW(it));
|
2013-12-27 03:00:03 -08:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:24:35 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_hoversel_item_elm_widget_item_focus_set(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Hoversel_Item_Data *it,
|
|
|
|
Eina_Bool focused)
|
|
|
|
{
|
2015-07-30 03:40:47 -07:00
|
|
|
elm_object_focus_set(VIEW(it), focused);
|
2015-05-19 05:24:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_hoversel_item_elm_widget_item_focus_get(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Hoversel_Item_Data *it)
|
|
|
|
{
|
|
|
|
return elm_widget_focus_get(VIEW(it));
|
|
|
|
}
|
|
|
|
|
2014-09-17 06:44:05 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_hoversel_item_efl_object_destructor(Eo *eo_item, Elm_Hoversel_Item_Data *item)
|
2011-12-19 18:44:46 -08:00
|
|
|
{
|
2014-09-17 06:44:05 -07:00
|
|
|
ELM_HOVERSEL_DATA_GET_OR_RETURN(WIDGET(item), sd);
|
2012-05-02 09:59:40 -07:00
|
|
|
|
2012-05-03 15:43:00 -07:00
|
|
|
elm_hoversel_hover_end(WIDGET(item));
|
2014-09-27 22:14:00 -07:00
|
|
|
sd->items = eina_list_remove(sd->items, eo_item);
|
2012-05-03 15:43:00 -07:00
|
|
|
eina_stringshare_del(item->label);
|
|
|
|
eina_stringshare_del(item->icon_file);
|
|
|
|
eina_stringshare_del(item->icon_group);
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_destructor(efl_super(eo_item, ELM_HOVERSEL_ITEM_CLASS));
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-05-02 09:59:40 -07:00
|
|
|
|
2015-08-04 06:51:36 -07:00
|
|
|
static void
|
2017-06-11 23:27:23 -07:00
|
|
|
_on_geometry_changed(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
2015-08-04 06:51:36 -07:00
|
|
|
{
|
2017-06-11 23:27:23 -07:00
|
|
|
Elm_Hoversel_Data *pd = data;
|
2015-08-04 06:51:36 -07:00
|
|
|
|
2017-06-11 23:27:23 -07:00
|
|
|
if (pd->resize_job)
|
|
|
|
ELM_SAFE_FREE(pd->resize_job, ecore_job_del);
|
|
|
|
|
|
|
|
pd->resize_job = ecore_job_add(_sizing_eval, obj);
|
2015-08-04 06:51:36 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_on_parent_resize(void *data, const Efl_Event *ev EINA_UNUSED)
|
2016-06-08 13:24:35 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = (Evas_Object *)data;
|
2017-06-11 23:27:23 -07:00
|
|
|
ELM_HOVERSEL_DATA_GET(obj, pd);
|
|
|
|
|
|
|
|
_on_geometry_changed(pd, NULL, obj, NULL);
|
2016-06-08 13:24:35 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static void
|
2017-06-11 23:27:23 -07:00
|
|
|
_elm_hoversel_efl_canvas_group_group_add(Eo *obj, Elm_Hoversel_Data *pd)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 08:29:45 -07:00
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _on_clicked, obj);
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2013-08-26 08:29:45 -07:00
|
|
|
//What are you doing here?
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_widget_theme_apply(obj);
|
2015-10-04 05:55:21 -07:00
|
|
|
|
2017-06-11 23:27:23 -07:00
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _on_geometry_changed, pd);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _on_geometry_changed, pd);
|
2016-10-25 13:33:36 -07:00
|
|
|
|
|
|
|
_elm_access_text_set
|
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Hoversel"));
|
|
|
|
_elm_access_callback_set
|
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
|
|
|
_elm_access_callback_set
|
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, obj);
|
2011-12-19 18:44:46 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_hoversel_efl_canvas_group_group_del(Eo *obj, Elm_Hoversel_Data *sd)
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
{
|
2014-09-27 22:14:00 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
EINA_LIST_FREE(sd->items, eo_item)
|
2012-05-03 15:43:00 -07:00
|
|
|
{
|
2015-11-09 12:18:49 -08:00
|
|
|
ELM_HOVERSEL_ITEM_DATA_GET(eo_item, it);
|
|
|
|
ELM_SAFE_FREE(VIEW(it), evas_object_del);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_del(eo_item);
|
2012-05-03 15:43:00 -07:00
|
|
|
}
|
2012-05-23 19:26:55 -07:00
|
|
|
elm_hoversel_hover_parent_set(obj, NULL);
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-01-27 03:56:14 -08:00
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static void
|
2016-10-10 02:59:42 -07:00
|
|
|
_elm_hoversel_efl_gfx_visible_set(Eo *obj, Elm_Hoversel_Data *sd, Eina_Bool vis)
|
2013-04-02 22:46:14 -07:00
|
|
|
{
|
2016-10-10 02:59:42 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
|
|
|
|
return;
|
2013-04-02 22:46:14 -07:00
|
|
|
|
2016-10-10 02:59:42 -07:00
|
|
|
efl_gfx_visible_set(efl_super(obj, MY_CLASS), vis);
|
|
|
|
efl_gfx_visible_set(sd->hover, vis);
|
2013-04-02 22:46:14 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static void
|
2016-04-11 09:51:15 -07:00
|
|
|
_elm_hoversel_elm_widget_widget_parent_set(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED, Evas_Object *parent)
|
2012-07-18 14:03:39 -07:00
|
|
|
{
|
|
|
|
elm_hoversel_hover_parent_set(obj, parent);
|
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-05-16 18:28:49 -07:00
|
|
|
_elm_hoversel_efl_ui_autorepeat_autorepeat_supported_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd EINA_UNUSED)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2014-03-23 02:59:22 -07:00
|
|
|
return EINA_FALSE;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
}
|
|
|
|
|
2008-12-08 01:24:46 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_hoversel_add(Evas_Object *parent)
|
|
|
|
{
|
2012-05-03 15:43:00 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-07-06 00:47:41 -07:00
|
|
|
return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_hoversel_efl_object_constructor(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_PUSH_BUTTON);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2008-12-08 01:24:46 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_hoversel_efl_object_destructor(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED)
|
2014-09-27 22:14:00 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_hoversel_clear(obj);
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_destructor(efl_super(obj, MY_CLASS));
|
2014-09-27 22:14:00 -07:00
|
|
|
}
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(_on_parent,
|
2016-08-10 07:23:04 -07:00
|
|
|
{ EFL_EVENT_DEL, _on_parent_del },
|
2016-06-13 22:24:43 -07:00
|
|
|
{ EFL_GFX_EVENT_RESIZE, _on_parent_resize });
|
2016-06-08 13:47:19 -07:00
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_hover_parent_set(Eo *obj, Elm_Hoversel_Data *sd, Evas_Object *parent)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:43:00 -07:00
|
|
|
if (sd->hover_parent)
|
2016-06-08 13:24:35 -07:00
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_array_del(sd->hover_parent, _on_parent(), obj);
|
2016-06-08 13:24:35 -07:00
|
|
|
}
|
2012-05-03 15:43:00 -07:00
|
|
|
|
|
|
|
sd->hover_parent = parent;
|
|
|
|
if (sd->hover_parent)
|
2016-06-08 13:24:35 -07:00
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_array_add(sd->hover_parent, _on_parent(), obj);
|
2016-06-08 13:24:35 -07:00
|
|
|
}
|
2008-12-08 01:24:46 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_hover_parent_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
|
2010-10-14 11:54:42 -07:00
|
|
|
{
|
2014-03-23 02:59:22 -07:00
|
|
|
return sd->hover_parent;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_horizontal_set(Eo *obj, Elm_Hoversel_Data *sd, Eina_Bool horizontal)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:43:00 -07:00
|
|
|
sd->horizontal = !!horizontal;
|
|
|
|
|
2015-10-04 05:55:21 -07:00
|
|
|
if (sd->scr)
|
2015-08-04 06:51:36 -07:00
|
|
|
{
|
2015-10-04 05:55:21 -07:00
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
|
|
|
elm_scroller_policy_set(sd->scr, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
|
|
|
|
elm_scroller_content_min_limit(sd->scr, EINA_FALSE, EINA_TRUE);
|
|
|
|
elm_scroller_bounce_set(sd->scr, EINA_TRUE, EINA_FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_scroller_policy_set(sd->scr, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
|
|
|
|
elm_scroller_content_min_limit(sd->scr, EINA_TRUE, EINA_FALSE);
|
|
|
|
elm_scroller_bounce_set(sd->scr, EINA_FALSE, EINA_TRUE);
|
|
|
|
}
|
2015-08-04 06:51:36 -07:00
|
|
|
}
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_widget_theme_apply(obj);
|
2010-01-13 19:47:28 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_horizontal_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
|
2009-08-11 03:44:49 -07:00
|
|
|
{
|
2014-03-23 02:59:22 -07:00
|
|
|
return sd->horizontal;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_hover_begin(Eo *obj, Elm_Hoversel_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:43:00 -07:00
|
|
|
if (sd->hover) return;
|
|
|
|
|
2009-03-19 06:36:46 -07:00
|
|
|
_activate(obj);
|
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_hover_end(Eo *obj, Elm_Hoversel_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2015-10-12 13:22:26 -07:00
|
|
|
const char *dismissstr;
|
2012-05-03 15:43:00 -07:00
|
|
|
|
|
|
|
if (!sd->hover) return;
|
|
|
|
|
2015-11-09 12:23:18 -08:00
|
|
|
dismissstr = elm_layout_data_get(sd->hover, "dismiss");
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2015-10-12 13:22:26 -07:00
|
|
|
if (dismissstr && !strcmp(dismissstr, "on"))
|
2013-11-19 09:13:31 -08:00
|
|
|
{
|
2015-10-12 13:22:26 -07:00
|
|
|
elm_hover_dismiss(sd->hover);
|
2013-11-19 09:13:31 -08:00
|
|
|
}
|
2015-10-12 13:22:26 -07:00
|
|
|
else
|
|
|
|
{
|
2015-11-09 16:05:05 -08:00
|
|
|
_hover_del(obj);
|
2015-10-12 13:22:26 -07:00
|
|
|
} // for backward compatibility
|
2016-10-26 23:26:41 -07:00
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
2008-12-09 22:33:24 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_expanded_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
|
2010-04-06 18:31:36 -07:00
|
|
|
{
|
2014-03-23 02:59:22 -07:00
|
|
|
return (sd->hover) ? EINA_TRUE : EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_clear(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
|
2009-08-14 04:17:06 -07:00
|
|
|
{
|
2011-12-19 17:03:17 -08:00
|
|
|
Elm_Object_Item *it;
|
2009-08-14 04:17:06 -07:00
|
|
|
Eina_List *l, *ll;
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->items, l, ll, it)
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(it);
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
}
|
2009-08-14 04:17:06 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static const Eina_List*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_items_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
|
2009-10-04 16:05:50 -07:00
|
|
|
{
|
2014-03-23 02:59:22 -07:00
|
|
|
return sd->items;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_hoversel_item_efl_object_constructor(Eo *obj, Elm_Hoversel_Item_Data *it)
|
2014-09-27 22:14:00 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, ELM_HOVERSEL_ITEM_CLASS));
|
|
|
|
it->base = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2014-09-27 22:14:00 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:59:22 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_hoversel_item_add(Eo *obj, Elm_Hoversel_Data *sd, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data)
|
2008-12-09 22:33:24 -08:00
|
|
|
{
|
2015-11-09 12:18:49 -08:00
|
|
|
Evas_Object *bt, *ic;
|
|
|
|
char buf[4096];
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
Eo *eo_item = efl_add(ELM_HOVERSEL_ITEM_CLASS, obj);
|
2014-09-27 22:14:00 -07:00
|
|
|
if (!eo_item) return NULL;
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2010-11-02 04:26:50 -07:00
|
|
|
item->label = eina_stringshare_add(label);
|
|
|
|
item->icon_file = eina_stringshare_add(icon_file);
|
|
|
|
item->icon_type = icon_type;
|
|
|
|
item->func = func;
|
2014-11-25 04:54:24 -08:00
|
|
|
WIDGET_ITEM_DATA_SET(eo_item, data);
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2015-11-09 12:18:49 -08:00
|
|
|
if (sd->horizontal)
|
|
|
|
snprintf(buf, sizeof(buf), "hoversel_horizontal_entry/%s",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "hoversel_vertical_entry/%s",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
|
|
|
|
VIEW(item) = bt = elm_button_add(obj);
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_set(bt, efl_ui_mirrored_get(obj));
|
2015-11-09 12:18:49 -08:00
|
|
|
elm_object_style_set(bt, buf);
|
|
|
|
elm_object_text_set(bt, item->label);
|
|
|
|
|
|
|
|
if (item->icon_file)
|
|
|
|
{
|
|
|
|
ic = elm_icon_add(bt);
|
|
|
|
elm_image_resizable_set(ic, EINA_FALSE, EINA_TRUE);
|
|
|
|
if (item->icon_type == ELM_ICON_FILE)
|
|
|
|
elm_image_file_set(ic, item->icon_file, item->icon_group);
|
|
|
|
else if (item->icon_type == ELM_ICON_STANDARD)
|
|
|
|
elm_icon_standard_set(ic, item->icon_file);
|
|
|
|
elm_object_part_content_set(bt, "icon", ic);
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _on_item_clicked, item);
|
|
|
|
efl_event_callback_add(bt, ELM_WIDGET_EVENT_FOCUSED, _item_focused_cb, item);
|
|
|
|
efl_event_callback_add(bt, ELM_WIDGET_EVENT_UNFOCUSED, _item_unfocused_cb, item);
|
2015-11-09 12:18:49 -08:00
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
sd->items = eina_list_append(sd->items, eo_item);
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
return eo_item;
|
2008-12-09 22:33:24 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_hoversel_item_icon_set(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Hoversel_Item_Data *item,
|
|
|
|
const char *icon_file,
|
|
|
|
const char *icon_group,
|
|
|
|
Elm_Icon_Type icon_type)
|
|
|
|
{
|
2010-11-02 04:26:50 -07:00
|
|
|
eina_stringshare_replace(&item->icon_file, icon_file);
|
|
|
|
eina_stringshare_replace(&item->icon_group, icon_group);
|
2012-05-03 15:43:00 -07:00
|
|
|
|
2010-11-02 04:26:50 -07:00
|
|
|
item->icon_type = icon_type;
|
2009-08-14 04:17:06 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_hoversel_item_icon_get(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Hoversel_Item_Data *item,
|
|
|
|
const char **icon_file,
|
|
|
|
const char **icon_group,
|
|
|
|
Elm_Icon_Type *icon_type)
|
|
|
|
{
|
2010-11-02 04:26:50 -07:00
|
|
|
if (icon_file) *icon_file = item->icon_file;
|
|
|
|
if (icon_group) *icon_group = item->icon_group;
|
|
|
|
if (icon_type) *icon_type = item->icon_type;
|
2009-09-16 12:13:55 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
static Elm_Object_Item *
|
2014-04-22 05:51:46 -07:00
|
|
|
item_focused_get(Elm_Hoversel_Data *sd)
|
2013-12-28 00:21:23 -08:00
|
|
|
{
|
2014-09-27 22:14:00 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
2013-12-28 00:21:23 -08:00
|
|
|
Eina_List *l;
|
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
|
|
|
{
|
|
|
|
ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
|
|
|
|
if (elm_object_focus_get(VIEW(item)))
|
|
|
|
return eo_item;
|
|
|
|
}
|
2013-12-28 00:21:23 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-02-04 22:47:31 -08:00
|
|
|
static Eina_Bool
|
|
|
|
item_focused_set(Elm_Object_Item *eo_item, Eina_Bool focus)
|
|
|
|
{
|
|
|
|
ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
|
|
|
|
if (elm_object_disabled_get(VIEW(item)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
elm_object_focus_set(VIEW(item), focus);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-04-14 22:40:38 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_move(Evas_Object *obj, const char *params)
|
2013-11-13 03:32:31 -08:00
|
|
|
{
|
2016-02-04 22:47:31 -08:00
|
|
|
Eina_List *l;
|
|
|
|
Elm_Object_Item *focused_item, *eo_item;
|
|
|
|
Eina_Bool ret, next = EINA_FALSE;
|
|
|
|
|
2014-04-14 22:40:38 -07:00
|
|
|
ELM_HOVERSEL_DATA_GET(obj, sd);
|
|
|
|
const char *dir = params;
|
2013-11-13 03:32:31 -08:00
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
if (!sd->hover) return EINA_FALSE;
|
2015-09-10 02:29:24 -07:00
|
|
|
_elm_widget_focus_auto_show(obj);
|
2016-02-04 22:47:31 -08:00
|
|
|
if (!strcmp(dir, "down") || !strcmp(dir, "right"))
|
2013-11-13 03:32:31 -08:00
|
|
|
{
|
2016-02-04 22:47:31 -08:00
|
|
|
focused_item = item_focused_get(sd);
|
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
2013-12-28 00:21:23 -08:00
|
|
|
{
|
2016-02-04 22:47:31 -08:00
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
ret = item_focused_set(eo_item, EINA_TRUE);
|
|
|
|
if (ret) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (eo_item == focused_item) next = EINA_TRUE;
|
2013-12-28 00:21:23 -08:00
|
|
|
}
|
2016-02-04 22:47:31 -08:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
2013-12-28 00:21:23 -08:00
|
|
|
{
|
2016-02-04 22:47:31 -08:00
|
|
|
if (eo_item == focused_item) return EINA_FALSE;
|
|
|
|
|
|
|
|
ret = item_focused_set(eo_item, EINA_TRUE);
|
|
|
|
if (ret) return EINA_TRUE;
|
2013-12-28 00:21:23 -08:00
|
|
|
}
|
2016-02-04 22:47:31 -08:00
|
|
|
return EINA_FALSE;
|
2013-11-13 03:32:31 -08:00
|
|
|
}
|
2016-02-04 22:47:31 -08:00
|
|
|
else if (!strcmp(dir, "up") || !strcmp(dir, "left"))
|
2013-11-13 03:32:31 -08:00
|
|
|
{
|
2016-02-04 22:47:31 -08:00
|
|
|
focused_item = item_focused_get(sd);
|
|
|
|
EINA_LIST_REVERSE_FOREACH(sd->items, l, eo_item)
|
2013-12-28 00:21:23 -08:00
|
|
|
{
|
2016-02-04 22:47:31 -08:00
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
ret = item_focused_set(eo_item, EINA_TRUE);
|
|
|
|
if (ret) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (eo_item == focused_item) next = EINA_TRUE;
|
2013-12-28 00:21:23 -08:00
|
|
|
}
|
2016-02-04 22:47:31 -08:00
|
|
|
EINA_LIST_REVERSE_FOREACH(sd->items, l, eo_item)
|
2013-12-28 00:21:23 -08:00
|
|
|
{
|
2016-02-04 22:47:31 -08:00
|
|
|
if (eo_item == focused_item) return EINA_FALSE;
|
|
|
|
|
|
|
|
ret = item_focused_set(eo_item, EINA_TRUE);
|
|
|
|
if (ret) return EINA_TRUE;
|
2013-12-28 00:21:23 -08:00
|
|
|
}
|
2016-02-04 22:47:31 -08:00
|
|
|
return EINA_FALSE;
|
2013-11-13 03:32:31 -08:00
|
|
|
}
|
2014-04-14 22:40:38 -07:00
|
|
|
else return EINA_FALSE;
|
|
|
|
}
|
2013-11-13 03:32:31 -08:00
|
|
|
|
2015-07-29 13:23:00 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
2017-08-16 23:08:00 -07:00
|
|
|
ELM_HOVERSEL_DATA_GET(obj, sd);
|
|
|
|
if (!sd->hover) return EINA_FALSE;
|
2015-07-29 13:23:00 -07:00
|
|
|
_activate(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2016-02-02 02:57:20 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
2017-08-16 23:08:00 -07:00
|
|
|
ELM_HOVERSEL_DATA_GET(obj, sd);
|
|
|
|
if (!sd->hover) return EINA_FALSE;
|
2016-02-02 02:57:20 -08:00
|
|
|
elm_hoversel_hover_end(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
// _hoversel_elm_widget_widget_event()
|
|
|
|
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(hoversel, Elm_Hoversel_Data)
|
|
|
|
|
2014-04-14 22:40:38 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-17 02:14:52 -07:00
|
|
|
_elm_hoversel_elm_widget_widget_event(Eo *obj, Elm_Hoversel_Data *sd, const Efl_Event *eo_event, Evas_Object *src)
|
2014-04-14 22:40:38 -07:00
|
|
|
{
|
2017-08-17 02:14:52 -07:00
|
|
|
if (elm_obj_widget_event(efl_super(obj, MY_CLASS), eo_event, src))
|
2017-08-16 23:08:00 -07:00
|
|
|
return EINA_TRUE; // note: this was FALSE but likely wrong
|
2014-03-23 02:59:22 -07:00
|
|
|
|
2017-08-17 02:14:52 -07:00
|
|
|
return _hoversel_elm_widget_widget_event(obj, sd, eo_event, src);
|
2013-11-13 03:32:31 -08:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_hoversel_class_constructor(Efl_Class *klass)
|
2014-03-23 02:59:22 -07:00
|
|
|
{
|
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-07-25 01:33:19 -07:00
|
|
|
EOLIAN const Elm_Atspi_Action *
|
|
|
|
_elm_hoversel_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
static Elm_Atspi_Action atspi_actions[] = {
|
2015-07-29 13:23:00 -07:00
|
|
|
{ "activate", "activate", NULL, _key_action_activate},
|
2014-07-25 01:33:19 -07:00
|
|
|
{ "move,up", "move", "up", _key_action_move},
|
|
|
|
{ "move,down", "move", "down", _key_action_move},
|
|
|
|
{ "move,left", "move", "left", _key_action_move},
|
|
|
|
{ "move,right", "move", "right", _key_action_move},
|
2016-02-02 02:57:20 -08:00
|
|
|
{ "escape", "escape", NULL, _key_action_escape},
|
2014-07-25 01:33:19 -07:00
|
|
|
{ NULL, NULL, NULL, NULL}
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2015-10-04 06:09:22 -07:00
|
|
|
EOLIAN void
|
2015-10-19 11:41:14 -07:00
|
|
|
_elm_hoversel_auto_update_set(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd, Eina_Bool auto_update)
|
2015-10-04 06:09:22 -07:00
|
|
|
{
|
2015-10-19 11:41:14 -07:00
|
|
|
sd->auto_update = !!auto_update;
|
2015-10-04 06:09:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2015-10-19 11:41:14 -07:00
|
|
|
_elm_hoversel_auto_update_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
|
2015-10-04 06:09:22 -07:00
|
|
|
{
|
2015-10-19 11:41:14 -07:00
|
|
|
return sd->auto_update;
|
2015-10-04 06:09:22 -07:00
|
|
|
}
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_HOVERSEL_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_hoversel)
|
|
|
|
|
2014-09-27 22:14:00 -07:00
|
|
|
#include "elm_hoversel_item.eo.c"
|
2014-08-11 07:46:11 -07:00
|
|
|
#include "elm_hoversel.eo.c"
|