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
|
2014-09-27 22:15:07 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2015-12-15 07:49:02 -08:00
|
|
|
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2011-11-23 17:06:26 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
2012-08-30 09:46:12 -07:00
|
|
|
#include "elm_widget_multibuttonentry.h"
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2017-06-04 07:25:36 -07:00
|
|
|
#include "elm_multibuttonentry_internal_part.eo.h"
|
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_MULTIBUTTONENTRY_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Multibuttonentry"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_multibuttonentry"
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
#define MAX_STR 256
|
|
|
|
#define MIN_W_ENTRY 10
|
2012-03-12 17:45:01 -07:00
|
|
|
|
|
|
|
//widget signals
|
|
|
|
static const char SIG_ITEM_SELECTED[] = "item,selected";
|
|
|
|
static const char SIG_ITEM_ADDED[] = "item,added";
|
|
|
|
static const char SIG_ITEM_DELETED[] = "item,deleted";
|
|
|
|
static const char SIG_ITEM_CLICKED[] = "item,clicked";
|
2015-04-17 00:32:04 -07:00
|
|
|
static const char SIG_ITEM_LONGPRESSED[] = "item,longpressed";
|
2012-03-12 17:45:01 -07:00
|
|
|
static const char SIG_CLICKED[] = "clicked";
|
|
|
|
static const char SIG_FOCUSED[] = "focused";
|
|
|
|
static const char SIG_UNFOCUSED[] = "unfocused";
|
|
|
|
static const char SIG_EXPANDED[] = "expanded";
|
|
|
|
static const char SIG_CONTRACTED[] = "contracted";
|
|
|
|
static const char SIG_EXPAND_STATE_CHANGED[] = "expand,state,changed";
|
2012-08-30 09:46:12 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
|
|
|
{SIG_ITEM_SELECTED, ""},
|
|
|
|
{SIG_ITEM_ADDED, ""},
|
|
|
|
{SIG_ITEM_DELETED, ""},
|
|
|
|
{SIG_ITEM_CLICKED, ""},
|
2015-04-17 00:32:04 -07:00
|
|
|
{SIG_ITEM_LONGPRESSED, ""},
|
2012-08-30 09:46:12 -07:00
|
|
|
{SIG_CLICKED, ""},
|
|
|
|
{SIG_FOCUSED, ""},
|
|
|
|
{SIG_UNFOCUSED, ""},
|
|
|
|
{SIG_EXPANDED, ""},
|
|
|
|
{SIG_CONTRACTED, ""},
|
|
|
|
{SIG_EXPAND_STATE_CHANGED, ""},
|
|
|
|
{NULL, NULL}
|
2012-03-12 17:45:01 -07:00
|
|
|
};
|
2012-03-02 04:43:02 -08:00
|
|
|
|
2016-10-27 02:44:44 -07:00
|
|
|
static Eina_Bool _elm_multibuttonentry_smart_focus_next_enable = EINA_FALSE;
|
|
|
|
static Eina_Bool _elm_multibuttonentry_smart_focus_direction_enable = EINA_TRUE;
|
|
|
|
|
2016-08-30 05:34:10 -07:00
|
|
|
static void _entry_changed_cb(void *data, const Efl_Event *event);
|
|
|
|
static void _entry_focus_in_cb(void *data, const Efl_Event *event);
|
|
|
|
static void _entry_focus_out_cb(void *data, const Efl_Event *event);
|
|
|
|
static void _entry_clicked_cb(void *data, const Efl_Event *event);
|
2015-09-23 15:21:46 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(_multi_buttonentry_cb,
|
2016-07-28 22:31:01 -07:00
|
|
|
{ ELM_ENTRY_EVENT_CHANGED, _entry_changed_cb },
|
2015-09-23 15:21:46 -07:00
|
|
|
{ ELM_WIDGET_EVENT_FOCUSED, _entry_focus_in_cb },
|
|
|
|
{ ELM_WIDGET_EVENT_UNFOCUSED, _entry_focus_out_cb },
|
2016-06-10 01:29:40 -07:00
|
|
|
{ EFL_UI_EVENT_CLICKED, _entry_clicked_cb }
|
2015-09-23 15:21:46 -07:00
|
|
|
);
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
|
2013-04-23 04:30:15 -07:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Object_Item *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
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
elm_obj_widget_translate(efl_super(obj, MY_CLASS));
|
2014-01-23 03:20:43 -08:00
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
return EINA_TRUE;
|
2013-04-23 04:30:15 -07:00
|
|
|
}
|
|
|
|
|
2013-12-26 09:27:39 -08:00
|
|
|
static char *
|
|
|
|
_format_count(int count, void *data EINA_UNUSED)
|
|
|
|
{
|
|
|
|
char buf[32];
|
|
|
|
|
2015-11-22 22:48:32 -08:00
|
|
|
if (!snprintf(buf, sizeof(buf), "+%d", count)) return NULL;
|
2013-12-26 09:27:39 -08:00
|
|
|
return strdup(buf);
|
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_elm_widget_theme_apply(Eo *obj, Elm_Multibuttonentry_Data *sd)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
const char *str;
|
|
|
|
int hpad = 0, vpad = 0;
|
2011-11-23 17:06:26 -08:00
|
|
|
Eina_List *l;
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
2015-10-01 03:41:06 -07:00
|
|
|
double pad_scale;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
|
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;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
str = elm_layout_data_get(obj, "horizontal_pad");
|
|
|
|
if (str) hpad = atoi(str);
|
|
|
|
str = elm_layout_data_get(obj, "vertical_pad");
|
|
|
|
if (str) vpad = atoi(str);
|
2017-06-09 00:47:42 -07:00
|
|
|
pad_scale = efl_ui_scale_get(obj) * elm_config_scale_get()
|
2015-10-01 03:41:06 -07:00
|
|
|
/ edje_object_base_scale_get(elm_layout_edje_get(obj));
|
|
|
|
elm_box_padding_set(sd->box, (hpad * pad_scale), (vpad * pad_scale));
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
2015-02-09 21:22:43 -08:00
|
|
|
if (VIEW(item))
|
2015-08-17 04:32:14 -07:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(VIEW(item), "multibuttonentry", "btn", elm_widget_style_get(obj)))
|
|
|
|
CRI("Failed to set layout!");
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
2012-03-05 01:58:38 -08:00
|
|
|
|
2015-04-22 19:05:31 -07:00
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, sd->label, "multibuttonentry", "label",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, sd->end, "multibuttonentry", "closedbutton",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj,sd->guide_text, "multibuttonentry", "guidetext",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
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;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:46:12 -07:00
|
|
|
_visual_guide_text_set(Evas_Object *obj)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_box_unpack(sd->box, sd->guide_text);
|
|
|
|
elm_box_unpack(sd->box, sd->entry);
|
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) return;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (!elm_widget_focus_get(obj))
|
|
|
|
elm_object_focus_set(sd->entry, EINA_FALSE);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if ((!eina_list_count(sd->items)) && sd->guide_text
|
|
|
|
&& (!elm_widget_focus_get(obj)) && (!sd->n_str))
|
2012-07-03 04:22:46 -07:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_hide(sd->entry);
|
|
|
|
elm_box_pack_end(sd->box, sd->guide_text);
|
|
|
|
evas_object_show(sd->guide_text);
|
|
|
|
sd->view_state = MULTIBUTTONENTRY_VIEW_GUIDETEXT;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_hide(sd->guide_text);
|
2012-07-03 04:22:46 -07:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->editable)
|
2012-07-03 04:22:46 -07:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_box_pack_end(sd->box, sd->entry);
|
|
|
|
evas_object_show(sd->entry);
|
|
|
|
if (elm_widget_focus_get(obj))
|
2012-07-03 04:22:46 -07:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
if (!sd->selected_it)
|
|
|
|
elm_object_focus_set(sd->entry, EINA_TRUE);
|
2012-07-03 04:22:46 -07:00
|
|
|
}
|
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
sd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:46:12 -07:00
|
|
|
_shrink_mode_set(Evas_Object *obj,
|
|
|
|
Eina_Bool shrink)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
int count;
|
2011-11-23 17:06:26 -08:00
|
|
|
Eina_List *l;
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_ENTRY)
|
|
|
|
evas_object_hide(sd->entry);
|
|
|
|
else if (sd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
|
|
|
|
evas_object_hide(sd->guide_text);
|
|
|
|
else if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
2017-01-15 18:48:48 -08:00
|
|
|
evas_object_hide(sd->end);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-03-06 04:06:47 -08:00
|
|
|
if (shrink == EINA_TRUE)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-03-06 04:06:47 -08:00
|
|
|
Evas_Coord w = 0, w_tmp = 0;
|
2011-11-23 17:06:26 -08:00
|
|
|
Evas_Coord box_inner_item_width_padding = 0;
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_box_padding_get(sd->box, &box_inner_item_width_padding, NULL);
|
2011-11-23 17:06:26 -08:00
|
|
|
// unpack all items and entry
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_box_unpack_all(sd->box);
|
2014-09-27 22:15:07 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
2015-02-09 21:22:43 -08:00
|
|
|
evas_object_hide(VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
item->visible = EINA_FALSE;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
// pack buttons only 1line
|
2012-08-30 09:46:12 -07:00
|
|
|
w = sd->w_box;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-07-28 14:34:40 -07:00
|
|
|
if (sd->label && sd->label_packed)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_box_pack_end(sd->box, sd->label);
|
2016-06-09 00:29:40 -07:00
|
|
|
efl_gfx_size_hint_combined_min_get(sd->label, &w_tmp, NULL);
|
2011-11-23 17:06:26 -08:00
|
|
|
w -= w_tmp;
|
|
|
|
w -= box_inner_item_width_padding;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
eo_item = NULL;
|
2012-08-30 09:46:12 -07:00
|
|
|
count = eina_list_count(sd->items);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-03-04 03:38:04 -08:00
|
|
|
Evas_Coord item_w, w_label_count = 0, h = 0;
|
2013-12-26 09:27:39 -08:00
|
|
|
char *buf;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_end(sd->box, VIEW(item));
|
|
|
|
evas_object_show(VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
item->visible = EINA_TRUE;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2016-06-09 00:29:40 -07:00
|
|
|
efl_gfx_size_hint_combined_min_get(VIEW(item), &item_w, NULL);
|
2015-03-04 03:38:04 -08:00
|
|
|
|
|
|
|
w -= item_w;
|
2012-08-30 09:46:12 -07:00
|
|
|
w -= box_inner_item_width_padding;
|
|
|
|
count--;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2013-08-23 07:30:46 -07:00
|
|
|
if (count > 0)
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2013-12-26 09:27:39 -08:00
|
|
|
buf = sd->format_func(count, (void *)sd->format_func_data);
|
|
|
|
if (buf)
|
|
|
|
{
|
|
|
|
edje_object_part_text_escaped_set
|
|
|
|
(sd->end, "elm.text", buf);
|
|
|
|
free(buf);
|
|
|
|
}
|
|
|
|
|
2013-08-23 07:30:46 -07:00
|
|
|
edje_object_size_min_calc(sd->end, &w_label_count, NULL);
|
|
|
|
elm_coords_finger_size_adjust(1, &w_label_count, 1, NULL);
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2013-08-23 07:30:46 -07:00
|
|
|
if ((w < 0) || (w < w_label_count))
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_unpack(sd->box, VIEW(item));
|
|
|
|
evas_object_hide(VIEW(item));
|
2013-08-23 07:30:46 -07:00
|
|
|
item->visible = EINA_FALSE;
|
|
|
|
count++;
|
2013-12-26 09:27:39 -08:00
|
|
|
|
|
|
|
buf = sd->format_func(count, (void *)sd->format_func_data);
|
|
|
|
if (buf)
|
|
|
|
{
|
|
|
|
edje_object_part_text_escaped_set
|
|
|
|
(sd->end, "elm.text", buf);
|
|
|
|
free(buf);
|
|
|
|
}
|
|
|
|
|
2013-08-23 07:30:46 -07:00
|
|
|
edje_object_size_min_calc(sd->end, &w_label_count, &h);
|
|
|
|
elm_coords_finger_size_adjust(1, &w_label_count, 1, &h);
|
|
|
|
evas_object_size_hint_min_set
|
|
|
|
(sd->end, w_label_count, h);
|
|
|
|
elm_box_pack_end(sd->box, sd->end);
|
|
|
|
evas_object_show(sd->end);
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2013-08-23 07:30:46 -07:00
|
|
|
break;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
}
|
2017-01-15 18:48:48 -08:00
|
|
|
|
2017-06-18 20:00:30 -07:00
|
|
|
if (sd->view_state != MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
{
|
|
|
|
sd->view_state = MULTIBUTTONENTRY_VIEW_SHRINK;
|
|
|
|
efl_event_callback_legacy_call
|
|
|
|
(obj, ELM_MULTIBUTTONENTRY_EVENT_EXPAND_STATE_CHANGED, (void *)1);
|
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// unpack all items and entry
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_box_unpack_all(sd->box);
|
2014-09-27 22:15:07 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
2015-02-09 21:22:43 -08:00
|
|
|
evas_object_hide(VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
item->visible = EINA_FALSE;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_hide(sd->end);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
|
|
|
// pack buttons only 1line
|
|
|
|
|
2015-07-28 14:34:40 -07:00
|
|
|
if (sd->label && sd->label_packed) elm_box_pack_end(sd->box, sd->label);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
|
|
|
// pack remain btns
|
2014-09-27 22:15:07 -07:00
|
|
|
eo_item = NULL;
|
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_end(sd->box, VIEW(item));
|
|
|
|
evas_object_show(VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
item->visible = EINA_TRUE;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2017-06-18 20:00:30 -07:00
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
{
|
|
|
|
sd->view_state = MULTIBUTTONENTRY_VIEW_NONE;
|
|
|
|
efl_event_callback_legacy_call
|
|
|
|
(obj, ELM_MULTIBUTTONENTRY_EVENT_EXPAND_STATE_CHANGED, (void *)(uintptr_t)sd->shrink);
|
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2016-10-27 02:44:44 -07:00
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
_elm_multibuttonentry_smart_focus_direction_enable = EINA_FALSE;
|
|
|
|
else
|
|
|
|
_elm_multibuttonentry_smart_focus_direction_enable = EINA_TRUE;
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->view_state != MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
_visual_guide_text_set(obj);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_view_update(Elm_Multibuttonentry_Data *sd)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
|
|
|
Evas_Coord width = 1, height = 1;
|
2012-12-07 00:44:47 -08:00
|
|
|
Evas_Object *obj = sd->parent;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
if (sd->w_box <= 0) return;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
|
|
|
// update label
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->label)
|
2016-06-09 00:29:40 -07:00
|
|
|
efl_gfx_size_hint_combined_min_get(sd->label, &width, &height);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->guide_text)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Coord guide_text_width = sd->w_box - width;
|
|
|
|
|
|
|
|
evas_object_size_hint_min_set(sd->guide_text, guide_text_width, height);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// update buttons in shrink mode
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
2012-03-06 04:06:47 -08:00
|
|
|
_shrink_mode_set(obj, EINA_TRUE);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
|
|
|
// update guidetext
|
2012-10-10 17:35:00 -07:00
|
|
|
_visual_guide_text_set(obj);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-09-15 03:41:51 -07:00
|
|
|
_elm_multibuttonentry_elm_widget_on_focus(Eo *obj, Elm_Multibuttonentry_Data *sd, Elm_Object_Item *item EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
if (elm_widget_focus_get(obj))
|
|
|
|
{
|
2012-10-10 02:37:50 -07:00
|
|
|
// ACCESS
|
2013-03-22 01:42:04 -07:00
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) goto end;
|
2012-10-10 02:37:50 -07:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->editable)
|
2012-03-25 01:51:12 -07:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
if ((sd->selected_it))
|
|
|
|
{
|
|
|
|
elm_entry_input_panel_show(sd->entry);
|
|
|
|
}
|
|
|
|
else if (((!sd->selected_it) || (!eina_list_count(sd->items))))
|
|
|
|
{
|
|
|
|
elm_entry_cursor_end_set(sd->entry);
|
2012-12-07 00:44:47 -08:00
|
|
|
_view_update(sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_entry_input_panel_show(sd->entry);
|
|
|
|
}
|
2012-03-25 01:51:12 -07:00
|
|
|
}
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_WIDGET_EVENT_FOCUSED, NULL);
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-09-15 18:25:18 -07:00
|
|
|
if (sd->editable)
|
|
|
|
{
|
|
|
|
_view_update(sd);
|
|
|
|
elm_entry_input_panel_hide(sd->entry);
|
|
|
|
}
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_WIDGET_EVENT_UNFOCUSED, NULL);
|
2012-03-25 01:51:12 -07:00
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
end:
|
2014-03-30 00:57:14 -07:00
|
|
|
return EINA_TRUE;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-02-09 21:22:43 -08:00
|
|
|
_item_del(Elm_Multibuttonentry_Item_Data *item)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Object *obj = WIDGET(item);
|
2012-03-05 23:00:59 -08:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2012-03-05 23:00:59 -08:00
|
|
|
|
2017-07-18 18:35:49 -07:00
|
|
|
sd->items = eina_list_remove(sd->items, EO_OBJ(item));
|
2015-09-21 16:49:45 -07:00
|
|
|
elm_box_unpack(sd->box, VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_MULTIBUTTONENTRY_EVENT_ITEM_DELETED, EO_OBJ(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2015-09-21 16:49:45 -07:00
|
|
|
if (sd->selected_it == item)
|
|
|
|
sd->selected_it = NULL;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
_shrink_mode_set(obj, EINA_TRUE);
|
|
|
|
|
|
|
|
if (!eina_list_count(sd->items))
|
|
|
|
_visual_guide_text_set(obj);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-02-09 21:22:43 -08:00
|
|
|
_current_item_state_change(Evas_Object *obj,
|
2012-08-30 09:46:12 -07:00
|
|
|
Multibuttonentry_Button_State state)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *item;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
item = sd->selected_it;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
if (!item) return;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
switch (state)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
case MULTIBUTTONENTRY_BUTTON_STATE_SELECTED:
|
2015-04-05 18:34:39 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,focused", "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_MULTIBUTTONENTRY_EVENT_ITEM_SELECTED, EO_OBJ(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
break;
|
2013-08-23 07:30:46 -07:00
|
|
|
case MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT:
|
2012-08-30 09:46:12 -07:00
|
|
|
default:
|
2015-04-05 18:34:39 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,default", "elm");
|
2012-08-30 09:46:12 -07:00
|
|
|
sd->selected_it = NULL;
|
|
|
|
break;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-02-09 21:22:43 -08:00
|
|
|
_current_item_change(Evas_Object *obj,
|
|
|
|
Elm_Object_Item *eo_it)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
2015-02-09 21:22:43 -08:00
|
|
|
Elm_Object_Item *eo_temp_it;
|
2011-11-24 00:34:47 -08:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2015-02-09 21:22:43 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_it, it);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
// change the state of previous item to "default"
|
|
|
|
_current_item_state_change(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
|
|
|
// change the current
|
2015-02-09 21:22:43 -08:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_temp_it)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
if (eo_temp_it == eo_it)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
sd->selected_it = it;
|
2011-11-23 17:06:26 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-02-09 21:22:43 -08:00
|
|
|
// change the state of current item to "focused"
|
|
|
|
_current_item_state_change(obj, MULTIBUTTONENTRY_BUTTON_STATE_SELECTED);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-02-09 21:22:43 -08:00
|
|
|
_item_select(Evas_Object *obj,
|
|
|
|
Elm_Multibuttonentry_Item_Data *it)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
if (it)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
_current_item_change(obj, EO_OBJ(it));
|
2015-10-29 22:26:31 -07:00
|
|
|
|
|
|
|
if (it->func) it->func((void *)(WIDGET_ITEM_DATA_GET(EO_OBJ(it))), WIDGET(it), EO_OBJ(it));
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (elm_widget_focus_get(obj))
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_object_focus_set(sd->entry, EINA_FALSE);
|
2015-08-27 23:49:58 -07:00
|
|
|
elm_object_focus_set(VIEW(it), EINA_TRUE);
|
2012-10-10 02:37:50 -07:00
|
|
|
|
|
|
|
// ACCESS
|
|
|
|
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
|
|
|
{
|
|
|
|
Evas_Object *ao, *po;
|
|
|
|
Eina_Strbuf *buf;
|
2015-08-06 23:15:45 -07:00
|
|
|
const char *part;
|
2012-10-10 02:37:50 -07:00
|
|
|
|
|
|
|
part = "elm.btn.text";
|
2015-02-09 21:22:43 -08:00
|
|
|
po = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(VIEW(it)), part);
|
2012-10-10 02:37:50 -07:00
|
|
|
ao = evas_object_data_get(po, "_part_access_obj");
|
|
|
|
_elm_access_highlight_set(ao);
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
|
|
|
eina_strbuf_append_printf(buf,
|
|
|
|
"multi button entry item %s is selected",
|
2015-02-09 21:22:43 -08:00
|
|
|
edje_object_part_text_get(elm_layout_edje_get(VIEW(it)), part));
|
2012-10-10 02:37:50 -07:00
|
|
|
|
2015-08-06 23:15:45 -07:00
|
|
|
_elm_access_say(eina_strbuf_string_get(buf));
|
2012-10-10 02:37:50 -07:00
|
|
|
eina_strbuf_free(buf);
|
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
else
|
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
_current_item_state_change
|
2012-08-30 09:46:12 -07:00
|
|
|
(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
|
|
|
|
if (elm_widget_focus_get(obj) && sd->editable)
|
|
|
|
elm_object_focus_set(sd->entry, EINA_TRUE);
|
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-02-09 21:22:43 -08:00
|
|
|
_on_item_clicked(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2014-01-06 06:30:02 -08:00
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
Elm_Object_Item *eo_it = data;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_it, it);
|
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(WIDGET(it), sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2015-02-14 05:56:05 -08:00
|
|
|
_item_select(WIDGET(it), it);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
elm_radio, elc_multibuttonentry, elm_colorselector: "checked" signal sent
Summary:
Radio, MBE items, color selector items have ELM_ATSPI_ROLE_RADIO_BUTTON role, when one item
is selected the other items are automatically unselected, so a notification has to be sent in atspi mode
to read the status accordingly
Test Plan:
In ATSPI mode when radio, mbe item, color selector item is selected
status has to notified.
Reviewers: kimcinoo, cedric
Subscribers: govi, rajeshps, jpeg
Differential Revision: https://phab.enlightenment.org/D4960
2017-06-13 21:04:51 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
elm_interface_atspi_accessible_state_changed_signal_emit(eo_it,
|
|
|
|
ELM_ATSPI_STATE_CHECKED,
|
|
|
|
EINA_TRUE);
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->selected_it)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_MULTIBUTTONENTRY_EVENT_ITEM_CLICKED, eo_it);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-02-09 21:22:43 -08:00
|
|
|
_on_item_deleted(void *data,
|
2013-08-23 07:30:46 -07:00
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2013-08-23 07:30:46 -07:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
2015-02-09 21:22:43 -08:00
|
|
|
Elm_Object_Item *eo_it = data;
|
|
|
|
Elm_Object_Item *eo_temp_it;
|
2013-08-23 07:30:46 -07:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_it, it);
|
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(WIDGET(it), sd);
|
2013-08-23 07:30:46 -07:00
|
|
|
// change the current
|
2015-02-09 21:22:43 -08:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_temp_it)
|
2013-08-23 07:30:46 -07:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_temp_it, temp_it);
|
2015-03-10 01:19:46 -07:00
|
|
|
if (VIEW(temp_it) == obj)
|
2013-08-23 07:30:46 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(eo_temp_it);
|
2013-08-23 07:30:46 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-27 02:44:44 -07:00
|
|
|
static void
|
|
|
|
_on_item_focused(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Elm_Multibuttonentry_Item_Data *it = data;
|
2016-12-05 07:53:42 -08:00
|
|
|
if (!it) return;
|
|
|
|
|
2016-10-27 02:44:44 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(WIDGET(it), sd);
|
|
|
|
|
|
|
|
sd->selected_it = it;
|
|
|
|
}
|
|
|
|
|
2016-02-02 03:35:17 -08:00
|
|
|
static void
|
|
|
|
_on_item_unfocused(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Elm_Multibuttonentry_Item_Data *it = data;
|
2016-12-05 07:53:42 -08:00
|
|
|
if (!it) return;
|
|
|
|
|
2016-10-27 02:44:44 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(WIDGET(it), sd);
|
2016-02-02 03:35:17 -08:00
|
|
|
|
2016-10-27 02:44:44 -07:00
|
|
|
sd->selected_it = NULL;
|
2016-02-02 03:35:17 -08:00
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,unfocused", "elm");
|
|
|
|
}
|
|
|
|
|
2015-03-27 23:05:44 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_long_press_cb(void *data)
|
|
|
|
{
|
|
|
|
Elm_Multibuttonentry_Item_Data *it = data;
|
|
|
|
|
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
|
|
|
sd->longpress_timer = NULL;
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_MULTIBUTTONENTRY_EVENT_ITEM_LONGPRESSED, EO_OBJ(it));
|
2015-03-27 23:05:44 -07:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_mouse_down_cb(void *data,
|
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Multibuttonentry_Item_Data *it = data;
|
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
|
|
|
|
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(WIDGET(it), sd);
|
|
|
|
|
|
|
|
if (ev->button != 1) return;
|
|
|
|
|
|
|
|
ecore_timer_del(sd->longpress_timer);
|
|
|
|
sd->longpress_timer = ecore_timer_add
|
|
|
|
(_elm_config->longpress_timeout, _long_press_cb, it);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_mouse_up_cb(void *data,
|
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Elm_Multibuttonentry_Item_Data *it = data;
|
|
|
|
|
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(WIDGET(it), sd);
|
|
|
|
|
|
|
|
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_multibuttonentry_item_elm_widget_item_signal_emit(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Multibuttonentry_Item_Data *item,
|
|
|
|
const char *emission,
|
|
|
|
const char *source)
|
2013-12-26 07:45:22 -08:00
|
|
|
{
|
2015-04-05 18:34:39 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), emission, source);
|
2013-12-26 07:45:22 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_multibuttonentry_item_elm_widget_item_part_text_set(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Multibuttonentry_Item_Data *item,
|
|
|
|
const char *part,
|
|
|
|
const char *label)
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2013-12-26 07:54:57 -08:00
|
|
|
const char *dest_part = NULL;
|
2015-08-28 03:52:17 -07:00
|
|
|
Evas_Coord minw = -1, minh = -1, boxw;
|
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(WIDGET(item), sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2013-12-26 07:54:57 -08:00
|
|
|
if (!part || !strcmp(part, "elm.text"))
|
|
|
|
dest_part = "elm.btn.text";
|
|
|
|
else
|
|
|
|
dest_part = part;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
edje_object_part_text_escaped_set(elm_layout_edje_get(VIEW(item)), dest_part, label);
|
2015-08-28 03:52:17 -07:00
|
|
|
|
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
edje_object_size_min_restricted_calc
|
|
|
|
(elm_layout_edje_get(VIEW(item)), &minw, &minh, minw, minh);
|
|
|
|
evas_object_size_hint_min_set(VIEW(item), minw, minh);
|
|
|
|
evas_object_geometry_get(sd->box, NULL, NULL, &boxw, NULL);
|
|
|
|
|
|
|
|
if (minw > boxw)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(VIEW(item), boxw, minh);
|
|
|
|
evas_object_resize(VIEW(item), boxw, minh);
|
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EOLIAN static const char *
|
|
|
|
_elm_multibuttonentry_item_elm_widget_item_part_text_get(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Multibuttonentry_Item_Data *item,
|
|
|
|
const char *part)
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2013-12-26 07:54:57 -08:00
|
|
|
const char *src_part = NULL;
|
|
|
|
|
|
|
|
if (!part || !strcmp(part, "elm.text"))
|
|
|
|
src_part = "elm.btn.text";
|
|
|
|
else
|
|
|
|
src_part = part;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
return edje_object_part_text_get(elm_layout_edje_get(VIEW(item)), src_part);
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
|
2014-09-17 06:44:05 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_multibuttonentry_item_efl_object_destructor(Eo *eo_it,
|
2014-09-17 06:44:05 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *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
|
|
|
{
|
2015-12-15 07:49:02 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
elm_interface_atspi_accessible_children_changed_del_signal_emit(WIDGET(it), eo_it);
|
2015-02-09 21:22:43 -08:00
|
|
|
_item_del(it);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_destructor(efl_super(eo_it, ELM_MULTIBUTTONENTRY_ITEM_CLASS));
|
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
|
|
|
}
|
|
|
|
|
2012-10-10 02:37:50 -07:00
|
|
|
static void
|
|
|
|
_access_multibuttonentry_label_register(Evas_Object *obj, Eina_Bool is_access)
|
|
|
|
{
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2012-10-10 02:37:50 -07:00
|
|
|
Evas_Object *po;
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2013-08-23 07:30:46 -07:00
|
|
|
po = (Evas_Object *)edje_object_part_object_get(sd->label, "elm.text");
|
2012-10-10 02:37:50 -07:00
|
|
|
if (is_access)
|
|
|
|
{
|
|
|
|
Evas_Object *ao;
|
|
|
|
ao = _elm_access_edje_object_part_object_register
|
2013-08-23 07:30:46 -07:00
|
|
|
(obj, sd->label, "elm.text");
|
2013-07-30 20:53:04 -07:00
|
|
|
_elm_access_text_set(_elm_access_info_get(ao),
|
2012-10-10 02:37:50 -07:00
|
|
|
ELM_ACCESS_TYPE, E_("multi button entry label"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_elm_access_edje_object_part_object_unregister
|
2013-08-23 07:30:46 -07:00
|
|
|
(obj, sd->label, "elm.text");
|
2012-10-10 02:37:50 -07:00
|
|
|
|
|
|
|
evas_object_pass_events_set(po, !is_access);
|
|
|
|
evas_object_propagate_events_set(sd->label, !is_access);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_multibuttonentry_item_register(Evas_Object *obj,
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Object_Item *eo_item,
|
2012-10-10 02:37:50 -07:00
|
|
|
Eina_Bool is_access)
|
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
2012-10-10 02:37:50 -07:00
|
|
|
if (is_access)
|
|
|
|
{
|
|
|
|
Evas_Object *ao;
|
|
|
|
ao = _elm_access_edje_object_part_object_register
|
2015-02-09 21:22:43 -08:00
|
|
|
(obj, elm_layout_edje_get(VIEW(item)), "elm.btn.text");
|
2013-07-30 20:53:04 -07:00
|
|
|
_elm_access_text_set(_elm_access_info_get(ao),
|
2012-10-10 02:37:50 -07:00
|
|
|
ELM_ACCESS_TYPE, E_("multi button entry item"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_elm_access_edje_object_part_object_unregister
|
2015-02-09 21:22:43 -08:00
|
|
|
(obj, elm_layout_edje_get(VIEW(item)), "elm.btn.text");
|
2012-10-10 02:37:50 -07:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
/* cannot read item because mouse-in event is delivered to
|
2012-10-10 02:37:50 -07:00
|
|
|
the multibuttonentry resize_obj which is registered as an access
|
|
|
|
object, so the mouse-in event should be blocked here */
|
2015-02-09 21:22:43 -08:00
|
|
|
evas_object_propagate_events_set(VIEW(item), !is_access);
|
2012-10-10 02:37:50 -07:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_multibuttonentry_item_efl_object_constructor(Eo *eo_item, Elm_Multibuttonentry_Item_Data *item)
|
2014-09-27 22:15:07 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
eo_item = efl_constructor(efl_super(eo_item, ELM_MULTIBUTTONENTRY_ITEM_CLASS));
|
|
|
|
item->base = efl_data_scope_get(eo_item, ELM_WIDGET_ITEM_CLASS);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return eo_item;
|
2014-09-27 22:15:07 -07:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
static Elm_Object_Item *
|
2015-02-09 21:22:43 -08:00
|
|
|
_item_new(Elm_Multibuttonentry_Data *sd,
|
2012-08-30 09:46:12 -07:00
|
|
|
const char *str,
|
|
|
|
Multibuttonentry_Pos pos,
|
2016-08-15 06:44:41 -07:00
|
|
|
Elm_Object_Item *efl_reference,
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Smart_Cb func,
|
|
|
|
void *data)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
2014-09-27 22:15:07 -07:00
|
|
|
Eo *eo_item;
|
2012-08-30 09:46:12 -07:00
|
|
|
Elm_Multibuttonentry_Item_Filter *item_filter;
|
2016-08-15 06:44:41 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *reference = efl_reference?
|
|
|
|
efl_data_scope_get(efl_reference, ELM_MULTIBUTTONENTRY_ITEM_CLASS):
|
2014-09-27 22:15:07 -07:00
|
|
|
NULL;
|
2012-12-07 00:44:47 -08:00
|
|
|
Evas_Object *obj;
|
2015-03-04 03:38:04 -08:00
|
|
|
int minw, minh, boxw;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
obj = sd->parent;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-03-05 23:01:09 -08:00
|
|
|
if (!str) return NULL;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->filter_list, l, item_filter)
|
2011-11-23 20:02:09 -08:00
|
|
|
{
|
|
|
|
if (!(item_filter->callback_func(obj, str, data, item_filter->data)))
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-02-09 21:22:43 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
eo_item = efl_add(ELM_MULTIBUTTONENTRY_ITEM_CLASS, obj);
|
2015-02-09 21:22:43 -08:00
|
|
|
if (!eo_item)
|
|
|
|
return NULL;
|
|
|
|
WIDGET_ITEM_DATA_SET(eo_item, data);
|
|
|
|
|
elc_multibuttonentry: role of MBE item, MBE updated, and state_set_get API added.
Summary:
Reason for role change:
MBE items do not act like push buttons, they need to maintain their status and at a time only one item can be selected, they act like radio buttons.
Role change of MBE from entry to panel, because MBE is just a container and entry is one of the children, when entry gets access frame, it will work as how entry works, but making MBE role as entry does not work as expected and also MBE should not receive highlight as a whole but only its children should receive highlight one more reason why MBE role cannot be entry.
state_set_get API added to get items state.
Test Plan:
When atspi mode is enabled the access frame has to
navigate directly on item and not on MBE as a whole and state has to
be read out
Reviewers: kimcinoo, cedric
Reviewed By: cedric
Subscribers: cedric, govi, rajeshps, jpeg
Differential Revision: https://phab.enlightenment.org/D4925
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-06-05 13:56:42 -07:00
|
|
|
elm_interface_atspi_accessible_role_set(eo_item, ELM_ATSPI_ROLE_RADIO_BUTTON);
|
2015-12-15 07:49:02 -08:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
|
|
|
VIEW(item) = elm_layout_add(obj);
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_type_set(VIEW(item), ELM_ATSPI_TYPE_DISABLED);
|
2015-12-15 07:49:02 -08:00
|
|
|
|
2015-02-23 05:45:33 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(VIEW(item), "multibuttonentry", "btn", elm_widget_style_get(obj)))
|
|
|
|
CRI("Failed to set layout!");
|
2015-02-09 21:22:43 -08:00
|
|
|
|
|
|
|
elm_object_part_text_set(VIEW(item), "elm.btn.text", str);
|
2011-11-23 20:02:09 -08:00
|
|
|
|
2011-12-21 23:56:01 -08:00
|
|
|
//entry is cleared when text is made to button
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_object_text_set(sd->entry, "");
|
2011-12-21 23:56:01 -08:00
|
|
|
|
2015-03-10 01:19:46 -07:00
|
|
|
elm_layout_signal_callback_add
|
|
|
|
(VIEW(item), "mouse,clicked,1", "*", _on_item_clicked, EO_OBJ(item));
|
|
|
|
elm_layout_signal_callback_add
|
|
|
|
(VIEW(item), "elm,deleted", "elm", _on_item_deleted, EO_OBJ(item));
|
2016-10-27 02:44:44 -07:00
|
|
|
evas_object_smart_callback_add
|
|
|
|
(VIEW(item), "focused", _on_item_focused, item);
|
2016-02-02 03:35:17 -08:00
|
|
|
evas_object_smart_callback_add
|
|
|
|
(VIEW(item), "unfocused", _on_item_unfocused, item);
|
2015-03-27 23:05:44 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(item),
|
|
|
|
EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, item);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(item),
|
|
|
|
EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, item);
|
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
evas_object_show(VIEW(item));
|
2013-07-05 20:07:51 -07:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
evas_object_smart_calculate(VIEW(item));
|
2016-06-09 00:29:40 -07:00
|
|
|
efl_gfx_size_hint_combined_min_get(VIEW(item), &minw, &minh);
|
2015-03-04 03:38:04 -08:00
|
|
|
evas_object_geometry_get(sd->box, NULL, NULL, &boxw, NULL);
|
|
|
|
|
|
|
|
if (sd->w_box && minw > boxw)
|
|
|
|
{
|
|
|
|
elm_coords_finger_size_adjust(1, &boxw, 1, &minh);
|
|
|
|
evas_object_size_hint_min_set(VIEW(item), boxw, minh);
|
|
|
|
evas_object_resize(VIEW(item), boxw, minh);
|
|
|
|
}
|
2013-12-26 07:45:22 -08:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_object_focus_allow_set(VIEW(item), EINA_TRUE);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
item->visible = EINA_TRUE;
|
|
|
|
|
2012-10-10 02:37:50 -07:00
|
|
|
// ACCESS
|
2013-03-22 01:42:04 -07:00
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
2012-10-10 02:37:50 -07:00
|
|
|
{
|
|
|
|
Eina_Strbuf *buf;
|
|
|
|
buf = eina_strbuf_new();
|
|
|
|
|
|
|
|
eina_strbuf_append_printf(buf,
|
|
|
|
"multi button entry item %s is added",
|
2015-02-09 21:22:43 -08:00
|
|
|
edje_object_part_text_get(elm_layout_edje_get(VIEW(item)), "elm.btn.text"));
|
2012-10-10 02:37:50 -07:00
|
|
|
|
2015-08-06 23:15:45 -07:00
|
|
|
_elm_access_say(eina_strbuf_string_get(buf));
|
2012-10-10 02:37:50 -07:00
|
|
|
eina_strbuf_free(buf);
|
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
_access_multibuttonentry_item_register(obj, eo_item, EINA_TRUE);
|
2012-10-10 02:37:50 -07:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
item->func = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (pos)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
case MULTIBUTTONENTRY_POS_START:
|
2014-09-27 22:15:07 -07:00
|
|
|
sd->items = eina_list_prepend(sd->items, eo_item);
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_widget_sub_object_add(obj, VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
_shrink_mode_set(obj, EINA_TRUE);
|
|
|
|
}
|
|
|
|
else
|
2012-03-06 18:57:36 -08:00
|
|
|
{
|
2015-07-28 14:34:40 -07:00
|
|
|
if (sd->label && sd->label_packed)
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_after(sd->box, VIEW(item), sd->label);
|
2012-08-30 09:46:12 -07:00
|
|
|
else
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_start(sd->box, VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
|
|
|
|
_visual_guide_text_set(obj);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MULTIBUTTONENTRY_POS_END:
|
2014-09-27 22:15:07 -07:00
|
|
|
sd->items = eina_list_append(sd->items, eo_item);
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_widget_sub_object_add(obj, VIEW(item));
|
|
|
|
evas_object_hide(VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
|
|
|
|
_visual_guide_text_set(obj);
|
2015-02-09 21:22:43 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->editable)
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_before(sd->box, VIEW(item), sd->entry);
|
2012-08-30 09:46:12 -07:00
|
|
|
else
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_end(sd->box, VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MULTIBUTTONENTRY_POS_BEFORE:
|
2016-08-15 06:44:41 -07:00
|
|
|
if (efl_reference)
|
|
|
|
sd->items = eina_list_prepend_relative(sd->items, eo_item, efl_reference);
|
2012-08-30 09:46:12 -07:00
|
|
|
else
|
2014-09-27 22:15:07 -07:00
|
|
|
sd->items = eina_list_append(sd->items, eo_item);
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_widget_sub_object_add(obj, VIEW(item));
|
|
|
|
evas_object_hide(VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
_shrink_mode_set(obj, EINA_TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
if (efl_reference)
|
2017-03-08 23:11:33 -08:00
|
|
|
elm_box_pack_before(sd->box, VIEW(item), VIEW(reference));
|
2012-08-30 09:46:12 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
|
|
|
|
_visual_guide_text_set(obj);
|
|
|
|
if (sd->editable)
|
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_before(sd->box, VIEW(item), sd->entry);
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
else
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_end(sd->box, VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
2012-03-06 18:57:36 -08:00
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
break;
|
2012-03-06 18:57:36 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
case MULTIBUTTONENTRY_POS_AFTER:
|
2016-08-15 06:44:41 -07:00
|
|
|
if (efl_reference)
|
|
|
|
sd->items = eina_list_append_relative(sd->items, eo_item, efl_reference);
|
2012-08-30 09:46:12 -07:00
|
|
|
else
|
2014-09-27 22:15:07 -07:00
|
|
|
sd->items = eina_list_append(sd->items, eo_item);
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_widget_sub_object_add(obj, VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
_shrink_mode_set(obj, EINA_TRUE);
|
|
|
|
}
|
|
|
|
else
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
if (efl_reference)
|
2017-03-08 23:11:33 -08:00
|
|
|
elm_box_pack_after(sd->box, VIEW(item), VIEW(reference));
|
2012-08-30 09:46:12 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
|
|
|
|
_visual_guide_text_set(obj);
|
|
|
|
if (sd->editable)
|
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_before(sd->box, VIEW(item), sd->entry);
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
else
|
2015-02-09 21:22:43 -08:00
|
|
|
elm_box_pack_end(sd->box, VIEW(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
2015-12-15 07:49:02 -08:00
|
|
|
|
2017-01-15 18:48:48 -08:00
|
|
|
if (!elm_object_focus_get(obj) && sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK && sd->w_box)
|
|
|
|
_shrink_mode_set(obj, EINA_TRUE);
|
|
|
|
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_MULTIBUTTONENTRY_EVENT_ITEM_ADDED, eo_item);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-12-15 07:49:02 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
{
|
|
|
|
elm_interface_atspi_accessible_children_changed_added_signal_emit(obj, eo_item);
|
|
|
|
elm_interface_atspi_accessible_added(eo_item);
|
|
|
|
}
|
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
return eo_item;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
//FIXME: having an empty event handling function and reacting on Evas
|
|
|
|
//events on specific objects is crazy, someone should fix that.
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-09 23:41:25 -07:00
|
|
|
_elm_multibuttonentry_elm_widget_widget_event(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd EINA_UNUSED, const Efl_Event *eo_event EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *ev)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2013-10-28 07:06:14 -07:00
|
|
|
(void)src;
|
|
|
|
(void)type;
|
|
|
|
(void)ev;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-10-10 02:37:50 -07:00
|
|
|
// ACCESS
|
2014-03-30 00:57:14 -07:00
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) return EINA_FALSE;
|
2012-10-10 02:37:50 -07:00
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
return EINA_TRUE;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2015-03-04 03:38:04 -08:00
|
|
|
_elm_multibuttonentry_elm_layout_sizing_eval(Eo *obj, Elm_Multibuttonentry_Data *sd EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-03-04 03:38:04 -08:00
|
|
|
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2013-10-05 01:12:50 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
edje_object_size_min_restricted_calc
|
|
|
|
(wd->resize_obj, &minw, &minh, minw, minh);
|
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2015-03-04 03:38:04 -08:00
|
|
|
evas_object_size_hint_max_set(obj, maxw, maxh);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-02-02 18:38:21 -08:00
|
|
|
_mouse_clicked_signal_cb(void *data EINA_UNUSED,
|
2012-12-07 00:44:47 -08:00
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2017-02-14 20:06:49 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
|
|
|
|
|
|
|
if (sd->editable) elm_entry_input_panel_show(sd->entry);
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_CLICKED, NULL);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:46:12 -07:00
|
|
|
_box_resize_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-03-04 03:38:04 -08:00
|
|
|
Evas_Coord w, h, mnw, mnh;
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Object_Item *eo_it;
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
int hpad;
|
2015-03-04 03:38:04 -08:00
|
|
|
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(sd->box, NULL, NULL, &w, &h);
|
2017-01-15 18:48:48 -08:00
|
|
|
if ((w <= elm_config_finger_size_get()) || (h <= elm_config_finger_size_get())) return;
|
|
|
|
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
elm_box_padding_get(obj, &hpad, NULL);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->h_box < h)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(sd->parent, ELM_MULTIBUTTONENTRY_EVENT_EXPANDED, NULL);
|
2012-08-30 09:46:12 -07:00
|
|
|
else if (sd->h_box > h)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(sd->parent, ELM_MULTIBUTTONENTRY_EVENT_CONTRACTED, NULL);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2015-06-30 18:54:46 -07:00
|
|
|
if (sd->items && sd->w_box != w)
|
2015-03-04 03:38:04 -08:00
|
|
|
{
|
2015-06-30 18:54:46 -07:00
|
|
|
EINA_LIST_FOREACH (sd->items, l, eo_it)
|
2015-03-04 03:38:04 -08:00
|
|
|
{
|
2015-06-30 18:54:46 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_it, it);
|
2015-03-04 03:38:04 -08:00
|
|
|
|
2015-06-30 18:54:46 -07:00
|
|
|
elm_layout_sizing_eval(VIEW(it));
|
|
|
|
evas_object_smart_calculate(VIEW(it));
|
2015-03-04 03:38:04 -08:00
|
|
|
|
2016-06-09 00:29:40 -07:00
|
|
|
efl_gfx_size_hint_combined_min_get(VIEW(it), &mnw, &mnh);
|
2015-03-04 03:38:04 -08:00
|
|
|
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
if (mnw > w - hpad)
|
2015-06-30 18:54:46 -07:00
|
|
|
{
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
mnw = w - hpad;
|
2015-06-30 18:54:46 -07:00
|
|
|
evas_object_size_hint_min_set(VIEW(it), mnw, mnh);
|
|
|
|
evas_object_resize(VIEW(it), mnw, mnh);
|
2015-03-04 03:38:04 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
sd->w_box = w;
|
|
|
|
sd->h_box = h;
|
2016-11-28 04:33:42 -08:00
|
|
|
|
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
|
|
|
|
_shrink_mode_set(data, EINA_TRUE);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:46:12 -07:00
|
|
|
_entry_resize_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Coord en_x, en_y, en_w, en_h;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_geometry_get(sd->entry, &en_x, &en_y, &en_w, &en_h);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
if (elm_widget_focus_get(sd->parent))
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_widget_show_region_set(sd->entry, en_x, en_y, en_w, en_h, EINA_TRUE);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_entry_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2016-06-20 07:31:31 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
const char *str;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
str = elm_object_text_get(sd->entry);
|
2012-12-07 00:44:47 -08:00
|
|
|
sd->n_str = str ? strlen(str) : 0;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_entry_focus_in_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *item = NULL;
|
2016-06-20 07:31:31 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (sd->selected_it)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
item = sd->selected_it;
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_object_focus_set(sd->entry, EINA_FALSE);
|
2015-08-27 23:49:58 -07:00
|
|
|
elm_object_focus_set(VIEW(item), EINA_TRUE);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_entry_focus_out_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2016-06-20 07:31:31 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
|
2011-11-24 00:34:37 -08:00
|
|
|
const char *str;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
str = elm_object_text_get(sd->entry);
|
2012-12-07 00:44:47 -08:00
|
|
|
if (str && str[0])
|
2015-02-09 21:22:43 -08:00
|
|
|
_item_new(sd, str, MULTIBUTTONENTRY_POS_END, NULL, NULL, NULL);
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_entry_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2016-06-20 07:31:31 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
_current_item_state_change(sd->parent, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_object_focus_set(sd->entry, EINA_TRUE);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-04-17 19:33:43 -07:00
|
|
|
_layout_key_down_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:46:12 -07:00
|
|
|
void *event_info)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *)event_info;
|
|
|
|
|
|
|
|
if (!sd->box) return;
|
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
if (sd->last_it_select)
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
|
|
|
if (sd->selected_it &&
|
2014-11-20 20:38:12 -08:00
|
|
|
((!strcmp(ev->key, "BackSpace")) ||
|
|
|
|
(!strcmp(ev->key, "Delete"))))
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *item = sd->selected_it;
|
2012-08-30 09:46:12 -07:00
|
|
|
if (item && sd->editable)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(EO_OBJ(item));
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_object_focus_set(sd->entry, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
2016-11-01 10:51:27 -07:00
|
|
|
else if (sd->selected_it &&
|
|
|
|
((!strcmp(ev->key, "KP_Enter")) ||
|
|
|
|
(!strcmp(ev->key, "Return"))))
|
|
|
|
{
|
|
|
|
Elm_Multibuttonentry_Item_Data *item = sd->selected_it;
|
|
|
|
if (item)
|
|
|
|
_on_item_clicked(EO_OBJ(item), NULL, NULL, NULL);
|
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
else if (((!sd->selected_it && (sd->n_str == 0) &&
|
2014-11-20 20:38:12 -08:00
|
|
|
(!strcmp(ev->key, "BackSpace"))) ||
|
|
|
|
(!strcmp(ev->key, "Delete"))))
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Object_Item *eo_item = eina_list_data_get(eina_list_last(sd->items));
|
|
|
|
if (eo_item)
|
|
|
|
{
|
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
2015-02-09 21:22:43 -08:00
|
|
|
_item_select(sd->parent, item);
|
2014-09-27 22:15:07 -07:00
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2015-02-09 21:22:43 -08:00
|
|
|
sd->last_it_select = EINA_TRUE;
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_entry_key_down_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:46:12 -07:00
|
|
|
void *event_info)
|
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
|
|
|
|
|
|
|
|
if (sd->n_str == 1 &&
|
2013-07-30 23:14:09 -07:00
|
|
|
(!strcmp(ev->key, "BackSpace") || !strcmp(ev->key, "Delete")))
|
2015-02-09 21:22:43 -08:00
|
|
|
sd->last_it_select = EINA_FALSE;
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_entry_key_up_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:46:12 -07:00
|
|
|
void *event_info)
|
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *)event_info;
|
2011-11-24 00:34:37 -08:00
|
|
|
const char *str;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (!sd->box) return;
|
|
|
|
|
|
|
|
str = elm_object_text_get(sd->entry);
|
2016-12-20 16:08:42 -08:00
|
|
|
if (!str) return;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
if (strlen(str) &&
|
2013-07-30 23:14:09 -07:00
|
|
|
(!strcmp(ev->key, "KP_Enter") || !strcmp(ev->key, "Return")))
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
_item_new(sd, str, MULTIBUTTONENTRY_POS_END, NULL, NULL, NULL);
|
2012-08-30 09:46:12 -07:00
|
|
|
sd->n_str = 0;
|
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:46:12 -07:00
|
|
|
_callbacks_register(Evas_Object *obj)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2013-10-05 01:12:50 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
elm_layout_signal_callback_add
|
2015-02-02 18:38:21 -08:00
|
|
|
(obj, "mouse,clicked,1", "*", _mouse_clicked_signal_cb, NULL);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_event_callback_add
|
2014-04-17 19:33:43 -07:00
|
|
|
(wd->resize_obj, EVAS_CALLBACK_KEY_DOWN,
|
|
|
|
_layout_key_down_cb, obj);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_event_callback_add
|
2013-04-24 04:41:37 -07:00
|
|
|
(sd->box, EVAS_CALLBACK_RESIZE, _box_resize_cb, obj);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_event_callback_add
|
2013-04-24 04:41:37 -07:00
|
|
|
(sd->entry, EVAS_CALLBACK_KEY_UP, _entry_key_up_cb, obj);
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_event_callback_add
|
2013-04-24 04:41:37 -07:00
|
|
|
(sd->entry, EVAS_CALLBACK_KEY_DOWN, _entry_key_down_cb, obj);
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_event_callback_add
|
2013-04-24 04:41:37 -07:00
|
|
|
(sd->entry, EVAS_CALLBACK_RESIZE, _entry_resize_cb, obj);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_array_add(sd->entry, _multi_buttonentry_cb(), obj);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:46:12 -07:00
|
|
|
_label_set(Evas_Object *obj,
|
|
|
|
const char *str)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2013-08-23 07:30:46 -07:00
|
|
|
Evas_Coord width, height;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2011-11-24 00:34:47 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
if (!str) return;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
eina_stringshare_replace(&sd->label_str, str);
|
|
|
|
|
2013-08-23 07:30:46 -07:00
|
|
|
edje_object_part_text_escaped_set(sd->label, "elm.text", str);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
if (!strlen(str))
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-07-28 14:34:40 -07:00
|
|
|
sd->label_packed = EINA_FALSE;
|
elm_multibuttonentry: fix label position and size defects
Summary:
1.) Fixing defective label position.
Whenever user create multibuttonentry and set some text into label,
label will be shown at zero point (0,0) of MultiButtonEntry parent.
But then, after clicking on any button of MBE object, label position forced to
be recalculated and changes it's position.
2.) Fixing wrong size when label is not used.
When label is not being used, buttons shift by few pixels,
and it looks like if label is actually there, which is wrong.
@fix
Reviewers: cedric, seoz, raster, reutskiy.v.v, Hermet
Reviewed By: Hermet
Subscribers: NikaWhite
Differential Revision: https://phab.enlightenment.org/D2416
2015-04-26 18:47:22 -07:00
|
|
|
elm_box_unpack(sd->box, sd->label);
|
2015-07-28 14:34:40 -07:00
|
|
|
evas_object_hide(sd->label);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
else
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-10-25 17:20:53 -07:00
|
|
|
if (sd->label_packed)
|
|
|
|
elm_box_unpack(sd->box, sd->label);
|
2015-07-28 14:34:40 -07:00
|
|
|
sd->label_packed = EINA_TRUE;
|
2013-08-23 07:30:46 -07:00
|
|
|
edje_object_size_min_calc(sd->label, &width, &height);
|
2015-07-28 14:34:40 -07:00
|
|
|
evas_object_size_hint_min_set(sd->label, width, height);
|
elm_multibuttonentry: fix label position and size defects
Summary:
1.) Fixing defective label position.
Whenever user create multibuttonentry and set some text into label,
label will be shown at zero point (0,0) of MultiButtonEntry parent.
But then, after clicking on any button of MBE object, label position forced to
be recalculated and changes it's position.
2.) Fixing wrong size when label is not used.
When label is not being used, buttons shift by few pixels,
and it looks like if label is actually there, which is wrong.
@fix
Reviewers: cedric, seoz, raster, reutskiy.v.v, Hermet
Reviewed By: Hermet
Subscribers: NikaWhite
Differential Revision: https://phab.enlightenment.org/D2416
2015-04-26 18:47:22 -07:00
|
|
|
elm_box_pack_start(sd->box, sd->label);
|
2015-07-28 14:34:40 -07:00
|
|
|
evas_object_show(sd->label);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
_view_update(sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_guide_text_set(Evas_Object *obj,
|
|
|
|
const char *str)
|
|
|
|
{
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
if (!str) return;
|
|
|
|
|
|
|
|
eina_stringshare_replace(&sd->guide_text_str, str);
|
|
|
|
if (sd->guide_text == NULL)
|
|
|
|
sd->guide_text = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
|
|
|
|
if (sd->guide_text)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_widget_theme_object_set(obj, sd->guide_text, "multibuttonentry",
|
|
|
|
"guidetext", elm_widget_style_get(obj));
|
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(sd->guide_text, 0.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(sd->guide_text, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
edje_object_part_text_escaped_set(sd->guide_text, "elm.text", str);
|
2012-12-07 00:44:47 -08:00
|
|
|
_view_update(sd);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
static Elm_Multibuttonentry_Item_Filter *
|
|
|
|
_filter_new(Elm_Multibuttonentry_Item_Filter_Cb func,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
Elm_Multibuttonentry_Item_Filter *item_filter =
|
|
|
|
ELM_NEW(Elm_Multibuttonentry_Item_Filter);
|
|
|
|
if (!item_filter) return NULL;
|
2011-11-24 00:34:47 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
item_filter->callback_func = func;
|
|
|
|
item_filter->data = data;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
return item_filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_filter_free(Elm_Multibuttonentry_Item_Filter *item_filter)
|
|
|
|
{
|
|
|
|
free(item_filter);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
static Eina_Bool
|
2012-08-30 09:46:12 -07:00
|
|
|
_box_min_size_calculate(Evas_Object *box,
|
2015-03-04 03:38:04 -08:00
|
|
|
Evas_Object_Box_Data *priv,
|
|
|
|
int *line_height,
|
|
|
|
void *data EINA_UNUSED)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-03-04 03:38:04 -08:00
|
|
|
Evas_Coord mnw, mnh, w, minw, minh = 0, linew = 0, lineh = 0;
|
|
|
|
int line_num;
|
2015-10-01 03:50:23 -07:00
|
|
|
Eina_List *l;
|
2011-11-23 17:06:26 -08:00
|
|
|
Evas_Object_Box_Option *opt;
|
|
|
|
|
|
|
|
evas_object_geometry_get(box, NULL, NULL, &w, NULL);
|
2016-06-09 00:29:40 -07:00
|
|
|
efl_gfx_size_hint_combined_min_get(box, &minw, NULL);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
if (!w) return EINA_FALSE;
|
|
|
|
|
|
|
|
line_num = 1;
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(priv->children, l, opt)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2016-06-09 00:29:40 -07:00
|
|
|
efl_gfx_size_hint_combined_min_get(opt->obj, &mnw, &mnh);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
linew += mnw;
|
|
|
|
if (lineh < mnh) lineh = mnh;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
if (linew > w)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-03-04 03:38:04 -08:00
|
|
|
linew = mnw;
|
|
|
|
line_num++;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
|
|
|
|
if ((linew != 0) && (l != eina_list_last(priv->children)))
|
|
|
|
linew += priv->pad.h;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
minh = lineh * line_num + (line_num - 1) * priv->pad.v;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
|
|
|
evas_object_size_hint_min_set(box, minw, minh);
|
2015-03-04 03:38:04 -08:00
|
|
|
*line_height = lineh;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
return EINA_TRUE;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:46:12 -07:00
|
|
|
_box_layout_cb(Evas_Object *o,
|
|
|
|
Evas_Object_Box_Data *priv,
|
2015-03-04 03:38:04 -08:00
|
|
|
void *data)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h, xx, yy;
|
2015-03-04 03:38:04 -08:00
|
|
|
Evas_Coord minw, minh, linew = 0, lineh = 0;
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Object_Box_Option *opt;
|
2012-10-10 02:44:38 -07:00
|
|
|
const Eina_List *l, *l_next;
|
2011-11-23 17:06:26 -08:00
|
|
|
Evas_Object *obj;
|
|
|
|
double ax, ay;
|
2015-09-14 04:53:34 -07:00
|
|
|
Eina_Bool rtl;
|
2012-10-10 17:35:00 -07:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
if (!_box_min_size_calculate(o, priv, &lineh, data)) return;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
|
|
|
evas_object_geometry_get(o, &x, &y, &w, &h);
|
|
|
|
|
2016-06-09 00:29:40 -07:00
|
|
|
efl_gfx_size_hint_combined_min_get(o, &minw, &minh);
|
2011-11-23 17:06:26 -08:00
|
|
|
evas_object_size_hint_align_get(o, &ax, &ay);
|
2015-09-14 04:53:34 -07:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
rtl = efl_ui_mirrored_get(data);
|
2015-09-14 04:53:34 -07:00
|
|
|
if (rtl) ax = 1.0 - ax;
|
|
|
|
|
2011-11-23 17:06:26 -08:00
|
|
|
if (w < minw)
|
|
|
|
{
|
|
|
|
x = x + ((w - minw) * (1.0 - ax));
|
|
|
|
w = minw;
|
|
|
|
}
|
|
|
|
if (h < minh)
|
|
|
|
{
|
|
|
|
y = y + ((h - minh) * (1.0 - ay));
|
|
|
|
h = minh;
|
|
|
|
}
|
|
|
|
|
|
|
|
xx = x;
|
|
|
|
yy = y;
|
|
|
|
|
2012-10-10 02:44:38 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(priv->children, l, l_next, opt)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-03-04 03:38:04 -08:00
|
|
|
Evas_Coord mnw, mnh;
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Coord ww, hh, ow, oh;
|
2011-11-23 17:06:26 -08:00
|
|
|
double wx, wy;
|
2011-12-25 20:01:31 -08:00
|
|
|
int fw, fh;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
|
|
|
obj = opt->obj;
|
|
|
|
evas_object_size_hint_align_get(obj, &ax, &ay);
|
|
|
|
evas_object_size_hint_weight_get(obj, &wx, &wy);
|
2016-06-09 00:29:40 -07:00
|
|
|
efl_gfx_size_hint_combined_min_get(obj, &mnw, &mnh);
|
2015-03-04 03:38:04 -08:00
|
|
|
|
|
|
|
fw = fh = EINA_FALSE;
|
2017-01-06 09:57:46 -08:00
|
|
|
if (EINA_DBL_EQ(ax, -1)) {fw = 1; ax = 0.5; }
|
|
|
|
if (EINA_DBL_EQ(ay, -1)) {fh = 1; ay = 0.5; }
|
2015-09-14 04:53:34 -07:00
|
|
|
if (rtl) ax = 1.0 - ax;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
ww = mnw;
|
2017-01-06 09:57:46 -08:00
|
|
|
if (!EINA_DBL_EQ(wx, 0))
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-03-04 03:38:04 -08:00
|
|
|
if (ww <= w - linew) ww = w - linew;
|
|
|
|
else ww = w;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
2015-03-04 03:38:04 -08:00
|
|
|
hh = lineh;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
|
|
|
ow = mnw;
|
|
|
|
if (fw) ow = ww;
|
|
|
|
oh = mnh;
|
|
|
|
if (fh) oh = hh;
|
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
linew += ww;
|
|
|
|
if (linew > w && l != priv->children)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-03-04 03:38:04 -08:00
|
|
|
xx = x;
|
|
|
|
yy += hh;
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
yy += priv->pad.v;
|
2015-03-04 03:38:04 -08:00
|
|
|
linew = ww;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
evas_object_move(obj,
|
2015-09-14 04:53:34 -07:00
|
|
|
((!rtl) ? (xx) : (x + (w - (xx - x) - ww)))
|
|
|
|
+ (Evas_Coord)(((double)(ww - ow)) * ax),
|
2015-03-04 03:38:04 -08:00
|
|
|
yy + (Evas_Coord)(((double)(hh - oh)) * ay));
|
2011-11-23 17:06:26 -08:00
|
|
|
evas_object_resize(obj, ow, oh);
|
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
xx += ww;
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
xx += priv->pad.h;
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
if (linew > w)
|
|
|
|
{
|
|
|
|
opt = eina_list_data_get(l_next);
|
2016-08-15 06:44:41 -07:00
|
|
|
if (opt && opt->obj && efl_isa(opt->obj, ELM_ENTRY_CLASS))
|
2015-03-04 03:38:04 -08:00
|
|
|
{
|
|
|
|
xx = x;
|
|
|
|
yy += hh;
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
yy += priv->pad.v;
|
2015-03-04 03:38:04 -08:00
|
|
|
linew = 0;
|
|
|
|
}
|
|
|
|
}
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
if ((linew != 0) && (l != eina_list_last(priv->children)))
|
|
|
|
linew += priv->pad.h;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-02 02:40:17 -08:00
|
|
|
static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_view_init(Evas_Object *obj, Elm_Multibuttonentry_Data *sd)
|
2012-01-02 02:40:17 -08:00
|
|
|
{
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
const char *str;
|
2015-10-01 03:41:06 -07:00
|
|
|
double pad_scale;
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
int hpad = 0, vpad = 0;
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
sd->box = elm_box_add(obj);
|
|
|
|
|
|
|
|
if (!sd->box) return;
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
|
|
|
|
str = elm_layout_data_get(obj, "horizontal_pad");
|
|
|
|
if (str) hpad = atoi(str);
|
|
|
|
str = elm_layout_data_get(obj, "vertical_pad");
|
|
|
|
if (str) vpad = atoi(str);
|
2017-06-09 00:47:42 -07:00
|
|
|
pad_scale = efl_ui_scale_get(obj) * elm_config_scale_get()
|
2015-10-01 03:41:06 -07:00
|
|
|
/ edje_object_base_scale_get(elm_layout_edje_get(obj));
|
|
|
|
elm_box_padding_set(sd->box, (hpad * pad_scale), (vpad * pad_scale));
|
multibuttonentry: add horizontal, vertical padding between items.
Summary:
There is no way to give padding between each items, previously.
So i added horizontal, vertical padding here.
I will add APIs for set, get padding size set, get.
@feature
Test Plan:
Change the horizontal, vertical paddidng value in multibuttonentry.edc
Run elementary_test
Execute multibuttonentry sample.
Add items.
Check the padding between items.
Reviewers: woohyun, seoz, Hermet, raster
Reviewed By: Hermet, raster
Subscribers: raster
Differential Revision: https://phab.enlightenment.org/D2534
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:18:17 -07:00
|
|
|
|
2015-03-04 03:38:04 -08:00
|
|
|
elm_box_layout_set(sd->box, _box_layout_cb, obj, NULL);
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_box_homogeneous_set(sd->box, EINA_FALSE);
|
|
|
|
elm_layout_content_set(obj, "box.swallow", sd->box);
|
|
|
|
|
|
|
|
sd->label = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
if (!sd->label) return;
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, sd->label, "multibuttonentry", "label",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
|
2012-10-10 02:37:50 -07:00
|
|
|
// ACCESS
|
2013-03-22 01:42:04 -07:00
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
2012-10-10 02:37:50 -07:00
|
|
|
_access_multibuttonentry_label_register(obj, EINA_TRUE);
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
sd->entry = elm_entry_add(obj);
|
|
|
|
if (!sd->entry) return;
|
|
|
|
elm_entry_single_line_set(sd->entry, EINA_TRUE);
|
2015-11-22 22:50:17 -08:00
|
|
|
elm_entry_cnp_mode_set(sd->entry, ELM_CNP_MODE_PLAINTEXT);
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_object_text_set(sd->entry, "");
|
|
|
|
elm_entry_input_panel_enabled_set(sd->entry, EINA_FALSE);
|
|
|
|
evas_object_size_hint_min_set(sd->entry, MIN_W_ENTRY, 0);
|
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(sd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(sd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_box_pack_end(sd->box, sd->entry);
|
|
|
|
evas_object_show(sd->entry);
|
|
|
|
|
|
|
|
sd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY;
|
|
|
|
|
|
|
|
{
|
2013-08-23 07:30:46 -07:00
|
|
|
Evas_Coord button_min_width = 0, button_min_height = 0;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
sd->end = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
if (!sd->end) return;
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, sd->end, "multibuttonentry", "closedbutton",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
|
2013-08-23 07:30:46 -07:00
|
|
|
edje_object_size_min_calc(sd->end, &button_min_width, &button_min_height);
|
|
|
|
elm_coords_finger_size_adjust(1, &button_min_width, 1, &button_min_height);
|
|
|
|
evas_object_size_hint_min_set(sd->end, button_min_width, button_min_height);
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_widget_sub_object_add(obj, sd->end);
|
|
|
|
}
|
2012-01-02 02:40:17 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-06-04 07:25:36 -07:00
|
|
|
_elm_multibuttonentry_text_set(Eo *obj, Elm_Multibuttonentry_Data *sd EINA_UNUSED, const char *part, const char *label)
|
2012-01-02 02:40:17 -08:00
|
|
|
{
|
2017-06-04 07:25:36 -07:00
|
|
|
Eina_Bool int_ret = EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-06-29 11:33:12 -07:00
|
|
|
if (!part || !strcmp(part, "default") || !strcmp(part, "elm.text"))
|
2012-03-05 23:45:10 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
if (label) _label_set(obj, label);
|
2012-11-25 22:32:53 -08:00
|
|
|
int_ret = EINA_TRUE;
|
2012-03-05 23:45:10 -08:00
|
|
|
}
|
|
|
|
else if (!strcmp(part, "guide"))
|
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
if (label) _guide_text_set(obj, label);
|
2012-11-25 22:32:53 -08:00
|
|
|
int_ret = EINA_TRUE;
|
2012-03-05 23:45:10 -08:00
|
|
|
}
|
2013-07-22 14:05:16 -07:00
|
|
|
else
|
2017-06-04 07:25:36 -07:00
|
|
|
efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
return int_ret;
|
2012-01-02 02:40:17 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static const char*
|
2017-06-04 07:25:36 -07:00
|
|
|
_elm_multibuttonentry_text_get(Eo *obj, Elm_Multibuttonentry_Data *sd, const char *part)
|
2012-01-02 02:40:17 -08:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
const char *text = NULL;
|
2012-03-06 04:06:47 -08:00
|
|
|
|
2012-03-05 23:45:10 -08:00
|
|
|
if (!part || !strcmp(part, "default"))
|
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
text = sd->label_str;
|
2012-03-05 23:45:10 -08:00
|
|
|
}
|
|
|
|
else if (!strcmp(part, "guide"))
|
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
text = sd->guide_text_str;
|
2012-03-05 23:45:10 -08:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
else
|
2017-06-04 07:25:36 -07:00
|
|
|
text = efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
|
2014-03-30 00:57:14 -07:00
|
|
|
|
|
|
|
return text;
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
|
2012-10-10 02:37:50 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
2012-10-10 02:37:50 -07:00
|
|
|
{
|
|
|
|
char *ret;
|
|
|
|
Eina_Strbuf *buf;
|
|
|
|
Eina_List *l = NULL;
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
2012-10-10 02:37:50 -07:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
|
2012-10-10 02:37:50 -07:00
|
|
|
|
|
|
|
if (sd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
|
|
|
|
{
|
|
|
|
if (sd->guide_text_str) return strdup(sd->guide_text_str);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
|
|
|
|
|
|
|
if (sd->label_str) eina_strbuf_append(buf, sd->label_str);
|
|
|
|
|
|
|
|
int invisible_its = 0;
|
2014-09-27 22:15:07 -07:00
|
|
|
EINA_LIST_FOREACH (sd->items, l, eo_item)
|
2012-10-10 02:37:50 -07:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
|
|
|
if (item->visible)
|
2012-10-10 02:37:50 -07:00
|
|
|
eina_strbuf_append_printf(buf, ", %s",
|
2015-02-09 21:22:43 -08:00
|
|
|
edje_object_part_text_get(elm_layout_edje_get(VIEW(item)), "elm.btn.text"));
|
2012-10-10 02:37:50 -07:00
|
|
|
else
|
|
|
|
invisible_its++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (invisible_its)
|
|
|
|
eina_strbuf_append_printf(buf, ", and %d more", invisible_its);
|
|
|
|
|
|
|
|
ret = eina_strbuf_string_steal(buf);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_multibuttonentry_efl_canvas_group_group_add(Eo *obj, Elm_Multibuttonentry_Data *priv)
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2013-10-05 01:12:50 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-08-30 09:46:12 -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
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(obj, "multibuttonentry", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
priv->last_it_select = EINA_TRUE;
|
2012-08-30 09:46:12 -07:00
|
|
|
priv->editable = EINA_TRUE;
|
2012-12-07 00:44:47 -08:00
|
|
|
priv->parent = obj;
|
2013-12-26 09:27:39 -08:00
|
|
|
priv->format_func = _format_count;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
_view_init(obj, priv);
|
2012-08-30 09:46:12 -07:00
|
|
|
_callbacks_register(obj);
|
2012-10-10 02:37:50 -07:00
|
|
|
|
|
|
|
// ACCESS
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_access_object_register(obj, wd->resize_obj);
|
2012-10-10 02:37:50 -07:00
|
|
|
_elm_access_text_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("multi button entry"));
|
2012-10-10 02:37:50 -07:00
|
|
|
_elm_access_callback_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_multibuttonentry_efl_canvas_group_group_del(Eo *obj, Elm_Multibuttonentry_Data *sd)
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2017-07-18 18:35:49 -07:00
|
|
|
Eina_List *l;
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
2015-10-01 03:03:29 -07:00
|
|
|
Elm_Multibuttonentry_Item_Filter *_item_filter = NULL;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2017-07-18 18:35:49 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_item)
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_del(eo_item);
|
2015-02-09 21:22:43 -08:00
|
|
|
|
2017-07-18 18:35:49 -07:00
|
|
|
sd->items = eina_list_free(sd->items);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
sd->selected_it = NULL;
|
|
|
|
|
2014-01-21 17:12:44 -08:00
|
|
|
eina_stringshare_del(sd->label_str);
|
|
|
|
eina_stringshare_del(sd->guide_text_str);
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_del(sd->entry);
|
2014-01-21 17:12:44 -08:00
|
|
|
evas_object_del(sd->label);
|
|
|
|
evas_object_del(sd->guide_text);
|
|
|
|
evas_object_del(sd->end);
|
2015-03-27 23:05:44 -07:00
|
|
|
ecore_timer_del(sd->longpress_timer);
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2015-10-01 03:03:29 -07:00
|
|
|
EINA_LIST_FREE(sd->filter_list, _item_filter)
|
|
|
|
_filter_free(_item_filter);
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-08-30 09:46:12 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-10-27 02:44:44 -07:00
|
|
|
return _elm_multibuttonentry_smart_focus_direction_enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_multibuttonentry_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, const Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item **direction_item, double *weight)
|
|
|
|
{
|
|
|
|
Eina_Bool ret;
|
|
|
|
Eina_List *items = NULL;
|
|
|
|
|
|
|
|
items = eina_list_append(items, sd->box);
|
|
|
|
|
|
|
|
ret = elm_widget_focus_list_direction_get
|
|
|
|
(obj, base, items, eina_list_data_get, degree, direction, direction_item, weight);
|
|
|
|
eina_list_free(items);
|
|
|
|
|
|
|
|
return ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd EINA_UNUSED)
|
2012-10-10 02:37:50 -07:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
return _elm_multibuttonentry_smart_focus_next_enable;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-09-15 03:41:51 -07:00
|
|
|
_elm_multibuttonentry_elm_widget_focus_next(Eo *obj, Elm_Multibuttonentry_Data *sd, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
|
|
|
|
2012-10-10 02:37:50 -07:00
|
|
|
Eina_List *items = NULL;
|
|
|
|
Eina_List *l = NULL;
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
2012-10-10 02:37:50 -07:00
|
|
|
Evas_Object *ao;
|
|
|
|
Evas_Object *po;
|
|
|
|
|
|
|
|
if (!elm_widget_focus_get(obj))
|
|
|
|
{
|
|
|
|
*next = (Evas_Object *)obj;
|
2014-03-30 00:57:14 -07:00
|
|
|
return EINA_TRUE;
|
2012-10-10 02:37:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sd->label)
|
|
|
|
{
|
2013-08-23 07:30:46 -07:00
|
|
|
po = (Evas_Object *)edje_object_part_object_get(sd->label, "elm.text");
|
2012-10-10 02:37:50 -07:00
|
|
|
ao = evas_object_data_get(po, "_part_access_obj");
|
2012-11-25 22:32:53 -08:00
|
|
|
int_ret = elm_widget_focus_get(ao);
|
2012-10-10 02:37:50 -07:00
|
|
|
items = eina_list_append(items, ao);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EINA_LIST_FOREACH (sd->items, l, eo_item)
|
2012-10-10 02:37:50 -07:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
2012-10-10 02:37:50 -07:00
|
|
|
po = (Evas_Object *)edje_object_part_object_get
|
2015-02-09 21:22:43 -08:00
|
|
|
(elm_layout_edje_get(VIEW(item)), "elm.btn.text");
|
2012-10-10 02:37:50 -07:00
|
|
|
ao = evas_object_data_get(po, "_part_access_obj");
|
2012-11-25 22:32:53 -08:00
|
|
|
int_ret = int_ret || elm_widget_focus_get(ao);
|
2012-10-10 02:37:50 -07:00
|
|
|
items = eina_list_append(items, ao);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sd->entry)
|
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
int_ret = int_ret || elm_widget_focus_get(sd->entry);
|
2012-10-10 02:37:50 -07:00
|
|
|
/* elm_widget_list_focus_liset_next_get() check parent of item
|
|
|
|
because parent sd->entry is not multibuttnentry but sd->box
|
|
|
|
so append sd->box instead of sd->entry, is this proper? */
|
|
|
|
items = eina_list_append(items, sd->box);
|
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
if (int_ret)
|
|
|
|
return elm_widget_focus_list_next_get
|
2015-09-15 03:41:51 -07:00
|
|
|
(obj, items, eina_list_data_get, dir, next, next_item);
|
2014-03-30 00:57:14 -07:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
2012-10-10 02:37:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_obj_process(Evas_Object *obj, Eina_Bool is_access)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Object_Item *it;
|
2012-10-10 02:37:50 -07:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
|
2012-10-10 02:37:50 -07:00
|
|
|
|
|
|
|
/* label */
|
|
|
|
_access_multibuttonentry_label_register(obj, is_access);
|
|
|
|
|
|
|
|
/* buttons */
|
2012-12-07 00:44:47 -08:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, it)
|
2012-10-10 02:37:50 -07:00
|
|
|
_access_multibuttonentry_item_register(obj, it, is_access);
|
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_elm_widget_access(Eo *obj, Elm_Multibuttonentry_Data *sd EINA_UNUSED, Eina_Bool acs)
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
_elm_multibuttonentry_smart_focus_next_enable = acs;
|
2012-11-25 22:32:53 -08:00
|
|
|
_access_obj_process(obj, _elm_multibuttonentry_smart_focus_next_enable);
|
2012-01-02 02:40:17 -08:00
|
|
|
}
|
|
|
|
|
2011-11-23 17:06:26 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_multibuttonentry_add(Evas_Object *parent)
|
|
|
|
{
|
2012-08-30 09:46:12 -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
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_multibuttonentry_efl_object_constructor(Eo *obj, Elm_Multibuttonentry_Data *sd 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);
|
elc_multibuttonentry: role of MBE item, MBE updated, and state_set_get API added.
Summary:
Reason for role change:
MBE items do not act like push buttons, they need to maintain their status and at a time only one item can be selected, they act like radio buttons.
Role change of MBE from entry to panel, because MBE is just a container and entry is one of the children, when entry gets access frame, it will work as how entry works, but making MBE role as entry does not work as expected and also MBE should not receive highlight as a whole but only its children should receive highlight one more reason why MBE role cannot be entry.
state_set_get API added to get items state.
Test Plan:
When atspi mode is enabled the access frame has to
navigate directly on item and not on MBE as a whole and state has to
be read out
Reviewers: kimcinoo, cedric
Reviewed By: cedric
Subscribers: cedric, govi, rajeshps, jpeg
Differential Revision: https://phab.enlightenment.org/D4925
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-06-05 13:56:42 -07:00
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_PANEL);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_entry_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
return sd->entry;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_expanded_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
return sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK ?
|
2012-08-30 09:46:12 -07:00
|
|
|
EINA_FALSE : EINA_TRUE;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_format_function_set(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, Elm_Multibuttonentry_Format_Cb f_func, const void *data)
|
2013-12-26 09:27:39 -08:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
sd->format_func = f_func;
|
2013-12-26 09:27:39 -08:00
|
|
|
if (!sd->format_func) sd->format_func = _format_count;
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
sd->format_func_data = data;
|
2013-12-26 09:27:39 -08:00
|
|
|
|
|
|
|
_view_update(sd);
|
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_expanded_set(Eo *obj, Elm_Multibuttonentry_Data *sd, Eina_Bool expanded)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
if (((sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) ?
|
|
|
|
EINA_FALSE : EINA_TRUE) == expanded) return;
|
2012-03-05 17:45:25 -08:00
|
|
|
|
|
|
|
if (expanded)
|
2012-03-06 04:06:47 -08:00
|
|
|
_shrink_mode_set(obj, EINA_FALSE);
|
2012-03-05 17:45:25 -08:00
|
|
|
else
|
2012-03-06 04:06:47 -08:00
|
|
|
_shrink_mode_set(obj, EINA_TRUE);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_editable_set(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, Eina_Bool editable)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
editable = !!editable;
|
|
|
|
if (sd->editable == editable) return;
|
|
|
|
sd->editable = editable;
|
2012-07-03 04:22:46 -07:00
|
|
|
|
2015-10-29 22:52:00 -07:00
|
|
|
if (sd->editable && (sd->view_state != MULTIBUTTONENTRY_VIEW_SHRINK))
|
|
|
|
{
|
|
|
|
elm_box_pack_end(sd->box, sd->entry);
|
|
|
|
evas_object_show(sd->entry);
|
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
else
|
2012-07-03 04:22:46 -07:00
|
|
|
{
|
2015-07-28 13:54:21 -07:00
|
|
|
elm_box_unpack(sd->box, sd->entry);
|
2012-08-30 09:46:12 -07:00
|
|
|
evas_object_hide(sd->entry);
|
2012-07-03 04:22:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_editable_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
|
2012-07-03 04:22:46 -07:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
return sd->editable;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_item_prepend(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, const char *label, Evas_Smart_Cb func, void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
return _item_new(sd, label, MULTIBUTTONENTRY_POS_START, NULL, func, data);
|
2012-07-03 04:22:46 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_item_append(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, const char *label, Evas_Smart_Cb func, void *data)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
return _item_new(sd, label, MULTIBUTTONENTRY_POS_END, NULL, func, data);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_item_insert_before(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, Elm_Object_Item *before, const char *label, Evas_Smart_Cb func, void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
return _item_new(sd, label, MULTIBUTTONENTRY_POS_BEFORE, before, func, data);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_item_insert_after(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, Elm_Object_Item *after, const char *label, Evas_Smart_Cb func, void *data)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
return _item_new(sd, label, MULTIBUTTONENTRY_POS_AFTER, after, func, data);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static const Eina_List*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_items_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
return sd->items;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_first_item_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
return eina_list_data_get(sd->items);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_last_item_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-03-30 00:57:14 -07:00
|
|
|
return eina_list_data_get(eina_list_last(sd->items));
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_selected_item_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
return EO_OBJ(sd->selected_it);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_multibuttonentry_item_selected_set(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Multibuttonentry_Item_Data *item,
|
|
|
|
Eina_Bool selected)
|
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
if (selected) _item_select(WIDGET(item), item);
|
|
|
|
else _item_select(WIDGET(item), NULL);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_multibuttonentry_item_selected_get(Eo *eo_item,
|
2016-06-08 13:48:07 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *item)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2016-06-08 13:48:07 -07:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(WIDGET(item), sd, EINA_FALSE);
|
2014-09-27 22:15:07 -07:00
|
|
|
if (!eo_item) return EINA_FALSE;
|
2016-06-08 13:48:07 -07:00
|
|
|
if (EO_OBJ(sd->selected_it) == eo_item)
|
|
|
|
return EINA_TRUE;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2016-06-08 13:48:07 -07:00
|
|
|
return EINA_FALSE;
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_clear(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2015-09-21 16:49:45 -07:00
|
|
|
while (sd->items)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(eina_list_data_get(sd->items));
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
sd->selected_it = NULL;
|
2012-12-07 00:44:47 -08:00
|
|
|
_view_update(sd);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_multibuttonentry_item_prev_get(const Eo *eo_it,
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *it)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
2015-02-09 21:22:43 -08:00
|
|
|
Elm_Object_Item *eo_temp_it;
|
2012-01-02 01:03:02 -08:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(WIDGET(it), sd, NULL);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_temp_it)
|
2012-01-02 01:03:02 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
if (eo_temp_it == eo_it)
|
2012-01-02 01:03:02 -08:00
|
|
|
{
|
|
|
|
l = eina_list_prev(l);
|
|
|
|
if (!l) return NULL;
|
|
|
|
return eina_list_data_get(l);
|
|
|
|
}
|
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_multibuttonentry_item_next_get(const Eo *eo_it,
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *it)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
2015-02-09 21:22:43 -08:00
|
|
|
Elm_Object_Item *eo_temp_it;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2012-12-07 00:44:47 -08:00
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(WIDGET(it), sd, NULL);
|
2011-11-23 17:06:26 -08:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_temp_it)
|
2012-01-02 01:03:02 -08:00
|
|
|
{
|
2015-02-09 21:22:43 -08:00
|
|
|
if (eo_temp_it == eo_it)
|
2012-01-02 01:03:02 -08:00
|
|
|
{
|
|
|
|
l = eina_list_next(l);
|
|
|
|
if (!l) return NULL;
|
|
|
|
return eina_list_data_get(l);
|
|
|
|
}
|
|
|
|
}
|
2011-11-23 17:06:26 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-10-01 03:55:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_multibuttonentry_item_elm_widget_item_disable(Eo *eo_it, Elm_Multibuttonentry_Item_Data *it)
|
|
|
|
{
|
|
|
|
const char* emission;
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(eo_it))
|
2015-10-01 03:55:02 -07:00
|
|
|
emission = "elm,state,disabled";
|
|
|
|
else
|
|
|
|
emission = "elm,state,enabled";
|
|
|
|
|
|
|
|
elm_layout_signal_emit(VIEW(it), emission, "elm");
|
|
|
|
}
|
|
|
|
|
2012-03-25 17:07:28 -07:00
|
|
|
EINA_DEPRECATED EAPI void *
|
2012-01-02 02:10:23 -08:00
|
|
|
elm_multibuttonentry_item_data_get(const Elm_Object_Item *it)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-09-14 04:51:26 -07:00
|
|
|
return (void *)WIDGET_ITEM_DATA_GET(it);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2012-03-25 17:07:28 -07:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-08-30 09:46:12 -07:00
|
|
|
elm_multibuttonentry_item_data_set(Elm_Object_Item *it,
|
|
|
|
void *data)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(it, data);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_item_filter_append(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, Elm_Multibuttonentry_Item_Filter_Cb func, void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2011-11-23 17:06:26 -08:00
|
|
|
Elm_Multibuttonentry_Item_Filter *new_item_filter = NULL;
|
|
|
|
Elm_Multibuttonentry_Item_Filter *_item_filter = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->filter_list, l, _item_filter)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
if (_item_filter && ((_item_filter->callback_func == func)
|
|
|
|
&& (_item_filter->data == data)))
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
INF("Already Registered this item filter!!!!\n");
|
2011-11-23 17:06:26 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2012-12-13 07:20:22 -08:00
|
|
|
new_item_filter = _filter_new(func, data);
|
|
|
|
if (!new_item_filter) return;
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
sd->filter_list = eina_list_append(sd->filter_list, new_item_filter);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_item_filter_prepend(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, Elm_Multibuttonentry_Item_Filter_Cb func, void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2011-11-23 17:06:26 -08:00
|
|
|
Elm_Multibuttonentry_Item_Filter *new_item_filter = NULL;
|
|
|
|
Elm_Multibuttonentry_Item_Filter *_item_filter = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
|
|
|
|
2011-11-24 00:34:47 -08:00
|
|
|
new_item_filter = _filter_new(func, data);
|
2011-11-23 17:06:26 -08:00
|
|
|
if (!new_item_filter) return;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->filter_list, l, _item_filter)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
if (_item_filter && ((_item_filter->callback_func == func)
|
|
|
|
&& (_item_filter->data == data)))
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
INF("Already Registered this item filter!!!!\n");
|
2013-01-09 00:28:03 -08:00
|
|
|
_filter_free(new_item_filter);
|
2011-11-23 17:06:26 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2012-08-30 09:46:12 -07:00
|
|
|
sd->filter_list = eina_list_prepend(sd->filter_list, new_item_filter);
|
2011-11-23 17:06:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 00:57:14 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_multibuttonentry_item_filter_remove(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, Elm_Multibuttonentry_Item_Filter_Cb func, void *data)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Multibuttonentry_Item_Filter *item_filter;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->filter_list, l, item_filter)
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
if ((item_filter->callback_func == func)
|
|
|
|
&& ((!data) || (item_filter->data == data)))
|
2011-11-23 17:06:26 -08:00
|
|
|
{
|
2012-08-30 09:46:12 -07:00
|
|
|
sd->filter_list = eina_list_remove_list(sd->filter_list, l);
|
2011-11-23 17:06:26 -08:00
|
|
|
_filter_free(item_filter);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
|
|
|
static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_multibuttonentry_class_constructor(Efl_Class *klass)
|
2014-03-30 00:57:14 -07:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2013-02-09 23:52:31 -08:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
|
|
|
_elm_multibuttonentry_smart_focus_next_enable = EINA_TRUE;
|
|
|
|
}
|
2014-03-30 00:57:14 -07:00
|
|
|
|
2015-12-15 07:49:02 -08:00
|
|
|
EOLIAN static Eina_List*
|
|
|
|
_elm_multibuttonentry_elm_interface_atspi_accessible_children_get(Eo *obj, Elm_Multibuttonentry_Data *sd)
|
|
|
|
{
|
|
|
|
Eina_List *ret;
|
2016-08-15 06:44:41 -07:00
|
|
|
ret = elm_interface_atspi_accessible_children_get(efl_super(obj, ELM_MULTIBUTTONENTRY_CLASS));
|
2015-12-15 07:49:02 -08:00
|
|
|
return eina_list_merge(eina_list_clone(sd->items), ret);
|
|
|
|
}
|
|
|
|
|
2016-11-09 17:58:41 -08:00
|
|
|
EOLIAN static const char*
|
2015-12-15 07:49:02 -08:00
|
|
|
_elm_multibuttonentry_item_elm_interface_atspi_accessible_name_get(Eo *obj, Elm_Multibuttonentry_Item_Data *item)
|
|
|
|
{
|
2016-11-09 17:58:41 -08:00
|
|
|
const char *ret;
|
2016-08-15 06:44:41 -07:00
|
|
|
ret = elm_interface_atspi_accessible_name_get(efl_super(obj, ELM_MULTIBUTTONENTRY_ITEM_CLASS));
|
2015-12-15 07:49:02 -08:00
|
|
|
if (ret) return ret;
|
|
|
|
|
|
|
|
const char *txt = elm_object_part_text_get(VIEW(item), "elm.btn.text");
|
2016-11-09 17:58:41 -08:00
|
|
|
return txt;
|
2015-12-15 07:49:02 -08:00
|
|
|
}
|
|
|
|
|
elc_multibuttonentry: role of MBE item, MBE updated, and state_set_get API added.
Summary:
Reason for role change:
MBE items do not act like push buttons, they need to maintain their status and at a time only one item can be selected, they act like radio buttons.
Role change of MBE from entry to panel, because MBE is just a container and entry is one of the children, when entry gets access frame, it will work as how entry works, but making MBE role as entry does not work as expected and also MBE should not receive highlight as a whole but only its children should receive highlight one more reason why MBE role cannot be entry.
state_set_get API added to get items state.
Test Plan:
When atspi mode is enabled the access frame has to
navigate directly on item and not on MBE as a whole and state has to
be read out
Reviewers: kimcinoo, cedric
Reviewed By: cedric
Subscribers: cedric, govi, rajeshps, jpeg
Differential Revision: https://phab.enlightenment.org/D4925
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-06-05 13:56:42 -07:00
|
|
|
EOLIAN static Elm_Atspi_State_Set
|
|
|
|
_elm_multibuttonentry_item_elm_interface_atspi_accessible_state_set_get(Eo *eo_it, Elm_Multibuttonentry_Item_Data *sd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Elm_Atspi_State_Set ret;
|
|
|
|
Eina_Bool sel;
|
|
|
|
|
|
|
|
ret = elm_interface_atspi_accessible_state_set_get(efl_super(eo_it, ELM_MULTIBUTTONENTRY_ITEM_CLASS));
|
|
|
|
|
|
|
|
sel = elm_obj_multibuttonentry_item_selected_get(eo_it);
|
|
|
|
|
|
|
|
STATE_TYPE_SET(ret, ELM_ATSPI_STATE_EDITABLE);
|
|
|
|
|
|
|
|
if (sel)
|
|
|
|
STATE_TYPE_SET(ret, ELM_ATSPI_STATE_CHECKED);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-12-15 07:49:02 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_activate(Eo *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(obj, it);
|
|
|
|
elm_layout_signal_emit(VIEW(it), "mouse,clicked,1", "elm");
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_delete(Eo *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(obj, it);
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,deleted", "elm");
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_longpress(Eo *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(obj, it);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_MULTIBUTTONENTRY_EVENT_ITEM_LONGPRESSED, obj);
|
2015-12-15 07:49:02 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN const Elm_Atspi_Action *
|
|
|
|
_elm_multibuttonentry_item_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Item_Data *pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
static Elm_Atspi_Action atspi_actions[] = {
|
|
|
|
{ "activate", NULL, NULL, _key_action_activate },
|
|
|
|
{ "delete", NULL, NULL, _key_action_delete},
|
|
|
|
{ "longpress", NULL, NULL, _key_action_longpress},
|
|
|
|
{ NULL, NULL, NULL, NULL}
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2017-06-04 07:25:36 -07:00
|
|
|
/* Efl.Part begin */
|
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_PART_OVERRIDE(elm_multibuttonentry, ELM_MULTIBUTTONENTRY, EFL_UI_LAYOUT, Elm_Multibuttonentry_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_SET(elm_multibuttonentry, ELM_MULTIBUTTONENTRY, EFL_UI_LAYOUT, Elm_Multibuttonentry_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_GET(elm_multibuttonentry, ELM_MULTIBUTTONENTRY, EFL_UI_LAYOUT, Elm_Multibuttonentry_Data, Elm_Part_Data)
|
2017-06-04 07:25:36 -07:00
|
|
|
#include "elm_multibuttonentry_internal_part.eo.c"
|
|
|
|
|
|
|
|
/* Efl.Part end */
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_MULTIBUTTONENTRY_EXTRA_OPS \
|
2017-08-07 00:13:38 -07:00
|
|
|
ELM_LAYOUT_SIZING_EVAL_OPS(elm_multibuttonentry), \
|
2017-05-18 01:52:17 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_multibuttonentry)
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
#include "elm_multibuttonentry_item.eo.c"
|
2014-08-11 07:46:11 -07:00
|
|
|
#include "elm_multibuttonentry.eo.c"
|