2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2017-10-15 08:44:18 -07:00
|
|
|
#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_PROTECTED
|
2017-09-18 19:18:22 -07:00
|
|
|
#define EFL_ACCESS_SELECTION_PROTECTED
|
2017-11-15 18:31:26 -08:00
|
|
|
#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
|
2014-09-27 22:15:56 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2018-12-21 14:46:10 -08:00
|
|
|
#define EFL_UI_L10N_PROTECTED
|
2017-11-14 09:56:08 -08:00
|
|
|
#define EFL_UI_FOCUS_OBJECT_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
#include "elm_priv.h"
|
2012-08-30 09:45:00 -07:00
|
|
|
#include "elm_widget_toolbar.h"
|
2014-03-12 07:17:26 -07:00
|
|
|
#include "els_box.h"
|
2008-12-18 05:38:58 -08:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_TOOLBAR_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Toolbar"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_toolbar"
|
2008-12-18 05:38:58 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
#define ELM_TOOLBAR_ITEM_FROM_INLIST(item) \
|
2014-09-27 22:15:56 -07:00
|
|
|
((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Toolbar_Item_Data) : NULL)
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
static const char SIG_SCROLL[] = "scroll";
|
|
|
|
static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
|
|
|
|
static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
|
|
|
|
static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
|
|
|
|
static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
|
2011-04-21 17:42:32 -07:00
|
|
|
static const char SIG_CLICKED[] = "clicked";
|
2014-07-19 09:46:35 -07:00
|
|
|
static const char SIG_SELECTED[] = "selected";
|
|
|
|
static const char SIG_UNSELECTED[] = "unselected";
|
2011-10-11 15:09:14 -07:00
|
|
|
static const char SIG_LONGPRESSED[] = "longpressed";
|
|
|
|
static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
|
2014-03-23 08:22:32 -07:00
|
|
|
static const char SIG_ITEM_FOCUSED[] = "item,focused";
|
|
|
|
static const char SIG_ITEM_UNFOCUSED[] = "item,unfocused";
|
2012-08-30 09:45:00 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
{SIG_SCROLL, ""},
|
|
|
|
{SIG_SCROLL_ANIM_START, ""},
|
|
|
|
{SIG_SCROLL_ANIM_STOP, ""},
|
|
|
|
{SIG_SCROLL_DRAG_START, ""},
|
|
|
|
{SIG_SCROLL_DRAG_STOP, ""},
|
2011-04-21 17:42:32 -07:00
|
|
|
{SIG_CLICKED, ""},
|
2014-07-19 09:46:35 -07:00
|
|
|
{SIG_SELECTED, ""},
|
|
|
|
{SIG_UNSELECTED, ""},
|
2011-10-11 15:09:14 -07:00
|
|
|
{SIG_LONGPRESSED, ""},
|
|
|
|
{SIG_CLICKED_DOUBLE, ""},
|
2014-03-23 08:22:32 -07:00
|
|
|
{SIG_ITEM_FOCUSED, ""},
|
|
|
|
{SIG_ITEM_UNFOCUSED, ""},
|
2014-01-23 02:30:34 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2014-01-23 00:24:19 -08:00
|
|
|
{SIG_WIDGET_FOCUSED, ""}, /**< handled by elm_widget */
|
|
|
|
{SIG_WIDGET_UNFOCUSED, ""}, /**< handled by elm_widget */
|
2011-04-21 17:42:32 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2014-04-15 00:07:52 -07:00
|
|
|
static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
|
2015-03-19 02:46:59 -07:00
|
|
|
static void _sizing_eval(Evas_Object *obj);
|
2014-04-15 00:07:52 -07:00
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"select", _key_action_select},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
static void _item_select(Elm_Toolbar_Item_Data *it);
|
2013-04-14 22:34:15 -07:00
|
|
|
|
2010-11-08 11:59:22 -08:00
|
|
|
static int
|
2012-08-30 09:45:00 -07:00
|
|
|
_toolbar_item_prio_compare_cb(const void *i1,
|
|
|
|
const void *i2)
|
2010-11-08 11:59:22 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
const Elm_Toolbar_Item_Data *eti1 = i1;
|
|
|
|
const Elm_Toolbar_Item_Data *eti2 = i2;
|
2010-11-08 11:59:22 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (!eti2) return 1;
|
|
|
|
if (!eti1) return -1;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (eti2->prio.priority == eti1->prio.priority)
|
|
|
|
return -1;
|
2008-12-18 05:38:58 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
return eti2->prio.priority - eti1->prio.priority;
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
}
|
|
|
|
|
2008-12-18 20:26:24 -08:00
|
|
|
static void
|
2018-04-02 02:22:51 -07:00
|
|
|
_items_visibility_fix(Elm_Toolbar *obj,
|
|
|
|
Elm_Toolbar_Data *sd,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Coord *iw,
|
|
|
|
Evas_Coord vw,
|
2018-10-22 01:03:28 -07:00
|
|
|
Eina_Bool usage_bx_more,
|
2012-08-30 09:45:00 -07:00
|
|
|
Eina_Bool *more)
|
2008-12-18 20:26:24 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it, *prev;
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Coord ciw = 0, cih = 0;
|
|
|
|
Eina_List *sorted = NULL;
|
|
|
|
int count = 0, i = 0;
|
2009-08-25 15:46:19 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
*more = EINA_FALSE;
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->separator)
|
|
|
|
{
|
|
|
|
prev = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
2012-12-17 06:12:49 -08:00
|
|
|
if (prev) it->prio.priority = prev->prio.priority;
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
}
|
2012-05-21 22:18:12 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2010-11-05 11:23:15 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
sorted = eina_list_sorted_insert
|
|
|
|
(sorted, _toolbar_item_prio_compare_cb, it);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sd->more_item)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(sd->VIEW(more_item), NULL, NULL, &ciw, &cih);
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE)) *iw += cih;
|
2012-08-30 09:45:00 -07:00
|
|
|
else *iw += ciw;
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FREE(sorted, it)
|
|
|
|
{
|
|
|
|
if (it->prio.priority > sd->standard_priority)
|
2011-09-29 16:46:55 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_geometry_get(VIEW(it), NULL, NULL, &ciw, &cih);
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE)) *iw += cih;
|
2012-08-30 09:45:00 -07:00
|
|
|
else *iw += ciw;
|
2018-10-22 01:03:28 -07:00
|
|
|
//expand is the case where the bx_more stuff is used and the prio.visible is completly ignored.
|
|
|
|
//if this is the case - then every item in there is just visible in the box - nothing (beside the items in the other box is hidden)
|
|
|
|
if (!usage_bx_more)
|
|
|
|
{
|
|
|
|
it->prio.visible = (*iw <= vw);
|
|
|
|
if (!it->prio.visible)
|
|
|
|
*more = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
it->prio.visible = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
it->in_box = sd->bx;
|
|
|
|
if (!it->separator) count++;
|
2018-10-22 01:03:28 -07:00
|
|
|
|
2011-09-29 16:46:55 -07:00
|
|
|
}
|
2011-09-11 19:05:30 -07:00
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
it->prio.visible = EINA_FALSE;
|
|
|
|
if (!it->separator) i++;
|
|
|
|
if (i <= (count + 1))
|
|
|
|
it->in_box = sd->bx_more;
|
|
|
|
else
|
|
|
|
it->in_box = sd->bx_more2;
|
|
|
|
*more = EINA_TRUE;
|
2011-09-11 19:05:30 -07:00
|
|
|
}
|
2010-11-05 11:23:15 -07:00
|
|
|
}
|
2018-04-02 02:22:51 -07:00
|
|
|
efl_ui_focus_composition_dirty(obj);
|
2018-05-06 10:02:35 -07:00
|
|
|
efl_ui_focus_object_prepare_logical(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
2009-10-07 10:11:41 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_item_menu_destroy(Elm_Toolbar_Item_Data *item)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(item->o_menu, evas_object_del);
|
2012-08-30 09:45:00 -07:00
|
|
|
item->menu = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_item_unselect(Elm_Toolbar_Item_Data *item)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
|
|
|
if ((!item) || (!item->selected)) return;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
item->selected = EINA_FALSE;
|
|
|
|
sd->selected_item = NULL;
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,unselected", "elm");
|
2014-01-14 04:32:28 -08:00
|
|
|
if (item->icon)
|
|
|
|
elm_widget_signal_emit(item->icon, "elm,state,unselected", "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(item), EFL_UI_EVENT_UNSELECTED, EO_OBJ(item));
|
2015-11-05 01:52:28 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(EO_OBJ(item), EFL_ACCESS_STATE_SELECTED, EINA_FALSE);
|
2008-12-18 20:26:24 -08:00
|
|
|
}
|
|
|
|
|
2009-10-06 08:08:41 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_menu_hide(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2009-10-06 08:08:41 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Object_Item *eo_selected;
|
|
|
|
Elm_Toolbar_Item_Data *it = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
eo_selected = elm_toolbar_selected_item_get(WIDGET(it));
|
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(eo_selected, selected);
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
_item_unselect(selected);
|
2009-10-06 08:08:41 -07:00
|
|
|
}
|
|
|
|
|
2009-11-13 14:22:05 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_menu_del(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2009-11-13 14:22:05 -08:00
|
|
|
{
|
|
|
|
// avoid hide being emitted during object deletion
|
|
|
|
evas_object_event_callback_del_full
|
2012-08-30 09:45:00 -07:00
|
|
|
(obj, EVAS_CALLBACK_HIDE, _menu_hide, data);
|
2009-11-13 14:22:05 -08:00
|
|
|
}
|
|
|
|
|
2009-10-06 08:08:41 -07:00
|
|
|
static void
|
2014-03-27 01:15:16 -07:00
|
|
|
_item_menu_create(Elm_Toolbar_Data *sd,
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *item)
|
2009-10-06 13:14:46 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
item->o_menu = elm_menu_add(elm_widget_parent_get(WIDGET(item)));
|
|
|
|
item->menu = EINA_TRUE;
|
2009-10-18 10:20:18 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->menu_parent)
|
|
|
|
elm_menu_parent_set(item->o_menu, sd->menu_parent);
|
2009-10-06 08:08:41 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(item->o_menu, EVAS_CALLBACK_HIDE, _menu_hide, item);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(item->o_menu, EVAS_CALLBACK_DEL, _menu_del, item);
|
2010-11-09 13:21:46 -08:00
|
|
|
}
|
|
|
|
|
2009-10-18 10:20:18 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_menu_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2009-10-15 13:48:00 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = data;
|
2009-10-15 13:48:00 -07:00
|
|
|
|
2014-09-14 04:51:26 -07:00
|
|
|
if (it->func) it->func((void *)(WIDGET_ITEM_DATA_GET(EO_OBJ(it))), WIDGET(it), EO_OBJ(it));
|
2009-10-15 13:48:00 -07:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_item_show(Elm_Toolbar_Item_Data *it)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Coord x, y, w, h, bx, by;
|
2009-08-25 15:46:19 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
2008-12-18 05:38:58 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_geometry_get(sd->bx, &bx, &by, NULL, NULL);
|
|
|
|
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show
|
|
|
|
(WIDGET(it), x - bx, y - by, w, h);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
2010-11-09 13:21:46 -08:00
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_item_mirrored_set(Evas_Object *obj EINA_UNUSED,
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it,
|
2012-08-30 09:45:00 -07:00
|
|
|
Eina_Bool mirrored)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_set(VIEW(it), mirrored);
|
|
|
|
if (it->o_menu) efl_ui_mirrored_set(it->o_menu, mirrored);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2010-11-09 13:21:46 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_mirrored_set(Evas_Object *obj,
|
|
|
|
Eina_Bool mirrored)
|
2010-11-09 13:21:46 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2010-11-09 13:21:46 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
_item_mirrored_set(obj, it, mirrored);
|
|
|
|
if (sd->more_item)
|
|
|
|
_item_mirrored_set(obj, sd->more_item, mirrored);
|
|
|
|
}
|
|
|
|
|
2012-10-18 00:57:13 -07:00
|
|
|
static void
|
|
|
|
_items_size_fit(Evas_Object *obj, Evas_Coord *bl, Evas_Coord view)
|
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it, *prev;
|
2012-10-18 00:57:13 -07:00
|
|
|
Eina_Bool full = EINA_FALSE, more = EINA_FALSE;
|
|
|
|
Evas_Coord min, mw, mh;
|
|
|
|
int sumf = 0, sumb = 0, prev_min = 0;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
2014-01-06 06:11:47 -08:00
|
|
|
mw = mh = -1;
|
2012-10-18 00:57:13 -07:00
|
|
|
if (it->in_box && it->in_box == sd->bx)
|
|
|
|
{
|
|
|
|
if (!it->separator && !it->object)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2015-07-02 04:00:57 -07:00
|
|
|
edje_object_size_min_restricted_calc(elm_layout_edje_get(VIEW(it)), &mw, &mh, mw, mh);
|
2012-10-18 00:57:13 -07:00
|
|
|
}
|
|
|
|
else if (!more)
|
|
|
|
{
|
|
|
|
more = EINA_TRUE;
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2015-07-02 04:00:57 -07:00
|
|
|
edje_object_size_min_restricted_calc(elm_layout_edje_get(sd->VIEW(more_item)), &mw, &mh, mw, mh);
|
2012-10-18 00:57:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mw != -1 || mh != -1)
|
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE)) min = mh;
|
2012-10-18 00:57:13 -07:00
|
|
|
else min = mw;
|
|
|
|
|
|
|
|
if ((!full) && ((sumf + min) > view))
|
|
|
|
{
|
|
|
|
prev = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
|
|
|
if (prev && prev->separator)
|
|
|
|
{
|
|
|
|
sumf -= prev_min;
|
|
|
|
sumb += prev_min;
|
|
|
|
}
|
|
|
|
full = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!full) sumf += min;
|
|
|
|
else sumb += min;
|
|
|
|
prev_min = min;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sumf != 0) *bl = (Evas_Coord)(((sumf + sumb) * view) / sumf);
|
|
|
|
}
|
|
|
|
|
2012-11-15 02:27:46 -08:00
|
|
|
static Eina_Bool
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_toolbar_item_coordinates_calc(Elm_Toolbar_Item_Data *item,
|
2012-11-15 02:27:46 -08:00
|
|
|
Elm_Toolbar_Item_Scrollto_Type type,
|
|
|
|
Evas_Coord *x,
|
|
|
|
Evas_Coord *y,
|
|
|
|
Evas_Coord *w,
|
|
|
|
Evas_Coord *h)
|
|
|
|
{
|
2014-04-12 10:00:33 -07:00
|
|
|
Evas_Coord ix, iy, iw, ih, bx, by, vw = 0, vh = 0;
|
2012-11-15 02:27:46 -08:00
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(WIDGET(item), NULL, NULL, &vw, &vh);
|
2012-11-15 02:27:46 -08:00
|
|
|
evas_object_geometry_get(sd->bx, &bx, &by, NULL, NULL);
|
|
|
|
evas_object_geometry_get(VIEW(item), &ix, &iy, &iw, &ih);
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case ELM_TOOLBAR_ITEM_SCROLLTO_IN:
|
|
|
|
*x = ix - bx;
|
|
|
|
*y = iy - by;
|
|
|
|
*w = iw;
|
|
|
|
*h = ih;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_TOOLBAR_ITEM_SCROLLTO_FIRST:
|
|
|
|
*x = ix - bx;
|
|
|
|
*y = iy - by;
|
|
|
|
*w = vw;
|
|
|
|
*h = vh;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_TOOLBAR_ITEM_SCROLLTO_MIDDLE:
|
|
|
|
*x = ix - bx + (iw / 2) - (vw / 2);
|
|
|
|
*y = iy - by + (ih / 2) - (vh / 2);
|
|
|
|
*w = vw;
|
|
|
|
*h = vh;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_TOOLBAR_ITEM_SCROLLTO_LAST:
|
|
|
|
*x = ix - bx + iw - vw;
|
|
|
|
*y = iy - by + ih - vh;
|
|
|
|
*w = vw;
|
|
|
|
*h = vh;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
static void
|
|
|
|
_resize_job(void *data)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = (Evas_Object *)data;
|
|
|
|
Evas_Coord mw, mh, vw = 0, vh = 0, w = 0, h = 0;
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2012-08-30 09:45:00 -07:00
|
|
|
Eina_List *list;
|
|
|
|
Eina_Bool more;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
sd->resize_job = NULL;
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, &vw, &vh);
|
2017-09-18 00:22:01 -07:00
|
|
|
evas_object_size_hint_combined_min_get(sd->bx, &mw, &mh);
|
2016-04-25 03:38:03 -07:00
|
|
|
w = sd->minw_bx;
|
|
|
|
h = sd->minh_bx;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_MENU)
|
2010-11-09 13:21:46 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Coord iw = 0, ih = 0, more_w = 0, more_h = 0;
|
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2010-11-09 13:21:46 -08:00
|
|
|
{
|
2012-09-26 20:05:50 -07:00
|
|
|
h = vh;
|
2018-10-22 01:03:28 -07:00
|
|
|
_items_visibility_fix(obj, sd, &ih, vh, EINA_FALSE, &more);
|
2010-11-09 13:21:46 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
else
|
2010-11-09 13:21:46 -08:00
|
|
|
{
|
2012-09-26 20:05:50 -07:00
|
|
|
w = vw;
|
2018-10-22 01:03:28 -07:00
|
|
|
_items_visibility_fix(obj, sd, &iw, vw, EINA_FALSE, &more);
|
2010-11-09 13:21:46 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_geometry_get
|
|
|
|
(sd->VIEW(more_item), NULL, NULL, &more_w, &more_h);
|
2010-11-09 13:21:46 -08:00
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2012-03-04 01:52:20 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if ((ih - more_h) <= vh) ih -= more_h;
|
2012-03-04 01:52:20 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if ((iw - more_w) <= vw) iw -= more_w;
|
2012-03-04 01:52:20 -08:00
|
|
|
}
|
2010-11-09 13:21:46 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
/* All items are removed from the box object, since removing
|
|
|
|
* individual items won't trigger a resize. Items are be
|
|
|
|
* readded below. */
|
|
|
|
evas_object_box_remove_all(sd->bx, EINA_FALSE);
|
2017-08-09 21:54:05 -07:00
|
|
|
if ((!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (ih > vh)) ||
|
|
|
|
( efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (iw > vw)) ||
|
|
|
|
more)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
|
|
|
Evas_Object *menu;
|
2010-11-09 13:21:46 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_menu_destroy(sd->more_item);
|
|
|
|
_item_menu_create(sd, sd->more_item);
|
|
|
|
menu =
|
2014-09-27 22:15:56 -07:00
|
|
|
elm_toolbar_item_menu_get(EO_OBJ(sd->more_item));
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (!it->prio.visible)
|
|
|
|
{
|
|
|
|
if (it->separator)
|
|
|
|
elm_menu_item_separator_add(menu, NULL);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Elm_Object_Item *menu_it;
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
menu_it = elm_menu_item_add
|
|
|
|
(menu, NULL, it->icon_str, it->label,
|
|
|
|
_elm_toolbar_item_menu_cb, it);
|
2016-03-02 04:10:48 -08:00
|
|
|
Eina_Bool disabled = elm_wdg_item_disabled_get(EO_OBJ(it));
|
|
|
|
elm_wdg_item_disabled_set(menu_it, disabled);
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->o_menu)
|
|
|
|
elm_menu_clone(it->o_menu, menu, menu_it);
|
|
|
|
}
|
|
|
|
evas_object_hide(VIEW(it));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_box_append(sd->bx, VIEW(it));
|
|
|
|
evas_object_show(VIEW(it));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
evas_object_box_append(sd->bx, sd->VIEW(more_item));
|
|
|
|
evas_object_show(sd->VIEW(more_item));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* All items are visible, show them all (except for the
|
|
|
|
* "More" button, of course). */
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
evas_object_show(VIEW(it));
|
|
|
|
evas_object_box_append(sd->bx, VIEW(it));
|
|
|
|
}
|
|
|
|
evas_object_hide(sd->VIEW(more_item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_HIDE)
|
|
|
|
{
|
|
|
|
Evas_Coord iw = 0, ih = 0;
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2012-09-26 20:05:50 -07:00
|
|
|
h = vh;
|
2018-10-22 01:03:28 -07:00
|
|
|
_items_visibility_fix(obj, sd, &ih, vh, EINA_FALSE, &more);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-26 20:05:50 -07:00
|
|
|
w = vw;
|
2018-10-22 01:03:28 -07:00
|
|
|
_items_visibility_fix(obj, sd, &iw, vw, EINA_FALSE, &more);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
evas_object_box_remove_all(sd->bx, EINA_FALSE);
|
2017-08-09 21:54:05 -07:00
|
|
|
if ((!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (ih > vh)) ||
|
|
|
|
( efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (iw > vw)) ||
|
|
|
|
more)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (!it->prio.visible)
|
|
|
|
evas_object_hide(VIEW(it));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_box_append(sd->bx, VIEW(it));
|
|
|
|
evas_object_show(VIEW(it));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* All items are visible, show them all */
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
evas_object_show(VIEW(it));
|
|
|
|
evas_object_box_append(sd->bx, VIEW(it));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
|
|
|
|
{
|
|
|
|
Evas_Coord iw = 0, ih = 0;
|
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2012-09-27 21:23:29 -07:00
|
|
|
h = (vh >= mh) ? vh : mh;
|
|
|
|
else
|
|
|
|
w = (vw >= mw) ? vw : mw;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2018-10-22 01:03:28 -07:00
|
|
|
_items_visibility_fix(obj, sd, &ih, vh, EINA_TRUE, &more);
|
2012-08-30 09:45:00 -07:00
|
|
|
else
|
2018-10-22 01:03:28 -07:00
|
|
|
_items_visibility_fix(obj, sd, &iw, vw, EINA_TRUE, &more);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
evas_object_box_remove_all(sd->bx, EINA_FALSE);
|
|
|
|
evas_object_box_remove_all(sd->bx_more, EINA_FALSE);
|
|
|
|
evas_object_box_remove_all(sd->bx_more2, EINA_FALSE);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->in_box)
|
|
|
|
{
|
|
|
|
evas_object_box_append(it->in_box, VIEW(it));
|
|
|
|
evas_object_show(VIEW(it));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (more)
|
|
|
|
{
|
|
|
|
evas_object_box_append(sd->bx, sd->VIEW(more_item));
|
|
|
|
evas_object_show(sd->VIEW(more_item));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_hide(sd->VIEW(more_item));
|
2012-10-18 00:57:13 -07:00
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2012-10-18 00:57:13 -07:00
|
|
|
{
|
2013-03-04 22:46:30 -08:00
|
|
|
if (h > vh) _items_size_fit(obj, &h, vh);
|
2012-12-02 23:01:22 -08:00
|
|
|
if (sd->item_count - sd->separator_count > 0)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_paging_set
|
|
|
|
(obj, 0.0, 0.0, 0, (h / (sd->item_count - sd->separator_count)));
|
2012-10-18 00:57:13 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-04 22:46:30 -08:00
|
|
|
if (w > vw) _items_size_fit(obj, &w, vw);
|
2012-12-02 23:01:22 -08:00
|
|
|
if (sd->item_count - sd->separator_count > 0)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_paging_set
|
|
|
|
(obj, 0.0, 0.0, (w / (sd->item_count - sd->separator_count)), 0);
|
2012-10-18 00:57:13 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2014-06-24 19:27:08 -07:00
|
|
|
h = (vh >= mh) ? vh : mh;
|
2012-08-30 09:45:00 -07:00
|
|
|
else
|
2014-06-24 19:27:08 -07:00
|
|
|
w = (vw >= mw) ? vw : mw;
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->selected)
|
2015-03-19 02:46:59 -07:00
|
|
|
_item_show(it);
|
|
|
|
evas_object_show(VIEW(it));
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-26 20:05:50 -07:00
|
|
|
if (sd->transverse_expanded)
|
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2012-09-26 20:05:50 -07:00
|
|
|
w = vw;
|
|
|
|
else
|
|
|
|
h = vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_resize(sd->bx, w, h);
|
|
|
|
|
2014-01-21 20:20:15 -08:00
|
|
|
// Remove the first or last separator since it is not necessary
|
2012-08-30 09:45:00 -07:00
|
|
|
list = evas_object_box_children_get(sd->bx_more);
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->separator &&
|
|
|
|
((VIEW(it) == eina_list_data_get(list)) ||
|
|
|
|
(VIEW(it) == eina_list_nth(list, eina_list_count(list) - 1))))
|
|
|
|
{
|
|
|
|
evas_object_box_remove(sd->bx_more, VIEW(it));
|
|
|
|
evas_object_move(VIEW(it), -9999, -9999);
|
|
|
|
evas_object_hide(VIEW(it));
|
|
|
|
}
|
|
|
|
}
|
2015-04-26 18:53:28 -07:00
|
|
|
eina_list_free(list);
|
2012-08-30 09:45:00 -07:00
|
|
|
list = evas_object_box_children_get(sd->bx_more2);
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->separator &&
|
|
|
|
((VIEW(it) == eina_list_data_get(list)) ||
|
|
|
|
(VIEW(it) == eina_list_nth(list, eina_list_count(list) - 1))))
|
|
|
|
{
|
|
|
|
evas_object_box_remove(sd->bx_more2, VIEW(it));
|
|
|
|
evas_object_move(VIEW(it), -9999, -9999);
|
|
|
|
evas_object_hide(VIEW(it));
|
|
|
|
}
|
|
|
|
}
|
2015-04-26 18:53:28 -07:00
|
|
|
eina_list_free(list);
|
2009-04-22 21:03:27 -07:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 08:22:32 -07:00
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_toolbar_item_focused(Elm_Object_Item *eo_it)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 08:22:32 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
const char *focus_raise;
|
|
|
|
|
|
|
|
if ((!sd) || (sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) ||
|
2014-09-27 22:15:56 -07:00
|
|
|
(eo_it == sd->focused_item))
|
2014-03-23 08:22:32 -07:00
|
|
|
return;
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
sd->focused_item = eo_it;
|
2014-05-11 06:42:45 -07:00
|
|
|
switch (_elm_config->focus_autoscroll_mode)
|
|
|
|
{
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
|
2014-09-27 22:15:56 -07:00
|
|
|
elm_toolbar_item_show(EO_OBJ(it),
|
2014-05-11 01:53:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_SCROLLTO_IN);
|
2014-05-11 06:42:45 -07:00
|
|
|
break;
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
|
2014-09-27 22:15:56 -07:00
|
|
|
elm_toolbar_item_bring_in(EO_OBJ(it),
|
2014-05-11 06:42:45 -07:00
|
|
|
ELM_TOOLBAR_ITEM_SCROLLTO_IN);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-03-23 08:22:32 -07:00
|
|
|
if (elm_widget_focus_highlight_enabled_get(obj))
|
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit
|
2014-03-23 08:22:32 -07:00
|
|
|
(VIEW(it), "elm,state,focused", "elm");
|
|
|
|
}
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit
|
2014-03-23 08:22:32 -07:00
|
|
|
(VIEW(it), "elm,highlight,on", "elm");
|
2015-07-02 04:00:57 -07:00
|
|
|
focus_raise = elm_layout_data_get(VIEW(it), "focusraise");
|
2014-03-23 08:22:32 -07:00
|
|
|
if ((focus_raise) && (!strcmp(focus_raise, "on")))
|
|
|
|
evas_object_raise(VIEW(it));
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_TOOLBAR_EVENT_ITEM_FOCUSED, EO_OBJ(it));
|
2014-10-09 01:14:38 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(EO_OBJ(it), EFL_ACCESS_STATE_FOCUSED, EINA_TRUE);
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_toolbar_item_unfocused(Elm_Object_Item *eo_it)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 08:22:32 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if ((!sd) || !sd->focused_item ||
|
2014-09-27 22:15:56 -07:00
|
|
|
(eo_it != sd->focused_item))
|
2014-03-23 08:22:32 -07:00
|
|
|
return;
|
|
|
|
if (sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
|
|
|
|
return;
|
|
|
|
if (elm_widget_focus_highlight_enabled_get(obj))
|
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(sd->focused_item, focus_it);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit
|
2014-09-27 22:15:56 -07:00
|
|
|
(VIEW(focus_it), "elm,state,unfocused", "elm");
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit
|
2014-03-23 08:22:32 -07:00
|
|
|
(VIEW(it), "elm,highlight,off", "elm");
|
|
|
|
sd->focused_item = NULL;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_TOOLBAR_EVENT_ITEM_UNFOCUSED, eo_it);
|
2014-10-09 01:14:38 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_FOCUSED, EINA_TRUE);
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function searches the nearest visible item based on the given item.
|
|
|
|
* If the given item is in the toolbar viewport, this returns the given item.
|
|
|
|
* Or this searches other items and checks the nearest fully visible item
|
|
|
|
* according to the given item's position.
|
|
|
|
*/
|
|
|
|
static Elm_Object_Item *
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_toolbar_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vx = 0, vy = 0, vw = 0, vh = 0; // toolbar viewport geometry
|
|
|
|
Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0; // given item geometry
|
|
|
|
Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; // candidate item geometry
|
|
|
|
Eina_List *item_list = NULL;
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *item = NULL;
|
2014-03-23 08:22:32 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2014-03-23 23:49:51 -07:00
|
|
|
Eina_Bool search_next = EINA_FALSE;
|
|
|
|
Evas_Object *it_obj;
|
2014-03-23 08:22:32 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
if (!eo_it) return NULL;
|
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 08:22:32 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(obj, &vx, &vy, &vw, &vh);
|
|
|
|
evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
|
|
|
|
|
2014-03-23 23:49:51 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
|
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
if (!elm_object_item_disabled_get(eo_it))
|
2014-12-26 01:40:14 -08:00
|
|
|
return eo_it;
|
2014-03-23 23:49:51 -07:00
|
|
|
else
|
|
|
|
search_next = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-12-26 01:40:14 -08:00
|
|
|
item_list = evas_object_box_children_get(sd->bx);
|
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if ((!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (iy < vy)) ||
|
|
|
|
( efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (iw < vw)) ||
|
2014-03-23 23:49:51 -07:00
|
|
|
search_next)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
|
|
|
while ((item_list = eina_list_next(item_list)))
|
|
|
|
{
|
2014-03-23 23:49:51 -07:00
|
|
|
it_obj = eina_list_data_get(item_list);
|
|
|
|
if (it_obj)
|
|
|
|
item = evas_object_data_get(it_obj, "item");
|
|
|
|
if (!item)
|
|
|
|
break;
|
2014-03-23 08:22:32 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 23:49:51 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:56 -07:00
|
|
|
!elm_object_item_disabled_get(EO_OBJ(item)))
|
2014-12-25 18:26:42 -08:00
|
|
|
{
|
|
|
|
eina_list_free(item_list);
|
|
|
|
return EO_OBJ(item);
|
|
|
|
}
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while ((item_list = eina_list_prev(item_list)))
|
|
|
|
{
|
2014-03-23 23:49:51 -07:00
|
|
|
it_obj = eina_list_data_get(item_list);
|
|
|
|
if (it_obj)
|
|
|
|
item = evas_object_data_get(it_obj, "item");
|
|
|
|
if (!item)
|
|
|
|
break;
|
2014-03-23 08:22:32 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 23:49:51 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:56 -07:00
|
|
|
!elm_object_item_disabled_get(EO_OBJ(item)))
|
2014-12-25 18:26:42 -08:00
|
|
|
{
|
|
|
|
eina_list_free(item_list);
|
|
|
|
return EO_OBJ(item);
|
|
|
|
}
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
}
|
2014-12-25 18:26:42 -08:00
|
|
|
eina_list_free(item_list);
|
2014-09-27 22:15:56 -07:00
|
|
|
return eo_it;
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-19 00:25:47 -08:00
|
|
|
_elm_toolbar_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Toolbar_Data *sd)
|
2012-07-25 21:36:12 -07:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2013-06-06 09:13:37 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2013-06-06 09:13:37 -07:00
|
|
|
|
2018-01-19 00:25:47 -08:00
|
|
|
int_ret = efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS));
|
2014-03-27 01:15:16 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
|
|
|
if (!sd->items) return EINA_FALSE;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2017-11-29 00:39:42 -08:00
|
|
|
if (efl_ui_focus_object_focus_get(obj))
|
2013-04-14 22:34:15 -07:00
|
|
|
{
|
2015-08-26 10:00:02 -07:00
|
|
|
evas_object_focus_set(wd->resize_obj, EINA_TRUE);
|
|
|
|
if (sd->mouse_down) return EINA_TRUE;
|
|
|
|
|
2014-03-23 08:22:32 -07:00
|
|
|
if (sd->last_focused_item)
|
2014-09-27 22:15:56 -07:00
|
|
|
eo_it = sd->last_focused_item;
|
2016-12-01 23:56:43 -08:00
|
|
|
else if (_elm_config->first_item_focus_on_first_focus_in)
|
2014-09-27 22:15:56 -07:00
|
|
|
{
|
|
|
|
eo_it = elm_toolbar_first_item_get(obj);
|
|
|
|
}
|
2014-07-21 02:55:55 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
if (eo_it)
|
2013-04-14 22:34:15 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
eo_it = _elm_toolbar_nearest_visible_item_get(obj, eo_it);
|
|
|
|
if (eo_it) _elm_toolbar_item_focused(eo_it);
|
2013-04-14 22:34:15 -07:00
|
|
|
}
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->last_focused_item = sd->focused_item;
|
|
|
|
if (sd->focused_item)
|
|
|
|
_elm_toolbar_item_unfocused(sd->focused_item);
|
2013-04-14 22:34:15 -07:00
|
|
|
evas_object_focus_set(wd->resize_obj, EINA_FALSE);
|
|
|
|
}
|
2014-03-27 01:15:16 -07:00
|
|
|
return EINA_TRUE;
|
2012-07-25 21:36:12 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_toolbar_item_elm_widget_item_item_focus_set(Eo *eo_it, Elm_Toolbar_Item_Data *it, Eina_Bool focused)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK(it);
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (focused)
|
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
sd->last_focused_item = eo_it;
|
2014-03-23 08:22:32 -07:00
|
|
|
if (!elm_object_focus_get(obj))
|
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
2015-02-02 22:47:32 -08:00
|
|
|
|
2017-10-13 02:09:56 -07:00
|
|
|
if (!elm_object_focus_get(obj))
|
2015-02-02 22:47:32 -08:00
|
|
|
return;
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
if (eo_it != sd->focused_item)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
|
|
|
if (sd->focused_item)
|
|
|
|
_elm_toolbar_item_unfocused(sd->focused_item);
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_toolbar_item_focused(eo_it);
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
2017-10-13 02:09:56 -07:00
|
|
|
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-13 02:09:56 -07:00
|
|
|
if (!elm_object_focus_get(obj))
|
2015-02-02 22:47:32 -08:00
|
|
|
return;
|
2014-09-27 22:15:56 -07:00
|
|
|
if (eo_it)
|
|
|
|
_elm_toolbar_item_unfocused(eo_it);
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
2014-05-11 09:04:25 -07:00
|
|
|
|
2017-10-13 02:09:56 -07:00
|
|
|
evas_object_focus_set(VIEW(it), focused);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_widget_item_highlight_in_theme(obj, EO_OBJ(it));
|
2014-05-11 09:04:25 -07:00
|
|
|
_elm_widget_highlight_in_theme_update(obj);
|
2014-03-23 08:22:32 -07:00
|
|
|
_elm_widget_focus_highlight_start(obj);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_elm_widget_item_item_focus_get(const Eo *eo_it, Elm_Toolbar_Item_Data *it)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_TOOLBAR_CHECK(obj) EINA_FALSE;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
if (eo_it == sd->focused_item)
|
2014-03-23 08:22:32 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-04-15 00:07:52 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_select(Evas_Object *obj, const char *params EINA_UNUSED)
|
2012-07-25 21:36:12 -07:00
|
|
|
{
|
2014-04-15 00:07:52 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2013-10-28 07:06:14 -07:00
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
if (!sd->items) return EINA_FALSE;
|
2014-04-15 00:07:52 -07:00
|
|
|
if (sd->focused_item)
|
2014-09-27 22:15:56 -07:00
|
|
|
{
|
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(sd->focused_item, focus_it);
|
|
|
|
_item_select(focus_it);
|
|
|
|
}
|
2012-07-25 21:36:12 -07:00
|
|
|
|
2014-04-15 00:07:52 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2013-11-12 17:29:30 -08:00
|
|
|
|
2011-12-08 21:26:33 -08:00
|
|
|
static void
|
2015-03-19 02:46:59 -07:00
|
|
|
_resizing_eval(Evas_Object *obj)
|
2011-12-08 21:26:33 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Coord x, y, h;
|
2015-03-19 02:46:59 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2011-12-08 21:26:33 -08:00
|
|
|
|
2015-03-19 02:46:59 -07:00
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, &h);
|
|
|
|
evas_object_move(sd->more, x, y + h);
|
|
|
|
if (sd->resize_job) ecore_job_del(sd->resize_job);
|
|
|
|
// fit and fix the visibility
|
|
|
|
sd->resize_job = ecore_job_add(_resize_job, obj);
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2015-03-19 02:46:59 -07:00
|
|
|
static void
|
|
|
|
_resizing_eval_item(Elm_Toolbar_Item_Data *it)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, h;
|
|
|
|
Evas_Coord mw = -1, mh = -1;
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, &h);
|
2012-09-05 00:42:57 -07:00
|
|
|
evas_object_move(sd->more, x, y + h);
|
2015-03-19 02:46:59 -07:00
|
|
|
//calculate the size of item
|
2015-07-02 04:00:57 -07:00
|
|
|
edje_object_size_min_restricted_calc(elm_layout_edje_get(VIEW(it)), &mw, &mh, mw, mh);
|
2015-03-19 02:46:59 -07:00
|
|
|
if (!it->separator && !it->object)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
evas_object_size_hint_min_set(VIEW(it), mw, mh);
|
|
|
|
evas_object_size_hint_max_set(VIEW(it), -1, -1);
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2015-03-19 02:46:59 -07:00
|
|
|
static void
|
|
|
|
_resize_cb(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_resizing_eval(data);
|
2011-12-08 21:26:33 -08:00
|
|
|
}
|
|
|
|
|
2016-12-21 15:28:24 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_elm_widget_item_disabled_set(Eo *eo_id, Elm_Toolbar_Item_Data *sd, Eina_Bool disabled)
|
|
|
|
{
|
|
|
|
elm_wdg_item_disabled_set(efl_super(eo_id, ELM_TOOLBAR_ITEM_CLASS), disabled);
|
2017-10-15 08:44:18 -07:00
|
|
|
efl_ui_focus_composition_dirty(WIDGET(sd));
|
2016-12-21 15:28:24 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_elm_widget_item_disable(Eo *eo_toolbar, Elm_Toolbar_Item_Data *toolbar_it)
|
2012-03-06 03:35:11 -08:00
|
|
|
{
|
2014-01-14 04:32:28 -08:00
|
|
|
const char* emission;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(eo_toolbar))
|
2014-01-14 04:32:28 -08:00
|
|
|
emission = "elm,state,disabled";
|
2012-08-30 09:45:00 -07:00
|
|
|
else
|
2014-01-14 04:32:28 -08:00
|
|
|
emission = "elm,state,enabled";
|
|
|
|
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(toolbar_it), emission, "elm");
|
2014-01-14 04:32:28 -08:00
|
|
|
if (toolbar_it->icon)
|
2014-04-26 10:40:45 -07:00
|
|
|
elm_widget_signal_emit(toolbar_it->icon, emission, "elm");
|
2012-03-29 03:08:37 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
_resize_cb(WIDGET(toolbar_it), NULL, NULL, NULL);
|
2012-03-06 03:35:11 -08:00
|
|
|
}
|
|
|
|
|
2015-11-09 12:24:37 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_elm_widget_item_signal_emit(Eo *eo_toolbar_it EINA_UNUSED,
|
|
|
|
Elm_Toolbar_Item_Data *toolbar_it,
|
|
|
|
const char *emission,
|
|
|
|
const char *source)
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(VIEW(toolbar_it), emission, source);
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_item_icon_set(Evas_Object *icon_obj,
|
|
|
|
const char *type,
|
|
|
|
const char *icon)
|
2012-03-06 03:35:11 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
char icon_str[512];
|
|
|
|
|
|
|
|
if ((!type) || (!*type)) goto end;
|
|
|
|
if ((!icon) || (!*icon)) return EINA_FALSE;
|
|
|
|
if ((snprintf(icon_str, sizeof(icon_str), "%s%s", type, icon) > 0)
|
|
|
|
&& (elm_icon_standard_set(icon_obj, icon_str)))
|
|
|
|
return EINA_TRUE;
|
|
|
|
end:
|
|
|
|
if (elm_icon_standard_set(icon_obj, icon))
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
WRN("couldn't find icon definition for '%s'", icon);
|
|
|
|
return EINA_FALSE;
|
2012-03-06 03:35:11 -08:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
static int
|
2014-03-27 01:15:16 -07:00
|
|
|
_internal_elm_toolbar_icon_size_get(Evas_Object *obj)
|
2012-03-06 03:35:11 -08:00
|
|
|
{
|
2013-10-05 01:15:58 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0);
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *icon_size = edje_object_data_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "icon_size");
|
2012-03-06 04:35:22 -08:00
|
|
|
|
2015-08-07 00:42:29 -07:00
|
|
|
if (icon_size)
|
2018-04-05 01:47:26 -07:00
|
|
|
return (int)(atoi(icon_size) * efl_gfx_entity_scale_get(obj) * elm_config_scale_get()
|
2015-08-07 00:42:29 -07:00
|
|
|
/ edje_object_base_scale_get(wd->resize_obj));
|
2012-07-11 23:19:16 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
return _elm_config->icon_size;
|
2012-03-06 03:35:11 -08:00
|
|
|
}
|
|
|
|
|
2011-10-19 07:17:14 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_menu_move_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-10-19 07:17:14 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = data;
|
2012-09-04 02:42:27 -07:00
|
|
|
Evas_Coord x, y, h;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
|
|
|
if (!sd->menu_parent) return;
|
2012-09-04 02:42:27 -07:00
|
|
|
evas_object_geometry_get(VIEW(it), &x, &y, NULL, &h);
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_menu_move(it->o_menu, x, y + h);
|
2011-10-19 07:17:14 -07:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_item_select(Elm_Toolbar_Item_Data *it)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2014-07-19 09:18:57 -07:00
|
|
|
Evas_Object *obj;
|
2012-08-30 09:45:00 -07:00
|
|
|
Eina_Bool sel;
|
2015-04-26 18:53:28 -07:00
|
|
|
Eina_List *list;
|
2008-12-18 05:38:58 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
2009-09-30 04:26:26 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)) || (it->separator) || (it->object))
|
2012-08-30 09:45:00 -07:00
|
|
|
return;
|
2015-10-12 00:46:36 -07:00
|
|
|
if ((sd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND) && (!sd->more_item))
|
|
|
|
return;
|
2012-08-30 09:45:00 -07:00
|
|
|
sel = it->selected;
|
|
|
|
|
2014-08-21 08:12:40 -07:00
|
|
|
if ((sd->select_mode != ELM_OBJECT_SELECT_MODE_NONE) &&
|
|
|
|
(sd->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sel)
|
2012-02-22 04:13:12 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
|
|
|
|
{
|
|
|
|
if (sd->more_item == it)
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit
|
|
|
|
(sd->more, "elm,state,close", "elm");
|
|
|
|
_item_unselect(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS)
|
|
|
|
_item_unselect(it);
|
2012-02-22 04:13:12 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Object_Item *eo_it2 = elm_toolbar_selected_item_get(WIDGET(it));
|
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(eo_it2, it2);
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_unselect(it2);
|
|
|
|
|
|
|
|
it->selected = EINA_TRUE;
|
2014-09-27 22:15:56 -07:00
|
|
|
sd->selected_item = EO_OBJ(it);
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
|
|
|
|
{
|
|
|
|
if (sd->more_item == it)
|
|
|
|
{
|
2015-04-26 18:53:28 -07:00
|
|
|
list = evas_object_box_children_get(sd->bx_more2);
|
|
|
|
if (!list)
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_layout_signal_emit
|
|
|
|
(sd->more, "elm,state,open", "elm");
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit
|
|
|
|
(sd->more, "elm,state,open2", "elm");
|
2015-04-26 18:53:28 -07:00
|
|
|
eina_list_free(list);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (it->in_box != sd->bx)
|
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit
|
2012-08-30 09:45:00 -07:00
|
|
|
(sd->VIEW(more_item), "elm,state,selected",
|
|
|
|
"elm");
|
|
|
|
elm_widget_signal_emit
|
|
|
|
(sd->more_item->icon, "elm,state,selected",
|
|
|
|
"elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit
|
2012-08-30 09:45:00 -07:00
|
|
|
(sd->VIEW(more_item), "elm,state,unselected",
|
|
|
|
"elm");
|
|
|
|
elm_widget_signal_emit
|
|
|
|
(sd->more_item->icon, "elm,state,unselected",
|
|
|
|
"elm");
|
|
|
|
}
|
|
|
|
elm_layout_signal_emit
|
|
|
|
(sd->more, "elm,state,close", "elm");
|
|
|
|
}
|
|
|
|
}
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
2014-01-14 04:32:28 -08:00
|
|
|
if (it->icon)
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_show(it);
|
2012-02-22 04:13:12 -08:00
|
|
|
}
|
2011-10-31 07:36:49 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-07-19 09:18:57 -07:00
|
|
|
obj = WIDGET(it);
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->menu && (!sel))
|
2011-10-31 07:36:49 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_show(it->o_menu);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_RESIZE, _menu_move_resize_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOVE, _menu_move_resize_cb, it);
|
2008-12-18 05:38:58 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
_menu_move_resize_cb(it, NULL, NULL, NULL);
|
|
|
|
}
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if ((!sel) || (sd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS))
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
{
|
2014-09-14 04:51:26 -07:00
|
|
|
if (it->func) it->func((void *)(WIDGET_ITEM_DATA_GET(EO_OBJ(it))), WIDGET(it), EO_OBJ(it));
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
}
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SELECTED, EO_OBJ(it));
|
2015-11-05 01:52:28 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(EO_OBJ(it), EFL_ACCESS_STATE_SELECTED, EINA_TRUE);
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
}
|
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
/* Send order signals when item is added/deleted.
|
|
|
|
* If the given item is on deletion, item_on_deletion should be EINA_TRUE. */
|
|
|
|
static void
|
|
|
|
_elm_toolbar_item_order_signal_emit(Elm_Toolbar_Data *sd,
|
|
|
|
Elm_Toolbar_Item_Data *it,
|
|
|
|
Eina_List *prev_list,
|
|
|
|
Eina_Bool item_on_deletion)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item_Data *first_it = NULL, *last_it = NULL;
|
|
|
|
Evas_Object *first_it_view = NULL, *last_it_view = NULL;
|
|
|
|
Elm_Toolbar_Item_Data *prev_first_it = NULL, *prev_last_it = NULL;
|
|
|
|
Evas_Object *prev_first_it_view = NULL, *prev_last_it_view = NULL;
|
|
|
|
Eina_List *list;
|
|
|
|
|
|
|
|
list = evas_object_box_children_get(sd->bx);
|
|
|
|
|
|
|
|
if (!list) return;
|
|
|
|
|
|
|
|
if (prev_list)
|
|
|
|
{
|
|
|
|
prev_first_it_view = eina_list_data_get(prev_list);
|
|
|
|
prev_last_it_view = eina_list_data_get(eina_list_last(prev_list));
|
|
|
|
prev_first_it = evas_object_data_get(prev_first_it_view, "item");
|
|
|
|
prev_last_it = evas_object_data_get(prev_last_it_view, "item");
|
|
|
|
}
|
|
|
|
|
|
|
|
first_it_view = eina_list_data_get(list);
|
|
|
|
last_it_view = eina_list_data_get(eina_list_last(list));
|
|
|
|
first_it = evas_object_data_get(first_it_view, "item");
|
|
|
|
last_it = evas_object_data_get(last_it_view, "item");
|
|
|
|
|
|
|
|
if (prev_first_it)
|
|
|
|
{
|
|
|
|
if ((prev_first_it != first_it) && (prev_first_it != last_it))
|
|
|
|
elm_layout_signal_emit(VIEW(prev_first_it), "elm,order,default,item", "elm");
|
|
|
|
else if (prev_first_it == last_it)
|
|
|
|
elm_layout_signal_emit(VIEW(prev_first_it), "elm,order,last,item", "elm");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prev_last_it)
|
|
|
|
{
|
|
|
|
if ((prev_last_it != last_it) && (prev_last_it != first_it))
|
|
|
|
elm_layout_signal_emit(VIEW(prev_last_it), "elm,order,default,item", "elm");
|
|
|
|
else if (prev_last_it == first_it)
|
|
|
|
elm_layout_signal_emit(VIEW(prev_last_it), "elm,order,first,item", "elm");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (it)
|
|
|
|
{
|
|
|
|
if (!item_on_deletion)
|
|
|
|
{
|
|
|
|
if (first_it == last_it)
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,order,first,item", "elm");
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,order,last,item", "elm");
|
|
|
|
}
|
|
|
|
else if (it == first_it)
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,order,first,item", "elm");
|
|
|
|
}
|
|
|
|
else if (it == last_it)
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,order,last,item", "elm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (first_it != last_it)
|
|
|
|
{
|
|
|
|
if (it == first_it)
|
|
|
|
{
|
|
|
|
Eina_List *next_l = eina_list_next(list);
|
|
|
|
first_it_view = eina_list_data_get(next_l);
|
|
|
|
first_it = evas_object_data_get(first_it_view, "item");
|
|
|
|
|
|
|
|
elm_layout_signal_emit(first_it_view, "elm,order,first,item", "elm");
|
|
|
|
}
|
|
|
|
else if (it == last_it)
|
|
|
|
{
|
|
|
|
Eina_List *prev_l = eina_list_prev(eina_list_last(list));
|
|
|
|
last_it_view = eina_list_data_get(prev_l);
|
|
|
|
last_it = evas_object_data_get(last_it_view, "item");
|
|
|
|
|
|
|
|
elm_layout_signal_emit(last_it_view, "elm,order,last,item", "elm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_list_free(list);
|
|
|
|
}
|
|
|
|
|
2010-10-26 03:30:45 -07:00
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_item_del(Elm_Toolbar_Item_Data *it)
|
2010-10-26 03:30:45 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item_State *it_state;
|
2014-03-23 08:22:32 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
2012-05-21 22:18:12 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_unselect(it);
|
2012-05-21 22:18:12 -07:00
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
_elm_toolbar_item_order_signal_emit(sd, it, NULL, EINA_TRUE);
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_LIST_FREE(it->states, it_state)
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->icon == it_state->icon)
|
|
|
|
it->icon = NULL;
|
|
|
|
eina_stringshare_del(it_state->label);
|
|
|
|
eina_stringshare_del(it_state->icon_str);
|
|
|
|
if (it_state->icon) evas_object_del(it_state->icon);
|
|
|
|
free(it_state);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
eina_stringshare_del(it->label);
|
|
|
|
if (it->label)
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,text,hidden", "elm");
|
2012-08-30 09:45:00 -07:00
|
|
|
eina_stringshare_del(it->icon_str);
|
2012-06-07 00:32:55 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->icon)
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,icon,hidden", "elm");
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_del(it->icon);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
if (sd->focused_item == EO_OBJ(it))
|
2014-03-23 08:22:32 -07:00
|
|
|
sd->focused_item = NULL;
|
2014-09-27 22:15:56 -07:00
|
|
|
if (sd->last_focused_item == EO_OBJ(it))
|
2014-03-23 08:22:32 -07:00
|
|
|
sd->last_focused_item = NULL;
|
|
|
|
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(it->object);
|
2012-08-30 09:45:00 -07:00
|
|
|
//TODO: See if checking for sd->menu_parent is necessary before
|
|
|
|
//deleting menu
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(it->o_menu);
|
2010-11-10 04:37:06 -08:00
|
|
|
}
|
|
|
|
|
2016-01-03 16:31:29 -08:00
|
|
|
static void
|
|
|
|
_item_shrink_signal_emit(Evas_Object *view, Elm_Toolbar_Shrink_Mode shrink_mode)
|
|
|
|
{
|
|
|
|
switch (shrink_mode)
|
|
|
|
{
|
|
|
|
case ELM_TOOLBAR_SHRINK_HIDE:
|
|
|
|
elm_layout_signal_emit(view, "elm,state,shrink,hide", "elm");
|
|
|
|
break;
|
|
|
|
case ELM_TOOLBAR_SHRINK_SCROLL:
|
|
|
|
elm_layout_signal_emit(view, "elm,state,shrink,scroll", "elm");
|
|
|
|
break;
|
|
|
|
case ELM_TOOLBAR_SHRINK_MENU:
|
|
|
|
elm_layout_signal_emit(view, "elm,state,shrink,menu", "elm");
|
|
|
|
break;
|
|
|
|
case ELM_TOOLBAR_SHRINK_EXPAND:
|
|
|
|
elm_layout_signal_emit(view, "elm,state,shrink,expand", "elm");
|
|
|
|
break;
|
|
|
|
case ELM_TOOLBAR_SHRINK_NONE:
|
|
|
|
case ELM_TOOLBAR_SHRINK_LAST:
|
|
|
|
default:
|
|
|
|
elm_layout_signal_emit(view, "elm,state,shrink,default", "elm");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_theme_hook(Evas_Object *obj,
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it,
|
2012-08-30 09:45:00 -07:00
|
|
|
double scale,
|
|
|
|
int icon_size)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2015-02-10 23:49:24 -08:00
|
|
|
Evas_Coord mw = -1, mh = -1;
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *view = VIEW(it);
|
|
|
|
const char *style;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2010-11-11 10:05:36 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
style = elm_widget_style_get(obj);
|
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_item_mirrored_set(obj, it, efl_ui_mirrored_get(obj));
|
2015-07-02 04:00:57 -07:00
|
|
|
edje_object_scale_set(elm_layout_edje_get(view), scale);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
if (!it->separator && !it->object)
|
|
|
|
{
|
2015-07-10 08:24:23 -07:00
|
|
|
if (!elm_layout_theme_set(view, "toolbar", "item", style))
|
|
|
|
CRI("Failed to set layout!");
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->selected)
|
2012-02-22 04:13:12 -08:00
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(view, "elm,state,selected", "elm");
|
2014-01-14 04:32:28 -08:00
|
|
|
if (it->icon)
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
|
2012-02-22 04:13:12 -08:00
|
|
|
}
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
2012-02-22 04:13:12 -08:00
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(view, "elm,state,disabled", "elm");
|
2014-01-14 04:32:28 -08:00
|
|
|
if (it->icon)
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,disabled", "elm");
|
2012-02-22 04:13:12 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->icon)
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
{
|
2016-01-30 05:54:24 -08:00
|
|
|
evas_object_size_hint_min_set(it->icon, icon_size * scale, icon_size * scale);
|
|
|
|
evas_object_size_hint_max_set(it->icon, icon_size * scale, icon_size * scale);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_content_set(view, "elm.swallow.icon", it->icon);
|
|
|
|
elm_layout_signal_emit
|
2013-03-04 21:49:29 -08:00
|
|
|
(view, "elm,state,icon,visible", "elm");
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->label)
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_text_set(view, "elm.text", it->label);
|
|
|
|
elm_layout_signal_emit(view, "elm,state,text,visible", "elm");
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
}
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
else
|
2010-10-26 03:30:45 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (!it->object)
|
2010-10-26 03:30:45 -07:00
|
|
|
{
|
2015-07-10 08:24:23 -07:00
|
|
|
if (!elm_layout_theme_set(view, "toolbar", "separator", style))
|
|
|
|
CRI("Failed to set layout!");
|
2010-10-26 03:30:45 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-10 08:24:23 -07:00
|
|
|
if (!elm_layout_theme_set(view, "toolbar", "object", style))
|
|
|
|
CRI("Failed to set layout!");
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_content_set(view, "elm.swallow.object", it->object);
|
2010-10-26 03:30:45 -07:00
|
|
|
}
|
|
|
|
}
|
2012-06-07 00:32:55 -07:00
|
|
|
|
2016-01-03 16:31:29 -08:00
|
|
|
_item_shrink_signal_emit(view, sd->shrink_mode);
|
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(view, "elm,orient,vertical", "elm");
|
2015-03-19 02:46:59 -07:00
|
|
|
else
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(view, "elm,orient,horizontal", "elm");
|
2015-03-19 02:46:59 -07:00
|
|
|
|
2015-07-02 04:00:57 -07:00
|
|
|
edje_object_message_signal_process(elm_layout_edje_get(view));
|
2015-03-19 02:46:59 -07:00
|
|
|
if (!it->separator && !it->object)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
if (sd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
|
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2015-03-19 02:46:59 -07:00
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(view, EVAS_HINT_EXPAND, -1.0);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(view, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(VIEW(it), -1.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(view, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(VIEW(it), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
}
|
|
|
|
_resizing_eval_item(it);
|
2015-10-15 16:33:15 -07:00
|
|
|
evas_object_smart_need_recalculate_set(obj, EINA_TRUE);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2012-09-11 22:15:43 -07:00
|
|
|
static void
|
|
|
|
_inform_item_number(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2013-03-18 05:07:23 -07:00
|
|
|
char buf[sizeof("elm,number,item,") + 4];
|
2012-09-11 22:15:43 -07:00
|
|
|
static int scount = 0;
|
|
|
|
int count = 0;
|
2015-03-24 15:47:33 -07:00
|
|
|
Evas_Coord mw, mh;
|
2012-09-11 22:15:43 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (!it->separator) count++;
|
|
|
|
}
|
|
|
|
if (scount != count)
|
|
|
|
{
|
|
|
|
scount = count;
|
2013-03-20 23:14:23 -07:00
|
|
|
if (snprintf(buf, sizeof(buf), "elm,number,item,%d", count) >= (int)sizeof(buf))
|
2013-03-18 05:07:23 -07:00
|
|
|
ERR("Too many items to fit signal buffer (%d)", count);
|
2012-09-11 22:15:43 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (!it->separator && !it->object)
|
2015-03-24 15:47:33 -07:00
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(it), buf, "elm");
|
|
|
|
edje_object_message_signal_process(elm_layout_edje_get(VIEW(it)));
|
2015-03-24 15:47:33 -07:00
|
|
|
|
|
|
|
mw = mh = -1;
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
|
2015-07-02 04:00:57 -07:00
|
|
|
edje_object_size_min_restricted_calc(elm_layout_edje_get(VIEW(it)), &mw, &mh, mw, mh);
|
2015-03-24 15:47:33 -07:00
|
|
|
evas_object_size_hint_min_set(VIEW(it), mw, mh);
|
|
|
|
}
|
2012-09-11 22:15:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
static void
|
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Coord minw = -1, minh = -1, minw_bx = -1, minh_bx = -1;
|
|
|
|
Evas_Coord vw = 0, vh = 0;
|
|
|
|
Evas_Coord w, h;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2013-10-05 01:15:58 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
evas_object_smart_need_recalculate_set(sd->bx, EINA_TRUE);
|
|
|
|
evas_object_smart_calculate(sd->bx);
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_size_min_calc(wd->resize_obj, &minw, &minh);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
2012-05-21 22:18:12 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (w < minw) w = minw;
|
|
|
|
if (h < minh) h = minh;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_resize(wd->resize_obj, w, h);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2017-09-18 00:22:01 -07:00
|
|
|
evas_object_size_hint_combined_min_get(sd->bx, &minw_bx, &minh_bx);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, &vw, &vh);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_NONE)
|
|
|
|
{
|
2012-10-03 19:43:57 -07:00
|
|
|
minw = minw_bx + (w - vw);
|
|
|
|
minh = minh_bx + (h - vh);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
else if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
|
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2012-09-27 21:23:29 -07:00
|
|
|
{
|
2012-10-18 00:57:13 -07:00
|
|
|
minw = minw_bx + (w - vw);
|
2013-03-04 22:46:30 -08:00
|
|
|
if (minh_bx <= vh) minh_bx = vh;
|
2012-10-18 00:57:13 -07:00
|
|
|
else _items_size_fit(obj, &minh_bx, vh);
|
2012-09-27 21:23:29 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-18 00:57:13 -07:00
|
|
|
minh = minh_bx + (h - vh);
|
2013-03-04 22:46:30 -08:00
|
|
|
if (minw_bx <= vw) minw_bx = vw;
|
2012-10-18 00:57:13 -07:00
|
|
|
else _items_size_fit(obj, &minw_bx, vw);
|
2012-09-27 21:23:29 -07:00
|
|
|
}
|
2012-03-04 01:52:20 -08:00
|
|
|
}
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
else
|
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2012-02-22 04:13:12 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
minw = minw_bx + (w - vw);
|
|
|
|
minh = h - vh;
|
2012-02-22 04:13:12 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
minw = w - vw;
|
|
|
|
minh = minh_bx + (h - vh);
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
}
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2012-09-26 20:05:50 -07:00
|
|
|
if (sd->transverse_expanded)
|
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2012-09-26 20:05:50 -07:00
|
|
|
minw_bx = vw;
|
|
|
|
else
|
|
|
|
minh_bx = vh;
|
|
|
|
}
|
|
|
|
|
2016-04-25 03:38:03 -07:00
|
|
|
/* Keep the box's minimum size for a moment.
|
|
|
|
It will be used for resizing the box in _resize_job() function. */
|
|
|
|
sd->minw_bx = minw_bx;
|
|
|
|
sd->minh_bx = minh_bx;
|
2012-09-26 20:05:50 -07:00
|
|
|
evas_object_resize(sd->more, minw_bx, minh_bx);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
2012-09-11 22:15:43 -07:00
|
|
|
|
|
|
|
_inform_item_number(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 08:22:32 -07:00
|
|
|
static void
|
|
|
|
_elm_toolbar_highlight_in_theme(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
const char *fh;
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
fh = edje_object_data_get
|
|
|
|
(wd->resize_obj, "focus_highlight");
|
|
|
|
if ((fh) && (!strcmp(fh, "on")))
|
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2018-11-19 20:56:37 -08:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply_Result
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_toolbar_efl_ui_widget_theme_apply(Eo *obj, Elm_Toolbar_Data *sd)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2012-08-30 09:45:00 -07:00
|
|
|
double scale = 0;
|
2018-11-19 20:56:37 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_RESULT_FAIL);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2018-11-19 20:56:37 -08:00
|
|
|
if (sd->delete_me) return EFL_UI_THEME_APPLY_RESULT_SUCCESS;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2018-11-19 20:56:37 -08:00
|
|
|
Efl_Ui_Theme_Apply_Result int_ret = EFL_UI_THEME_APPLY_RESULT_FAIL;
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2018-11-19 20:56:37 -08:00
|
|
|
if (!int_ret) return EFL_UI_THEME_APPLY_RESULT_FAIL;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-11-14 00:18:02 -08:00
|
|
|
elm_widget_theme_object_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(obj, wd->resize_obj, "toolbar", "base",
|
2012-11-14 00:18:02 -08:00
|
|
|
elm_widget_style_get(obj));
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2013-05-10 00:53:34 -07:00
|
|
|
edje_object_signal_emit(wd->resize_obj, "elm,orient,vertical", "elm");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(wd->resize_obj, "elm,orient,horizontal", "elm");
|
2012-11-14 00:18:02 -08:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(sd->more, "toolbar", "more", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2014-03-24 23:55:53 -07:00
|
|
|
elm_object_signal_emit(sd->more, "elm,orient,vertical", "elm");
|
2013-05-10 00:53:34 -07:00
|
|
|
else
|
2014-03-24 23:55:53 -07:00
|
|
|
elm_object_signal_emit(sd->more, "elm,orient,horizontal", "elm");
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
sd->theme_icon_size = _internal_elm_toolbar_icon_size_get(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->priv_icon_size) sd->icon_size = sd->priv_icon_size;
|
|
|
|
else sd->icon_size = sd->theme_icon_size;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
scale = (efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
_item_theme_hook(obj, it, scale, sd->icon_size);
|
|
|
|
|
|
|
|
if (sd->more_item)
|
|
|
|
_item_theme_hook(obj, sd->more_item, scale, sd->icon_size);
|
|
|
|
|
2014-03-23 08:22:32 -07:00
|
|
|
_elm_toolbar_highlight_in_theme(obj);
|
2015-10-15 16:33:15 -07:00
|
|
|
evas_object_smart_need_recalculate_set(obj, EINA_TRUE);
|
2012-08-30 09:45:00 -07: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;
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_toolbar_item_label_update(Elm_Toolbar_Item_Data *item)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_text_set(VIEW(item), "elm.text", item->label);
|
2012-09-11 22:30:35 -07:00
|
|
|
if (item->label)
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,text,visible", "elm");
|
2012-09-11 22:30:35 -07:00
|
|
|
else
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,text,hidden", "elm");
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
|
|
|
|
2010-11-11 10:05:36 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_label_set_cb(void *data,
|
|
|
|
Evas_Object *obj,
|
|
|
|
const char *emission,
|
|
|
|
const char *source)
|
2010-11-11 10:05:36 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *item = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
_elm_toolbar_item_label_update(item);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_callback_del
|
2012-08-30 09:45:00 -07:00
|
|
|
(obj, emission, source, _elm_toolbar_item_label_set_cb);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,label,reset", "elm");
|
2010-11-11 10:05:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_item_label_set(Elm_Toolbar_Item_Data *item,
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *label,
|
|
|
|
const char *sig)
|
2010-11-11 10:05:36 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *s;
|
|
|
|
|
|
|
|
if ((label) && (item->label) && (!strcmp(label, item->label))) return;
|
|
|
|
|
|
|
|
eina_stringshare_replace(&item->label, label);
|
2015-07-02 04:00:57 -07:00
|
|
|
s = elm_layout_data_get(VIEW(item), "transition_animation_on");
|
2012-08-30 09:45:00 -07:00
|
|
|
if ((s) && (atoi(s)))
|
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_text_set
|
2012-08-30 09:45:00 -07:00
|
|
|
(VIEW(item), "elm.text_new", item->label);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), sig, "elm");
|
|
|
|
elm_layout_signal_callback_add
|
2012-08-30 09:45:00 -07:00
|
|
|
(VIEW(item), "elm,state,label_set,done", "elm",
|
|
|
|
_elm_toolbar_item_label_set_cb, item);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_elm_toolbar_item_label_update(item);
|
|
|
|
|
2015-03-19 02:46:59 -07:00
|
|
|
_resizing_eval_item(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_elm_widget_item_part_text_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *part,
|
|
|
|
const char *label)
|
|
|
|
{
|
2012-09-06 21:33:45 -07:00
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
if ((!part) || (!strcmp(part, "default")) ||
|
|
|
|
(!strcmp(part, "elm.text")))
|
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
_item_label_set(item, label, "elm,state,label_set");
|
2012-09-06 21:33:45 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (label)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,visible", part);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), buf, "elm");
|
2012-09-06 21:33:45 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hidden", part);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), buf, "elm");
|
2012-09-06 21:33:45 -07:00
|
|
|
}
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_text_set(VIEW(item), part, label);
|
2012-09-06 21:33:45 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_elm_widget_item_part_text_get(const Eo *eo_it EINA_UNUSED, Elm_Toolbar_Item_Data *it,
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *part)
|
|
|
|
{
|
2012-09-06 21:33:45 -07:00
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
if (!part || !strcmp(part, "default"))
|
|
|
|
snprintf(buf, sizeof(buf), "elm.text");
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "%s", part);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2015-07-02 04:00:57 -07:00
|
|
|
return elm_layout_text_get(VIEW(it), buf);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_elm_widget_item_part_content_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *part,
|
|
|
|
Evas_Object *content)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(item);
|
|
|
|
double scale;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
2015-07-02 04:07:48 -07:00
|
|
|
if (part && strcmp(part, "object") && strcmp(part, "elm.swallow.object"))
|
|
|
|
{
|
2016-05-24 04:40:18 -07:00
|
|
|
efl_content_set(efl_part(VIEW(item), part), content);
|
2015-07-02 04:07:48 -07:00
|
|
|
return;
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
if (item->object == content) return;
|
|
|
|
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(item->object);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
item->object = content;
|
|
|
|
if (item->object)
|
|
|
|
elm_widget_sub_object_add(obj, item->object);
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
scale = (efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_theme_hook(obj, item, scale, sd->icon_size);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Evas_Object *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_elm_widget_item_part_content_get(const Eo *eo_it EINA_UNUSED, Elm_Toolbar_Item_Data *it,
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *part)
|
|
|
|
{
|
2015-07-02 04:07:48 -07:00
|
|
|
if (part && strcmp(part, "object") && strcmp(part, "elm.swallow.object"))
|
|
|
|
{
|
2016-05-24 04:40:18 -07:00
|
|
|
return efl_content_get(efl_part(VIEW(it), part));
|
2015-07-02 04:07:48 -07:00
|
|
|
}
|
2014-09-27 22:15:56 -07:00
|
|
|
return it->object;
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Evas_Object *
|
|
|
|
_elm_toolbar_item_elm_widget_item_part_content_unset(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *part)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(item);
|
|
|
|
Evas_Object *o;
|
|
|
|
double scale;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
2015-07-15 19:29:29 -07:00
|
|
|
if (part && strcmp(part, "object") && strcmp(part, "elm.swallow.object"))
|
|
|
|
{
|
2016-05-24 04:40:18 -07:00
|
|
|
return efl_content_unset(efl_part(VIEW(item), part));
|
2015-07-15 19:29:29 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_content_unset(VIEW(item), "elm.swallow.object");
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, item->object);
|
2012-08-30 09:45:00 -07:00
|
|
|
o = item->object;
|
|
|
|
item->object = NULL;
|
2018-04-05 01:47:26 -07:00
|
|
|
scale = (efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_theme_hook(obj, item, scale, sd->icon_size);
|
|
|
|
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
2017-08-30 02:47:21 -07:00
|
|
|
EOLIAN static void
|
2018-12-21 14:46:10 -08:00
|
|
|
_elm_toolbar_efl_ui_l10n_translation_update(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2013-04-23 04:30:15 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_translate(EO_OBJ(it));
|
2013-04-23 04:30:15 -07:00
|
|
|
|
2018-12-21 14:46:10 -08:00
|
|
|
efl_ui_l10n_translation_update(efl_super(obj, MY_CLASS));
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_resize(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2015-10-15 16:33:15 -07:00
|
|
|
evas_object_smart_need_recalculate_set(data, EINA_TRUE);
|
2015-03-19 02:46:59 -07:00
|
|
|
_resizing_eval(data);
|
2010-11-11 10:05:36 -08:00
|
|
|
}
|
|
|
|
|
2012-05-21 22:18:12 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_move_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)
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
|
|
|
Evas_Coord x, y, h;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(data, sd);
|
2012-05-21 22:18:12 -07:00
|
|
|
evas_object_geometry_get(data, &x, &y, NULL, &h);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_move(sd->more, x, y + h);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
|
2011-10-11 13:14:52 -07:00
|
|
|
static void
|
2016-05-12 22:06:18 -07:00
|
|
|
_mouse_clicked_cb(Elm_Toolbar_Item_Data *it,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *emission,
|
2014-01-06 06:30:02 -08:00
|
|
|
const char *source EINA_UNUSED)
|
2011-10-11 13:14:52 -07:00
|
|
|
{
|
|
|
|
int button;
|
2011-10-11 14:05:32 -07:00
|
|
|
char buf[sizeof("elm,action,click,") + 1];
|
2011-10-11 13:14:52 -07:00
|
|
|
|
|
|
|
button = atoi(emission + sizeof("mouse,clicked,") - 1);
|
2016-05-12 22:06:18 -07:00
|
|
|
if (button == 1)
|
|
|
|
{
|
|
|
|
/* regular left click event */
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_CLICKED, EO_OBJ(it));
|
2016-05-12 22:06:18 -07:00
|
|
|
return;
|
|
|
|
}
|
2011-10-11 13:14:52 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm,action,click,%d", button);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(it), buf, "elm");
|
2011-10-11 13:14:52 -07:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2016-05-12 22:06:18 -07:00
|
|
|
_action_click_cb(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = data;
|
2011-08-24 01:11:58 -07:00
|
|
|
|
2011-08-23 23:29:13 -07:00
|
|
|
if ((_elm_config->access_mode == ELM_ACCESS_MODE_OFF) ||
|
2011-10-20 18:08:01 -07:00
|
|
|
(_elm_access_2nd_click_timeout(VIEW(it))))
|
2011-08-23 23:29:13 -07:00
|
|
|
{
|
|
|
|
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_access_say(E_("Selected"));
|
2011-08-23 23:29:13 -07:00
|
|
|
_item_select(it);
|
|
|
|
}
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
|
|
|
|
2012-06-14 05:59:38 -07:00
|
|
|
static void
|
2013-02-14 21:37:53 -08:00
|
|
|
_item_move_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)
|
2013-02-14 21:37:53 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *item = data;
|
2013-02-14 21:37:53 -08:00
|
|
|
|
|
|
|
item->on_move = EINA_FALSE;
|
|
|
|
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(VIEW(item), EVAS_CALLBACK_MOVE, _item_move_cb, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_items_change(Elm_Toolbar_Item_Data *reorder_from, Elm_Toolbar_Item_Data *reorder_to)
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *prev = NULL, *next = NULL;
|
2012-06-14 05:59:38 -07:00
|
|
|
int tmp;
|
|
|
|
|
2013-07-05 20:26:59 -07:00
|
|
|
if (!reorder_from) return;
|
2013-02-14 21:37:53 -08:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(reorder_from), sd);
|
|
|
|
if (reorder_from == reorder_to) return;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2013-07-05 20:26:59 -07:00
|
|
|
if ((reorder_to) &&
|
2013-02-14 21:37:53 -08:00
|
|
|
(!reorder_from->separator) && (!reorder_to->separator))
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
prev = ELM_TOOLBAR_ITEM_FROM_INLIST
|
2013-02-14 21:37:53 -08:00
|
|
|
(EINA_INLIST_GET(reorder_from)->prev);
|
|
|
|
if (prev == reorder_to)
|
|
|
|
prev = reorder_from;
|
2012-06-14 05:59:38 -07:00
|
|
|
if (!prev)
|
2012-08-30 09:45:00 -07:00
|
|
|
next = ELM_TOOLBAR_ITEM_FROM_INLIST
|
2013-02-14 21:37:53 -08:00
|
|
|
(EINA_INLIST_GET(reorder_from)->next);
|
|
|
|
if (next == reorder_to)
|
2012-09-18 22:23:22 -07:00
|
|
|
next = NULL;
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_remove
|
2013-02-14 21:37:53 -08:00
|
|
|
(sd->items, EINA_INLIST_GET(reorder_from));
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_append_relative
|
2013-02-14 21:37:53 -08:00
|
|
|
(sd->items, EINA_INLIST_GET(reorder_from),
|
|
|
|
EINA_INLIST_GET(reorder_to));
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_remove
|
2013-02-14 21:37:53 -08:00
|
|
|
(sd->items, EINA_INLIST_GET(reorder_to));
|
2012-06-14 05:59:38 -07:00
|
|
|
if (prev)
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_append_relative
|
2013-02-14 21:37:53 -08:00
|
|
|
(sd->items, EINA_INLIST_GET(reorder_to),
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_GET(prev));
|
2012-06-14 05:59:38 -07:00
|
|
|
else if (next)
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_prepend_relative
|
2013-02-14 21:37:53 -08:00
|
|
|
(sd->items, EINA_INLIST_GET(reorder_to),
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_GET(next));
|
2012-09-18 22:23:22 -07:00
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend
|
2013-02-14 21:37:53 -08:00
|
|
|
(sd->items, EINA_INLIST_GET(reorder_to));
|
|
|
|
|
|
|
|
evas_object_box_remove(sd->bx, VIEW(reorder_from));
|
|
|
|
evas_object_box_insert_after(sd->bx, VIEW(reorder_from),
|
|
|
|
VIEW(reorder_to));
|
|
|
|
evas_object_box_remove(sd->bx, VIEW(reorder_to));
|
|
|
|
if (prev)
|
|
|
|
evas_object_box_insert_after(sd->bx, VIEW(reorder_to),
|
|
|
|
VIEW(prev));
|
|
|
|
else if (next)
|
|
|
|
evas_object_box_insert_before(sd->bx, VIEW(reorder_to),
|
|
|
|
VIEW(next));
|
|
|
|
else
|
|
|
|
evas_object_box_prepend(sd->bx, VIEW(reorder_to));
|
2012-09-18 22:23:22 -07:00
|
|
|
|
2013-02-14 21:37:53 -08:00
|
|
|
tmp = reorder_from->prio.priority;
|
|
|
|
reorder_from->prio.priority = reorder_to->prio.priority;
|
|
|
|
reorder_to->prio.priority = tmp;
|
|
|
|
|
|
|
|
reorder_from->on_move = EINA_TRUE;
|
|
|
|
reorder_to->on_move = EINA_TRUE;
|
|
|
|
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(reorder_from), EVAS_CALLBACK_MOVE,
|
|
|
|
_item_move_cb, reorder_from);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(reorder_to), EVAS_CALLBACK_MOVE,
|
|
|
|
_item_move_cb, reorder_to);
|
|
|
|
}
|
|
|
|
|
2015-03-19 02:46:59 -07:00
|
|
|
_resizing_eval(WIDGET(reorder_from));
|
2013-02-14 21:37:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_transit_del_cb(void *data, Elm_Transit *transit EINA_UNUSED)
|
2013-02-14 21:37:53 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it, *item = data;
|
2013-02-14 21:37:53 -08:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
if (item->reorder_to)
|
|
|
|
{
|
|
|
|
if (item->reorder_to == sd->reorder_empty)
|
|
|
|
sd->reorder_empty = item;
|
|
|
|
else if (item == sd->reorder_empty)
|
|
|
|
sd->reorder_empty = item->reorder_to;
|
|
|
|
|
|
|
|
_items_change(item->reorder_to, item);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2012-09-18 22:23:22 -07:00
|
|
|
{
|
2013-02-14 21:37:53 -08:00
|
|
|
if (it != item)
|
|
|
|
{
|
|
|
|
if (it->reorder_to == item)
|
|
|
|
it->reorder_to = item->reorder_to;
|
|
|
|
else if (it->reorder_to == item->reorder_to)
|
|
|
|
it->reorder_to = item;
|
|
|
|
}
|
2012-09-18 22:23:22 -07:00
|
|
|
}
|
2013-02-14 21:37:53 -08:00
|
|
|
}
|
|
|
|
if (item->proxy)
|
|
|
|
{
|
|
|
|
evas_object_image_source_visible_set(elm_image_object_get(item->proxy), EINA_TRUE);
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(item->proxy, evas_object_del);
|
2013-02-14 21:37:53 -08:00
|
|
|
}
|
|
|
|
item->trans = NULL;
|
|
|
|
|
|
|
|
if (item->reorder_to)
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
if (it->trans) break;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2013-02-14 21:37:53 -08:00
|
|
|
if (!it) sd->reorder_empty = sd->reorder_item;
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
2013-02-14 21:37:53 -08:00
|
|
|
item->reorder_to = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_transition_start
|
2014-09-27 22:15:56 -07:00
|
|
|
(Elm_Toolbar_Item_Data *it, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
2013-02-14 21:37:53 -08:00
|
|
|
{
|
|
|
|
Evas_Coord tx, ty;
|
2013-04-29 08:50:25 -07:00
|
|
|
Evas_Object *obj = WIDGET(it), *img = NULL;
|
2013-02-14 21:37:53 -08:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
it->proxy = elm_image_add(obj);
|
2013-04-29 08:50:25 -07:00
|
|
|
img = elm_image_object_get(it->proxy);
|
2013-02-14 21:37:53 -08:00
|
|
|
elm_image_aspect_fixed_set(it->proxy, EINA_FALSE);
|
2013-04-29 08:50:25 -07:00
|
|
|
evas_object_image_source_set(img, VIEW(it));
|
|
|
|
evas_object_image_source_visible_set(img, EINA_FALSE);
|
|
|
|
evas_object_image_source_clip_set(img, EINA_FALSE);
|
2013-02-14 21:37:53 -08:00
|
|
|
|
|
|
|
it->trans = elm_transit_add();
|
|
|
|
elm_transit_object_add(it->trans, it->proxy);
|
|
|
|
evas_object_geometry_get(VIEW(sd->reorder_empty), &tx, &ty, NULL, NULL);
|
2018-11-21 07:47:38 -08:00
|
|
|
evas_object_geometry_set(it->proxy, x, y, w, h);
|
2013-02-14 21:37:53 -08:00
|
|
|
evas_object_show(it->proxy);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2013-02-14 21:37:53 -08:00
|
|
|
elm_transit_effect_translation_add(it->trans, 0, 0, tx - x, 0);
|
|
|
|
elm_transit_duration_set(it->trans, 0.2);
|
|
|
|
elm_transit_del_cb_set(it->trans, _transit_del_cb, it);
|
|
|
|
elm_transit_go(it->trans);
|
|
|
|
|
|
|
|
it->reorder_to = sd->reorder_empty;
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_animate_missed_items(Elm_Toolbar_Item_Data *prev, Elm_Toolbar_Item_Data *next)
|
2013-02-14 21:37:53 -08:00
|
|
|
{
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(prev), sd);
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it, *it2;
|
2013-02-14 21:37:53 -08:00
|
|
|
Eina_List *list, *l;
|
|
|
|
Evas_Object *o;
|
|
|
|
Eina_Bool reverse = EINA_FALSE;
|
|
|
|
Evas_Coord fx, fy, fw, fh;
|
|
|
|
|
|
|
|
list = evas_object_box_children_get(sd->bx);
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(list, l, o)
|
|
|
|
{
|
|
|
|
if (o == VIEW(prev))
|
|
|
|
break;
|
|
|
|
else if (o == VIEW(next))
|
|
|
|
reverse = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!reverse)
|
|
|
|
l = eina_list_next(l);
|
|
|
|
else
|
|
|
|
l = eina_list_prev(l);
|
|
|
|
|
|
|
|
while (VIEW(next) != eina_list_data_get(l))
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (VIEW(it) == eina_list_data_get(l))
|
|
|
|
{
|
|
|
|
if (!it->trans && it != sd->reorder_item)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(VIEW(sd->reorder_empty), &fx, &fy, &fw, &fh);
|
|
|
|
_item_transition_start(it, fx, fy, fw, fh);
|
|
|
|
sd->reorder_empty = it;
|
|
|
|
}
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it2)
|
|
|
|
{
|
|
|
|
if (it == it2->reorder_to) break;
|
|
|
|
}
|
|
|
|
if (it2)
|
|
|
|
{
|
|
|
|
it2->reorder_to = NULL;
|
|
|
|
evas_object_geometry_get(it2->proxy, &fx, &fy, &fw, &fh);
|
|
|
|
if (it2->trans) elm_transit_del(it2->trans);
|
|
|
|
_item_transition_start(it2, fx, fy, fw, fh);
|
|
|
|
sd->reorder_empty = it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!reverse)
|
|
|
|
l = eina_list_next(l);
|
|
|
|
else
|
|
|
|
l = eina_list_prev(l);
|
|
|
|
}
|
2015-04-26 18:53:28 -07:00
|
|
|
eina_list_free(list);
|
2013-02-14 21:37:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_mouse_move_reorder(Elm_Toolbar_Item_Data *item,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Event_Mouse_Move *ev)
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
2013-02-14 21:37:53 -08:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Evas_Coord fx, fy, fw, fh;
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it, *it2;
|
2013-02-14 21:37:53 -08:00
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
evas_object_geometry_get(VIEW(item), &x, &y, &w, &h);
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2013-02-14 21:37:53 -08:00
|
|
|
evas_object_move(item->proxy, x, ev->cur.canvas.y - (h / 2));
|
|
|
|
else
|
|
|
|
evas_object_move(item->proxy, ev->cur.canvas.x - (w / 2), y);
|
|
|
|
evas_object_show(item->proxy);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2013-02-14 21:37:53 -08:00
|
|
|
if (sd->reorder_empty->on_move) return;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->VIEW(reorder_empty), &x, &y, &w, &h);
|
|
|
|
if (ev->cur.canvas.x < x || ev->cur.canvas.x > x + w)
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->on_move) continue;
|
|
|
|
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
|
|
|
|
if (ev->cur.canvas.x > x && ev->cur.canvas.x < x + w) break;
|
|
|
|
}
|
|
|
|
if (it && (it != sd->reorder_empty))
|
|
|
|
{
|
|
|
|
_animate_missed_items(sd->reorder_empty, it);
|
|
|
|
if (!it->trans && it != item)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(VIEW(it), &fx, &fy, &fw, &fh);
|
|
|
|
_item_transition_start(it, fx, fy, fw, fh);
|
|
|
|
sd->reorder_empty = it;
|
|
|
|
}
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it2)
|
|
|
|
{
|
|
|
|
if (it == it2->reorder_to) break;
|
|
|
|
}
|
|
|
|
if (it2)
|
|
|
|
{
|
|
|
|
it2->reorder_to = NULL;
|
|
|
|
evas_object_geometry_get(it2->proxy, &fx, &fy, &fw, &fh);
|
|
|
|
if (it2->trans) elm_transit_del(it2->trans);
|
|
|
|
_item_transition_start(it2, fx, fy, fw, fh);
|
|
|
|
sd->reorder_empty = it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_mouse_up_reorder(Elm_Toolbar_Item_Data *it,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
2012-09-18 22:23:22 -07:00
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Event_Mouse_Up *ev EINA_UNUSED)
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(obj, EVAS_CALLBACK_MOUSE_MOVE,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_move_reorder, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->more, EVAS_CALLBACK_MOUSE_MOVE,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_move_reorder, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_move_reorder, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(obj, EVAS_CALLBACK_MOUSE_UP,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_up_reorder, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->more, EVAS_CALLBACK_MOUSE_UP,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_up_reorder, it);
|
|
|
|
|
2013-02-14 21:37:53 -08:00
|
|
|
if (it->proxy)
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
2013-02-14 21:37:53 -08:00
|
|
|
evas_object_image_source_visible_set(elm_image_object_get(it->proxy), EINA_TRUE);
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(it->proxy, evas_object_del);
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
2012-09-18 22:23:22 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(obj, EINA_FALSE);
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_item_reorder_start(Elm_Toolbar_Item_Data *item)
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
2013-04-29 08:50:25 -07:00
|
|
|
Evas_Object *obj = WIDGET(item), *img = NULL;
|
2012-06-14 05:59:38 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
2013-02-14 21:37:53 -08:00
|
|
|
sd->reorder_empty = sd->reorder_item = item;
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2013-02-14 21:37:53 -08:00
|
|
|
item->proxy = elm_image_add(obj);
|
2013-04-29 08:50:25 -07:00
|
|
|
img = elm_image_object_get(item->proxy);
|
2013-02-14 21:37:53 -08:00
|
|
|
elm_image_aspect_fixed_set(item->proxy, EINA_FALSE);
|
2013-04-29 08:50:25 -07:00
|
|
|
evas_object_image_source_set(img, VIEW(item));
|
|
|
|
evas_object_image_source_visible_set(img, EINA_FALSE);
|
|
|
|
evas_object_image_source_clip_set(img, EINA_FALSE);
|
2013-04-29 02:35:32 -07:00
|
|
|
|
2013-02-14 21:37:53 -08:00
|
|
|
evas_object_layer_set(item->proxy, 100);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,moving", "elm");
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(obj, EVAS_CALLBACK_MOUSE_MOVE,
|
2013-02-14 21:37:53 -08:00
|
|
|
(Evas_Object_Event_Cb)_mouse_move_reorder, item);
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(sd->more, EVAS_CALLBACK_MOUSE_MOVE,
|
2013-02-14 21:37:53 -08:00
|
|
|
(Evas_Object_Event_Cb)_mouse_move_reorder, item);
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add
|
2013-02-14 21:37:53 -08:00
|
|
|
(item->proxy, EVAS_CALLBACK_MOUSE_MOVE,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_move_reorder, item);
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(obj, EVAS_CALLBACK_MOUSE_UP,
|
2013-02-14 21:37:53 -08:00
|
|
|
(Evas_Object_Event_Cb)_mouse_up_reorder, item);
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(sd->more, EVAS_CALLBACK_MOUSE_UP,
|
2013-02-14 21:37:53 -08:00
|
|
|
(Evas_Object_Event_Cb)_mouse_up_reorder, item);
|
2012-06-14 05:59:38 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(VIEW(item), &x, &y, &w, &h);
|
2018-11-21 07:47:38 -08:00
|
|
|
evas_object_geometry_set(item->proxy, x, y, w, h);
|
2013-02-14 21:37:53 -08:00
|
|
|
evas_object_show(item->proxy);
|
2012-09-18 22:23:22 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(WIDGET(item), EINA_TRUE);
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
|
2011-10-11 15:09:14 -07:00
|
|
|
static Eina_Bool
|
2012-11-14 02:49:59 -08:00
|
|
|
_long_press_cb(void *data)
|
2011-10-11 15:09:14 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
|
|
|
sd->long_timer = NULL;
|
|
|
|
sd->long_press = EINA_TRUE;
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-09-18 22:23:22 -07:00
|
|
|
if (sd->reorder_mode)
|
2012-06-14 05:59:38 -07:00
|
|
|
_item_reorder_start(it);
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_LONGPRESSED, EO_OBJ(it));
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-10-11 15:09:14 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2012-06-14 05:59:38 -07:00
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_mouse_move_cb(Elm_Toolbar_Item_Data *it,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Event_Mouse_Move *ev)
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
2012-06-14 05:59:38 -07:00
|
|
|
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
|
|
|
|
|
2013-05-21 10:24:02 -07:00
|
|
|
if ((x > ev->cur.canvas.x) || (ev->cur.canvas.x > x + w) ||
|
|
|
|
(y > ev->cur.canvas.y) || (ev->cur.canvas.y > y + h))
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
2013-05-29 05:08:50 -07:00
|
|
|
ELM_SAFE_FREE(sd->long_timer, ecore_timer_del);
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-11 15:09:14 -07:00
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_mouse_down_cb(Elm_Toolbar_Item_Data *it,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Event_Mouse_Down *ev)
|
2011-10-11 15:09:14 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
2011-10-11 15:09:14 -07:00
|
|
|
if (ev->button != 1) return;
|
|
|
|
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_CLICKED_DOUBLE, EO_OBJ(it));
|
2014-03-23 08:22:32 -07:00
|
|
|
sd->mouse_down = EINA_TRUE;
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->long_press = EINA_FALSE;
|
|
|
|
if (sd->long_timer)
|
|
|
|
ecore_timer_interval_set
|
|
|
|
(sd->long_timer, _elm_config->longpress_timeout);
|
|
|
|
else
|
|
|
|
sd->long_timer = ecore_timer_add
|
2012-11-14 02:49:59 -08:00
|
|
|
(_elm_config->longpress_timeout, _long_press_cb, it);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-06-14 05:59:38 -07:00
|
|
|
evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
|
2012-08-30 09:45:00 -07:00
|
|
|
(Evas_Object_Event_Cb)_mouse_move_cb, it);
|
2011-10-11 15:09:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_mouse_up_cb(Elm_Toolbar_Item_Data *it,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Event_Mouse_Up *ev)
|
2011-10-11 15:09:14 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
2011-10-11 15:09:14 -07:00
|
|
|
if (ev->button != 1) return;
|
2014-03-23 08:22:32 -07:00
|
|
|
sd->mouse_down = EINA_FALSE;
|
2013-05-29 05:08:50 -07:00
|
|
|
ELM_SAFE_FREE(sd->long_timer, ecore_timer_del);
|
2014-09-27 22:15:56 -07:00
|
|
|
if ((!elm_object_item_disabled_get(EO_OBJ(it))) &&
|
|
|
|
(sd->focused_item != EO_OBJ(it)))
|
|
|
|
elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_move_cb, it);
|
2011-10-11 15:09:14 -07:00
|
|
|
}
|
|
|
|
|
2010-10-29 11:42:01 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_mouse_in_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2010-10-29 11:42:01 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,highlighted", "elm");
|
2014-01-14 04:32:28 -08:00
|
|
|
if (it->icon)
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,highlighted", "elm");
|
2014-04-01 04:26:33 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
if (!elm_object_item_disabled_get(EO_OBJ(it)) &&
|
2014-04-01 04:26:33 -07:00
|
|
|
(_elm_config->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN))
|
2014-09-27 22:15:56 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE);
|
2010-10-29 11:42:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_mouse_out_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2010-10-29 11:42:01 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,unhighlighted", "elm");
|
2014-01-14 04:32:28 -08:00
|
|
|
if (it->icon)
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,unhighlighted", "elm");
|
2010-10-29 11:42:01 -07:00
|
|
|
}
|
|
|
|
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
static void
|
|
|
|
_scroll_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL, NULL);
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_scroll_anim_start_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_ANIM_START, NULL);
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_scroll_anim_stop_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_ANIM_STOP, NULL);
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_scroll_drag_start_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
{
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
ELM_SAFE_FREE(sd->long_timer, ecore_timer_del);
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_DRAG_START, NULL);
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_scroll_drag_stop_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_DRAG_STOP, NULL);
|
added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
2013-07-02 21:57:17 -07:00
|
|
|
}
|
|
|
|
|
2009-10-02 12:22:40 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_layout(Evas_Object *o,
|
|
|
|
Evas_Object_Box_Data *priv,
|
|
|
|
void *data)
|
2009-10-02 12:22:40 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *obj = (Evas_Object *)data;
|
2016-05-05 22:53:17 -07:00
|
|
|
Eina_Bool horizontal;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2016-05-05 22:53:17 -07:00
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
horizontal = efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE);
|
2016-05-05 22:53:17 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
_els_box_layout
|
2017-06-13 03:41:15 -07:00
|
|
|
(o, priv, horizontal, sd->homogeneous, efl_ui_mirrored_get(obj));
|
2009-10-02 12:22:40 -07:00
|
|
|
}
|
|
|
|
|
2011-08-23 23:29:13 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
2011-08-23 23:29:13 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = (Elm_Toolbar_Item_Data *)data;
|
|
|
|
const char *txt = (it->base)->access_info;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-08-24 09:13:13 -07:00
|
|
|
if (!txt) txt = it->label;
|
2011-08-23 23:29:13 -07:00
|
|
|
if (txt) return strdup(txt);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-08-24 09:13:13 -07:00
|
|
|
return NULL;
|
2011-08-23 23:29:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_state_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
2011-08-23 23:29:13 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = (Elm_Toolbar_Item_Data *)data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-08-23 23:29:13 -07:00
|
|
|
if (it->separator)
|
2012-08-30 09:45:00 -07:00
|
|
|
return strdup(E_("Separator"));
|
2016-03-02 04:10:48 -08:00
|
|
|
else if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
2012-08-30 09:45:00 -07:00
|
|
|
return strdup(E_("State: Disabled"));
|
2011-08-23 23:29:13 -07:00
|
|
|
else if (it->selected)
|
2012-08-30 09:45:00 -07:00
|
|
|
return strdup(E_("State: Selected"));
|
2011-08-23 23:29:13 -07:00
|
|
|
else if (it->menu)
|
2012-08-30 09:45:00 -07:00
|
|
|
return strdup(E_("Has menu"));
|
|
|
|
|
2011-08-23 23:29:13 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-17 06:44:05 -07:00
|
|
|
EOLIAN static void
|
2018-05-07 16:48:10 -07:00
|
|
|
_elm_toolbar_item_efl_object_invalidate(Eo *eo_item, Elm_Toolbar_Item_Data *item)
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *next = NULL;
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
obj = WIDGET(item);
|
|
|
|
|
|
|
|
if (item != sd->more_item) /* more item does not get in the list */
|
|
|
|
{
|
2012-12-08 10:17:04 -08:00
|
|
|
if (!sd->delete_me)
|
2012-12-02 22:52:03 -08:00
|
|
|
next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next);
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(item));
|
|
|
|
sd->item_count--;
|
2012-12-08 10:17:04 -08:00
|
|
|
if (!sd->delete_me)
|
2012-12-02 22:52:03 -08:00
|
|
|
{
|
|
|
|
if (!next) next = ELM_TOOLBAR_ITEM_FROM_INLIST(sd->items);
|
|
|
|
if ((sd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS) &&
|
|
|
|
item->selected && next) _item_select(next);
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
2017-10-15 08:44:18 -07:00
|
|
|
efl_ui_focus_composition_dirty(WIDGET(item));
|
2016-12-21 15:28:24 -08:00
|
|
|
|
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
|
|
|
_item_del(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
if (item != sd->more_item)
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2018-07-02 02:16:41 -07:00
|
|
|
else
|
|
|
|
sd->more_item = NULL;
|
2012-01-27 03:56:14 -08:00
|
|
|
|
2018-05-07 16:48:10 -07:00
|
|
|
efl_invalidate(efl_super(eo_item, ELM_TOOLBAR_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-11-13 20:08:25 -08:00
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_activate_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *part_obj EINA_UNUSED,
|
2013-01-03 01:31:33 -08:00
|
|
|
Elm_Object_Item *item)
|
2012-11-13 20:08:25 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(item, it);
|
2013-03-08 00:21:38 -08:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
2012-11-13 20:08:25 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(item)) return;
|
2012-11-13 20:08:25 -08:00
|
|
|
|
2013-03-08 00:21:38 -08:00
|
|
|
if (it->selected && (sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS))
|
|
|
|
{
|
|
|
|
_elm_access_say(E_("Unselected"));
|
|
|
|
_item_unselect(it);
|
|
|
|
}
|
|
|
|
else
|
2012-11-13 20:08:25 -08:00
|
|
|
{
|
|
|
|
_elm_access_say(E_("Selected"));
|
|
|
|
_item_select(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-08 01:20:37 -08:00
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_access_widget_item_register(Elm_Toolbar_Item_Data *it)
|
2012-11-08 01:20:37 -08:00
|
|
|
{
|
|
|
|
Elm_Access_Info *ai;
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_access_widget_item_register(it->base);
|
|
|
|
ai = _elm_access_info_get(it->base->access_obj);
|
2012-11-08 01:20:37 -08:00
|
|
|
|
|
|
|
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Toolbar Item"));
|
|
|
|
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it);
|
|
|
|
_elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it);
|
2012-11-13 20:08:25 -08:00
|
|
|
_elm_access_activate_callback_set(ai, _access_activate_cb, NULL);
|
2012-11-08 01:20:37 -08:00
|
|
|
}
|
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
EOLIAN static Eina_Rect
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_efl_ui_focus_object_focus_geometry_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Item_Data *pd)
|
2016-12-21 15:28:24 -08:00
|
|
|
{
|
2017-09-13 19:59:44 -07:00
|
|
|
Eina_Rect rect;
|
2017-04-30 01:57:56 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(VIEW(pd), &rect.x, &rect.y, &rect.w, &rect.h);
|
|
|
|
|
|
|
|
return rect;
|
2016-12-21 15:28:24 -08:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_toolbar_item_efl_object_constructor(Eo *eo_it, Elm_Toolbar_Item_Data *it)
|
2014-09-27 22:15:56 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
eo_it = efl_constructor(efl_super(eo_it, ELM_TOOLBAR_ITEM_CLASS));
|
|
|
|
it->base = efl_data_scope_get(eo_it, ELM_WIDGET_ITEM_CLASS);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(eo_it, EFL_ACCESS_ROLE_MENU_ITEM);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return eo_it;
|
2014-09-27 22:15:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Elm_Toolbar_Item_Data *
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_new(Evas_Object *obj,
|
|
|
|
const char *icon,
|
|
|
|
const char *label,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *data)
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
{
|
|
|
|
Evas_Object *icon_obj;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
Eo *eo_it = efl_add(ELM_TOOLBAR_ITEM_CLASS, obj);
|
2015-11-09 12:25:04 -08:00
|
|
|
|
|
|
|
if (!eo_it) return NULL;
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(eo_it, it);
|
2011-12-08 21:26:33 -08:00
|
|
|
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
it->label = eina_stringshare_add(label);
|
|
|
|
it->prio.visible = 1;
|
|
|
|
it->prio.priority = 0;
|
|
|
|
it->func = func;
|
|
|
|
it->separator = EINA_FALSE;
|
2012-03-06 03:35:11 -08:00
|
|
|
it->object = NULL;
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(EO_OBJ(it), data);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2018-05-07 15:16:29 -07:00
|
|
|
VIEW_SET(it, elm_layout_add(obj));
|
2018-11-23 00:49:55 -08:00
|
|
|
_efl_ui_focus_event_redirector(VIEW(it), eo_it);
|
2016-12-21 15:28:24 -08:00
|
|
|
elm_widget_tree_unfocusable_set(VIEW(it), EINA_TRUE);
|
2013-04-14 22:34:15 -07:00
|
|
|
evas_object_data_set(VIEW(it), "item", it);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_access_type_set(VIEW(it), EFL_ACCESS_TYPE_DISABLED);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2015-11-09 12:25:04 -08:00
|
|
|
icon_obj = elm_icon_add(VIEW(it));
|
2018-02-14 18:14:52 -08:00
|
|
|
efl_parent_set(icon_obj, eo_it);
|
2016-09-20 14:46:11 -07:00
|
|
|
|
2012-11-08 00:02:12 -08:00
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
2012-11-08 01:20:37 -08:00
|
|
|
_access_widget_item_register(it);
|
2011-08-24 01:11:58 -07:00
|
|
|
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
if (_item_icon_set(icon_obj, "toolbar/", icon))
|
|
|
|
{
|
|
|
|
it->icon = icon_obj;
|
|
|
|
it->icon_str = eina_stringshare_add(icon);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
it->icon = NULL;
|
|
|
|
it->icon_str = NULL;
|
|
|
|
evas_object_del(icon_obj);
|
|
|
|
}
|
|
|
|
|
2015-07-10 08:24:23 -07:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(VIEW(it), "toolbar", "item", elm_widget_style_get(obj)))
|
|
|
|
CRI("Failed to set layout!");
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_callback_add
|
2016-05-12 22:06:18 -07:00
|
|
|
(VIEW(it), "elm,action,click", "elm", _action_click_cb, it);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_callback_add
|
2016-05-12 22:06:18 -07:00
|
|
|
(VIEW(it), "mouse,clicked,*", "*", (Edje_Signal_Cb)_mouse_clicked_cb, it);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_callback_add
|
2012-08-30 09:45:00 -07:00
|
|
|
(VIEW(it), "elm,mouse,in", "elm", _mouse_in_cb, it);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_callback_add
|
2012-08-30 09:45:00 -07:00
|
|
|
(VIEW(it), "elm,mouse,out", "elm", _mouse_out_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, (Evas_Object_Event_Cb)_mouse_down_cb,
|
|
|
|
it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_UP, (Evas_Object_Event_Cb)_mouse_up_cb, it);
|
|
|
|
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
if (it->icon)
|
|
|
|
{
|
2015-08-07 00:42:29 -07:00
|
|
|
evas_object_size_hint_min_set(it->icon, sd->icon_size, sd->icon_size);
|
|
|
|
evas_object_size_hint_max_set(it->icon, sd->icon_size, sd->icon_size);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_content_set(VIEW(it), "elm.swallow.icon", it->icon);
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,icon,visible", "elm");
|
2015-09-12 01:16:41 -07:00
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,icon,visible", "elm");
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
evas_object_show(it->icon);
|
|
|
|
}
|
2015-09-12 01:16:41 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,icon,hidden", "elm");
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,icon,hidden", "elm");
|
|
|
|
}
|
|
|
|
|
From: Artem Popov <artem.popov@samsung.com>
Subject: [E-devel] Fwd: [Patch] elm_toolbar add signals patch.
For new style of toolbar (align icon and text to center of item) are
necessary some signals ("elm,state,text,visible",
"elm,state,text,hidden", "elm,state,icon,visible",
"elm,state,icon,hidden")
New style for toolbar, where icon and text are align to center of item.
SVN revision: 73028
2012-06-29 03:03:27 -07:00
|
|
|
if (it->label)
|
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_text_set(VIEW(it), "elm.text", it->label);
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,text,visible", "elm");
|
2015-09-12 01:16:41 -07:00
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,text,visible", "elm");
|
From: Artem Popov <artem.popov@samsung.com>
Subject: [E-devel] Fwd: [Patch] elm_toolbar add signals patch.
For new style of toolbar (align icon and text to center of item) are
necessary some signals ("elm,state,text,visible",
"elm,state,text,hidden", "elm,state,icon,visible",
"elm,state,icon,hidden")
New style for toolbar, where icon and text are align to center of item.
SVN revision: 73028
2012-06-29 03:03:27 -07:00
|
|
|
}
|
2015-09-12 01:16:41 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,state,text,hidden", "elm");
|
|
|
|
elm_layout_signal_emit(VIEW(it), "elm,text,hidden", "elm");
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_message_signal_process(elm_layout_edje_get(VIEW(it)));
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2018-04-02 02:22:51 -07:00
|
|
|
efl_ui_focus_composition_dirty(obj);
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_RESIZE, _item_resize, obj);
|
|
|
|
if ((!sd->items) && (sd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS))
|
2012-03-07 05:23:22 -08:00
|
|
|
_item_select(it);
|
2015-10-02 07:44:19 -07:00
|
|
|
|
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_added(eo_it);
|
2015-10-02 07:44:19 -07:00
|
|
|
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
return it;
|
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
static void
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_toolbar_item_icon_update(Elm_Toolbar_Item_Data *item)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2012-03-01 11:14:46 -08:00
|
|
|
Elm_Toolbar_Item_State *it_state;
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *old_icon =
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_content_get(VIEW(item), "elm.swallow.icon");
|
2012-03-01 11:14:46 -08:00
|
|
|
Eina_List *l;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(WIDGET(item), old_icon);
|
2016-11-28 11:15:20 -08:00
|
|
|
elm_layout_content_unset(VIEW(item), "elm.swallow.icon");
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_content_set(VIEW(item), "elm.swallow.icon", item->icon);
|
2012-09-11 22:30:35 -07:00
|
|
|
if (item->icon)
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,icon,visible", "elm");
|
2012-09-11 22:30:35 -07:00
|
|
|
else
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,icon,hidden", "elm");
|
2012-06-25 22:54:45 -07:00
|
|
|
evas_object_hide(old_icon);
|
2012-03-01 11:14:46 -08:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(item->states, l, it_state)
|
|
|
|
{
|
|
|
|
if (it_state->icon == old_icon) return;
|
|
|
|
}
|
|
|
|
evas_object_del(old_icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_set_cb(void *data,
|
|
|
|
Evas_Object *obj,
|
|
|
|
const char *emission,
|
|
|
|
const char *source)
|
2012-03-01 11:14:46 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *item = data;
|
2012-03-01 11:14:46 -08:00
|
|
|
_elm_toolbar_item_icon_update(item);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_callback_del
|
2012-08-30 09:45:00 -07:00
|
|
|
(obj, emission, source, _elm_toolbar_item_icon_set_cb);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), "elm,state,icon,reset", "elm");
|
2012-03-01 11:14:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set(Evas_Object *obj,
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *item,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *icon_obj,
|
|
|
|
const char *icon_str,
|
|
|
|
double icon_size,
|
|
|
|
const char *sig)
|
2012-03-01 11:14:46 -08:00
|
|
|
{
|
|
|
|
Evas_Object *old_icon;
|
|
|
|
const char *s;
|
2012-08-30 09:45:00 -07:00
|
|
|
int ms = 0;
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
if (icon_str)
|
|
|
|
eina_stringshare_replace(&item->icon_str, icon_str);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eina_stringshare_del(item->icon_str);
|
|
|
|
item->icon_str = NULL;
|
|
|
|
}
|
|
|
|
item->icon = icon_obj;
|
2016-01-29 07:33:27 -08:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
if (icon_obj)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ms = (icon_size * elm_config_scale_get());
|
2011-11-29 21:10:23 -08:00
|
|
|
evas_object_size_hint_min_set(item->icon, ms, ms);
|
|
|
|
evas_object_size_hint_max_set(item->icon, ms, ms);
|
|
|
|
evas_object_show(item->icon);
|
|
|
|
elm_widget_sub_object_add(obj, item->icon);
|
|
|
|
}
|
2015-07-02 04:00:57 -07:00
|
|
|
s = elm_layout_data_get(VIEW(item), "transition_animation_on");
|
2012-03-01 11:14:46 -08:00
|
|
|
if ((s) && (atoi(s)))
|
|
|
|
{
|
2015-07-02 04:00:57 -07:00
|
|
|
old_icon = elm_layout_content_get
|
2012-08-30 09:45:00 -07:00
|
|
|
(VIEW(item), "elm.swallow.icon_new");
|
2012-03-01 11:14:46 -08:00
|
|
|
if (old_icon)
|
|
|
|
{
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(WIDGET(item), old_icon);
|
2012-03-01 11:14:46 -08:00
|
|
|
evas_object_hide(old_icon);
|
|
|
|
}
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_content_set
|
2012-08-30 09:45:00 -07:00
|
|
|
(VIEW(item), "elm.swallow.icon_new", item->icon);
|
2015-07-02 04:00:57 -07:00
|
|
|
elm_layout_signal_emit(VIEW(item), sig, "elm");
|
|
|
|
elm_layout_signal_callback_add
|
2012-08-30 09:45:00 -07:00
|
|
|
(VIEW(item), "elm,state,icon_set,done", "elm",
|
|
|
|
_elm_toolbar_item_icon_set_cb, item);
|
2012-03-01 11:14:46 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
_elm_toolbar_item_icon_update(item);
|
2015-03-19 02:46:59 -07:00
|
|
|
_resizing_eval_item(item);
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_elm_toolbar_item_state_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:00 -07:00
|
|
|
void *event_info)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Object_Item *eo_it = event_info;
|
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(eo_it, it);
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Toolbar_Item_State *it_state;
|
|
|
|
|
|
|
|
it_state = eina_list_data_get(it->current_state);
|
|
|
|
if (it_state->func)
|
|
|
|
it_state->func((void *)it_state->data, obj, event_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Elm_Toolbar_Item_State *
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_state_new(const char *label,
|
|
|
|
const char *icon_str,
|
|
|
|
Evas_Object *icon,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *data)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item_State *it_state;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
it_state = ELM_NEW(Elm_Toolbar_Item_State);
|
|
|
|
it_state->label = eina_stringshare_add(label);
|
|
|
|
it_state->icon_str = eina_stringshare_add(icon_str);
|
|
|
|
it_state->icon = icon;
|
|
|
|
it_state->func = func;
|
|
|
|
it_state->data = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
return it_state;
|
|
|
|
}
|
|
|
|
|
2012-08-07 03:20:30 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_action_left_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *o EINA_UNUSED,
|
|
|
|
const char *sig EINA_UNUSED,
|
|
|
|
const char *src EINA_UNUSED)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it, *it2;
|
2012-08-07 03:20:30 -07:00
|
|
|
Eina_Bool done = EINA_FALSE;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
|
|
|
if (it->selected)
|
|
|
|
{
|
|
|
|
Eina_Bool found = EINA_FALSE;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
EINA_INLIST_REVERSE_FOREACH(sd->items, it2)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
if (elm_object_item_disabled_get(EO_OBJ(it2)))
|
2012-08-07 03:20:30 -07:00
|
|
|
continue;
|
|
|
|
if (it2 == it)
|
|
|
|
{
|
|
|
|
found = EINA_TRUE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!found) continue;
|
|
|
|
if (it2->separator) continue;
|
|
|
|
_item_unselect(it);
|
|
|
|
_item_select(it2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
done = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!done)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
if (elm_object_item_disabled_get(EO_OBJ(it))) continue;
|
2012-08-07 03:20:30 -07:00
|
|
|
if (it->separator) continue;
|
|
|
|
_item_select(it);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_action_right_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *o EINA_UNUSED,
|
|
|
|
const char *sig EINA_UNUSED,
|
|
|
|
const char *src EINA_UNUSED)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it, *it2;
|
2012-08-07 03:20:30 -07:00
|
|
|
Eina_Bool done = EINA_FALSE;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
|
|
|
if (it->selected)
|
|
|
|
{
|
|
|
|
Eina_Bool found = EINA_FALSE;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it2)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
if (elm_object_item_disabled_get(EO_OBJ(it2)))
|
2012-08-07 03:20:30 -07:00
|
|
|
continue;
|
|
|
|
if (it2 == it)
|
|
|
|
{
|
|
|
|
found = EINA_TRUE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!found) continue;
|
|
|
|
if (it2->separator) continue;
|
|
|
|
_item_unselect(it);
|
|
|
|
_item_select(it2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
done = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!done)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_REVERSE_FOREACH(sd->items, it)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
if (elm_object_item_disabled_get(EO_OBJ(it))) continue;
|
2012-08-07 03:20:30 -07:00
|
|
|
if (it->separator) continue;
|
|
|
|
_item_select(it);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_action_up_cb(void *data,
|
|
|
|
Evas_Object *o,
|
|
|
|
const char *sig,
|
|
|
|
const char *src)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
|
|
|
_elm_toolbar_action_left_cb(data, o, sig, src);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_action_down_cb(void *data,
|
|
|
|
Evas_Object *o,
|
|
|
|
const char *sig,
|
|
|
|
const char *src)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
|
|
|
_elm_toolbar_action_right_cb(data, o, sig, src);
|
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_toolbar_efl_canvas_group_group_add(Eo *obj, Elm_Toolbar_Data *priv)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2013-02-16 05:39:59 -08:00
|
|
|
Evas_Object *edje;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 22:19:19 -07:00
|
|
|
|
2013-02-16 05:39:59 -08:00
|
|
|
edje = edje_object_add(evas_object_evas_get(obj));
|
2017-08-08 05:06:43 -07:00
|
|
|
elm_widget_resize_object_set(obj, edje);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
elm_widget_theme_object_set
|
2013-02-16 05:39:59 -08:00
|
|
|
(obj, edje, "toolbar", "base", elm_widget_style_get(obj));
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
priv->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_smart_member_add(priv->hit_rect, obj);
|
|
|
|
elm_widget_sub_object_add(obj, priv->hit_rect);
|
|
|
|
|
|
|
|
/* common scroller hit rectangle setup */
|
|
|
|
evas_object_color_set(priv->hit_rect, 0, 0, 0, 0);
|
|
|
|
evas_object_show(priv->hit_rect);
|
|
|
|
evas_object_repeat_events_set(priv->hit_rect, EINA_TRUE);
|
|
|
|
|
2012-03-28 23:41:23 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_objects_set(obj, edje, priv->hit_rect);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
priv->standard_priority = -99999;
|
2017-08-09 21:54:05 -07:00
|
|
|
priv->dir = EFL_UI_DIR_HORIZONTAL;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set
|
|
|
|
(obj, _elm_config->thumbscroll_bounce_enable, EINA_FALSE);
|
|
|
|
elm_interface_scrollable_policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
|
|
|
|
elm_interface_scrollable_scroll_cb_set(obj, _scroll_cb);
|
|
|
|
elm_interface_scrollable_animate_start_cb_set(obj, _scroll_anim_start_cb);
|
|
|
|
elm_interface_scrollable_animate_stop_cb_set(obj, _scroll_anim_stop_cb);
|
|
|
|
elm_interface_scrollable_drag_start_cb_set(obj, _scroll_drag_start_cb);
|
|
|
|
elm_interface_scrollable_drag_stop_cb_set(obj, _scroll_drag_stop_cb);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
edje_object_signal_callback_add
|
2013-02-16 05:39:59 -08:00
|
|
|
(edje, "elm,action,left", "elm", _elm_toolbar_action_left_cb, obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
edje_object_signal_callback_add
|
2013-02-16 05:39:59 -08:00
|
|
|
(edje, "elm,action,right", "elm", _elm_toolbar_action_right_cb, obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
edje_object_signal_callback_add
|
2013-02-16 05:39:59 -08:00
|
|
|
(edje, "elm,action,up", "elm", _elm_toolbar_action_up_cb, obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
edje_object_signal_callback_add
|
2013-02-16 05:39:59 -08:00
|
|
|
(edje, "elm,action,down", "elm", _elm_toolbar_action_down_cb, obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
priv->shrink_mode = ELM_TOOLBAR_SHRINK_NONE;
|
2014-03-27 01:15:16 -07:00
|
|
|
priv->theme_icon_size = _internal_elm_toolbar_icon_size_get(obj);
|
2013-03-19 19:57:22 -07:00
|
|
|
priv->icon_size = priv->theme_icon_size;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
priv->homogeneous = EINA_TRUE;
|
|
|
|
priv->align = 0.5;
|
|
|
|
|
|
|
|
priv->bx = evas_object_box_add(evas_object_evas_get(obj));
|
2014-11-12 07:14:57 -08:00
|
|
|
evas_object_box_align_set(priv->bx, priv->align, 0.5);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_box_layout_set(priv->bx, _layout, obj, NULL);
|
|
|
|
elm_widget_sub_object_add(obj, priv->bx);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_set(obj, priv->bx);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_show(priv->bx);
|
|
|
|
|
|
|
|
priv->more = elm_layout_add(obj);
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set(priv->more, "toolbar", "more", "default"))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(priv->dir, EINA_TRUE))
|
2014-03-24 23:55:53 -07:00
|
|
|
elm_object_signal_emit(priv->more, "elm,orient,vertical", "elm");
|
2013-05-10 00:53:34 -07:00
|
|
|
else
|
2014-03-24 23:55:53 -07:00
|
|
|
elm_object_signal_emit(priv->more, "elm,orient,horizontal", "elm");
|
2013-03-01 18:04:31 -08:00
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_access_type_set(priv->more, EFL_ACCESS_TYPE_DISABLED);
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_widget_sub_object_add(obj, priv->more);
|
|
|
|
evas_object_show(priv->more);
|
|
|
|
|
|
|
|
priv->bx_more = evas_object_box_add(evas_object_evas_get(obj));
|
2014-11-12 07:14:57 -08:00
|
|
|
evas_object_box_align_set(priv->bx_more, priv->align, 0.5);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_box_layout_set(priv->bx_more, _layout, obj, NULL);
|
|
|
|
elm_widget_sub_object_add(obj, priv->bx_more);
|
|
|
|
elm_layout_content_set
|
|
|
|
(priv->more, "elm.swallow.content", priv->bx_more);
|
|
|
|
evas_object_show(priv->bx_more);
|
|
|
|
|
|
|
|
priv->bx_more2 = evas_object_box_add(evas_object_evas_get(obj));
|
2014-11-12 07:14:57 -08:00
|
|
|
evas_object_box_align_set(priv->bx_more2, priv->align, 0.5);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_box_layout_set(priv->bx_more2, _layout, obj, NULL);
|
|
|
|
elm_widget_sub_object_add(obj, priv->bx_more2);
|
|
|
|
elm_layout_content_set
|
|
|
|
(priv->more, "elm.swallow.content2", priv->bx_more2);
|
|
|
|
evas_object_show(priv->bx_more2);
|
2012-05-21 22:18:12 -07:00
|
|
|
|
2012-01-05 22:42:10 -08:00
|
|
|
elm_toolbar_shrink_mode_set(obj, _elm_config->toolbar_shrink_mode);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move_cb, obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(priv->bx, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2014-03-23 08:22:32 -07:00
|
|
|
_elm_toolbar_highlight_in_theme(obj);
|
2008-12-18 05:38:58 -08:00
|
|
|
_sizing_eval(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_toolbar_efl_canvas_group_group_del(Eo *obj, Elm_Toolbar_Data *sd)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it, *next;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-12-08 10:17:04 -08:00
|
|
|
sd->delete_me = EINA_TRUE;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->resize_job);
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->resize_job = NULL;
|
|
|
|
|
|
|
|
it = ELM_TOOLBAR_ITEM_FROM_INLIST(sd->items);
|
|
|
|
while (it)
|
|
|
|
{
|
|
|
|
next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
2018-02-14 18:14:52 -08:00
|
|
|
efl_del(EO_OBJ(it));
|
2012-08-30 09:45:00 -07:00
|
|
|
it = next;
|
|
|
|
}
|
2018-02-14 18:14:52 -08:00
|
|
|
if (sd->more_item) efl_del(EO_OBJ(sd->more_item));
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(sd->long_timer);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_toolbar_efl_gfx_entity_position_set(Eo *obj, Elm_Toolbar_Data *sd, Eina_Position2D pos)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2017-09-14 20:14:32 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y))
|
2016-10-10 20:39:05 -07:00
|
|
|
return;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
|
|
|
|
efl_gfx_entity_position_set(sd->hit_rect, pos);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_toolbar_efl_gfx_entity_size_set(Eo *obj, Elm_Toolbar_Data *sd, Eina_Size2D sz)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2017-09-15 02:37:25 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, sz.w, sz.h))
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
return;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
|
|
|
|
efl_gfx_entity_size_set(sd->hit_rect, sz);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_toolbar_efl_canvas_group_group_member_add(Eo *obj, Elm_Toolbar_Data *sd, Evas_Object *member)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
if (sd->hit_rect)
|
|
|
|
evas_object_raise(sd->hit_rect);
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static Eina_Bool _elm_toolbar_smart_focus_next_enable = EINA_FALSE;
|
|
|
|
|
2012-11-08 01:20:37 -08:00
|
|
|
static void
|
2014-03-27 01:15:16 -07:00
|
|
|
_access_obj_process(Elm_Toolbar_Data * sd, Eina_Bool is_access)
|
2012-11-08 01:20:37 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2012-11-08 01:20:37 -08:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH (sd->items, it)
|
|
|
|
{
|
|
|
|
if (is_access) _access_widget_item_register(it);
|
2014-09-27 22:15:56 -07:00
|
|
|
else _elm_access_widget_item_unregister(it->base);
|
2012-11-08 01:20:37 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_toolbar_efl_ui_widget_on_access_update(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, Eina_Bool acs)
|
2012-08-30 09:45:00 -07:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
_elm_toolbar_smart_focus_next_enable = acs;
|
2012-11-25 22:32:53 -08:00
|
|
|
_access_obj_process(sd, _elm_toolbar_smart_focus_next_enable);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
static Eina_Rect
|
2017-08-28 23:59:40 -07:00
|
|
|
_elm_toolbar_coordinates_adjust(Elm_Toolbar_Item_Data *it)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
|
|
|
Evas_Coord ix, iy, iw, ih, vx, vy, vw, vh;
|
2017-09-13 19:59:44 -07:00
|
|
|
Eina_Rect r;
|
2014-03-23 08:22:32 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(sd->hit_rect, &vx, &vy, &vw, &vh);
|
|
|
|
evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
|
2017-09-13 19:59:44 -07:00
|
|
|
r = EINA_RECT(ix, iy, iw, ih);
|
2017-08-28 23:59:40 -07:00
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
|
|
|
//TODO: Enhance it later.
|
|
|
|
if ((ix < vx) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh))
|
2017-08-28 23:59:40 -07:00
|
|
|
r.y = iy - ih;
|
2014-03-23 08:22:32 -07:00
|
|
|
else if (iy < vy)
|
2017-08-28 23:59:40 -07:00
|
|
|
r.y = iy + ih;
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//TODO: Enhance it later.
|
|
|
|
if ((iy < vy) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh))
|
2017-08-28 23:59:40 -07:00
|
|
|
r.x = ix - iw;
|
2014-03-23 08:22:32 -07:00
|
|
|
else if (ix < vx)
|
2017-08-28 23:59:40 -07:00
|
|
|
r.x = ix + iw;
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
2017-08-28 23:59:40 -07:00
|
|
|
|
|
|
|
return r;
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
|
2016-12-21 15:28:24 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_efl_ui_focus_object_focus_set(Eo *obj, Elm_Toolbar_Item_Data *pd EINA_UNUSED, Eina_Bool focus)
|
|
|
|
{
|
|
|
|
efl_ui_focus_object_focus_set(efl_super(obj, ELM_TOOLBAR_ITEM_CLASS), focus);
|
|
|
|
elm_wdg_item_focus_set(obj, focus);
|
|
|
|
}
|
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
EOLIAN static Eina_Rect
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_efl_ui_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Toolbar_Data *sd)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
2017-09-13 19:59:44 -07:00
|
|
|
Eina_Rect r = {};
|
2017-08-28 23:59:40 -07:00
|
|
|
|
2014-05-06 22:13:19 -07:00
|
|
|
if (sd->focused_item)
|
2014-05-06 22:08:04 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(sd->focused_item, focus_it);
|
2017-08-28 23:59:40 -07:00
|
|
|
r = _elm_toolbar_coordinates_adjust(focus_it);
|
|
|
|
elm_widget_focus_highlight_focus_part_geometry_get(VIEW(focus_it), &r.x, &r.y, &r.w, &r.h);
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
2014-07-03 19:55:21 -07:00
|
|
|
else
|
2017-08-28 23:59:40 -07:00
|
|
|
evas_object_geometry_get(obj, &r.x, &r.y, &r.w, &r.h);
|
|
|
|
|
|
|
|
return r;
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_toolbar_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-11-06 21:00:43 -08:00
|
|
|
return elm_legacy_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2016-12-21 15:28:24 -08:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_toolbar_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Toolbar_Data *pd EINA_UNUSED, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect EINA_UNUSED)
|
2016-12-21 15:28:24 -08:00
|
|
|
{
|
2017-09-02 10:08:18 -07:00
|
|
|
configured_state->logical = EINA_TRUE;
|
2017-10-23 22:03:46 -07:00
|
|
|
return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj);
|
2016-12-21 15:28:24 -08:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_toolbar_efl_object_constructor(Eo *obj, Elm_Toolbar_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2018-09-21 10:06:04 -07:00
|
|
|
legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
|
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);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_TOOL_BAR);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
2017-10-15 10:44:35 -07:00
|
|
|
efl_ui_focus_composition_custom_manager_set(obj, obj);
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
return obj;
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_icon_size_set(Eo *obj, Elm_Toolbar_Data *sd, int icon_size)
|
2009-08-25 17:30:55 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->priv_icon_size == icon_size) return;
|
|
|
|
sd->priv_icon_size = icon_size;
|
|
|
|
|
|
|
|
if (sd->priv_icon_size) sd->icon_size = sd->priv_icon_size;
|
|
|
|
else sd->icon_size = sd->theme_icon_size;
|
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2009-08-25 17:30:55 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_icon_size_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
return sd->priv_icon_size;
|
2009-08-25 17:47:31 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_toolbar_item_append(Eo *obj, Elm_Toolbar_Data *sd, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2012-08-30 09:45:00 -07:00
|
|
|
double scale;
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
Eina_List *prev_list;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
it = _item_new(obj, icon, label, func, data);
|
2014-03-27 01:15:16 -07:00
|
|
|
if (!it) return NULL;
|
2018-04-05 01:47:26 -07:00
|
|
|
scale = (efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
prev_list = evas_object_box_children_get(sd->bx);
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_append(sd->items, EINA_INLIST_GET(it));
|
|
|
|
evas_object_box_append(sd->bx, VIEW(it));
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_show(VIEW(it));
|
2011-09-28 22:07:50 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_theme_hook(obj, it, scale, sd->icon_size);
|
|
|
|
sd->item_count++;
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
_elm_toolbar_item_order_signal_emit(sd, it, prev_list, EINA_FALSE);
|
|
|
|
eina_list_free(prev_list);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_toolbar_item_prepend(Eo *obj, Elm_Toolbar_Data *sd, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2012-08-30 09:45:00 -07:00
|
|
|
double scale;
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
Eina_List *prev_list;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
it = _item_new(obj, icon, label, func, data);
|
2014-03-27 01:15:16 -07:00
|
|
|
if (!it) return NULL;
|
2018-04-05 01:47:26 -07:00
|
|
|
scale = (efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2011-11-29 21:10:23 -08:00
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
prev_list = evas_object_box_children_get(sd->bx);
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(it));
|
|
|
|
evas_object_box_prepend(sd->bx, VIEW(it));
|
2011-11-29 21:10:23 -08:00
|
|
|
evas_object_show(VIEW(it));
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_theme_hook(obj, it, scale, sd->icon_size);
|
|
|
|
sd->item_count++;
|
2011-11-29 21:10:23 -08:00
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
_elm_toolbar_item_order_signal_emit(sd, it, prev_list, EINA_FALSE);
|
|
|
|
eina_list_free(prev_list);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
return EO_OBJ(it);
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_toolbar_item_insert_before(Eo *obj, Elm_Toolbar_Data *sd, Elm_Object_Item *eo_before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
2010-10-29 11:57:55 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2012-08-30 09:45:00 -07:00
|
|
|
double scale;
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
Eina_List *prev_list;
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2015-04-20 22:30:41 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL);
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(eo_before, _before);
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(_before, NULL);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
it = _item_new(obj, icon, label, func, data);
|
2014-03-27 01:15:16 -07:00
|
|
|
if (!it) return NULL;
|
2018-04-05 01:47:26 -07:00
|
|
|
scale = (efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2010-10-29 11:57:55 -07:00
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
prev_list = evas_object_box_children_get(sd->bx);
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_prepend_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(_before));
|
|
|
|
evas_object_box_insert_before(sd->bx, VIEW(it), VIEW(_before));
|
|
|
|
_item_theme_hook(obj, it, scale, sd->icon_size);
|
|
|
|
sd->item_count++;
|
2011-11-29 21:10:23 -08:00
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
_elm_toolbar_item_order_signal_emit(sd, it, prev_list, EINA_FALSE);
|
|
|
|
eina_list_free(prev_list);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:56 -07:00
|
|
|
_elm_toolbar_item_insert_after(Eo *obj, Elm_Toolbar_Data *sd, Elm_Object_Item *eo_after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2012-08-30 09:45:00 -07:00
|
|
|
double scale;
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
Eina_List *prev_list;
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2015-04-20 22:30:41 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL);
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_DATA_GET(eo_after, _after);
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(_after, NULL);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
it = _item_new(obj, icon, label, func, data);
|
2014-03-27 01:15:16 -07:00
|
|
|
if (!it) return NULL;
|
2018-04-05 01:47:26 -07:00
|
|
|
scale = (efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2010-10-29 11:57:55 -07:00
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
prev_list = evas_object_box_children_get(sd->bx);
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_append_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(_after));
|
|
|
|
evas_object_box_insert_after(sd->bx, VIEW(it), VIEW(_after));
|
|
|
|
_item_theme_hook(obj, it, scale, sd->icon_size);
|
|
|
|
sd->item_count++;
|
2011-11-29 21:10:23 -08:00
|
|
|
|
Elementary Toolbar: Send order signals when a item is added/removed
Summary:
Send order signals for changing item's state according to its order.
It does not affect to existing themes. It sends the following signals.
elm,order,first,item
elm,order,default,item
elm,order,last,item
@feature
Test Plan: N/A
Reviewers: woohyun, jaehwan, eagleeye, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3883
2016-04-14 23:10:49 -07:00
|
|
|
_elm_toolbar_item_order_signal_emit(sd, it, prev_list, EINA_FALSE);
|
|
|
|
eina_list_free(prev_list);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
return EO_OBJ(it);
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_first_item_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2010-10-29 11:57:55 -07:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
if (!sd->items) return NULL;
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = ELM_TOOLBAR_ITEM_FROM_INLIST(sd->items);
|
|
|
|
if (it) return EO_OBJ(it);
|
|
|
|
return NULL;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_last_item_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
if (!sd->items) return NULL;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it = ELM_TOOLBAR_ITEM_FROM_INLIST(sd->items->last);
|
|
|
|
if (it) return EO_OBJ(it);
|
|
|
|
return NULL;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2016-11-29 23:18:46 -08:00
|
|
|
EOLIAN static Eina_Iterator*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_items_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2016-11-29 23:18:46 -08:00
|
|
|
{
|
2016-11-30 05:03:59 -08:00
|
|
|
return eina_inlist_iterator_new(sd->items);
|
2016-11-29 23:18:46 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_next_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *it)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *ret_it = ELM_TOOLBAR_ITEM_FROM_INLIST(
|
|
|
|
EINA_INLIST_GET(it)->next);
|
|
|
|
if (ret_it) return EO_OBJ(ret_it);
|
|
|
|
else return NULL;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_prev_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *it)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *ret_it = ELM_TOOLBAR_ITEM_FROM_INLIST(
|
|
|
|
EINA_INLIST_GET(it)->prev);
|
|
|
|
if (ret_it) return EO_OBJ(ret_it);
|
|
|
|
else return NULL;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_priority_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item, int priority)
|
|
|
|
{
|
2011-04-01 04:20:18 -07:00
|
|
|
if (item->prio.priority == priority) return;
|
|
|
|
item->prio.priority = priority;
|
2015-03-19 02:46:59 -07:00
|
|
|
_resizing_eval(WIDGET(item));
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_priority_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item)
|
2014-09-27 22:15:56 -07:00
|
|
|
{
|
|
|
|
return item->prio.priority;
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_toolbar_item_find_by_label(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, const char *label)
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2011-11-29 21:10:23 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
if (!strcmp(it->label, label)) return EO_OBJ(it);
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
2014-03-27 01:15:16 -07:00
|
|
|
|
|
|
|
return NULL;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
2018-04-16 11:02:59 -07:00
|
|
|
_elm_toolbar_item_selected_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item, Eina_Bool selected)
|
2014-09-27 22:15:56 -07:00
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
if (item->selected == selected) return;
|
|
|
|
if (selected) _item_select(item);
|
|
|
|
else _item_unselect(item);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_selected_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item)
|
2014-09-27 22:15:56 -07:00
|
|
|
{
|
|
|
|
return item->selected;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_selected_item_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
return sd->selected_item;
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_more_item_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
return EO_OBJ(sd->more_item);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_icon_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
|
|
|
const char *icon)
|
2010-10-29 11:40:59 -07:00
|
|
|
{
|
2011-09-30 00:33:09 -07:00
|
|
|
Evas_Object *obj;
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *icon_obj;
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item);
|
2010-10-29 11:40:59 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
obj = WIDGET(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2010-10-29 11:40:59 -07:00
|
|
|
if ((icon) && (item->icon_str) && (!strcmp(icon, item->icon_str))) return;
|
|
|
|
|
|
|
|
icon_obj = elm_icon_add(obj);
|
|
|
|
if (!icon_obj) return;
|
|
|
|
if (_item_icon_set(icon_obj, "toolbar/", icon))
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set
|
|
|
|
(obj, item, icon_obj, icon, sd->icon_size, "elm,state,icon_set");
|
2010-10-29 11:40:59 -07:00
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set
|
|
|
|
(obj, item, NULL, NULL, 0, "elm,state,icon_set");
|
2010-10-29 11:40:59 -07:00
|
|
|
evas_object_del(icon_obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_icon_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *it)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
return it->icon_str;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Evas_Object *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_object_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item)
|
2014-09-27 22:15:56 -07:00
|
|
|
{
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, NULL);
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
return VIEW(item);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Evas_Object *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_icon_object_get(const Eo *eo_it EINA_UNUSED, Elm_Toolbar_Item_Data *it)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
return it->icon;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_toolbar_item_icon_memfile_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
|
|
|
const void *img,
|
|
|
|
size_t size,
|
|
|
|
const char *format,
|
|
|
|
const char *key)
|
|
|
|
{
|
2011-09-28 16:07:18 -07:00
|
|
|
Evas_Object *icon_obj;
|
2011-09-30 00:33:09 -07:00
|
|
|
Evas_Object *obj;
|
2011-09-28 16:07:18 -07:00
|
|
|
Eina_Bool ret;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
|
2011-09-28 16:07:18 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
obj = WIDGET(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2011-09-28 16:07:18 -07:00
|
|
|
|
|
|
|
if (img && size)
|
|
|
|
{
|
2012-05-25 12:53:59 -07:00
|
|
|
icon_obj = elm_icon_add(obj);
|
2011-09-28 16:07:18 -07:00
|
|
|
evas_object_repeat_events_set(icon_obj, EINA_TRUE);
|
2012-05-28 14:50:11 -07:00
|
|
|
ret = elm_image_memfile_set(icon_obj, img, size, format, key);
|
2011-09-28 16:07:18 -07:00
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
evas_object_del(icon_obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set
|
|
|
|
(obj, item, icon_obj, NULL, sd->icon_size, "elm,state,icon_set");
|
2011-12-01 11:14:48 -08:00
|
|
|
}
|
|
|
|
else
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set
|
|
|
|
(obj, item, NULL, NULL, 0, "elm,state,icon_set");
|
2011-12-01 11:14:48 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_toolbar_item_icon_file_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
|
|
|
const char *file,
|
|
|
|
const char *key)
|
|
|
|
{
|
2011-12-01 11:14:48 -08:00
|
|
|
Evas_Object *icon_obj;
|
|
|
|
Evas_Object *obj;
|
|
|
|
Eina_Bool ret;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
|
2011-12-01 11:14:48 -08:00
|
|
|
|
|
|
|
obj = WIDGET(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2011-12-01 11:14:48 -08:00
|
|
|
|
|
|
|
if (file)
|
|
|
|
{
|
2012-05-25 12:53:59 -07:00
|
|
|
icon_obj = elm_icon_add(obj);
|
2011-12-01 11:14:48 -08:00
|
|
|
evas_object_repeat_events_set(icon_obj, EINA_TRUE);
|
2012-05-28 14:50:11 -07:00
|
|
|
ret = elm_image_file_set(icon_obj, file, key);
|
2011-12-01 11:14:48 -08:00
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
evas_object_del(icon_obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set
|
|
|
|
(obj, item, icon_obj, NULL, sd->icon_size, "elm,state,icon_set");
|
2011-09-28 16:07:18 -07:00
|
|
|
}
|
|
|
|
else
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set
|
|
|
|
(obj, item, NULL, NULL, 0, "elm,state,icon_set");
|
2011-09-28 16:07:18 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_separator_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
|
|
|
Eina_Bool separator)
|
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj = WIDGET(item);
|
2011-08-04 02:39:25 -07:00
|
|
|
double scale;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
2009-08-30 09:54:15 -07:00
|
|
|
if (item->separator == separator) return;
|
|
|
|
item->separator = separator;
|
2018-04-05 01:47:26 -07:00
|
|
|
scale = (efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_theme_hook(obj, item, scale, sd->icon_size);
|
2012-06-25 01:33:15 -07:00
|
|
|
evas_object_size_hint_min_set(VIEW(item), -1, -1);
|
2012-11-13 21:55:43 -08:00
|
|
|
if (separator) sd->separator_count++;
|
|
|
|
else sd->separator_count--;
|
2009-08-30 09:54:15 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_separator_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *it)
|
2009-08-30 09:54:15 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
return it->separator;
|
2009-08-30 09:54:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *sd, Elm_Toolbar_Shrink_Mode shrink_mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-01-03 16:31:29 -08:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2010-10-21 12:57:43 -07:00
|
|
|
Eina_Bool bounce;
|
2009-08-25 15:46:19 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->shrink_mode == shrink_mode) return;
|
|
|
|
sd->shrink_mode = shrink_mode;
|
2010-10-22 14:41:22 -07:00
|
|
|
bounce = (_elm_config->thumbscroll_bounce_enable) &&
|
2012-08-30 09:45:00 -07:00
|
|
|
(shrink_mode == ELM_TOOLBAR_SHRINK_SCROLL);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(obj, bounce, EINA_FALSE);
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
|
2018-05-07 16:48:10 -07:00
|
|
|
if (sd->more_item) efl_del(EO_OBJ(sd->more_item));
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
|
|
|
|
if (shrink_mode == ELM_TOOLBAR_SHRINK_MENU)
|
|
|
|
{
|
2012-08-06 05:17:02 -07:00
|
|
|
elm_toolbar_homogeneous_set(obj, EINA_FALSE);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
2016-05-14 03:20:41 -07:00
|
|
|
sd->more_item = _item_new(obj, "go-down", "More", NULL, NULL);
|
2015-10-19 17:06:38 -07:00
|
|
|
_resizing_eval_item(sd->more_item);
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
}
|
2010-10-26 03:30:45 -07:00
|
|
|
else if (shrink_mode == ELM_TOOLBAR_SHRINK_HIDE)
|
2012-08-06 05:17:02 -07:00
|
|
|
{
|
|
|
|
elm_toolbar_homogeneous_set(obj, EINA_FALSE);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
2012-08-06 05:17:02 -07:00
|
|
|
}
|
2012-05-21 22:18:12 -07:00
|
|
|
else if (shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
|
|
|
|
{
|
2012-08-06 05:17:02 -07:00
|
|
|
elm_toolbar_homogeneous_set(obj, EINA_FALSE);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
|
2016-05-14 03:20:41 -07:00
|
|
|
sd->more_item = _item_new(obj, "go-down", "More", NULL, NULL);
|
2015-10-19 17:06:38 -07:00
|
|
|
_resizing_eval_item(sd->more_item);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
2017-05-25 21:01:56 -07:00
|
|
|
else if (shrink_mode == ELM_TOOLBAR_SHRINK_SCROLL)
|
|
|
|
{
|
|
|
|
elm_toolbar_homogeneous_set(obj, EINA_FALSE);
|
|
|
|
elm_interface_scrollable_policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
|
|
|
|
}
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
else
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2016-01-03 16:31:29 -08:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
_item_shrink_signal_emit(VIEW(it), sd->shrink_mode);
|
|
|
|
|
2015-10-15 16:33:15 -07:00
|
|
|
evas_object_smart_need_recalculate_set(obj, EINA_TRUE);
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
2009-09-30 03:53:08 -07:00
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Toolbar_Shrink_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_shrink_mode_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2010-04-26 22:43:54 -07:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
return sd->shrink_mode;
|
2010-04-26 22:43:54 -07:00
|
|
|
}
|
|
|
|
|
2012-09-26 20:05:50 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_transverse_expanded_set(Evas_Object *obj, Eina_Bool transverse_expanded)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->transverse_expanded == transverse_expanded) return;
|
|
|
|
sd->transverse_expanded = transverse_expanded;
|
|
|
|
|
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_transverse_expanded_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_CHECK(obj) EINA_FALSE;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
return sd->transverse_expanded;
|
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_homogeneous_set(Eo *obj, Elm_Toolbar_Data *sd, Eina_Bool homogeneous)
|
2009-09-30 03:53:08 -07:00
|
|
|
{
|
2012-08-06 05:17:02 -07:00
|
|
|
homogeneous = !!homogeneous;
|
2012-08-30 09:45:00 -07:00
|
|
|
if (homogeneous == sd->homogeneous) return;
|
|
|
|
sd->homogeneous = homogeneous;
|
2012-08-06 05:17:02 -07:00
|
|
|
if (homogeneous) elm_toolbar_shrink_mode_set(obj, ELM_TOOLBAR_SHRINK_NONE);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_smart_calculate(sd->bx);
|
2009-09-30 03:53:08 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_homogeneous_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2009-10-06 08:08:41 -07:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
return sd->homogeneous;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_menu_parent_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, Evas_Object *parent)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2009-10-07 10:11:41 -07:00
|
|
|
|
2010-12-03 06:08:33 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(parent);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
sd->menu_parent = parent;
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2009-10-18 10:20:18 -07:00
|
|
|
{
|
2009-10-11 06:37:01 -07:00
|
|
|
if (it->o_menu)
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_menu_parent_set(it->o_menu, sd->menu_parent);
|
2009-10-18 10:20:18 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
if ((sd->more_item) && (sd->more_item->o_menu))
|
|
|
|
elm_menu_parent_set(sd->more_item->o_menu, sd->menu_parent);
|
2009-10-06 08:08:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_menu_parent_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2010-04-26 22:43:54 -07:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
return sd->menu_parent;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_align_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, double align)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2012-02-22 04:13:12 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->align != align)
|
2014-11-12 07:14:57 -08:00
|
|
|
evas_object_box_align_set(sd->bx, 0.5, align);
|
2012-02-22 04:13:12 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->align != align)
|
2014-11-12 07:14:57 -08:00
|
|
|
evas_object_box_align_set(sd->bx, align, 0.5);
|
2012-02-22 04:13:12 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->align = align;
|
2009-10-06 13:14:46 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static double
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_align_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
return sd->align;
|
2010-03-30 13:42:01 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_menu_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
|
|
|
Eina_Bool menu)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
2009-10-18 10:20:18 -07:00
|
|
|
|
2009-10-06 08:08:41 -07:00
|
|
|
if (item->menu == menu) return;
|
2012-08-30 09:45:00 -07:00
|
|
|
if (menu) _item_menu_create(sd, item);
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
else _item_menu_destroy(item);
|
2009-10-06 08:08:41 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Evas_Object *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_menu_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item)
|
2014-09-27 22:15:56 -07:00
|
|
|
{
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, NULL);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
if (!item->menu) return NULL;
|
|
|
|
return item->o_menu;
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Elm_Toolbar_Item_State *
|
2014-09-14 04:51:26 -07:00
|
|
|
_elm_toolbar_item_state_add(Eo *eo_item, Elm_Toolbar_Item_Data *item,
|
2014-09-27 22:15:56 -07:00
|
|
|
const char *icon,
|
|
|
|
const char *label,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *data)
|
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Toolbar_Item_State *it_state;
|
|
|
|
Evas_Object *icon_obj;
|
|
|
|
Evas_Object *obj;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, NULL);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
obj = WIDGET(item);
|
|
|
|
|
|
|
|
if (!item->states)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
it_state = _item_state_new
|
|
|
|
(item->label, item->icon_str, item->icon, item->func,
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_GET(EO_OBJ(item)));
|
2011-11-29 21:10:23 -08:00
|
|
|
item->states = eina_list_append(item->states, it_state);
|
|
|
|
item->current_state = item->states;
|
|
|
|
}
|
|
|
|
|
|
|
|
icon_obj = elm_icon_add(obj);
|
|
|
|
if (!icon_obj) goto error_state_add;
|
|
|
|
|
|
|
|
if (!_item_icon_set(icon_obj, "toolbar/", icon))
|
|
|
|
{
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(icon_obj, evas_object_del);
|
2011-11-29 21:10:23 -08:00
|
|
|
icon = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
it_state = _item_state_new(label, icon, icon_obj, func, data);
|
|
|
|
item->states = eina_list_append(item->states, it_state);
|
|
|
|
item->func = _elm_toolbar_item_state_cb;
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(eo_item, NULL);
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
return it_state;
|
|
|
|
|
|
|
|
error_state_add:
|
|
|
|
if (item->states && !eina_list_next(item->states))
|
|
|
|
{
|
|
|
|
eina_stringshare_del(item->label);
|
|
|
|
eina_stringshare_del(item->icon_str);
|
|
|
|
free(eina_list_data_get(item->states));
|
2013-04-10 04:28:22 -07:00
|
|
|
item->states = eina_list_free(item->states);
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
return NULL;
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-09-14 04:51:26 -07:00
|
|
|
_elm_toolbar_item_state_del(Eo *eo_item, Elm_Toolbar_Item_Data *item,
|
2014-09-27 22:15:56 -07:00
|
|
|
Elm_Toolbar_Item_State *state)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Toolbar_Item_State *it_state;
|
2012-08-30 09:45:00 -07:00
|
|
|
Eina_List *del_state;
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
if (!state) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (!item->states) return EINA_FALSE;
|
|
|
|
|
|
|
|
del_state = eina_list_data_find_list(item->states, state);
|
|
|
|
if (del_state == item->states) return EINA_FALSE;
|
|
|
|
if (del_state == item->current_state)
|
2014-09-27 22:15:56 -07:00
|
|
|
elm_toolbar_item_state_unset(EO_OBJ(item));
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
eina_stringshare_del(state->label);
|
|
|
|
eina_stringshare_del(state->icon_str);
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(state->icon);
|
2011-11-29 21:10:23 -08:00
|
|
|
free(state);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
item->states = eina_list_remove_list(item->states, del_state);
|
|
|
|
if (item->states && !eina_list_next(item->states))
|
|
|
|
{
|
|
|
|
it_state = eina_list_data_get(item->states);
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(eo_item, it_state->data);
|
2011-11-29 21:10:23 -08:00
|
|
|
item->func = it_state->func;
|
|
|
|
eina_stringshare_del(it_state->label);
|
|
|
|
eina_stringshare_del(it_state->icon_str);
|
|
|
|
free(eina_list_data_get(item->states));
|
2013-04-10 04:28:22 -07:00
|
|
|
item->states = eina_list_free(item->states);
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_toolbar_item_state_set(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
|
|
|
Elm_Toolbar_Item_State *state)
|
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Toolbar_Item_State *it_state;
|
2012-08-30 09:45:00 -07:00
|
|
|
Eina_List *next_state;
|
2011-11-29 21:10:23 -08:00
|
|
|
Evas_Object *obj;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
obj = WIDGET(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2011-11-29 21:10:23 -08:00
|
|
|
if (!item->states) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (state)
|
|
|
|
{
|
|
|
|
next_state = eina_list_data_find_list(item->states, state);
|
|
|
|
if (!next_state) return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
next_state = item->states;
|
|
|
|
|
|
|
|
if (next_state == item->current_state) return EINA_TRUE;
|
|
|
|
|
|
|
|
it_state = eina_list_data_get(next_state);
|
|
|
|
if (eina_list_data_find(item->current_state, state))
|
|
|
|
{
|
|
|
|
_item_label_set(item, it_state->label, "elm,state,label_set,forward");
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set
|
|
|
|
(obj, item, it_state->icon, it_state->icon_str,
|
|
|
|
sd->icon_size, "elm,state,icon_set,forward");
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_item_label_set(item, it_state->label, "elm,state,label_set,backward");
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set
|
|
|
|
(obj, item, it_state->icon, it_state->icon_str,
|
|
|
|
sd->icon_size, "elm,state,icon_set,backward");
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
2014-01-14 04:32:28 -08:00
|
|
|
if (item->icon)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(item)))
|
2014-01-14 04:32:28 -08:00
|
|
|
elm_widget_signal_emit(item->icon, "elm,state,disabled", "elm");
|
|
|
|
else
|
|
|
|
elm_widget_signal_emit(item->icon, "elm,state,enabled", "elm");
|
|
|
|
}
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
item->current_state = next_state;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
return EINA_TRUE;
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2011-11-29 21:10:23 -08:00
|
|
|
elm_toolbar_item_state_unset(Elm_Object_Item *it)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_toolbar_item_state_set(it, NULL);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Elm_Toolbar_Item_State *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_item_state_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item)
|
2014-09-27 22:15:56 -07:00
|
|
|
{
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, NULL);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
if ((!item->states) || (!item->current_state)) return NULL;
|
|
|
|
if (item->current_state == item->states) return NULL;
|
|
|
|
|
|
|
|
return eina_list_data_get(item->current_state);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Elm_Toolbar_Item_State *
|
|
|
|
_elm_toolbar_item_state_next(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
|
|
|
Eina_List *next_state;
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, NULL);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
if (!item->states) return NULL;
|
|
|
|
|
|
|
|
next_state = eina_list_next(item->current_state);
|
|
|
|
if (!next_state)
|
|
|
|
next_state = eina_list_next(item->states);
|
|
|
|
return eina_list_data_get(next_state);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static Elm_Toolbar_Item_State *
|
|
|
|
_elm_toolbar_item_state_prev(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
|
|
|
Eina_List *prev_state;
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item, NULL);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
if (!item->states) return NULL;
|
|
|
|
|
|
|
|
prev_state = eina_list_prev(item->current_state);
|
2016-11-08 04:40:50 -08:00
|
|
|
if (!prev_state)
|
2011-11-29 21:10:23 -08:00
|
|
|
prev_state = eina_list_last(item->states);
|
|
|
|
return eina_list_data_get(prev_state);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
2010-04-12 01:12:02 -07:00
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
2017-08-09 21:54:05 -07:00
|
|
|
_elm_toolbar_efl_ui_direction_direction_set(Eo *obj, Elm_Toolbar_Data *sd, Efl_Ui_Dir dir)
|
2011-08-06 20:42:28 -07:00
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
// Adjust direction to be either horizontal or vertical.
|
|
|
|
if (efl_ui_dir_is_horizontal(dir, EINA_TRUE))
|
|
|
|
dir = EFL_UI_DIR_HORIZONTAL;
|
|
|
|
else
|
|
|
|
dir = EFL_UI_DIR_VERTICAL;
|
2016-05-05 22:53:17 -07:00
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
sd->dir = dir;
|
2016-05-05 22:53:17 -07:00
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
|
2014-11-12 07:14:57 -08:00
|
|
|
evas_object_box_align_set(sd->bx, 0.5, sd->align);
|
2012-02-22 04:13:12 -08:00
|
|
|
else
|
2014-11-12 07:14:57 -08:00
|
|
|
evas_object_box_align_set(sd->bx, sd->align, 0.5);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-08-06 20:42:28 -07:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
EOLIAN static Efl_Ui_Dir
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_efl_ui_direction_direction_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2011-08-06 20:42:28 -07:00
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
return sd->dir;
|
2016-05-05 22:53:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
|
|
|
{
|
2017-08-09 21:54:05 -07:00
|
|
|
Efl_Ui_Dir dir;
|
2016-05-05 22:53:17 -07:00
|
|
|
|
|
|
|
if (horizontal)
|
2017-08-09 21:54:05 -07:00
|
|
|
dir = EFL_UI_DIR_HORIZONTAL;
|
2016-05-05 22:53:17 -07:00
|
|
|
else
|
2017-08-09 21:54:05 -07:00
|
|
|
dir = EFL_UI_DIR_VERTICAL;
|
2016-05-05 22:53:17 -07:00
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
efl_ui_direction_set(obj, dir);
|
2016-05-05 22:53:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_horizontal_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
|
|
|
|
|
2017-08-09 21:54:05 -07:00
|
|
|
return efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static unsigned int
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_toolbar_items_count(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
return sd->item_count;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_standard_priority_set(Eo *obj, Elm_Toolbar_Data *sd, int priority)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->standard_priority == priority) return;
|
|
|
|
sd->standard_priority = priority;
|
2015-03-19 02:46:59 -07:00
|
|
|
_resizing_eval(obj);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_standard_priority_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
return sd->standard_priority;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_select_mode_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, Elm_Object_Select_Mode mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-03-07 05:23:22 -08:00
|
|
|
if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
|
|
|
|
return;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
if (sd->select_mode == mode) return;
|
2015-09-23 00:20:45 -07:00
|
|
|
sd->select_mode = mode;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-03-07 08:01:37 -08:00
|
|
|
if ((mode == ELM_OBJECT_SELECT_MODE_ALWAYS) &&
|
2012-08-30 09:45:00 -07:00
|
|
|
(sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) &&
|
|
|
|
sd->items)
|
|
|
|
_item_select(ELM_TOOLBAR_ITEM_FROM_INLIST(sd->items));
|
|
|
|
|
2012-03-07 05:23:22 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Select_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_select_mode_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2012-03-07 05:23:22 -08:00
|
|
|
{
|
2014-03-27 01:15:16 -07:00
|
|
|
return sd->select_mode;
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
2012-09-18 22:23:22 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_reorder_mode_set(Evas_Object *obj,
|
|
|
|
Eina_Bool reorder_mode)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
sd->reorder_mode = !!reorder_mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_reorder_mode_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_CHECK(obj) EINA_FALSE;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
return sd->reorder_mode;
|
|
|
|
}
|
2012-11-11 23:29:17 -08:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_show(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
|
|
|
Elm_Toolbar_Item_Scrollto_Type type)
|
2012-11-11 23:29:17 -08:00
|
|
|
{
|
2012-11-15 02:27:46 -08:00
|
|
|
Evas_Coord x, y, w, h;
|
2012-11-11 23:29:17 -08:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item);
|
2012-11-11 23:29:17 -08:00
|
|
|
|
2013-04-16 05:06:11 -07:00
|
|
|
if (_elm_toolbar_item_coordinates_calc(item, type, &x, &y, &w, &h))
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show
|
|
|
|
(WIDGET(item), x, y, w, h);
|
2012-11-11 23:29:17 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_toolbar_item_bring_in(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *item,
|
|
|
|
Elm_Toolbar_Item_Scrollto_Type type)
|
2012-11-11 23:29:17 -08:00
|
|
|
{
|
2012-11-15 02:27:46 -08:00
|
|
|
Evas_Coord x, y, w, h;
|
2012-11-11 23:29:17 -08:00
|
|
|
|
2014-09-27 22:15:56 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(item);
|
2012-11-11 23:29:17 -08:00
|
|
|
|
2013-04-16 05:06:11 -07:00
|
|
|
if (_elm_toolbar_item_coordinates_calc(item, type, &x, &y, &w, &h))
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_region_bring_in
|
|
|
|
(WIDGET(item), x, y, w, h);
|
2012-11-11 23:29:17 -08:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2016-11-09 17:58:41 -08:00
|
|
|
EOLIAN static const char*
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_toolbar_item_efl_access_object_i18n_name_get(const Eo *eo_item, Elm_Toolbar_Item_Data *item)
|
2014-10-09 01:14:38 -07:00
|
|
|
{
|
2016-11-09 17:58:41 -08:00
|
|
|
const char *ret;
|
2018-04-03 04:27:30 -07:00
|
|
|
ret = efl_access_object_i18n_name_get(efl_super(eo_item, ELM_TOOLBAR_ITEM_CLASS));
|
2015-12-17 00:36:02 -08:00
|
|
|
if (ret) return ret;
|
2017-09-06 03:54:59 -07:00
|
|
|
return _elm_widget_item_accessible_plain_name_get(eo_item, item->label);
|
2014-10-09 01:14:38 -07:00
|
|
|
}
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
EOLIAN static Efl_Access_State_Set
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_toolbar_item_efl_access_object_state_set_get(const Eo *eo_it, Elm_Toolbar_Item_Data *item EINA_UNUSED)
|
2014-10-09 01:14:38 -07:00
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
Efl_Access_State_Set ret;
|
2014-10-09 01:14:38 -07:00
|
|
|
Eina_Bool sel;
|
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
ret = efl_access_object_state_set_get(efl_super(eo_it, ELM_TOOLBAR_ITEM_CLASS));
|
2014-10-09 01:14:38 -07:00
|
|
|
|
2018-04-16 11:02:59 -07:00
|
|
|
sel = elm_toolbar_item_selected_get(eo_it);
|
2014-10-09 01:14:38 -07:00
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_SELECTABLE);
|
2014-10-09 01:14:38 -07:00
|
|
|
|
|
|
|
if (sel)
|
2017-10-18 18:13:54 -07:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_SELECTED);
|
2014-10-09 01:14:38 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_efl_ui_widget_focused_item_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2014-03-23 08:22:32 -07:00
|
|
|
{
|
2014-05-26 06:06:23 -07:00
|
|
|
return sd->focused_item;
|
2014-03-23 08:22:32 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_toolbar_class_constructor(Efl_Class *klass)
|
2014-03-27 01:15:16 -07:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-11-15 18:55:06 -08:00
|
|
|
EOLIAN static const Efl_Access_Action_Data*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd EINA_UNUSED)
|
2014-07-25 01:33:19 -07:00
|
|
|
{
|
2017-11-15 18:55:06 -08:00
|
|
|
static Efl_Access_Action_Data atspi_actions[] = {
|
2014-07-25 01:33:19 -07:00
|
|
|
{ "select", "select", NULL, _key_action_select},
|
|
|
|
{ NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2014-10-09 01:14:38 -07:00
|
|
|
EOLIAN static Eina_List*
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_toolbar_efl_access_object_access_children_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
2014-10-09 01:14:38 -07:00
|
|
|
{
|
2015-12-01 07:55:12 -08:00
|
|
|
Eina_List *ret = NULL, *ret2 = NULL;
|
2014-10-09 01:14:38 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
2018-04-03 04:27:30 -07:00
|
|
|
ret2 = efl_access_object_access_children_get(efl_super(obj, ELM_TOOLBAR_CLASS));
|
2014-10-09 01:14:38 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
ret = eina_list_append(ret, EO_OBJ(it));
|
|
|
|
|
2015-12-01 07:55:12 -08:00
|
|
|
return eina_list_merge(ret, ret2);
|
2014-10-09 01:14:38 -07:00
|
|
|
}
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
EOLIAN static Efl_Access_State_Set
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_toolbar_efl_access_object_state_set_get(const Eo *obj, Elm_Toolbar_Data *sd EINA_UNUSED)
|
2014-10-09 01:14:38 -07:00
|
|
|
{
|
2018-04-03 04:27:30 -07:00
|
|
|
return efl_access_object_state_set_get(efl_super(obj, ELM_TOOLBAR_CLASS));
|
2014-10-09 01:14:38 -07:00
|
|
|
}
|
|
|
|
|
2015-05-26 07:28:35 -07:00
|
|
|
EOLIAN int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_efl_access_selection_selected_children_count_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
|
|
|
return pd->selected_item ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eo*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_toolbar_efl_access_selection_selected_child_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_idx)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
|
|
|
if (child_idx != 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return pd->selected_item;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_toolbar_efl_access_selection_child_select(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item_Data *item;
|
2016-08-05 00:17:13 -07:00
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
2016-08-05 00:17:13 -07:00
|
|
|
if (child_index-- == 0)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
2016-08-05 00:17:13 -07:00
|
|
|
elm_toolbar_item_selected_set(EO_OBJ(item), EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
2015-05-26 07:28:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_toolbar_efl_access_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
|
|
|
if (child_index != 0)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
if (!pd->selected_item)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
elm_toolbar_item_selected_set(pd->selected_item, EINA_FALSE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_toolbar_efl_access_selection_is_child_selected(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item_Data *item;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
return elm_toolbar_item_selected_get(EO_OBJ(item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_toolbar_efl_access_selection_all_children_select(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd EINA_UNUSED)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_toolbar_efl_access_selection_access_selection_clear(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
|
|
|
if (pd->selected_item)
|
|
|
|
elm_toolbar_item_selected_set(pd->selected_item, EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_toolbar_efl_access_selection_child_deselect(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
|
2015-05-26 07:28:35 -07:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item_Data *item;
|
|
|
|
if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
elm_toolbar_item_selected_set(EO_OBJ(item), EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2015-10-15 16:33:15 -07:00
|
|
|
EOLIAN void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_toolbar_efl_canvas_group_group_calculate(Eo *obj, Elm_Toolbar_Data *pd EINA_UNUSED)
|
2015-10-15 16:33:15 -07:00
|
|
|
{
|
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2016-04-26 01:54:51 -07:00
|
|
|
/* Legacy deprecated functions */
|
2015-10-15 16:33:15 -07:00
|
|
|
|
2016-04-26 01:54:51 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_icon_order_lookup_set(Evas_Object *obj EINA_UNUSED,
|
|
|
|
Elm_Icon_Lookup_Order order EINA_UNUSED)
|
|
|
|
{
|
|
|
|
// this method's behaviour has been overridden by elm_config_icon_theme_set
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Icon_Lookup_Order
|
|
|
|
elm_toolbar_icon_order_lookup_get(const Evas_Object *obj EINA_UNUSED)
|
|
|
|
{
|
|
|
|
return ELM_ICON_LOOKUP_FDO_THEME;
|
|
|
|
}
|
2017-05-18 01:52:17 -07:00
|
|
|
|
2018-05-10 04:25:43 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_more_item_is_present(Elm_Toolbar_Data *pd)
|
|
|
|
{
|
|
|
|
return pd->shrink_mode == ELM_TOOLBAR_SHRINK_MENU || pd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND;
|
|
|
|
}
|
|
|
|
|
2017-10-15 08:44:18 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_part_of_chain(Elm_Toolbar_Item_Data *pd)
|
|
|
|
{
|
|
|
|
Eina_Bool want = EINA_TRUE;
|
|
|
|
if (elm_wdg_item_disabled_get(pd->base->eo_obj))
|
|
|
|
want = EINA_FALSE;
|
|
|
|
|
2018-04-02 02:22:51 -07:00
|
|
|
if (!pd->prio.visible)
|
2017-10-15 08:44:18 -07:00
|
|
|
want = EINA_FALSE;
|
|
|
|
|
|
|
|
if (pd->separator)
|
|
|
|
want = EINA_FALSE;
|
|
|
|
|
|
|
|
return want;
|
|
|
|
}
|
|
|
|
|
2017-10-13 02:09:56 -07:00
|
|
|
EOLIAN static void
|
2017-10-15 08:44:18 -07:00
|
|
|
_elm_toolbar_efl_ui_focus_composition_prepare(Eo *obj, Elm_Toolbar_Data *pd)
|
2017-10-13 02:09:56 -07:00
|
|
|
{
|
2017-10-15 08:44:18 -07:00
|
|
|
Elm_Toolbar_Item_Data *it;
|
|
|
|
Eina_List *order = NULL;
|
2018-04-02 02:22:51 -07:00
|
|
|
Eina_Bool require_more_items = EINA_FALSE;
|
2017-10-15 08:44:18 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(pd->items, it)
|
|
|
|
{
|
|
|
|
if (_part_of_chain(it))
|
|
|
|
order = eina_list_append(order, EO_OBJ(it));
|
2018-05-10 04:25:43 -07:00
|
|
|
if (_more_item_is_present(pd) && !it->prio.visible)
|
|
|
|
require_more_items = EINA_TRUE;
|
2017-10-15 08:44:18 -07:00
|
|
|
}
|
|
|
|
|
2018-04-02 02:22:51 -07:00
|
|
|
if (require_more_items)
|
2017-10-15 08:44:18 -07:00
|
|
|
{
|
|
|
|
if (_part_of_chain(pd->more_item))
|
|
|
|
order = eina_list_append(order, EO_OBJ(pd->more_item));
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_ui_focus_composition_elements_set(obj, order);
|
2017-10-13 02:09:56 -07:00
|
|
|
}
|
|
|
|
|
2018-11-22 08:54:57 -08:00
|
|
|
EOLIAN static Efl_Ui_Focus_Object*
|
2018-12-04 00:39:25 -08:00
|
|
|
_elm_toolbar_item_efl_ui_focus_object_focus_parent_get(const Eo *obj EINA_UNUSED, Elm_Toolbar_Item_Data *pd)
|
2018-11-22 08:54:57 -08:00
|
|
|
{
|
|
|
|
return WIDGET(pd);
|
|
|
|
}
|
|
|
|
|
2017-10-13 02:09:56 -07:00
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
/* Standard widget overrides */
|
|
|
|
|
|
|
|
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_toolbar, Elm_Toolbar_Data)
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_TOOLBAR_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_toolbar)
|
|
|
|
|
2014-03-27 01:15:16 -07:00
|
|
|
#include "elm_toolbar.eo.c"
|
2014-09-27 22:15:56 -07:00
|
|
|
#include "elm_toolbar_item.eo.c"
|