2008-12-18 05:38:58 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
2012-08-30 09:45:00 -07:00
|
|
|
#include "elm_widget_toolbar.h"
|
2008-12-18 05:38:58 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
EAPI const char ELM_TOOLBAR_SMART_NAME[] = "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) \
|
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) ? EINA_INLIST_CONTAINER_GET(item, Elm_Toolbar_Item) : NULL)
|
|
|
|
|
2011-04-21 17:42:32 -07:00
|
|
|
static const char SIG_CLICKED[] = "clicked";
|
2011-10-11 15:09:14 -07:00
|
|
|
static const char SIG_LONGPRESSED[] = "longpressed";
|
|
|
|
static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
|
2012-08-30 09:45:00 -07:00
|
|
|
static const char SIG_LANG_CHANGED[] = "language,changed";
|
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2011-04-21 17:42:32 -07:00
|
|
|
{SIG_CLICKED, ""},
|
2011-10-11 15:09:14 -07:00
|
|
|
{SIG_LONGPRESSED, ""},
|
|
|
|
{SIG_CLICKED_DOUBLE, ""},
|
2012-08-30 09:45:00 -07:00
|
|
|
{SIG_LANG_CHANGED, ""},
|
2011-04-21 17:42:32 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
static const Evas_Smart_Interface *_smart_interfaces[] =
|
2010-10-14 08:27:31 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
(Evas_Smart_Interface *)&ELM_SCROLLABLE_IFACE, NULL
|
|
|
|
};
|
2010-10-14 08:27:31 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
EVAS_SMART_SUBCLASS_IFACE_NEW
|
|
|
|
(ELM_TOOLBAR_SMART_NAME, _elm_toolbar, Elm_Toolbar_Smart_Class,
|
|
|
|
Elm_Widget_Smart_Class, elm_widget_smart_class_get, _smart_callbacks,
|
|
|
|
_smart_interfaces);
|
2010-10-14 08:27:31 -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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
const Elm_Toolbar_Item *eti1 = i1;
|
|
|
|
const Elm_Toolbar_Item *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
|
2012-08-30 09:45:00 -07:00
|
|
|
_items_visibility_fix(Elm_Toolbar_Smart_Data *sd,
|
|
|
|
Evas_Coord *iw,
|
|
|
|
Evas_Coord vw,
|
|
|
|
Eina_Bool *more)
|
2008-12-18 20:26:24 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *it, *prev;
|
|
|
|
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);
|
|
|
|
it->prio.priority = prev->prio.priority;
|
|
|
|
}
|
|
|
|
}
|
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);
|
|
|
|
if (sd->vertical) *iw += cih;
|
|
|
|
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);
|
|
|
|
if (sd->vertical) *iw += cih;
|
|
|
|
else *iw += ciw;
|
|
|
|
it->prio.visible = (*iw <= vw);
|
|
|
|
it->in_box = sd->bx;
|
|
|
|
if (!it->separator) count++;
|
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
|
|
|
}
|
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
|
|
|
|
_item_menu_destroy(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
if (item->o_menu)
|
2012-08-21 20:11:23 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_del(item->o_menu);
|
|
|
|
item->o_menu = NULL;
|
2012-08-21 20:11:23 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
item->menu = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_unselect(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
if ((!item) || (!item->selected)) return;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
item->selected = EINA_FALSE;
|
|
|
|
sd->selected_item = NULL;
|
|
|
|
edje_object_signal_emit(VIEW(item), "elm,state,unselected", "elm");
|
|
|
|
elm_widget_signal_emit(item->icon, "elm,state,unselected", "elm");
|
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,
|
|
|
|
Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __UNUSED__)
|
2009-10-06 08:08:41 -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
|
|
|
Elm_Toolbar_Item *selected;
|
2009-10-18 10:20:18 -07:00
|
|
|
Elm_Toolbar_Item *it = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
selected = (Elm_Toolbar_Item *)elm_toolbar_selected_item_get(WIDGET(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
|
|
|
_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,
|
|
|
|
Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info __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
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_menu_create(Elm_Toolbar_Smart_Data *sd,
|
|
|
|
Elm_Toolbar_Item *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,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __UNUSED__)
|
2009-10-15 13:48:00 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *it = data;
|
2009-10-15 13:48:00 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->func) it->func((void *)(it->base.data), WIDGET(it), it);
|
2009-10-15 13:48:00 -07:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_show(Elm_Toolbar_Item *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);
|
|
|
|
sd->s_iface->content_region_show
|
|
|
|
(ELM_WIDGET_DATA(sd)->obj, x - bx, y - by, w, h);
|
|
|
|
}
|
2010-11-09 13:21:46 -08:00
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_mirrored_set(Evas_Object *obj __UNUSED__,
|
|
|
|
Elm_Toolbar_Item *it,
|
|
|
|
Eina_Bool mirrored)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2012-03-01 11:14:46 -08:00
|
|
|
edje_object_mirrored_set(VIEW(it), mirrored);
|
2012-06-12 09:27:15 -07:00
|
|
|
if (it->o_menu) elm_widget_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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *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)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it, *prev;
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
min = mw = mh = -1;
|
|
|
|
if (it->in_box && it->in_box == sd->bx)
|
|
|
|
{
|
|
|
|
if (!it->separator && !it->object)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh);
|
|
|
|
if (!it->separator && !it->object)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
}
|
|
|
|
else if (!more)
|
|
|
|
{
|
|
|
|
more = EINA_TRUE;
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
edje_object_size_min_restricted_calc(sd->VIEW(more_item), &mw, &mh, mw, mh);
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mw != -1 || mh != -1)
|
|
|
|
{
|
|
|
|
if (sd->vertical) min = mh;
|
|
|
|
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-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;
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
Eina_List *list;
|
|
|
|
Eina_Bool more;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
sd->resize_job = NULL;
|
|
|
|
sd->s_iface->content_viewport_size_get(obj, &vw, &vh);
|
|
|
|
evas_object_size_hint_min_get(sd->bx, &mw, &mh);
|
|
|
|
evas_object_geometry_get(sd->bx, NULL, NULL, &w, &h);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
if (sd->vertical)
|
2010-11-09 13:21:46 -08:00
|
|
|
{
|
2012-09-26 20:05:50 -07:00
|
|
|
h = vh;
|
2012-08-30 09:45:00 -07:00
|
|
|
_items_visibility_fix(sd, &ih, vh, &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;
|
2012-08-30 09:45:00 -07:00
|
|
|
_items_visibility_fix(sd, &iw, vw, &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
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->vertical)
|
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);
|
|
|
|
if (((sd->vertical) && (ih > vh)) ||
|
|
|
|
((!sd->vertical) && (iw > vw)) || more)
|
|
|
|
{
|
|
|
|
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 =
|
|
|
|
elm_toolbar_item_menu_get((Elm_Object_Item *)sd->more_item);
|
|
|
|
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);
|
|
|
|
elm_object_item_disabled_set
|
|
|
|
(menu_it, elm_widget_item_disabled_get(it));
|
|
|
|
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
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->vertical)
|
|
|
|
{
|
2012-09-26 20:05:50 -07:00
|
|
|
h = vh;
|
2012-08-30 09:45:00 -07:00
|
|
|
_items_visibility_fix(sd, &ih, vh, &more);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-26 20:05:50 -07:00
|
|
|
w = vw;
|
2012-08-30 09:45:00 -07:00
|
|
|
_items_visibility_fix(sd, &iw, vw, &more);
|
|
|
|
}
|
|
|
|
evas_object_box_remove_all(sd->bx, EINA_FALSE);
|
|
|
|
if (((sd->vertical) && (ih > vh)) ||
|
|
|
|
((!sd->vertical) && (iw > vw)) || more)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
2012-09-26 20:05:50 -07:00
|
|
|
if (sd->vertical)
|
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
|
|
|
|
|
|
|
if (sd->vertical)
|
|
|
|
_items_visibility_fix(sd, &ih, vh, &more);
|
|
|
|
else
|
|
|
|
_items_visibility_fix(sd, &iw, vw, &more);
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
if (sd->vertical)
|
|
|
|
{
|
|
|
|
if (h > vh) _items_size_fit(obj, &h, vh);
|
2012-11-13 21:55:43 -08:00
|
|
|
sd->s_iface->paging_set(obj, 0.0, 0.0, 0, (h / (sd->item_count - sd->separator_count)));
|
2012-10-18 00:57:13 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (w > vw) _items_size_fit(obj, &w, vw);
|
2012-11-13 21:55:43 -08:00
|
|
|
sd->s_iface->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
|
|
|
|
{
|
|
|
|
if (sd->vertical)
|
|
|
|
{
|
2012-09-26 20:05:50 -07:00
|
|
|
if ((vh >= mh) && (h != vh)) h = vh;
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-26 20:05:50 -07:00
|
|
|
if ((vw >= mw) && (w != vw)) w = vw;
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->selected)
|
|
|
|
{
|
|
|
|
_item_show(it);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-26 20:05:50 -07:00
|
|
|
if (sd->transverse_expanded)
|
|
|
|
{
|
|
|
|
if (sd->vertical)
|
|
|
|
w = vw;
|
|
|
|
else
|
|
|
|
h = vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_resize(sd->bx, w, h);
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
// Remove the first or last separator since it is not neccessary
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
2009-04-22 21:03:27 -07:00
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_elm_toolbar_smart_on_focus(Evas_Object *obj)
|
2012-07-25 21:36:12 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
2012-07-25 21:36:12 -07:00
|
|
|
if (elm_widget_focus_get(obj))
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_focus_set(ELM_WIDGET_DATA(sd)->resize_obj, EINA_TRUE);
|
2012-07-25 21:36:12 -07:00
|
|
|
else
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_focus_set(ELM_WIDGET_DATA(sd)->resize_obj, EINA_FALSE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
2012-07-25 21:36:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_smart_event(Evas_Object *obj __UNUSED__,
|
|
|
|
Evas_Object *src __UNUSED__,
|
|
|
|
Evas_Callback_Type type __UNUSED__,
|
|
|
|
void *event_info)
|
2012-07-25 21:36:12 -07:00
|
|
|
{
|
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
|
|
|
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
|
|
|
|
2012-10-22 23:07:30 -07:00
|
|
|
//TODO: Key Down Event precess for toolbar
|
2012-07-25 21:36:12 -07:00
|
|
|
|
2012-10-22 23:07:30 -07:00
|
|
|
return EINA_FALSE;
|
2012-07-25 21:36:12 -07:00
|
|
|
}
|
|
|
|
|
2011-12-08 21:26:33 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_resize_cb(void *data,
|
|
|
|
Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __UNUSED__)
|
2011-12-08 21:26:33 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Coord x, y, h;
|
2011-12-08 21:26:33 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
evas_object_geometry_get(data, &x, &y, NULL, &h);
|
2012-09-05 00:42:57 -07:00
|
|
|
evas_object_move(sd->more, x, y + h);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
if (!sd->resize_job)
|
|
|
|
sd->resize_job = ecore_job_add(_resize_job, data);
|
2011-12-08 21:26:33 -08:00
|
|
|
}
|
|
|
|
|
2012-03-06 03:35:11 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_disable_hook(Elm_Object_Item *it)
|
2012-03-06 03:35:11 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *toolbar_it = (Elm_Toolbar_Item *)it;
|
2012-03-29 03:08:37 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (elm_widget_item_disabled_get(toolbar_it))
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(VIEW(toolbar_it), "elm,state,disabled", "elm");
|
|
|
|
elm_widget_signal_emit(toolbar_it->icon, "elm,state,disabled", "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(VIEW(toolbar_it), "elm,state,enabled", "elm");
|
|
|
|
elm_widget_signal_emit(toolbar_it->icon, "elm,state,enabled", "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
|
|
|
}
|
|
|
|
|
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
|
|
|
|
_elm_toolbar_icon_size_get(Elm_Toolbar_Smart_Data *sd)
|
2012-03-06 03:35:11 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
const char *icon_size = edje_object_data_get
|
|
|
|
(ELM_WIDGET_DATA(sd)->resize_obj, "icon_size");
|
2012-03-06 04:35:22 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (icon_size) return atoi(icon_size);
|
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,
|
|
|
|
Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __UNUSED__)
|
2011-10-19 07:17:14 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *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
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_select(Elm_Toolbar_Item *it)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *it2;
|
|
|
|
Evas_Object *obj2;
|
|
|
|
Eina_Bool sel;
|
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
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (elm_widget_item_disabled_get(it) || (it->separator) || (it->object))
|
|
|
|
return;
|
|
|
|
sel = it->selected;
|
|
|
|
|
|
|
|
if (sd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
|
[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
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
it2 = (Elm_Toolbar_Item *)
|
|
|
|
elm_toolbar_selected_item_get(WIDGET(it));
|
|
|
|
_item_unselect(it2);
|
|
|
|
|
|
|
|
it->selected = EINA_TRUE;
|
|
|
|
sd->selected_item = it;
|
|
|
|
if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
|
|
|
|
{
|
|
|
|
if (sd->more_item == it)
|
|
|
|
{
|
|
|
|
if (!evas_object_box_children_get(sd->bx_more2))
|
|
|
|
elm_layout_signal_emit
|
|
|
|
(sd->more, "elm,state,open", "elm");
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit
|
|
|
|
(sd->more, "elm,state,open2", "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (it->in_box != sd->bx)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit
|
|
|
|
(sd->VIEW(more_item), "elm,state,selected",
|
|
|
|
"elm");
|
|
|
|
elm_widget_signal_emit
|
|
|
|
(sd->more_item->icon, "elm,state,selected",
|
|
|
|
"elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_signal_emit
|
|
|
|
(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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
|
|
|
|
_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
|
|
|
|
|
|
|
obj2 = WIDGET(it);
|
|
|
|
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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->func) it->func((void *)(it->base.data), WIDGET(it), 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
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_smart_callback_call(obj2, SIG_CLICKED, 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
|
|
|
}
|
|
|
|
|
2010-10-26 03:30:45 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_del(Elm_Toolbar_Item *it)
|
2010-10-26 03:30:45 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item_State *it_state;
|
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
|
|
|
|
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)
|
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,text,hidden", "elm");
|
|
|
|
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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,icon,hidden", "elm");
|
|
|
|
evas_object_del(it->icon);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (it->object) evas_object_del(it->object);
|
|
|
|
//TODO: See if checking for sd->menu_parent is necessary before
|
|
|
|
//deleting menu
|
|
|
|
if (it->o_menu) evas_object_del(it->o_menu);
|
2010-11-10 04:37:06 -08:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_theme_hook(Evas_Object *obj,
|
|
|
|
Elm_Toolbar_Item *it,
|
|
|
|
double scale,
|
|
|
|
int icon_size)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Coord mw, mh, minw, minh;
|
|
|
|
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);
|
|
|
|
|
|
|
|
_item_mirrored_set(obj, it, elm_widget_mirrored_get(obj));
|
|
|
|
edje_object_scale_set(view, scale);
|
|
|
|
|
|
|
|
if (!it->separator && !it->object)
|
|
|
|
{
|
|
|
|
elm_widget_theme_object_set(obj, view, "toolbar", "item", style);
|
|
|
|
if (it->selected)
|
2012-02-22 04:13:12 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
edje_object_signal_emit(view, "elm,state,selected", "elm");
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
|
2012-02-22 04:13:12 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
if (elm_widget_item_disabled_get(it))
|
2012-02-22 04:13:12 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
edje_object_signal_emit(view, "elm,state,disabled", "elm");
|
|
|
|
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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
int ms = 0;
|
[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
|
|
|
ms = ((double)icon_size * scale);
|
|
|
|
evas_object_size_hint_min_set(it->icon, ms, ms);
|
|
|
|
evas_object_size_hint_max_set(it->icon, ms, ms);
|
|
|
|
edje_object_part_swallow(view, "elm.swallow.icon", it->icon);
|
|
|
|
edje_object_signal_emit
|
|
|
|
(VIEW(it), "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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
edje_object_part_text_escaped_set(view, "elm.text", it->label);
|
|
|
|
edje_object_signal_emit(VIEW(it), "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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, view, "toolbar", "separator", style);
|
|
|
|
if (sd->vertical)
|
2010-10-26 03:30:45 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -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, -1.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(view, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2010-10-26 03:30:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, view, "toolbar", "object", style);
|
|
|
|
edje_object_part_swallow(view, "elm.swallow.object", it->object);
|
2010-10-26 03:30:45 -07:00
|
|
|
}
|
|
|
|
}
|
2012-06-07 00:32:55 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
mw = mh = minw = minh = -1;
|
|
|
|
if (!it->separator && !it->object)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
|
|
|
|
edje_object_size_min_restricted_calc(view, &mw, &mh, mw, mh);
|
|
|
|
if (!it->separator && !it->object)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2012-10-18 01:47:41 -07:00
|
|
|
evas_object_size_hint_min_set(view, mw, mh);
|
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);
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
char buf[sizeof("elm,action,click,") + 3];
|
|
|
|
static int scount = 0;
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (!it->separator) count++;
|
|
|
|
}
|
|
|
|
if (scount != count)
|
|
|
|
{
|
|
|
|
scount = count;
|
|
|
|
sprintf(buf, "elm,number,item,%d", count);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (!it->separator && !it->object)
|
|
|
|
edje_object_signal_emit(VIEW(it), buf, "elm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
evas_object_smart_need_recalculate_set(sd->bx, EINA_TRUE);
|
|
|
|
evas_object_smart_calculate(sd->bx);
|
|
|
|
edje_object_size_min_calc(ELM_WIDGET_DATA(sd)->resize_obj, &minw, &minh);
|
|
|
|
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;
|
|
|
|
|
|
|
|
evas_object_resize(ELM_WIDGET_DATA(sd)->resize_obj, w, h);
|
|
|
|
|
|
|
|
evas_object_size_hint_min_get(sd->bx, &minw_bx, &minh_bx);
|
|
|
|
sd->s_iface->content_viewport_size_get(obj, &vw, &vh);
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2012-09-27 21:23:29 -07:00
|
|
|
if (sd->vertical)
|
|
|
|
{
|
2012-10-18 00:57:13 -07:00
|
|
|
minw = minw_bx + (w - vw);
|
|
|
|
if (minh_bx <= vh) minh_bx = vh;
|
|
|
|
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);
|
|
|
|
if (minw_bx <= vw) minw_bx = vw;
|
|
|
|
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
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->vertical)
|
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)
|
|
|
|
{
|
|
|
|
if (sd->vertical)
|
|
|
|
minw_bx = vw;
|
|
|
|
else
|
|
|
|
minh_bx = vh;
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_resize(sd->bx, minw_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
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_elm_toolbar_smart_theme(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
double scale = 0;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->on_deletion)
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
if (!ELM_WIDGET_CLASS(_elm_toolbar_parent_sc)->theme(obj))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
elm_layout_theme_set
|
|
|
|
(sd->more, "toolbar", "more", elm_widget_style_get(obj));
|
|
|
|
|
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
|
|
|
|
|
|
|
sd->theme_icon_size = _elm_toolbar_icon_size_get(sd);
|
|
|
|
if (sd->priv_icon_size) sd->icon_size = sd->priv_icon_size;
|
|
|
|
else sd->icon_size = sd->theme_icon_size;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
_sizing_eval(obj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_toolbar_item_label_update(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
Evas_Coord mw = -1, mh = -1, minw = -1, minh = -1;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
edje_object_part_text_escaped_set(VIEW(item), "elm.text", item->label);
|
2012-09-11 22:30:35 -07:00
|
|
|
if (item->label)
|
|
|
|
edje_object_signal_emit(VIEW(item), "elm,state,text,visible", "elm");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(VIEW(item), "elm,state,text,hidden", "elm");
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh);
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
if (sd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->vertical)
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(VIEW(item), EVAS_HINT_EXPAND, -1.0);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
else
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(VIEW(item), -1.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
}
|
2012-05-21 22:18:12 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_min_get(VIEW(item), &minw, &minh);
|
|
|
|
if ((minw < mw) && (minh < mh))
|
|
|
|
evas_object_size_hint_min_set(VIEW(item), mw, mh);
|
|
|
|
else if ((minw < mw) && (minh > mh))
|
|
|
|
evas_object_size_hint_min_set(VIEW(item), mw, minh);
|
|
|
|
else if ((minw > mw) && (minh < mh))
|
|
|
|
evas_object_size_hint_min_set(VIEW(item), minw, mh);
|
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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *item = data;
|
|
|
|
|
|
|
|
_elm_toolbar_item_label_update(item);
|
|
|
|
edje_object_signal_callback_del
|
|
|
|
(obj, emission, source, _elm_toolbar_item_label_set_cb);
|
|
|
|
edje_object_signal_emit(VIEW(item), "elm,state,label,reset", "elm");
|
2010-11-11 10:05:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_item_label_set(Elm_Toolbar_Item *item,
|
|
|
|
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);
|
|
|
|
s = edje_object_data_get(VIEW(item), "transition_animation_on");
|
|
|
|
if ((s) && (atoi(s)))
|
|
|
|
{
|
|
|
|
edje_object_part_text_escaped_set
|
|
|
|
(VIEW(item), "elm.text_new", item->label);
|
|
|
|
edje_object_signal_emit(VIEW(item), sig, "elm");
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(VIEW(item), "elm,state,label_set,done", "elm",
|
|
|
|
_elm_toolbar_item_label_set_cb, item);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_elm_toolbar_item_label_update(item);
|
|
|
|
|
|
|
|
_resize_cb(WIDGET(item), NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_text_set_hook(Elm_Object_Item *it,
|
|
|
|
const char *part,
|
|
|
|
const char *label)
|
|
|
|
{
|
2012-09-06 21:33:45 -07:00
|
|
|
Elm_Toolbar_Item *item;
|
|
|
|
char buf[256];
|
|
|
|
item = (Elm_Toolbar_Item *)it;
|
|
|
|
|
|
|
|
if ((!part) || (!strcmp(part, "default")) ||
|
|
|
|
(!strcmp(part, "elm.text")))
|
|
|
|
{
|
|
|
|
_item_label_set(((Elm_Toolbar_Item *)it), label, "elm,state,label_set");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (label)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,visible", part);
|
|
|
|
edje_object_signal_emit(VIEW(item), buf, "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hidden", part);
|
|
|
|
edje_object_signal_emit(VIEW(item), buf, "elm");
|
|
|
|
}
|
|
|
|
edje_object_part_text_escaped_set(VIEW(item), part, label);
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
_item_text_get_hook(const Elm_Object_Item *it,
|
|
|
|
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
|
|
|
|
2012-09-06 21:33:45 -07:00
|
|
|
return edje_object_part_text_get(VIEW(it), buf);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_content_set_hook(Elm_Object_Item *it,
|
|
|
|
const char *part,
|
|
|
|
Evas_Object *content)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
|
|
|
Evas_Object *obj = WIDGET(item);
|
|
|
|
double scale;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (part && strcmp(part, "object")) return;
|
|
|
|
if (item->object == content) return;
|
|
|
|
|
|
|
|
if (item->object) evas_object_del(item->object);
|
|
|
|
|
|
|
|
item->object = content;
|
|
|
|
if (item->object)
|
|
|
|
elm_widget_sub_object_add(obj, item->object);
|
|
|
|
|
|
|
|
scale = (elm_widget_scale_get(obj) * elm_config_scale_get());
|
|
|
|
_item_theme_hook(obj, item, scale, sd->icon_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_item_content_get_hook(const Elm_Object_Item *it,
|
|
|
|
const char *part)
|
|
|
|
{
|
|
|
|
if (part && strcmp(part, "object")) return NULL;
|
|
|
|
return ((Elm_Toolbar_Item *)it)->object;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_item_content_unset_hook(Elm_Object_Item *it,
|
|
|
|
const char *part)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
|
|
|
Evas_Object *obj = WIDGET(item);
|
|
|
|
Evas_Object *o;
|
|
|
|
double scale;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (part && strcmp(part, "object")) return NULL;
|
|
|
|
|
|
|
|
edje_object_part_unswallow(VIEW(it), item->object);
|
|
|
|
elm_widget_sub_object_del(obj, item->object);
|
|
|
|
o = item->object;
|
|
|
|
item->object = NULL;
|
|
|
|
scale = (elm_widget_scale_get(obj) * elm_config_scale_get());
|
|
|
|
_item_theme_hook(obj, item, scale, sd->icon_size);
|
|
|
|
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_elm_toolbar_smart_translate(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
evas_object_smart_callback_call(obj, SIG_LANG_CHANGED, NULL);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_resize(void *data,
|
|
|
|
Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
_sizing_eval(data);
|
|
|
|
_resize_cb(data, NULL, NULL, NULL);
|
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,
|
|
|
|
Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __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
|
2012-08-30 09:45:00 -07:00
|
|
|
_select_filter_cb(Elm_Toolbar_Item *it,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
const char *emission,
|
|
|
|
const char *source __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);
|
2012-08-30 09:45:00 -07:00
|
|
|
if (button == 1) return; /* regular left click event */
|
2011-10-11 13:14:52 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm,action,click,%d", button);
|
2012-03-01 11:14:46 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), buf, "elm");
|
2011-10-11 13:14:52 -07:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_select_cb(void *data,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
const char *emission __UNUSED__,
|
|
|
|
const char *source __UNUSED__)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2011-08-23 23:29:13 -07:00
|
|
|
Elm_Toolbar_Item *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
|
2012-08-30 09:45:00 -07:00
|
|
|
_items_change(Evas_Object *obj)
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *prev = NULL, *next = NULL;
|
|
|
|
int tmp;
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if ((sd->reorder_from) && (sd->reorder_to) &&
|
|
|
|
(!sd->reorder_from->separator) && (!sd->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
|
|
|
|
(EINA_INLIST_GET(sd->reorder_from)->prev);
|
2012-09-18 22:23:22 -07:00
|
|
|
if (prev == sd->reorder_to)
|
|
|
|
prev = sd->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
|
|
|
|
(EINA_INLIST_GET(sd->reorder_from)->next);
|
2012-09-18 22:23:22 -07:00
|
|
|
if (next == sd->reorder_to)
|
|
|
|
next = NULL;
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_remove
|
|
|
|
(sd->items, EINA_INLIST_GET(sd->reorder_from));
|
|
|
|
sd->items = eina_inlist_append_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(sd->reorder_from),
|
|
|
|
EINA_INLIST_GET(sd->reorder_to));
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->items = eina_inlist_remove
|
|
|
|
(sd->items, EINA_INLIST_GET(sd->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
|
|
|
|
(sd->items, EINA_INLIST_GET(sd->reorder_to),
|
|
|
|
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
|
|
|
|
(sd->items, EINA_INLIST_GET(sd->reorder_to),
|
|
|
|
EINA_INLIST_GET(next));
|
2012-09-18 22:23:22 -07:00
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend
|
|
|
|
(sd->items, EINA_INLIST_GET(sd->reorder_to));
|
|
|
|
|
|
|
|
if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_NONE ||
|
|
|
|
sd->shrink_mode == ELM_TOOLBAR_SHRINK_SCROLL)
|
|
|
|
{
|
|
|
|
evas_object_box_remove(sd->bx, VIEW(sd->reorder_from));
|
|
|
|
evas_object_box_insert_after(sd->bx, VIEW(sd->reorder_from),
|
|
|
|
VIEW(sd->reorder_to));
|
|
|
|
evas_object_box_remove(sd->bx, VIEW(sd->reorder_to));
|
|
|
|
if (prev)
|
|
|
|
evas_object_box_insert_after(sd->bx, VIEW(sd->reorder_to),
|
|
|
|
VIEW(prev));
|
|
|
|
else if (next)
|
|
|
|
evas_object_box_insert_before(sd->bx, VIEW(sd->reorder_to),
|
|
|
|
VIEW(next));
|
|
|
|
else
|
|
|
|
evas_object_box_prepend(sd->bx, VIEW(sd->reorder_to));
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
tmp = sd->reorder_from->prio.priority;
|
|
|
|
sd->reorder_from->prio.priority = sd->reorder_to->prio.priority;
|
|
|
|
sd->reorder_to->prio.priority = tmp;
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
_resize_cb(obj, NULL, NULL, NULL);
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_mouse_move_reorder(Elm_Toolbar_Item *it,
|
|
|
|
Evas *evas __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
Evas_Event_Mouse_Move *ev)
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-06-14 05:59:38 -07:00
|
|
|
evas_object_geometry_get(VIEW(it), NULL, NULL, &w, &h);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_move
|
|
|
|
(VIEW(it), ev->cur.canvas.x - (w / 2), ev->cur.canvas.y - (h / 2));
|
2012-06-14 05:59:38 -07:00
|
|
|
evas_object_show(VIEW(it));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_mouse_up_reorder(Elm_Toolbar_Item *it,
|
|
|
|
Evas *evas __UNUSED__,
|
2012-09-18 22:23:22 -07:00
|
|
|
Evas_Object *obj,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Event_Mouse_Up *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);
|
|
|
|
|
|
|
|
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);
|
|
|
|
elm_widget_item_del(it);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
|
|
|
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
|
|
|
|
if ((x < ev->canvas.x) && (ev->canvas.x < x + w) &&
|
|
|
|
(y < ev->canvas.y) && (ev->canvas.y < y + h))
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->reorder_to = it;
|
|
|
|
_items_change(WIDGET(it));
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
}
|
2012-09-18 22:23:22 -07:00
|
|
|
|
|
|
|
sd->s_iface->hold_set(obj, EINA_FALSE);
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_reorder_start(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(item);
|
|
|
|
Evas_Object *icon_obj;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
sd->reorder_from = item;
|
2012-06-14 05:59:38 -07:00
|
|
|
|
|
|
|
icon_obj = elm_icon_add(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_icon_order_lookup_set(icon_obj, sd->lookup_order);
|
|
|
|
|
2012-06-14 05:59:38 -07:00
|
|
|
if (!icon_obj) return;
|
|
|
|
it = elm_widget_item_new(obj, Elm_Toolbar_Item);
|
|
|
|
if (!it)
|
|
|
|
{
|
|
|
|
evas_object_del(icon_obj);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
it->label = eina_stringshare_add(item->label);
|
|
|
|
VIEW(it) = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
|
|
|
|
if (_item_icon_set(icon_obj, "toolbar/", item->icon_str))
|
|
|
|
{
|
|
|
|
it->icon = icon_obj;
|
|
|
|
it->icon_str = eina_stringshare_add(item->icon_str);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
it->icon = NULL;
|
|
|
|
it->icon_str = NULL;
|
|
|
|
evas_object_del(icon_obj);
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_widget_theme_object_set(obj, VIEW(it), "toolbar", "item",
|
|
|
|
elm_widget_style_get(obj));
|
2012-06-14 05:59:38 -07:00
|
|
|
if (it->icon)
|
|
|
|
{
|
|
|
|
int ms = 0;
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ms = ((double)sd->icon_size * elm_config_scale_get());
|
2012-06-14 05:59:38 -07:00
|
|
|
evas_object_size_hint_min_set(it->icon, ms, ms);
|
|
|
|
evas_object_size_hint_max_set(it->icon, ms, ms);
|
|
|
|
edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon);
|
2012-07-08 22:11:05 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,icon,visible", "elm");
|
2012-06-14 05:59:38 -07:00
|
|
|
evas_object_show(it->icon);
|
|
|
|
elm_widget_sub_object_add(obj, it->icon);
|
|
|
|
}
|
2012-07-22 18:59:41 -07:00
|
|
|
if (it->label)
|
|
|
|
{
|
|
|
|
edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label);
|
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm");
|
|
|
|
}
|
2012-06-14 05:59:38 -07:00
|
|
|
|
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,moving", "elm");
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(obj, EVAS_CALLBACK_MOUSE_MOVE,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_move_reorder, it);
|
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,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_move_reorder, it);
|
2012-06-14 05:59:38 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_move_reorder, it);
|
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,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_up_reorder, it);
|
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,
|
|
|
|
(Evas_Object_Event_Cb)_mouse_up_reorder, it);
|
2012-06-14 05:59:38 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(VIEW(item), &x, &y, &w, &h);
|
|
|
|
evas_object_resize(VIEW(it), w, h);
|
|
|
|
evas_object_move(VIEW(it), x, y);
|
|
|
|
evas_object_show(VIEW(it));
|
2012-09-18 22:23:22 -07:00
|
|
|
|
|
|
|
sd->s_iface->hold_set(WIDGET(it), EINA_TRUE);
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
|
2011-10-11 15:09:14 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_long_press(Elm_Toolbar_Item *it)
|
|
|
|
{
|
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);
|
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-10-11 15:09:14 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2012-09-18 22:23:22 -07:00
|
|
|
static void
|
|
|
|
_drag_start_cb(Evas_Object *obj, void *data __UNUSED__)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->long_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(sd->long_timer);
|
|
|
|
sd->long_timer = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-14 05:59:38 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_mouse_move_cb(Elm_Toolbar_Item *it,
|
|
|
|
Evas *evas __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
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);
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if ((sd->long_timer) &&
|
2012-06-14 05:59:38 -07:00
|
|
|
((x > ev->cur.canvas.x) || (ev->cur.canvas.x > x + w) ||
|
2012-08-30 09:45:00 -07:00
|
|
|
(y > ev->cur.canvas.y) || (ev->cur.canvas.y > y + h)))
|
2012-06-14 05:59:38 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ecore_timer_del(sd->long_timer);
|
|
|
|
sd->long_timer = NULL;
|
2012-06-14 05:59:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-11 15:09:14 -07:00
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_mouse_down_cb(Elm_Toolbar_Item *it,
|
|
|
|
Evas *evas __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
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)
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
|
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
|
|
|
|
(_elm_config->longpress_timeout, (Ecore_Task_Cb)_long_press, it);
|
|
|
|
|
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
|
2012-08-30 09:45:00 -07:00
|
|
|
_mouse_up_cb(Elm_Toolbar_Item *it,
|
|
|
|
Evas *evas __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
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;
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->long_timer)
|
2011-10-11 15:09:14 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ecore_timer_del(sd->long_timer);
|
|
|
|
sd->long_timer = NULL;
|
2011-10-11 15:09:14 -07:00
|
|
|
}
|
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,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
const char *emission __UNUSED__,
|
|
|
|
const char *source __UNUSED__)
|
2010-10-29 11:42:01 -07:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-03-01 11:14:46 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,highlighted", "elm");
|
2010-10-29 11:42:01 -07:00
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,highlighted", "elm");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_mouse_out_cb(void *data,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
const char *emission __UNUSED__,
|
|
|
|
const char *source __UNUSED__)
|
2010-10-29 11:42:01 -07:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-03-01 11:14:46 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,unhighlighted", "elm");
|
2010-10-29 11:42:01 -07:00
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,unhighlighted", "elm");
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
_els_box_layout
|
|
|
|
(o, priv, !sd->vertical, sd->homogeneous, elm_widget_mirrored_get(obj));
|
2009-10-02 12:22:40 -07:00
|
|
|
}
|
|
|
|
|
2011-08-23 23:29:13 -07:00
|
|
|
static char *
|
2012-10-14 22:47:02 -07:00
|
|
|
_access_info_cb(void *data,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *obj __UNUSED__,
|
2012-10-14 22:47:02 -07:00
|
|
|
Elm_Widget_Item *item __UNUSED__)
|
2011-08-23 23:29:13 -07:00
|
|
|
{
|
2012-10-14 22:47:02 -07:00
|
|
|
Elm_Toolbar_Item *it = (Elm_Toolbar_Item *)data;
|
|
|
|
const char *txt = ((Elm_Widget_Item *)it)->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 *
|
2012-10-14 22:47:02 -07:00
|
|
|
_access_state_cb(void *data,
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
Elm_Widget_Item *item __UNUSED__)
|
2011-08-23 23:29:13 -07:00
|
|
|
{
|
2012-10-14 22:47:02 -07:00
|
|
|
Elm_Toolbar_Item *it = (Elm_Toolbar_Item *)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"));
|
2011-12-08 05:53:38 -08:00
|
|
|
else if (elm_widget_item_disabled_get(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;
|
|
|
|
}
|
|
|
|
|
2012-01-27 03:56:14 -08:00
|
|
|
static Eina_Bool
|
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_pre_hook(Elm_Object_Item *it)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *item, *next;
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
item = (Elm_Toolbar_Item *)it;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
obj = WIDGET(item);
|
|
|
|
|
|
|
|
if (item != sd->more_item) /* more item does not get in the list */
|
|
|
|
{
|
|
|
|
next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next);
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(item));
|
|
|
|
sd->item_count--;
|
|
|
|
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-01-27 03:56:14 -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)
|
|
|
|
_elm_toolbar_smart_theme(obj);
|
2012-01-27 03:56:14 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
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
|
|
|
|
_access_activate_cb(void *data __UNUSED__,
|
|
|
|
Evas_Object *part_obj __UNUSED__,
|
|
|
|
Elm_Widget_Item *item)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
it = (Elm_Toolbar_Item *)item;
|
|
|
|
|
|
|
|
if (elm_widget_item_disabled_get(it)) return;
|
|
|
|
|
|
|
|
if (it->selected)
|
|
|
|
{
|
|
|
|
_elm_access_say(E_("Unselected"));
|
|
|
|
_item_unselect(it);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_elm_access_say(E_("Selected"));
|
|
|
|
_item_select(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-08 01:20:37 -08:00
|
|
|
static void
|
|
|
|
_access_widget_item_register(Elm_Toolbar_Item *it)
|
|
|
|
{
|
|
|
|
Elm_Access_Info *ai;
|
|
|
|
_elm_access_widget_item_register((Elm_Widget_Item *)it);
|
|
|
|
ai = _elm_access_object_get(it->base.access_obj);
|
|
|
|
|
|
|
|
_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
|
|
|
}
|
|
|
|
|
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
|
|
|
static Elm_Toolbar_Item *
|
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;
|
|
|
|
Elm_Toolbar_Item *it;
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Coord mw, mh;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
icon_obj = elm_icon_add(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_icon_order_lookup_set(icon_obj, sd->lookup_order);
|
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 (!icon_obj) return NULL;
|
2012-05-25 12:53:59 -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
|
|
|
it = elm_widget_item_new(obj, Elm_Toolbar_Item);
|
|
|
|
if (!it)
|
|
|
|
{
|
|
|
|
evas_object_del(icon_obj);
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-12-08 21:26:33 -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
|
|
|
elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
|
2012-01-09 17:00:23 -08:00
|
|
|
elm_widget_item_disable_hook_set(it, _item_disable_hook);
|
2011-12-08 21:26:33 -08:00
|
|
|
elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
|
|
|
|
elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
|
2012-03-06 03:35:11 -08:00
|
|
|
elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
|
|
|
|
elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
|
|
|
|
elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
|
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;
|
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->base.data = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-03-01 11:14:46 -08:00
|
|
|
VIEW(it) = edje_object_add(evas_object_evas_get(obj));
|
2012-08-30 09:45:00 -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);
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, VIEW(it), "toolbar", "item", elm_widget_style_get(obj));
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(VIEW(it), "elm,action,click", "elm", _select_cb, it);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(VIEW(it), "mouse,clicked,*", "*", (Edje_Signal_Cb)_select_filter_cb, it);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(VIEW(it), "elm,mouse,in", "elm", _mouse_in_cb, it);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(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);
|
2011-10-20 18:08:01 -07:00
|
|
|
elm_widget_sub_object_add(obj, VIEW(it));
|
2012-08-30 09:45:00 -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 (it->icon)
|
|
|
|
{
|
|
|
|
int ms = 0;
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ms = ((double)sd->icon_size * 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
|
|
|
evas_object_size_hint_min_set(it->icon, ms, ms);
|
|
|
|
evas_object_size_hint_max_set(it->icon, ms, ms);
|
2012-03-01 11:14:46 -08:00
|
|
|
edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon);
|
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
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,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);
|
|
|
|
elm_widget_sub_object_add(obj, it->icon);
|
|
|
|
}
|
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)
|
|
|
|
{
|
|
|
|
edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label);
|
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm");
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-06-25 01:50:11 -07:00
|
|
|
mw = mh = -1;
|
2012-06-25 01:33:15 -07:00
|
|
|
if (!it->separator && !it->object)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2012-03-01 11:14:46 -08:00
|
|
|
edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh);
|
2012-06-25 01:33:15 -07:00
|
|
|
if (!it->separator && !it->object)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
|
2011-08-06 20:42:28 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->vertical)
|
2012-03-04 01:52:20 -08:00
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, -1.0);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-03-04 01:52:20 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(VIEW(it), -1.0, EVAS_HINT_EXPAND);
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-03-04 01:52:20 -08:00
|
|
|
}
|
2011-08-06 20:42:28 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
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);
|
2011-08-06 20:42:28 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_size_hint_min_set(VIEW(it), mw, mh);
|
2012-02-22 04:13:12 -08:00
|
|
|
evas_object_size_hint_max_set(VIEW(it), -1, -1);
|
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);
|
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
|
2012-03-01 11:14:46 -08:00
|
|
|
_elm_toolbar_item_icon_update(Elm_Toolbar_Item *item)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Evas_Coord mw = -1, mh = -1, minw = -1, minh = -1;
|
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 =
|
|
|
|
edje_object_part_swallow_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
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
2012-03-01 11:14:46 -08:00
|
|
|
elm_widget_sub_object_del(VIEW(item), old_icon);
|
|
|
|
edje_object_part_swallow(VIEW(item), "elm.swallow.icon", item->icon);
|
2012-09-11 22:30:35 -07:00
|
|
|
if (item->icon)
|
|
|
|
edje_object_signal_emit(VIEW(item), "elm,state,icon,visible", "elm");
|
|
|
|
else
|
|
|
|
edje_object_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
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh);
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
|
2012-03-01 11:14:46 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->vertical)
|
2012-03-04 01:52:20 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(VIEW(item), EVAS_HINT_EXPAND, -1.0);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-03-04 01:52:20 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(VIEW(item), -1.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-03-04 01:52:20 -08:00
|
|
|
}
|
2012-03-01 11:14:46 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-03-01 11:14:46 -08:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-06-25 01:33:15 -07:00
|
|
|
evas_object_size_hint_min_get(VIEW(item), &minw, &minh);
|
|
|
|
if ((minw < mw) && (minh < mh))
|
|
|
|
evas_object_size_hint_min_set(VIEW(item), mw, mh);
|
|
|
|
else if ((minw < mw) && (minh > mh))
|
|
|
|
evas_object_size_hint_min_set(VIEW(item), mw, minh);
|
|
|
|
else if ((minw > mw) && (minh < mh))
|
|
|
|
evas_object_size_hint_min_set(VIEW(item), minw, mh);
|
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
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *item = data;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2012-03-01 11:14:46 -08:00
|
|
|
edje_object_part_unswallow(VIEW(item), item->icon);
|
|
|
|
_elm_toolbar_item_icon_update(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
edje_object_signal_callback_del
|
|
|
|
(obj, emission, source, _elm_toolbar_item_icon_set_cb);
|
|
|
|
edje_object_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,
|
|
|
|
Elm_Toolbar_Item *item,
|
|
|
|
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;
|
|
|
|
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);
|
|
|
|
}
|
2012-03-01 11:14:46 -08:00
|
|
|
s = edje_object_data_get(VIEW(item), "transition_animation_on");
|
|
|
|
if ((s) && (atoi(s)))
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
old_icon = edje_object_part_swallow_get
|
|
|
|
(VIEW(item), "elm.swallow.icon_new");
|
2012-03-01 11:14:46 -08:00
|
|
|
if (old_icon)
|
|
|
|
{
|
|
|
|
elm_widget_sub_object_del(VIEW(item), old_icon);
|
|
|
|
evas_object_hide(old_icon);
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
edje_object_part_swallow
|
|
|
|
(VIEW(item), "elm.swallow.icon_new", item->icon);
|
|
|
|
edje_object_signal_emit(VIEW(item), sig, "elm");
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(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);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
_resize_cb(obj, NULL, NULL, NULL);
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:00 -07:00
|
|
|
_elm_toolbar_item_state_cb(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it = event_info;
|
|
|
|
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,
|
|
|
|
Evas_Object *o __UNUSED__,
|
|
|
|
const char *sig __UNUSED__,
|
|
|
|
const char *src __UNUSED__)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
|
|
|
Elm_Toolbar_Item *it, *it2;
|
|
|
|
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
|
|
|
{
|
|
|
|
if (elm_object_item_disabled_get((Elm_Object_Item *)it2))
|
|
|
|
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
|
|
|
{
|
|
|
|
if (elm_object_item_disabled_get((Elm_Object_Item *)it)) continue;
|
|
|
|
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,
|
|
|
|
Evas_Object *o __UNUSED__,
|
|
|
|
const char *sig __UNUSED__,
|
|
|
|
const char *src __UNUSED__)
|
2012-08-07 03:20:30 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
|
|
|
Elm_Toolbar_Item *it, *it2;
|
|
|
|
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
|
|
|
{
|
|
|
|
if (elm_object_item_disabled_get((Elm_Object_Item *)it2))
|
|
|
|
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
|
|
|
{
|
|
|
|
if (elm_object_item_disabled_get((Elm_Object_Item *)it)) continue;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
static void
|
|
|
|
_elm_toolbar_smart_add(Evas_Object *obj)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
EVAS_SMART_DATA_ALLOC(obj, Elm_Toolbar_Smart_Data);
|
|
|
|
|
|
|
|
ELM_WIDGET_DATA(priv)->resize_obj =
|
|
|
|
edje_object_add(evas_object_evas_get(obj));
|
|
|
|
|
|
|
|
ELM_WIDGET_CLASS(_elm_toolbar_parent_sc)->base.add(obj);
|
|
|
|
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, ELM_WIDGET_DATA(priv)->resize_obj, "toolbar", "base",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
|
|
|
|
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
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
priv->s_iface = evas_object_smart_interface_get
|
|
|
|
(obj, ELM_SCROLLABLE_IFACE_NAME);
|
|
|
|
|
|
|
|
priv->s_iface->objects_set
|
|
|
|
(obj, ELM_WIDGET_DATA(priv)->resize_obj, priv->hit_rect);
|
|
|
|
|
|
|
|
priv->more_item = NULL;
|
|
|
|
priv->selected_item = NULL;
|
|
|
|
priv->standard_priority = -99999;
|
|
|
|
|
|
|
|
priv->s_iface->bounce_allow_set
|
|
|
|
(obj, _elm_config->thumbscroll_bounce_enable, EINA_FALSE);
|
|
|
|
priv->s_iface->policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
|
2012-09-18 22:23:22 -07:00
|
|
|
priv->s_iface->drag_start_cb_set(obj, _drag_start_cb);
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,left", "elm",
|
|
|
|
_elm_toolbar_action_left_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,right", "elm",
|
|
|
|
_elm_toolbar_action_right_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,up", "elm",
|
|
|
|
_elm_toolbar_action_up_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,down", "elm",
|
|
|
|
_elm_toolbar_action_down_cb, obj);
|
|
|
|
|
|
|
|
priv->shrink_mode = ELM_TOOLBAR_SHRINK_NONE;
|
|
|
|
priv->priv_icon_size = 0; // unset
|
|
|
|
priv->theme_icon_size = _elm_toolbar_icon_size_get(priv);
|
|
|
|
if (priv->priv_icon_size) priv->icon_size = priv->priv_icon_size;
|
|
|
|
else priv->icon_size = priv->theme_icon_size;
|
|
|
|
|
|
|
|
priv->homogeneous = EINA_TRUE;
|
|
|
|
priv->align = 0.5;
|
|
|
|
|
|
|
|
priv->bx = evas_object_box_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_size_hint_align_set(priv->bx, priv->align, 0.5);
|
|
|
|
evas_object_box_layout_set(priv->bx, _layout, obj, NULL);
|
|
|
|
elm_widget_sub_object_add(obj, priv->bx);
|
|
|
|
priv->s_iface->content_set(obj, priv->bx);
|
|
|
|
evas_object_show(priv->bx);
|
|
|
|
|
|
|
|
priv->more = elm_layout_add(obj);
|
|
|
|
elm_layout_theme_set(priv->more, "toolbar", "more", "default");
|
|
|
|
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));
|
|
|
|
evas_object_size_hint_align_set(priv->bx_more, priv->align, 0.5);
|
|
|
|
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));
|
|
|
|
evas_object_size_hint_align_set(priv->bx_more2, priv->align, 0.5);
|
|
|
|
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);
|
2010-11-08 11:58:46 -08:00
|
|
|
elm_toolbar_icon_order_lookup_set(obj, ELM_ICON_LOOKUP_THEME_FDO);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
_sizing_eval(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_toolbar_smart_del(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it, *next;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
sd->on_deletion = EINA_TRUE;
|
|
|
|
|
|
|
|
if (sd->resize_job)
|
|
|
|
ecore_job_del(sd->resize_job);
|
|
|
|
|
|
|
|
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);
|
|
|
|
elm_widget_item_del(it);
|
|
|
|
it = next;
|
|
|
|
}
|
|
|
|
if (sd->more_item)
|
|
|
|
{
|
|
|
|
elm_widget_item_del(sd->more_item);
|
|
|
|
sd->more_item = NULL;
|
|
|
|
}
|
|
|
|
if (sd->long_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(sd->long_timer);
|
|
|
|
sd->long_timer = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ELM_WIDGET_CLASS(_elm_toolbar_parent_sc)->base.del(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_toolbar_smart_move(Evas_Object *obj,
|
|
|
|
Evas_Coord x,
|
|
|
|
Evas_Coord y)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
ELM_WIDGET_CLASS(_elm_toolbar_parent_sc)->base.move(obj, x, y);
|
|
|
|
|
|
|
|
evas_object_move(sd->hit_rect, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_toolbar_smart_resize(Evas_Object *obj,
|
|
|
|
Evas_Coord w,
|
|
|
|
Evas_Coord h)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
ELM_WIDGET_CLASS(_elm_toolbar_parent_sc)->base.resize(obj, w, h);
|
|
|
|
|
|
|
|
evas_object_resize(sd->hit_rect, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_toolbar_smart_member_add(Evas_Object *obj,
|
|
|
|
Evas_Object *member)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
ELM_WIDGET_CLASS(_elm_toolbar_parent_sc)->base.member_add(obj, member);
|
|
|
|
|
|
|
|
if (sd->hit_rect)
|
|
|
|
evas_object_raise(sd->hit_rect);
|
|
|
|
}
|
|
|
|
|
2012-11-08 01:20:37 -08:00
|
|
|
static Eina_List *
|
|
|
|
_access_item_find_append(const Evas_Object *obj,
|
|
|
|
Evas_Object *bx,
|
|
|
|
Eina_List *items)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
Eina_List *list;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
list = evas_object_box_children_get(bx);
|
|
|
|
if (!list) return items;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH (sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->separator) continue;
|
|
|
|
if (eina_list_data_find(list, it->base.view))
|
|
|
|
items = eina_list_append(items, it->base.access_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
return items;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_elm_toolbar_smart_focus_next(const Evas_Object *obj,
|
|
|
|
Elm_Focus_Direction dir,
|
|
|
|
Evas_Object **next)
|
|
|
|
{
|
|
|
|
Eina_List *items = NULL;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->more_item && sd->more_item->selected)
|
|
|
|
{
|
|
|
|
items = _access_item_find_append(obj, sd->bx_more, items);
|
|
|
|
items = _access_item_find_append(obj, sd->bx_more2, items);
|
|
|
|
items = eina_list_append(items, sd->more_item->base.access_obj);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
items = _access_item_find_append(obj, sd->bx, items);
|
|
|
|
if (sd->more_item &&
|
|
|
|
eina_list_data_find(evas_object_box_children_get(sd->bx),
|
|
|
|
sd->more_item->base.view))
|
|
|
|
items = eina_list_append(items, sd->more_item->base.access_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
return elm_widget_focus_list_next_get
|
|
|
|
(obj, items, eina_list_data_get, dir, next);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_obj_process(Elm_Toolbar_Smart_Data * sd, Eina_Bool is_access)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH (sd->items, it)
|
|
|
|
{
|
|
|
|
if (is_access) _access_widget_item_register(it);
|
|
|
|
else _elm_access_widget_item_unregister((Elm_Widget_Item *)it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_toolbar_smart_access(Evas_Object *obj, Eina_Bool is_access)
|
|
|
|
{
|
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (is_access)
|
|
|
|
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next =
|
|
|
|
_elm_toolbar_smart_focus_next;
|
|
|
|
else
|
|
|
|
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next = NULL;
|
|
|
|
_access_obj_process(sd, is_access);
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
static void
|
|
|
|
_elm_toolbar_smart_set_user(Elm_Toolbar_Smart_Class *sc)
|
|
|
|
{
|
|
|
|
ELM_WIDGET_CLASS(sc)->base.add = _elm_toolbar_smart_add;
|
|
|
|
ELM_WIDGET_CLASS(sc)->base.del = _elm_toolbar_smart_del;
|
|
|
|
ELM_WIDGET_CLASS(sc)->base.move = _elm_toolbar_smart_move;
|
|
|
|
ELM_WIDGET_CLASS(sc)->base.resize = _elm_toolbar_smart_resize;
|
|
|
|
ELM_WIDGET_CLASS(sc)->base.member_add = _elm_toolbar_smart_member_add;
|
|
|
|
|
|
|
|
ELM_WIDGET_CLASS(sc)->on_focus = _elm_toolbar_smart_on_focus;
|
|
|
|
ELM_WIDGET_CLASS(sc)->event = _elm_toolbar_smart_event;
|
|
|
|
ELM_WIDGET_CLASS(sc)->theme = _elm_toolbar_smart_theme;
|
|
|
|
ELM_WIDGET_CLASS(sc)->translate = _elm_toolbar_smart_translate;
|
2012-11-08 01:20:37 -08:00
|
|
|
|
|
|
|
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
|
|
|
ELM_WIDGET_CLASS(sc)->focus_next = _elm_toolbar_smart_focus_next;
|
|
|
|
|
|
|
|
ELM_WIDGET_CLASS(sc)->access = _elm_toolbar_smart_access;
|
2012-08-30 09:45:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const Elm_Toolbar_Smart_Class *
|
|
|
|
elm_toolbar_smart_class_get(void)
|
|
|
|
{
|
|
|
|
static Elm_Toolbar_Smart_Class _sc =
|
|
|
|
ELM_TOOLBAR_SMART_CLASS_INIT_NAME_VERSION(ELM_TOOLBAR_SMART_NAME);
|
|
|
|
static const Elm_Toolbar_Smart_Class *class = NULL;
|
|
|
|
Evas_Smart_Class *esc = (Evas_Smart_Class *)&_sc;
|
|
|
|
|
|
|
|
if (class)
|
|
|
|
return class;
|
|
|
|
|
|
|
|
_elm_toolbar_smart_set(&_sc);
|
|
|
|
esc->callbacks = _smart_callbacks;
|
|
|
|
class = &_sc;
|
|
|
|
|
|
|
|
return class;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_toolbar_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
|
|
|
|
|
|
|
obj = elm_widget_add(_elm_toolbar_smart_class_new(), parent);
|
|
|
|
if (!obj) return NULL;
|
|
|
|
|
|
|
|
if (!elm_widget_sub_object_add(parent, obj))
|
|
|
|
ERR("could not add %p as sub object of %p", obj, parent);
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_icon_size_set(Evas_Object *obj,
|
|
|
|
int icon_size)
|
2009-08-25 17:30:55 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
_elm_toolbar_smart_theme(obj);
|
2009-08-25 17:30:55 -07:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI int
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_toolbar_icon_size_get(const Evas_Object *obj)
|
2009-08-25 17:47:31 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) 0;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
return sd->priv_icon_size;
|
2009-08-25 17:47:31 -07:00
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_append(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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
double scale;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
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
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
it = _item_new(obj, icon, label, func, 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
|
|
|
if (!it) return NULL;
|
2012-08-30 09:45:00 -07:00
|
|
|
scale = (elm_widget_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
|
|
|
|
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);
|
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
|
|
|
_sizing_eval(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
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
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return (Elm_Object_Item *)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
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_prepend(Evas_Object *obj,
|
|
|
|
const char *icon,
|
|
|
|
const char *label,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *data)
|
2010-10-29 11:57:55 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
double scale;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
it = _item_new(obj, icon, label, func, data);
|
2011-11-29 21:10:23 -08:00
|
|
|
if (!it) return NULL;
|
2012-08-30 09:45:00 -07:00
|
|
|
scale = (elm_widget_scale_get(obj) * elm_config_scale_get());
|
2011-11-29 21:10:23 -08:00
|
|
|
|
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);
|
2011-11-29 21:10:23 -08:00
|
|
|
_sizing_eval(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->item_count++;
|
2011-11-29 21:10:23 -08:00
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return (Elm_Object_Item *)it;
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_insert_before(Evas_Object *obj,
|
|
|
|
Elm_Object_Item *before,
|
|
|
|
const char *icon,
|
|
|
|
const char *label,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *data)
|
2010-10-29 11:57:55 -07:00
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Toolbar_Item *it, *_before;
|
2012-08-30 09:45:00 -07:00
|
|
|
double scale;
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(before, NULL);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
_before = (Elm_Toolbar_Item *)before;
|
2011-11-29 21:10:23 -08:00
|
|
|
it = _item_new(obj, icon, label, func, data);
|
|
|
|
if (!it) return NULL;
|
2012-08-30 09:45:00 -07:00
|
|
|
scale = (elm_widget_scale_get(obj) * elm_config_scale_get());
|
2010-10-29 11:57:55 -07:00
|
|
|
|
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));
|
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);
|
2011-11-29 21:10:23 -08:00
|
|
|
_sizing_eval(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->item_count++;
|
2011-11-29 21:10:23 -08:00
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return (Elm_Object_Item *)it;
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_insert_after(Evas_Object *obj,
|
|
|
|
Elm_Object_Item *after,
|
|
|
|
const char *icon,
|
|
|
|
const char *label,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *data)
|
2010-10-29 11:57:55 -07:00
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Toolbar_Item *it, *_after;
|
2012-08-30 09:45:00 -07:00
|
|
|
double scale;
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(after, NULL);
|
|
|
|
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
_after = (Elm_Toolbar_Item *)after;
|
2011-11-29 21:10:23 -08:00
|
|
|
it = _item_new(obj, icon, label, func, data);
|
|
|
|
if (!it) return NULL;
|
2012-08-30 09:45:00 -07:00
|
|
|
scale = (elm_widget_scale_get(obj) * elm_config_scale_get());
|
2010-10-29 11:57:55 -07:00
|
|
|
|
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));
|
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);
|
2011-11-29 21:10:23 -08:00
|
|
|
_sizing_eval(obj);
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->item_count++;
|
2011-11-29 21:10:23 -08:00
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return (Elm_Object_Item *)it;
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_toolbar_first_item_get(const Evas_Object *obj)
|
2010-10-29 11:57:55 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->items) return NULL;
|
|
|
|
return (Elm_Object_Item *)ELM_TOOLBAR_ITEM_FROM_INLIST(sd->items);
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_toolbar_last_item_get(const Evas_Object *obj)
|
2010-10-29 11:57:55 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->items) return NULL;
|
|
|
|
|
|
|
|
return (Elm_Object_Item *)ELM_TOOLBAR_ITEM_FROM_INLIST(sd->items->last);
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_toolbar_item_next_get(const Elm_Object_Item *it)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
|
|
|
return (Elm_Object_Item *)ELM_TOOLBAR_ITEM_FROM_INLIST(
|
|
|
|
EINA_INLIST_GET(((Elm_Toolbar_Item *)it))->next);
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
2010-10-29 11:57:55 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_toolbar_item_prev_get(const Elm_Object_Item *it)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
|
|
|
return (Elm_Object_Item *)ELM_TOOLBAR_ITEM_FROM_INLIST(
|
|
|
|
EINA_INLIST_GET(((Elm_Toolbar_Item *)it))->prev);
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
2010-10-29 11:57:55 -07: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
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_priority_set(Elm_Object_Item *it,
|
|
|
|
int 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
|
|
|
{
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2011-04-01 04:20:18 -07:00
|
|
|
if (item->prio.priority == priority) return;
|
|
|
|
item->prio.priority = priority;
|
2012-08-30 09:45:00 -07:00
|
|
|
_resize_cb(WIDGET(item), 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
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
2011-11-29 21:10:23 -08:00
|
|
|
elm_toolbar_item_priority_get(const Elm_Object_Item *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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, 0);
|
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return ((Elm_Toolbar_Item *)it)->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
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_find_by_label(const Evas_Object *obj,
|
|
|
|
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
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
|
|
|
if (!strcmp(it->label, label))
|
2012-03-06 03:51:42 -08:00
|
|
|
return (Elm_Object_Item *)it;
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_selected_set(Elm_Object_Item *it,
|
|
|
|
Eina_Bool selected)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it);
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
if (item->selected == selected) return;
|
|
|
|
if (selected) _item_select(item);
|
|
|
|
else _item_unselect(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_item_selected_get(const Elm_Object_Item *it)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return ((Elm_Toolbar_Item *)it)->selected;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_toolbar_selected_item_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
return (Elm_Object_Item *)sd->selected_item;
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
2012-05-21 22:18:12 -07:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_toolbar_more_item_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
return (Elm_Object_Item *)sd->more_item;
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
|
2010-10-29 11:40:59 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_icon_set(Elm_Object_Item *it,
|
|
|
|
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;
|
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it);
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI const char *
|
|
|
|
elm_toolbar_item_icon_get(const Elm_Object_Item *it)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return ((Elm_Toolbar_Item *)it)->icon_str;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_toolbar_item_object_get(const Elm_Object_Item *it)
|
|
|
|
{
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)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);
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
return VIEW(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_toolbar_item_icon_object_get(Elm_Object_Item *it)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return ((Elm_Toolbar_Item *)it)->icon;
|
2011-11-29 21:10:23 -08:00
|
|
|
}
|
|
|
|
|
2011-09-28 16:07:18 -07:00
|
|
|
EAPI Eina_Bool
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_icon_memfile_set(Elm_Object_Item *it,
|
|
|
|
const void *img,
|
|
|
|
size_t size,
|
|
|
|
const char *format,
|
|
|
|
const char *key)
|
2011-09-28 16:07:18 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
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
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_icon_file_set(Elm_Object_Item *it,
|
|
|
|
const char *file,
|
|
|
|
const char *key)
|
2011-12-01 11:14:48 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
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
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, 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;
|
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_separator_set(Elm_Object_Item *it,
|
|
|
|
Eina_Bool separator)
|
2009-08-30 09:54:15 -07:00
|
|
|
{
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
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
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
2009-08-30 09:54:15 -07:00
|
|
|
if (item->separator == separator) return;
|
|
|
|
item->separator = separator;
|
2012-08-30 09:45:00 -07:00
|
|
|
scale = (elm_widget_scale_get(obj) * elm_config_scale_get());
|
|
|
|
_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
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI Eina_Bool
|
2011-11-29 21:10:23 -08:00
|
|
|
elm_toolbar_item_separator_get(const Elm_Object_Item *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);
|
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return ((Elm_Toolbar_Item *)it)->separator;
|
2009-08-30 09:54:15 -07:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_shrink_mode_set(Evas_Object *obj,
|
|
|
|
Elm_Toolbar_Shrink_Mode shrink_mode)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
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
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
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);
|
|
|
|
sd->s_iface->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
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_widget_item_del(sd->more_item);
|
|
|
|
sd->more_item = 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
|
|
|
}
|
|
|
|
|
|
|
|
if (shrink_mode == ELM_TOOLBAR_SHRINK_MENU)
|
|
|
|
{
|
2012-08-06 05:17:02 -07:00
|
|
|
elm_toolbar_homogeneous_set(obj, EINA_FALSE);
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->s_iface->policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
|
|
|
sd->more_item = _item_new(obj, "more_menu", "More", 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
|
|
|
}
|
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);
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->s_iface->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);
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->s_iface->policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
|
|
|
|
sd->more_item = _item_new(obj, "more_menu", "More", NULL, NULL);
|
2012-05-21 22:18:12 -07: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
|
2012-08-30 09:45:00 -07:00
|
|
|
sd->s_iface->policy_set
|
|
|
|
(obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
2009-09-30 03:53:08 -07: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
|
|
|
EAPI Elm_Toolbar_Shrink_Mode
|
2012-01-05 22:42:10 -08:00
|
|
|
elm_toolbar_shrink_mode_get(const Evas_Object *obj)
|
2010-04-26 22:43:54 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) ELM_TOOLBAR_SHRINK_NONE;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2010-04-26 22:43:54 -07:00
|
|
|
|
2012-08-30 09:45:00 -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;
|
|
|
|
}
|
|
|
|
|
2009-09-30 03:53:08 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_homogeneous_set(Evas_Object *obj,
|
|
|
|
Eina_Bool homogeneous)
|
2009-09-30 03:53:08 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
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
|
|
|
}
|
|
|
|
|
2010-04-26 22:43:54 -07:00
|
|
|
EAPI Eina_Bool
|
2011-05-03 21:53:39 -07:00
|
|
|
elm_toolbar_homogeneous_get(const Evas_Object *obj)
|
2010-04-26 22:43:54 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) EINA_FALSE;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2010-04-26 22:43:54 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
return sd->homogeneous;
|
2010-04-26 22:43:54 -07:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_menu_parent_set(Evas_Object *obj,
|
|
|
|
Evas_Object *parent)
|
2009-10-06 08:08:41 -07:00
|
|
|
{
|
2009-10-18 10:20:18 -07:00
|
|
|
Elm_Toolbar_Item *it;
|
2009-10-07 10:11:41 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
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
|
|
|
}
|
|
|
|
|
2010-04-26 22:43:54 -07:00
|
|
|
EAPI Evas_Object *
|
2010-10-14 11:18:34 -07:00
|
|
|
elm_toolbar_menu_parent_get(const Evas_Object *obj)
|
2010-04-26 22:43:54 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) NULL;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2010-04-26 22:43:54 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
return sd->menu_parent;
|
2010-04-26 22:43:54 -07:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_align_set(Evas_Object *obj,
|
|
|
|
double align)
|
2009-10-06 13:14:46 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2009-10-06 13:14:46 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->vertical)
|
2012-02-22 04:13:12 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
if (sd->align != align)
|
|
|
|
evas_object_size_hint_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)
|
|
|
|
evas_object_size_hint_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
|
|
|
}
|
|
|
|
|
2010-03-30 13:42:01 -07:00
|
|
|
EAPI double
|
|
|
|
elm_toolbar_align_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) 0.0;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2010-03-30 13:42:01 -07:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
return sd->align;
|
2010-03-30 13:42:01 -07:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_menu_set(Elm_Object_Item *it,
|
|
|
|
Eina_Bool menu)
|
2009-10-06 08:08:41 -07:00
|
|
|
{
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_toolbar_item_menu_get(const 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
|
|
|
{
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Toolbar_Item_State *
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_state_add(Elm_Object_Item *it,
|
|
|
|
const char *icon,
|
|
|
|
const char *label,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *data)
|
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
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
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
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
obj = WIDGET(item);
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
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,
|
|
|
|
item->base.data);
|
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);
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_icon_order_lookup_set(icon_obj, sd->lookup_order);
|
2011-11-29 21:10:23 -08:00
|
|
|
if (!icon_obj) goto error_state_add;
|
|
|
|
|
|
|
|
if (!_item_icon_set(icon_obj, "toolbar/", icon))
|
|
|
|
{
|
|
|
|
evas_object_del(icon_obj);
|
|
|
|
icon_obj = NULL;
|
|
|
|
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;
|
|
|
|
item->base.data = NULL;
|
|
|
|
|
|
|
|
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));
|
|
|
|
eina_list_free(item->states);
|
|
|
|
item->states = NULL;
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Eina_Bool
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_state_del(Elm_Object_Item *it,
|
|
|
|
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;
|
|
|
|
Elm_Toolbar_Item *item;
|
2012-08-30 09:45:00 -07:00
|
|
|
Eina_List *del_state;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
2011-11-29 21:10:23 -08:00
|
|
|
|
|
|
|
if (!state) return EINA_FALSE;
|
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
item = (Elm_Toolbar_Item *)it;
|
2011-11-29 21:10:23 -08:00
|
|
|
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)
|
|
|
|
elm_toolbar_item_state_unset(it);
|
|
|
|
|
|
|
|
eina_stringshare_del(state->label);
|
|
|
|
eina_stringshare_del(state->icon_str);
|
|
|
|
if (state->icon) evas_object_del(state->icon);
|
|
|
|
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);
|
|
|
|
item->base.data = it_state->data;
|
|
|
|
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));
|
|
|
|
eina_list_free(item->states);
|
|
|
|
item->states = NULL;
|
|
|
|
}
|
2012-08-30 09:45:00 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_item_state_set(Elm_Object_Item *it,
|
|
|
|
Elm_Toolbar_Item_State *state)
|
2011-11-29 21:10:23 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
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
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, 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
|
|
|
}
|
2011-12-08 05:53:38 -08:00
|
|
|
if (elm_widget_item_disabled_get(item))
|
2011-11-29 21:10:23 -08:00
|
|
|
elm_widget_signal_emit(item->icon, "elm,state,disabled", "elm");
|
|
|
|
else
|
|
|
|
elm_widget_signal_emit(item->icon, "elm,state,enabled", "elm");
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
elm_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
|
|
|
}
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
EAPI Elm_Toolbar_Item_State *
|
|
|
|
elm_toolbar_item_state_get(const 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
|
|
|
{
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)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);
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item_State *
|
|
|
|
elm_toolbar_item_state_next(Elm_Object_Item *it)
|
|
|
|
{
|
|
|
|
Eina_List *next_state;
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)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);
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item_State *
|
|
|
|
elm_toolbar_item_state_prev(Elm_Object_Item *it)
|
|
|
|
{
|
|
|
|
Eina_List *prev_state;
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)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);
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
if (!item->states) return NULL;
|
|
|
|
|
|
|
|
prev_state = eina_list_prev(item->current_state);
|
|
|
|
if ((!prev_state) || (prev_state == item->states))
|
|
|
|
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
|
|
|
|
2010-11-08 11:58:46 -08:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_icon_order_lookup_set(Evas_Object *obj,
|
|
|
|
Elm_Icon_Lookup_Order order)
|
2010-11-08 11:58:46 -08:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it;
|
2012-08-30 09:45:00 -07:00
|
|
|
|
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->lookup_order == order) return;
|
|
|
|
sd->lookup_order = order;
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
elm_icon_order_lookup_set(it->icon, order);
|
|
|
|
if (sd->more_item)
|
|
|
|
elm_icon_order_lookup_set(sd->more_item->icon, order);
|
2010-11-08 11:58:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Icon_Lookup_Order
|
|
|
|
elm_toolbar_icon_order_lookup_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) ELM_ICON_LOOKUP_THEME_FDO;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
return sd->lookup_order;
|
2010-11-08 11:58:46 -08:00
|
|
|
}
|
2011-08-06 20:42:28 -07:00
|
|
|
|
2011-10-31 07:36:49 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_horizontal_set(Evas_Object *obj,
|
|
|
|
Eina_Bool horizontal)
|
2011-08-06 20:42:28 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
2012-08-06 05:17:02 -07:00
|
|
|
horizontal = !!horizontal;
|
2012-08-30 09:45:00 -07:00
|
|
|
if (!horizontal == sd->vertical) return;
|
|
|
|
sd->vertical = !horizontal;
|
|
|
|
if (sd->vertical)
|
|
|
|
evas_object_size_hint_align_set(sd->bx, 0.5, sd->align);
|
2012-02-22 04:13:12 -08:00
|
|
|
else
|
2012-08-30 09:45:00 -07:00
|
|
|
evas_object_size_hint_align_set(sd->bx, sd->align, 0.5);
|
|
|
|
|
2011-08-06 20:42:28 -07:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2011-10-31 07:36:49 -07:00
|
|
|
elm_toolbar_horizontal_get(const Evas_Object *obj)
|
2011-08-06 20:42:28 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) EINA_FALSE;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
return !sd->vertical;
|
2011-08-06 20:42:28 -07:00
|
|
|
}
|
2011-12-29 15:05:26 -08:00
|
|
|
|
|
|
|
EAPI unsigned int
|
|
|
|
elm_toolbar_items_count(const Evas_Object *obj)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) 0;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
return sd->item_count;
|
2011-12-29 15:05:26 -08:00
|
|
|
}
|
2012-01-05 22:42:10 -08:00
|
|
|
|
2012-05-21 22:18:12 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_standard_priority_set(Evas_Object *obj,
|
|
|
|
int priority)
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->standard_priority == priority) return;
|
|
|
|
sd->standard_priority = priority;
|
|
|
|
_resize_cb(obj, NULL, NULL, NULL);
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
|
2012-06-07 00:32:55 -07:00
|
|
|
EAPI int
|
|
|
|
elm_toolbar_standard_priority_get(const Evas_Object *obj)
|
2012-05-21 22:18:12 -07:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) 0;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
return sd->standard_priority;
|
2012-05-21 22:18:12 -07:00
|
|
|
}
|
|
|
|
|
2012-03-07 05:23:22 -08:00
|
|
|
EAPI void
|
2012-08-30 09:45:00 -07:00
|
|
|
elm_toolbar_select_mode_set(Evas_Object *obj,
|
|
|
|
Elm_Object_Select_Mode mode)
|
2012-03-07 05:23:22 -08:00
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj);
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
|
|
|
|
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;
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
if (sd->select_mode != mode)
|
|
|
|
sd->select_mode = mode;
|
2012-03-07 05:23:22 -08:00
|
|
|
}
|
|
|
|
|
2012-03-07 08:01:37 -08:00
|
|
|
EAPI Elm_Object_Select_Mode
|
2012-03-07 05:23:22 -08:00
|
|
|
elm_toolbar_select_mode_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-08-30 09:45:00 -07:00
|
|
|
ELM_TOOLBAR_CHECK(obj) ELM_OBJECT_SELECT_MODE_MAX;
|
|
|
|
ELM_TOOLBAR_DATA_GET(obj, sd);
|
2012-03-07 05:23:22 -08:00
|
|
|
|
2012-08-30 09:45:00 -07:00
|
|
|
return sd->select_mode;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_show(Elm_Object_Item *it)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h, bx, by;
|
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->bx, &bx, &by, NULL, NULL);
|
|
|
|
evas_object_geometry_get(VIEW(item), &x, &y, &w, &h);
|
|
|
|
x = x - bx;
|
|
|
|
y = y - by;
|
|
|
|
sd->s_iface->content_region_show(WIDGET(item), x, y, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_bring_in(Elm_Object_Item *it)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h, bx, by;
|
|
|
|
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
|
|
|
|
|
|
|
|
ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->bx, &bx, &by, NULL, NULL);
|
|
|
|
evas_object_geometry_get(VIEW(item), &x, &y, &w, &h);
|
|
|
|
x = x - bx;
|
|
|
|
y = y - by;
|
|
|
|
sd->s_iface->region_bring_in(WIDGET(item), x, y, w, h);
|
|
|
|
}
|