2008-12-18 05:38:58 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
|
|
|
typedef struct _Widget_Data Widget_Data;
|
|
|
|
|
|
|
|
struct _Widget_Data
|
|
|
|
{
|
|
|
|
Evas_Object *scr, *bx;
|
[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
|
|
|
Evas_Object *menu_parent;
|
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
|
|
|
Eina_Inlist *items;
|
|
|
|
Elm_Toolbar_Item *more_item, *selected_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
|
|
|
Elm_Toolbar_Shrink_Mode shrink_mode;
|
2010-11-08 11:58:46 -08:00
|
|
|
Elm_Icon_Lookup_Order lookup_order;
|
2008-12-18 05:38:58 -08:00
|
|
|
int icon_size;
|
2009-10-06 13:14:46 -07:00
|
|
|
double align;
|
[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
|
|
|
Eina_Bool homogeneous : 1;
|
2010-11-05 11:23:15 -07:00
|
|
|
Eina_Bool no_select : 1;
|
2011-09-29 16:46:55 -07:00
|
|
|
Eina_Bool always_select : 1;
|
2011-08-06 20:42:28 -07:00
|
|
|
Eina_Bool vertical : 1;
|
2010-11-11 10:05:36 -08:00
|
|
|
Ecore_Job *resize_job;
|
2008-12-18 05:38:58 -08:00
|
|
|
};
|
|
|
|
|
2009-02-25 07:54:26 -08:00
|
|
|
struct _Elm_Toolbar_Item
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2010-09-09 19:05:45 -07:00
|
|
|
Elm_Widget_Item base;
|
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
|
|
|
EINA_INLIST;
|
2008-12-18 05:38:58 -08:00
|
|
|
const char *label;
|
2010-10-14 08:27:31 -07:00
|
|
|
const char *icon_str;
|
2008-12-18 05:38:58 -08:00
|
|
|
Evas_Object *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
|
|
|
Evas_Object *o_menu;
|
2010-03-16 08:31:38 -07:00
|
|
|
Evas_Smart_Cb func;
|
[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
|
|
|
struct {
|
|
|
|
int priority;
|
|
|
|
Eina_Bool visible : 1;
|
|
|
|
} prio;
|
2009-06-17 08:35:19 -07:00
|
|
|
Eina_Bool selected : 1;
|
2009-08-25 15:46:19 -07:00
|
|
|
Eina_Bool disabled : 1;
|
2009-08-30 09:54:15 -07:00
|
|
|
Eina_Bool separator : 1;
|
2010-08-04 12:20:52 -07:00
|
|
|
Eina_Bool menu : 1;
|
2010-10-29 11:57:55 -07:00
|
|
|
Eina_List *states;
|
|
|
|
Eina_List *current_state;
|
2008-12-18 05:38:58 -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
|
|
|
#define ELM_TOOLBAR_ITEM_FROM_INLIST(item) \
|
|
|
|
((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Toolbar_Item) : NULL)
|
|
|
|
|
2010-10-29 11:57:55 -07:00
|
|
|
struct _Elm_Toolbar_Item_State
|
|
|
|
{
|
|
|
|
const char *label;
|
|
|
|
const char *icon_str;
|
|
|
|
Evas_Object *icon;
|
|
|
|
Evas_Smart_Cb func;
|
|
|
|
const void *data;
|
|
|
|
};
|
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
static const char *widtype = NULL;
|
2009-08-25 15:46:19 -07:00
|
|
|
static void _item_show(Elm_Toolbar_Item *it);
|
|
|
|
static void _item_select(Elm_Toolbar_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
|
|
|
static void _item_unselect(Elm_Toolbar_Item *it);
|
2009-08-25 15:46:19 -07:00
|
|
|
static void _item_disable(Elm_Toolbar_Item *it, Eina_Bool disabled);
|
2009-11-14 17:52:40 -08:00
|
|
|
static void _del_pre_hook(Evas_Object *obj);
|
2008-12-18 05:38:58 -08:00
|
|
|
static void _del_hook(Evas_Object *obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
static void _mirrored_set(Evas_Object *obj, Eina_Bool mirrored);
|
|
|
|
static void _mirrored_set_item(Evas_Object *obj, Elm_Toolbar_Item *it, Eina_Bool mirrored);
|
2008-12-18 05:38:58 -08:00
|
|
|
static void _theme_hook(Evas_Object *obj);
|
|
|
|
static void _sizing_eval(Evas_Object *obj);
|
2009-11-14 17:52:40 -08:00
|
|
|
static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
2009-10-06 08:08:41 -07:00
|
|
|
static void _menu_move_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
2009-10-11 06:37:01 -07:00
|
|
|
static void _menu_hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
2009-11-14 17:52:40 -08:00
|
|
|
static void _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data);
|
2010-11-05 11:23:59 -07:00
|
|
|
static void _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 *signal);
|
|
|
|
static void _item_label_set(Elm_Toolbar_Item *item, const char *label, const char *signal);
|
2009-10-06 08:08:41 -07:00
|
|
|
|
2011-04-21 17:42:32 -07:00
|
|
|
static const char SIG_CLICKED[] = "clicked";
|
|
|
|
|
|
|
|
static const Evas_Smart_Cb_Description _signals[] = {
|
|
|
|
{SIG_CLICKED, ""},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-10-14 08:27:31 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_item_icon_set(Evas_Object *icon_obj, const char *type, const char *icon)
|
|
|
|
{
|
|
|
|
char icon_str[512];
|
|
|
|
|
2010-10-22 14:41:22 -07:00
|
|
|
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)))
|
2010-10-14 08:27:31 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-11-08 11:59:22 -08:00
|
|
|
static int
|
|
|
|
_elm_toolbar_icon_size_get(Widget_Data *wd)
|
|
|
|
{
|
|
|
|
const char *icon_size = edje_object_data_get(
|
|
|
|
elm_smart_scroller_edje_object_get(wd->scr), "icon_size");
|
|
|
|
if (icon_size)
|
2011-04-01 04:20:18 -07:00
|
|
|
return atoi(icon_size);
|
2010-11-08 11:59:22 -08:00
|
|
|
return _elm_config->icon_size;
|
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2009-02-25 07:54:26 -08:00
|
|
|
_item_show(Elm_Toolbar_Item *it)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2010-09-09 19:05:45 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(it->base.widget);
|
2008-12-18 05:38:58 -08:00
|
|
|
Evas_Coord x, y, w, h, bx, by;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return;
|
2008-12-18 05:38:58 -08:00
|
|
|
evas_object_geometry_get(wd->bx, &bx, &by, NULL, NULL);
|
2010-09-09 19:05:45 -07:00
|
|
|
evas_object_geometry_get(it->base.view, &x, &y, &w, &h);
|
2008-12-18 05:38:58 -08:00
|
|
|
elm_smart_scroller_child_region_show(wd->scr, x - bx, y - by, w, h);
|
|
|
|
}
|
|
|
|
|
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 void
|
|
|
|
_item_unselect(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
Widget_Data *wd;
|
|
|
|
if ((!item) || (!item->selected)) return;
|
|
|
|
wd = elm_widget_data_get(item->base.widget);
|
|
|
|
if (!wd) return;
|
|
|
|
item->selected = EINA_FALSE;
|
|
|
|
wd->selected_item = NULL;
|
|
|
|
edje_object_signal_emit(item->base.view, "elm,state,unselected", "elm");
|
2010-11-23 04:57:00 -08:00
|
|
|
elm_widget_signal_emit(item->icon, "elm,state,unselected", "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
|
|
|
}
|
|
|
|
|
2008-12-18 20:26:24 -08:00
|
|
|
static void
|
2009-02-25 07:54:26 -08:00
|
|
|
_item_select(Elm_Toolbar_Item *it)
|
2008-12-18 20:26:24 -08:00
|
|
|
{
|
2009-02-25 07:54:26 -08:00
|
|
|
Elm_Toolbar_Item *it2;
|
2010-09-09 19:05:45 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(it->base.widget);
|
2010-03-09 03:42:53 -08:00
|
|
|
Evas_Object *obj2;
|
2011-09-11 19:05:30 -07:00
|
|
|
Eina_Bool sel;
|
2009-08-25 15:46:19 -07:00
|
|
|
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return;
|
2011-09-11 19:05:30 -07:00
|
|
|
if ((it->disabled) || (it->separator)) return;
|
|
|
|
sel = it->selected;
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
|
2010-11-05 11:23:15 -07:00
|
|
|
if (!wd->no_select)
|
|
|
|
{
|
2011-09-29 16:46:55 -07:00
|
|
|
if (sel)
|
|
|
|
{
|
|
|
|
if (wd->always_select) return;
|
|
|
|
_item_unselect(it);
|
|
|
|
}
|
2011-09-11 19:05:30 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
it2 = elm_toolbar_selected_item_get(it->base.widget);
|
|
|
|
_item_unselect(it2);
|
|
|
|
|
|
|
|
it->selected = EINA_TRUE;
|
|
|
|
wd->selected_item = it;
|
|
|
|
edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
|
|
|
|
_item_show(it);
|
|
|
|
}
|
2010-11-05 11:23:15 -07:00
|
|
|
}
|
2010-09-09 19:05:45 -07:00
|
|
|
obj2 = it->base.widget;
|
2011-09-11 19:05:30 -07:00
|
|
|
if (it->menu && (!sel))
|
2009-10-18 10:20:18 -07:00
|
|
|
{
|
|
|
|
evas_object_show(it->o_menu);
|
2010-09-09 19:05:45 -07:00
|
|
|
evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_RESIZE,
|
2009-10-18 10:20:18 -07:00
|
|
|
_menu_move_resize, it);
|
2010-09-09 19:05:45 -07:00
|
|
|
evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOVE,
|
2009-10-18 10:20:18 -07:00
|
|
|
_menu_move_resize, it);
|
2009-10-07 10:11:41 -07:00
|
|
|
|
2009-10-18 10:20:18 -07:00
|
|
|
_menu_move_resize(it, NULL, NULL, NULL);
|
|
|
|
}
|
2010-09-09 19:05:45 -07:00
|
|
|
if (it->func) it->func((void *)(it->base.data), it->base.widget, it);
|
2011-04-21 17:42:32 -07:00
|
|
|
evas_object_smart_callback_call(obj2, SIG_CLICKED, it);
|
2008-12-18 20:26:24 -08:00
|
|
|
}
|
|
|
|
|
2009-10-06 08:08:41 -07:00
|
|
|
static void
|
2010-03-09 09:51:30 -08: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;
|
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
|
|
|
selected = elm_toolbar_selected_item_get(it->base.widget);
|
|
|
|
_item_unselect(selected);
|
2009-10-06 08:08:41 -07:00
|
|
|
}
|
|
|
|
|
2009-11-13 14:22:05 -08:00
|
|
|
static void
|
2010-03-09 09:51:30 -08: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
|
2011-04-01 04:20:18 -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
|
2010-03-09 09:51:30 -08:00
|
|
|
_menu_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-10-06 13:14:46 -07:00
|
|
|
{
|
2011-04-01 04:20:18 -07:00
|
|
|
Elm_Toolbar_Item *it = data;
|
|
|
|
Evas_Coord x,y,w,h;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(it->base.widget);
|
2009-10-18 10:20:18 -07:00
|
|
|
|
2011-04-01 04:20:18 -07:00
|
|
|
if ((!wd) || (!wd->menu_parent)) return;
|
|
|
|
evas_object_geometry_get(it->base.view, &x, &y, &w, &h);
|
|
|
|
elm_menu_move(it->o_menu, x, y+h);
|
2009-10-06 08:08:41 -07:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
static void
|
2009-08-25 15:46:19 -07:00
|
|
|
_item_disable(Elm_Toolbar_Item *it, Eina_Bool disabled)
|
|
|
|
{
|
2010-09-09 19:05:45 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(it->base.widget);
|
2009-08-25 15:46:19 -07:00
|
|
|
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return;
|
2009-08-25 15:46:19 -07:00
|
|
|
if (it->disabled == disabled) return;
|
2011-04-27 09:06:11 -07:00
|
|
|
it->disabled = !!disabled;
|
2009-10-06 13:14:46 -07:00
|
|
|
if (it->disabled)
|
2010-10-29 11:42:01 -07:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,disabled", "elm");
|
|
|
|
}
|
2009-08-25 15:46:19 -07:00
|
|
|
else
|
2010-10-29 11:42:01 -07:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,enabled", "elm");
|
|
|
|
}
|
2009-08-25 15:46:19 -07:00
|
|
|
}
|
|
|
|
|
2010-11-09 13:21:46 -08:00
|
|
|
static void
|
|
|
|
_item_del(Elm_Toolbar_Item *it)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item_State *it_state;
|
2011-01-27 14:14:32 -08:00
|
|
|
_item_unselect(it);
|
2010-11-09 13:21:46 -08:00
|
|
|
elm_widget_item_pre_notify_del(it);
|
|
|
|
EINA_LIST_FREE(it->states, it_state)
|
|
|
|
{
|
|
|
|
if (it->icon == it_state->icon)
|
2011-04-01 04:20:18 -07:00
|
|
|
it->icon = NULL;
|
2010-11-09 13:21:46 -08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
eina_stringshare_del(it->label);
|
|
|
|
eina_stringshare_del(it->icon_str);
|
|
|
|
if (it->icon) evas_object_del(it->icon);
|
|
|
|
//TODO: See if checking for wd->menu_parent is necessary before deleting menu
|
|
|
|
if (it->o_menu) evas_object_del(it->o_menu);
|
|
|
|
elm_widget_item_del(it);
|
|
|
|
}
|
|
|
|
|
2009-10-18 10:20:18 -07:00
|
|
|
static void
|
2009-10-15 13:48:00 -07:00
|
|
|
_del_pre_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
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 *it, *next;
|
2009-10-15 13:48:00 -07:00
|
|
|
|
|
|
|
if (!wd) return;
|
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_TOOLBAR_ITEM_FROM_INLIST(wd->items);
|
|
|
|
while(it)
|
2009-11-13 14:22:05 -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
|
|
|
next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
2010-11-09 13:21:46 -08:00
|
|
|
_item_del(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
|
|
|
it = next;
|
2009-11-13 14:22:05 -08:00
|
|
|
}
|
2010-11-09 13:21:46 -08:00
|
|
|
if (wd->more_item)
|
2011-04-01 04:20:18 -07:00
|
|
|
_item_del(wd->more_item);
|
2009-10-15 13:48:00 -07:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
|
|
|
_del_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-08-25 15:46:19 -07:00
|
|
|
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return;
|
2008-12-18 05:38:58 -08:00
|
|
|
free(wd);
|
|
|
|
}
|
|
|
|
|
2010-11-09 13:21:46 -08:00
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
|
|
|
_mirrored_set_item(Evas_Object *obj __UNUSED__, Elm_Toolbar_Item *it, Eina_Bool mirrored)
|
|
|
|
{
|
|
|
|
edje_object_mirrored_set(it->base.view, mirrored);
|
|
|
|
elm_widget_mirrored_set(it->o_menu, mirrored);
|
|
|
|
}
|
|
|
|
|
2010-11-09 13:21:46 -08:00
|
|
|
static void
|
|
|
|
_theme_hook_item(Evas_Object *obj, Elm_Toolbar_Item *it, double scale, int icon_size)
|
|
|
|
{
|
|
|
|
Evas_Object *view = it->base.view;
|
|
|
|
Evas_Coord mw, mh;
|
|
|
|
const char *style = elm_widget_style_get(obj);
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set_item(obj, it, elm_widget_mirrored_get(obj));
|
2010-11-09 13:21:46 -08:00
|
|
|
edje_object_scale_set(view, scale);
|
|
|
|
if (!it->separator)
|
|
|
|
{
|
|
|
|
_elm_theme_object_set(obj, view, "toolbar", "item", style);
|
|
|
|
if (it->selected)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(view, "elm,state,selected", "elm");
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
|
|
|
|
}
|
|
|
|
if (it->disabled)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(view, "elm,state,disabled", "elm");
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,disabled", "elm");
|
|
|
|
}
|
|
|
|
if (it->icon)
|
|
|
|
{
|
|
|
|
int ms = 0;
|
|
|
|
|
|
|
|
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_part_text_set(view, "elm.text", it->label);
|
|
|
|
}
|
|
|
|
else
|
2011-04-01 04:20:18 -07:00
|
|
|
_elm_theme_object_set(obj, view, "toolbar", "separator", style);
|
2010-11-09 13:21:46 -08:00
|
|
|
|
|
|
|
mw = mh = -1;
|
|
|
|
if (!it->separator)
|
2011-04-01 04:20:18 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2010-11-09 13:21:46 -08:00
|
|
|
edje_object_size_min_restricted_calc(view, &mw, &mh, mw, mh);
|
|
|
|
if (!it->separator)
|
2011-04-01 04:20:18 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2010-11-09 13:21:46 -08:00
|
|
|
evas_object_size_hint_min_set(view, mw, mh);
|
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
|
|
|
_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(wd->items, it)
|
|
|
|
_mirrored_set_item(obj, it, mirrored);
|
|
|
|
if (wd->more_item)
|
2011-04-01 04:20:18 -07:00
|
|
|
_mirrored_set_item(obj, wd->more_item, mirrored);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
|
|
|
_theme_hook(Evas_Object *obj)
|
|
|
|
{
|
2008-12-18 20:26:24 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-02-25 07:54:26 -08:00
|
|
|
Elm_Toolbar_Item *it;
|
2010-05-11 18:03:46 -07:00
|
|
|
double scale = 0;
|
2009-04-22 21:03:27 -07:00
|
|
|
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return;
|
2011-02-09 08:14:02 -08:00
|
|
|
_elm_widget_mirrored_reload(obj);
|
2010-05-11 18:03:46 -07:00
|
|
|
elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", elm_widget_style_get(obj));
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
2009-08-30 09:54:15 -07:00
|
|
|
scale = (elm_widget_scale_get(obj) * _elm_config->scale);
|
2010-11-05 02:43:13 -07:00
|
|
|
edje_object_scale_set(wd->scr, scale);
|
2010-11-08 11:59:22 -08:00
|
|
|
wd->icon_size = _elm_toolbar_icon_size_get(wd);
|
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
|
|
|
EINA_INLIST_FOREACH(wd->items, it)
|
2010-11-09 13:21:46 -08:00
|
|
|
_theme_hook_item(obj, it, scale, wd->icon_size);
|
|
|
|
if (wd->more_item)
|
2011-04-01 04:20:18 -07:00
|
|
|
_theme_hook_item(obj, wd->more_item, scale, wd->icon_size);
|
2008-12-18 05:38:58 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-08-06 20:42:28 -07:00
|
|
|
Evas_Coord minw = -1, minh = -1, minw_bx, minh_bx;
|
2008-12-18 05:38:58 -08:00
|
|
|
Evas_Coord vw = 0, vh = 0;
|
2009-09-30 04:26:26 -07:00
|
|
|
Evas_Coord w, h;
|
2008-12-18 05:38:58 -08:00
|
|
|
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return;
|
2009-10-02 12:22:40 -07:00
|
|
|
evas_object_smart_calculate(wd->bx);
|
2009-10-06 13:14:46 -07:00
|
|
|
edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
|
2009-08-30 09:33:03 -07:00
|
|
|
&minw, &minh);
|
2009-09-30 04:26:26 -07:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
2009-10-18 10:20:18 -07:00
|
|
|
if (w < minw) w = minw;
|
|
|
|
if (h < minh) h = minh;
|
2009-09-30 04:26:26 -07:00
|
|
|
evas_object_resize(wd->scr, w, h);
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
evas_object_size_hint_min_get(wd->bx, &minw, &minh);
|
2010-11-11 10:05:36 -08:00
|
|
|
minw_bx = minw;
|
2011-08-06 20:42:28 -07:00
|
|
|
minh_bx = minh;
|
|
|
|
if (wd->vertical && (h > minh)) minh = h;
|
|
|
|
if ((!wd->vertical) && (w > minw)) minw = w;
|
2008-12-18 05:38:58 -08:00
|
|
|
evas_object_resize(wd->bx, minw, minh);
|
|
|
|
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &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
|
|
|
switch (wd->shrink_mode)
|
|
|
|
{
|
2011-04-01 04:20:18 -07:00
|
|
|
case ELM_TOOLBAR_SHRINK_MENU: /* fallthrough */
|
|
|
|
case ELM_TOOLBAR_SHRINK_HIDE: /* fallthrough */
|
2011-08-06 20:42:28 -07:00
|
|
|
case ELM_TOOLBAR_SHRINK_SCROLL:
|
|
|
|
if (wd->vertical) minh = h - vh;
|
|
|
|
else minw = w - vw;
|
|
|
|
break;
|
|
|
|
case ELM_TOOLBAR_SHRINK_NONE:
|
|
|
|
if (wd->vertical) minh = minh_bx + (h - vh);
|
|
|
|
else minw = minw_bx + (w - vw);
|
|
|
|
break;
|
[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
|
|
|
}
|
2009-11-09 18:03:52 -08:00
|
|
|
minh = minh + (h - vh);
|
2008-12-18 05:38:58 -08:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2009-11-09 18:03:52 -08:00
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
2008-12-18 05:38:58 -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
|
|
|
static void
|
|
|
|
_item_menu_create(Widget_Data *wd, Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
item->o_menu = elm_menu_add(item->base.view);
|
|
|
|
if (wd->menu_parent)
|
|
|
|
elm_menu_parent_set(item->o_menu, wd->menu_parent);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_menu_destroy(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
if (item->o_menu)
|
|
|
|
{
|
|
|
|
evas_object_del(item->o_menu);
|
|
|
|
item->o_menu = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_toolbar_item_prio_compare_cb(const void *i1, const void *i2)
|
|
|
|
{
|
|
|
|
const Elm_Toolbar_Item *eti1 = i1;
|
|
|
|
const Elm_Toolbar_Item *eti2 = i2;
|
|
|
|
|
|
|
|
if (!eti2) return 1;
|
|
|
|
if (!eti1) return -1;
|
|
|
|
|
|
|
|
return eti2->prio.priority - eti1->prio.priority;
|
|
|
|
}
|
|
|
|
|
2010-10-26 03:30:45 -07:00
|
|
|
static void
|
|
|
|
_fix_items_visibility(Widget_Data *wd, Evas_Coord *iw, Evas_Coord vw)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
Eina_List *sorted = NULL;
|
2010-11-09 13:21:46 -08:00
|
|
|
Evas_Coord ciw;
|
2010-10-26 03:30:45 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(wd->items, it)
|
|
|
|
{
|
|
|
|
sorted = eina_list_sorted_insert(sorted,
|
|
|
|
_toolbar_item_prio_compare_cb, it);
|
|
|
|
}
|
|
|
|
|
2010-11-09 13:21:46 -08:00
|
|
|
if (wd->more_item)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(wd->more_item->base.view, NULL, NULL, &ciw, NULL);
|
|
|
|
*iw += ciw;
|
|
|
|
}
|
2010-10-26 03:30:45 -07:00
|
|
|
EINA_LIST_FREE(sorted, it)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(it->base.view, NULL, NULL, &ciw, NULL);
|
|
|
|
*iw += ciw;
|
|
|
|
it->prio.visible = (*iw <= vw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-10 04:37:06 -08:00
|
|
|
static void
|
|
|
|
_elm_toolbar_item_menu_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it = data;
|
|
|
|
if (it->func) it->func((void *)(it->base.data), it->base.widget, it);
|
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2010-11-11 10:05:36 -08:00
|
|
|
_resize_job(void *data)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
2010-03-09 03:42:53 -08:00
|
|
|
Evas_Coord mw, mh, vw, vh, w, h;
|
2009-02-25 07:54:26 -08:00
|
|
|
Elm_Toolbar_Item *it;
|
2011-02-08 04:08:28 -08:00
|
|
|
Evas_Object *obj = (Evas_Object *) data;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return;
|
2010-11-11 10:05:36 -08:00
|
|
|
wd->resize_job = NULL;
|
2008-12-18 05:38:58 -08:00
|
|
|
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
|
|
|
|
evas_object_size_hint_min_get(wd->bx, &mw, &mh);
|
|
|
|
evas_object_geometry_get(wd->bx, NULL, NULL, &w, &h);
|
[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 (wd->shrink_mode == ELM_TOOLBAR_SHRINK_MENU)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2010-11-05 11:21:01 -07:00
|
|
|
Evas_Coord iw = 0, more_w;
|
2010-11-11 10:05:36 -08:00
|
|
|
|
|
|
|
evas_object_resize(wd->bx, vw, h);
|
2010-10-26 03:30:45 -07:00
|
|
|
_fix_items_visibility(wd, &iw, vw);
|
2010-11-05 11:21:01 -07:00
|
|
|
evas_object_geometry_get(wd->more_item->base.view, NULL, NULL, &more_w, NULL);
|
|
|
|
if (iw - more_w <= vw)
|
2011-04-01 04:20:18 -07:00
|
|
|
iw -= more_w;
|
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
|
|
|
|
2010-10-26 03:30:45 -07:00
|
|
|
/* All items are removed from the box object, since removing individual
|
|
|
|
* items won't trigger a resize. Items are be readded below. */
|
[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
|
|
|
evas_object_box_remove_all(wd->bx, EINA_FALSE);
|
|
|
|
if (iw > vw)
|
|
|
|
{
|
|
|
|
Evas_Object *menu;
|
|
|
|
|
|
|
|
_item_menu_destroy(wd->more_item);
|
|
|
|
_item_menu_create(wd, wd->more_item);
|
|
|
|
menu = elm_toolbar_item_menu_get(wd->more_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
|
|
|
EINA_INLIST_FOREACH(wd->items, 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
|
|
|
{
|
2011-04-01 04:20:18 -07:00
|
|
|
if (!it->prio.visible)
|
[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 (it->separator)
|
|
|
|
elm_menu_item_separator_add(menu, NULL);
|
|
|
|
else
|
|
|
|
{
|
2010-10-14 08:27:31 -07:00
|
|
|
Elm_Menu_Item *item;
|
2010-10-20 14:30:00 -07:00
|
|
|
item = elm_menu_item_add(menu, NULL, it->icon_str, it->label,
|
2010-11-10 04:37:06 -08:00
|
|
|
_elm_toolbar_item_menu_cb, 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
|
|
|
elm_menu_item_disabled_set(item, it->disabled);
|
2010-10-20 14:30:03 -07:00
|
|
|
if (it->o_menu) elm_menu_clone(it->o_menu, menu, 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
|
|
|
}
|
|
|
|
evas_object_hide(it->base.view);
|
|
|
|
}
|
2011-04-01 04:20:18 -07:00
|
|
|
else
|
[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
|
|
|
{
|
|
|
|
evas_object_box_append(wd->bx, it->base.view);
|
|
|
|
evas_object_show(it->base.view);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_box_append(wd->bx, wd->more_item->base.view);
|
|
|
|
evas_object_show(wd->more_item->base.view);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-26 03:30:45 -07:00
|
|
|
/* All items are visible, show them all (except for the "More"
|
|
|
|
* button, of course). */
|
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
|
|
|
EINA_INLIST_FOREACH(wd->items, 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-11-09 13:21:46 -08:00
|
|
|
evas_object_show(it->base.view);
|
|
|
|
evas_object_box_append(wd->bx, it->base.view);
|
[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-11-09 13:21:46 -08:00
|
|
|
evas_object_hide(wd->more_item->base.view);
|
[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 (wd->shrink_mode == ELM_TOOLBAR_SHRINK_HIDE)
|
|
|
|
{
|
|
|
|
Evas_Coord iw = 0;
|
2010-11-11 10:05:36 -08:00
|
|
|
|
|
|
|
evas_object_resize(wd->bx, vw, h);
|
2010-10-26 03:30:45 -07:00
|
|
|
_fix_items_visibility(wd, &iw, vw);
|
|
|
|
evas_object_box_remove_all(wd->bx, EINA_FALSE);
|
|
|
|
if (iw > vw)
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(wd->items, it)
|
|
|
|
{
|
2011-04-01 04:20:18 -07:00
|
|
|
if (!it->prio.visible)
|
|
|
|
evas_object_hide(it->base.view);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_box_append(wd->bx, it->base.view);
|
|
|
|
evas_object_show(it->base.view);
|
|
|
|
}
|
2010-10-26 03:30:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* All items are visible, show them all */
|
|
|
|
EINA_INLIST_FOREACH(wd->items, it)
|
|
|
|
{
|
|
|
|
evas_object_show(it->base.view);
|
|
|
|
evas_object_box_append(wd->bx, it->base.view);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
[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
|
|
|
|
{
|
2010-11-11 10:05:36 -08:00
|
|
|
if ((vw >= mw) && (w != vw)) evas_object_resize(wd->bx, vw, h);
|
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
|
|
|
EINA_INLIST_FOREACH(wd->items, 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
|
|
|
{
|
|
|
|
if (it->selected)
|
|
|
|
{
|
|
|
|
_item_show(it);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-12-18 05:38:58 -08: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
|
|
|
}
|
|
|
|
|
2010-11-11 10:05:36 -08:00
|
|
|
static void
|
|
|
|
_resize_item(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
_sizing_eval(data);
|
|
|
|
_resize(data, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
|
|
|
if (!wd->resize_job)
|
2011-04-01 04:20:18 -07:00
|
|
|
wd->resize_job = ecore_job_add(_resize_job, data);
|
2010-11-11 10:05:36 -08:00
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_select(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) ||
|
|
|
|
(_elm_access_2nd_click_timeout(it->base.view)))
|
|
|
|
{
|
|
|
|
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
|
|
|
_elm_access_say(E_("Selected"));
|
|
|
|
_item_select(it);
|
|
|
|
}
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
|
|
|
|
2010-10-29 11:42:01 -07:00
|
|
|
static void
|
|
|
|
_mouse_in(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it = data;
|
|
|
|
edje_object_signal_emit(it->base.view, "elm,state,highlighted", "elm");
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,highlighted", "elm");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_mouse_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it = data;
|
|
|
|
edje_object_signal_emit(it->base.view, "elm,state,unhighlighted", "elm");
|
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,unhighlighted", "elm");
|
|
|
|
}
|
|
|
|
|
2009-10-02 12:22:40 -07:00
|
|
|
static void
|
|
|
|
_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data)
|
|
|
|
{
|
2011-02-08 04:08:28 -08:00
|
|
|
Evas_Object *obj = (Evas_Object *) data;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2011-08-06 20:42:28 -07:00
|
|
|
_els_box_layout(o, priv, !wd->vertical, wd->homogeneous, elm_widget_mirrored_get(obj));
|
2009-10-02 12:22:40 -07:00
|
|
|
}
|
|
|
|
|
2011-08-23 23:29:13 -07:00
|
|
|
static char *
|
2011-08-24 09:13:13 -07:00
|
|
|
_access_info_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Widget_Item *item)
|
2011-08-23 23:29:13 -07:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it = (Elm_Toolbar_Item *)item;
|
2011-08-24 09:13:13 -07:00
|
|
|
const char *txt = item->access_info;
|
|
|
|
if (!txt) txt = it->label;
|
2011-08-23 23:29:13 -07:00
|
|
|
if (txt) return strdup(txt);
|
2011-08-24 09:13:13 -07:00
|
|
|
return NULL;
|
2011-08-23 23:29:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_access_state_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Widget_Item *item __UNUSED__)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it = (Elm_Toolbar_Item *)item;
|
|
|
|
if (it->separator)
|
|
|
|
return strdup(E_("Separator"));
|
|
|
|
else if (it->disabled)
|
|
|
|
return strdup(E_("State: Disabled"));
|
|
|
|
else if (it->selected)
|
|
|
|
return strdup(E_("State: Selected"));
|
|
|
|
else if (it->menu)
|
|
|
|
return strdup(E_("Has menu"));
|
|
|
|
return 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
|
|
|
static Elm_Toolbar_Item *
|
|
|
|
_item_new(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Object *icon_obj;
|
|
|
|
Evas_Coord mw, mh;
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
|
|
|
|
icon_obj = elm_icon_add(obj);
|
2010-11-08 11:58:46 -08:00
|
|
|
elm_icon_order_lookup_set(icon_obj, wd->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;
|
|
|
|
it = elm_widget_item_new(obj, Elm_Toolbar_Item);
|
|
|
|
if (!it)
|
|
|
|
{
|
|
|
|
evas_object_del(icon_obj);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
it->label = eina_stringshare_add(label);
|
|
|
|
it->prio.visible = 1;
|
|
|
|
it->prio.priority = 0;
|
|
|
|
it->func = func;
|
|
|
|
it->separator = EINA_FALSE;
|
|
|
|
it->base.data = data;
|
|
|
|
it->base.view = edje_object_add(evas_object_evas_get(obj));
|
2011-08-23 23:29:13 -07:00
|
|
|
_elm_access_item_register((Elm_Widget_Item *)it, it->base.view);
|
|
|
|
_elm_access_text_set(_elm_access_item_get((Elm_Widget_Item *)it),
|
|
|
|
ELM_ACCESS_TYPE, E_("Tool Item"));
|
|
|
|
_elm_access_callback_set(_elm_access_item_get((Elm_Widget_Item *)it),
|
|
|
|
ELM_ACCESS_INFO, _access_info_cb, it);
|
|
|
|
_elm_access_callback_set(_elm_access_item_get((Elm_Widget_Item *)it),
|
|
|
|
ELM_ACCESS_STATE, _access_state_cb, 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);
|
|
|
|
}
|
|
|
|
|
|
|
|
_elm_theme_object_set(obj, it->base.view, "toolbar", "item",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
edje_object_signal_callback_add(it->base.view, "elm,action,click", "elm",
|
|
|
|
_select, it);
|
2010-10-29 11:42:01 -07:00
|
|
|
edje_object_signal_callback_add(it->base.view, "elm,mouse,in", "elm",
|
2011-04-01 04:20:18 -07:00
|
|
|
_mouse_in, it);
|
2010-10-29 11:42:01 -07:00
|
|
|
edje_object_signal_callback_add(it->base.view, "elm,mouse,out", "elm",
|
2011-04-01 04:20:18 -07:00
|
|
|
_mouse_out, 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
|
|
|
elm_widget_sub_object_add(obj, it->base.view);
|
|
|
|
if (it->icon)
|
|
|
|
{
|
|
|
|
int ms = 0;
|
|
|
|
|
|
|
|
ms = ((double)wd->icon_size * _elm_config->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(it->base.view, "elm.swallow.icon", it->icon);
|
|
|
|
evas_object_show(it->icon);
|
|
|
|
elm_widget_sub_object_add(obj, it->icon);
|
|
|
|
}
|
|
|
|
edje_object_part_text_set(it->base.view, "elm.text", it->label);
|
|
|
|
mw = mh = -1;
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2011-08-06 20:42:28 -07:00
|
|
|
if (wd->vertical)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(it->base.view, EVAS_HINT_EXPAND, -1.0);
|
|
|
|
evas_object_size_hint_align_set(it->base.view, EVAS_HINT_FILL, 0.5);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(it->base.view, -1.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(it->base.view, 0.5, EVAS_HINT_FILL);
|
|
|
|
}
|
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->base.view, mw, mh);
|
2010-11-11 10:05:36 -08:00
|
|
|
evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_RESIZE,
|
|
|
|
_resize_item, obj);
|
2011-09-29 16:46:55 -07:00
|
|
|
if ((!wd->items) && wd->always_select) _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;
|
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_toolbar_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
Evas *e;
|
|
|
|
Widget_Data *wd;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2011-03-31 23:08:02 -07:00
|
|
|
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
|
2011-04-01 04:20:18 -07:00
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_SET_WIDTYPE(widtype, "toolbar");
|
2009-05-13 05:21:52 -07:00
|
|
|
elm_widget_type_set(obj, "toolbar");
|
|
|
|
elm_widget_sub_object_add(parent, obj);
|
2008-12-18 05:38:58 -08:00
|
|
|
elm_widget_data_set(obj, wd);
|
2009-10-15 13:48:00 -07:00
|
|
|
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
|
2008-12-18 05:38:58 -08:00
|
|
|
elm_widget_del_hook_set(obj, _del_hook);
|
|
|
|
elm_widget_theme_hook_set(obj, _theme_hook);
|
2010-09-27 21:28:14 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
2009-07-06 23:46:51 -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
|
|
|
wd->more_item = 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
|
|
|
wd->selected_item = NULL;
|
2008-12-18 05:38:58 -08:00
|
|
|
wd->scr = elm_smart_scroller_add(e);
|
2010-05-07 06:24:29 -07:00
|
|
|
elm_smart_scroller_widget_set(wd->scr, obj);
|
2010-05-11 18:03:46 -07:00
|
|
|
elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", "default");
|
2010-10-21 12:57:43 -07:00
|
|
|
elm_smart_scroller_bounce_allow_set(wd->scr,
|
|
|
|
_elm_config->thumbscroll_bounce_enable,
|
|
|
|
EINA_FALSE);
|
2008-12-18 05:38:58 -08:00
|
|
|
elm_widget_resize_object_set(obj, wd->scr);
|
2009-07-06 23:46:51 -07:00
|
|
|
elm_smart_scroller_policy_set(wd->scr,
|
2011-04-01 04:20:18 -07:00
|
|
|
ELM_SMART_SCROLLER_POLICY_AUTO,
|
|
|
|
ELM_SMART_SCROLLER_POLICY_OFF);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2010-11-08 11:59:22 -08:00
|
|
|
|
|
|
|
wd->icon_size = _elm_toolbar_icon_size_get(wd);
|
|
|
|
|
|
|
|
|
2009-10-02 12:22:40 -07:00
|
|
|
wd->homogeneous = EINA_TRUE;
|
2009-10-06 13:14:46 -07:00
|
|
|
wd->align = 0.5;
|
2009-10-22 15:10:23 -07:00
|
|
|
|
2009-10-02 12:22:40 -07:00
|
|
|
wd->bx = evas_object_box_add(e);
|
2009-10-06 13:14:46 -07:00
|
|
|
evas_object_size_hint_align_set(wd->bx, wd->align, 0.5);
|
2011-02-08 04:08:28 -08:00
|
|
|
evas_object_box_layout_set(wd->bx, _layout, obj, NULL);
|
2008-12-18 05:38:58 -08:00
|
|
|
elm_widget_sub_object_add(obj, wd->bx);
|
|
|
|
elm_smart_scroller_child_set(wd->scr, wd->bx);
|
|
|
|
evas_object_show(wd->bx);
|
|
|
|
|
2010-10-21 12:24:43 -07:00
|
|
|
elm_toolbar_mode_shrink_set(obj, _elm_config->toolbar_shrink_mode);
|
2009-08-30 09:33:03 -07:00
|
|
|
evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, _resize, obj);
|
2010-11-11 10:05:36 -08:00
|
|
|
evas_object_event_callback_add(wd->bx, EVAS_CALLBACK_RESIZE, _resize, 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
|
|
|
|
2011-04-21 17:42:32 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _signals);
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_icon_size_set(Evas_Object *obj, int icon_size)
|
2009-08-25 17:30:55 -07:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-08-25 17:30:55 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return;
|
2009-08-25 17:47:31 -07:00
|
|
|
if (wd->icon_size == icon_size) return;
|
2009-08-25 17:30:55 -07:00
|
|
|
wd->icon_size = icon_size;
|
|
|
|
_theme_hook(obj);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2010-03-09 03:42:53 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) 0;
|
2009-08-25 17:47:31 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return 0;
|
2009-08-25 17:47:31 -07:00
|
|
|
return wd->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
|
|
|
EAPI Elm_Toolbar_Item *
|
|
|
|
elm_toolbar_item_append(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
|
|
|
|
Elm_Toolbar_Item *it = _item_new(obj, icon, label, func, data);
|
|
|
|
if (!it) return NULL;
|
2011-09-28 22:07:50 -07:00
|
|
|
double scale = (elm_widget_scale_get(obj) * _elm_config->scale);
|
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
|
|
|
|
|
|
|
wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
|
|
|
|
evas_object_box_append(wd->bx, it->base.view);
|
|
|
|
evas_object_show(it->base.view);
|
2011-09-28 22:07:50 -07:00
|
|
|
|
|
|
|
_theme_hook_item(obj, it, scale, wd->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);
|
|
|
|
|
|
|
|
return it;
|
|
|
|
}
|
|
|
|
|
2010-10-29 11:57:55 -07:00
|
|
|
static void
|
|
|
|
_elm_toolbar_item_state_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
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)
|
2011-04-01 04:20:18 -07:00
|
|
|
it_state->func((void *)it_state->data, obj, event_info);
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item_State *
|
|
|
|
elm_toolbar_item_state_next(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
Widget_Data *wd;
|
|
|
|
Evas_Object *obj;
|
|
|
|
Eina_List *next_state;
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2010-10-29 11:57:55 -07:00
|
|
|
|
|
|
|
obj = item->base.widget;
|
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
if (!item->states) return NULL;
|
|
|
|
|
|
|
|
next_state = eina_list_next(item->current_state);
|
|
|
|
if (!next_state)
|
2011-04-01 04:20:18 -07:00
|
|
|
next_state = eina_list_next(item->states);
|
2010-10-29 11:57:55 -07:00
|
|
|
return eina_list_data_get(next_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item_State *
|
|
|
|
elm_toolbar_item_state_prev(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
Widget_Data *wd;
|
|
|
|
Evas_Object *obj;
|
|
|
|
Eina_List *prev_state;
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2010-10-29 11:57:55 -07:00
|
|
|
|
|
|
|
obj = item->base.widget;
|
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
if (!item->states) return NULL;
|
|
|
|
|
|
|
|
prev_state = eina_list_prev(item->current_state);
|
|
|
|
if ((!prev_state) || (prev_state == item->states))
|
2011-04-01 04:20:18 -07:00
|
|
|
prev_state = eina_list_last(item->states);
|
2010-10-29 11:57:55 -07:00
|
|
|
return eina_list_data_get(prev_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_state_unset(Elm_Toolbar_Item *it)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
|
2010-10-29 11:57:55 -07:00
|
|
|
elm_toolbar_item_state_set(it, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_item_state_set(Elm_Toolbar_Item *it, Elm_Toolbar_Item_State *state)
|
|
|
|
{
|
|
|
|
Widget_Data *wd;
|
|
|
|
Eina_List *next_state;
|
|
|
|
Elm_Toolbar_Item_State *it_state;
|
|
|
|
Evas_Object *obj;
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
|
2010-10-29 11:57:55 -07:00
|
|
|
|
|
|
|
obj = it->base.widget;
|
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
if (!it->states) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (state)
|
|
|
|
{
|
|
|
|
next_state = eina_list_data_find_list(it->states, state);
|
|
|
|
if (!next_state) return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
2011-04-01 04:20:18 -07:00
|
|
|
next_state = it->states;
|
2010-10-29 11:57:55 -07:00
|
|
|
|
|
|
|
if (next_state == it->current_state) return EINA_TRUE;
|
|
|
|
|
2010-11-05 11:23:59 -07:00
|
|
|
it_state = eina_list_data_get(next_state);
|
|
|
|
if (eina_list_data_find(it->current_state, state))
|
|
|
|
{
|
|
|
|
_item_label_set(it, it_state->label, "elm,state,label_set,forward");
|
|
|
|
_elm_toolbar_item_icon_obj_set(obj, it, it_state->icon, it_state->icon_str,
|
|
|
|
wd->icon_size, "elm,state,icon_set,forward");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_item_label_set(it, it_state->label, "elm,state,label_set,backward");
|
|
|
|
_elm_toolbar_item_icon_obj_set(obj, it, it_state->icon, it_state->icon_str,
|
|
|
|
wd->icon_size, "elm,state,icon_set,backward");
|
|
|
|
}
|
2010-11-08 11:58:46 -08:00
|
|
|
if (it->disabled)
|
2011-04-01 04:20:18 -07:00
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,disabled", "elm");
|
2010-11-08 11:58:46 -08:00
|
|
|
else
|
2011-04-01 04:20:18 -07:00
|
|
|
elm_widget_signal_emit(it->icon, "elm,state,enabled", "elm");
|
2010-11-05 11:23:59 -07:00
|
|
|
|
2010-10-29 11:57:55 -07:00
|
|
|
it->current_state = next_state;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item_State *
|
2010-11-08 08:39:07 -08:00
|
|
|
elm_toolbar_item_state_get(const Elm_Toolbar_Item *it)
|
2010-10-29 11:57:55 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
|
2010-10-29 11:57:55 -07:00
|
|
|
if ((!it->states) || (!it->current_state)) return NULL;
|
|
|
|
if (it->current_state == it->states) return NULL;
|
|
|
|
|
|
|
|
return eina_list_data_get(it->current_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Elm_Toolbar_Item_State *
|
|
|
|
_item_state_new(const char *label, const char *icon_str, Evas_Object *icon, Evas_Smart_Cb func, const void *data)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item_State *it_state;
|
|
|
|
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;
|
|
|
|
return it_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item_State *
|
|
|
|
elm_toolbar_item_state_add(Elm_Toolbar_Item *item, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item_State *it_state;
|
|
|
|
Evas_Object *icon_obj;
|
|
|
|
Evas_Object *obj;
|
2010-11-08 11:58:46 -08:00
|
|
|
Widget_Data *wd;
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2010-10-29 11:57:55 -07:00
|
|
|
obj = item->base.widget;
|
2010-11-08 11:58:46 -08:00
|
|
|
wd = elm_widget_data_get(item->base.widget);
|
|
|
|
if (!wd) return NULL;
|
2010-10-29 11:57:55 -07:00
|
|
|
|
|
|
|
if (!item->states)
|
|
|
|
{
|
|
|
|
it_state = _item_state_new(item->label, item->icon_str, item->icon,
|
|
|
|
item->func, item->base.data);
|
|
|
|
item->states = eina_list_append(item->states, it_state);
|
|
|
|
item->current_state = item->states;
|
|
|
|
}
|
|
|
|
|
|
|
|
icon_obj = elm_icon_add(obj);
|
2010-11-08 11:58:46 -08:00
|
|
|
elm_icon_order_lookup_set(icon_obj, wd->lookup_order);
|
2010-10-29 11:57:55 -07: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;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_item_state_del(Elm_Toolbar_Item *item, Elm_Toolbar_Item_State *state)
|
|
|
|
{
|
|
|
|
Eina_List *del_state;
|
|
|
|
Elm_Toolbar_Item_State *it_state;
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
|
2010-10-29 11:57:55 -07:00
|
|
|
|
|
|
|
if (!state) return EINA_FALSE;
|
|
|
|
if (!item->states) return EINA_FALSE;
|
|
|
|
|
|
|
|
del_state = eina_list_data_find_list(item->states, state);
|
|
|
|
if (del_state == item->states) return EINA_FALSE;
|
|
|
|
if (del_state == item->current_state)
|
2011-04-01 04:20:18 -07:00
|
|
|
elm_toolbar_item_state_unset(item);
|
2010-10-29 11:57:55 -07:00
|
|
|
|
|
|
|
eina_stringshare_del(state->label);
|
|
|
|
eina_stringshare_del(state->icon_str);
|
|
|
|
if (state->icon) evas_object_del(state->icon);
|
|
|
|
free(state);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
EAPI Elm_Toolbar_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
|
|
|
elm_toolbar_item_prepend(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2010-03-09 03:42:53 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2008-12-18 05:38:58 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
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 (!wd) return NULL;
|
|
|
|
|
|
|
|
Elm_Toolbar_Item *it = _item_new(obj, icon, label, func, data);
|
|
|
|
if (!it) return NULL;
|
2011-09-28 22:07:50 -07:00
|
|
|
double scale = (elm_widget_scale_get(obj) * _elm_config->scale);
|
2009-08-25 15:46:19 -07:00
|
|
|
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
|
|
|
|
evas_object_box_prepend(wd->bx, it->base.view);
|
|
|
|
evas_object_show(it->base.view);
|
2011-09-28 22:07:50 -07:00
|
|
|
_theme_hook_item(obj, it, scale, wd->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);
|
|
|
|
|
|
|
|
return it;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item *
|
|
|
|
elm_toolbar_item_insert_before(Evas_Object *obj, Elm_Toolbar_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(before, 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
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-10-15 06:36:44 -07:00
|
|
|
if (!wd) return NULL;
|
2010-10-14 08:27:31 -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 *it = _item_new(obj, icon, label, func, data);
|
|
|
|
if (!it) return NULL;
|
2011-09-28 22:07:50 -07:00
|
|
|
double scale = (elm_widget_scale_get(obj) * _elm_config->scale);
|
2009-08-30 09:33:03 -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
|
|
|
wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
|
|
|
|
EINA_INLIST_GET(before));
|
|
|
|
evas_object_box_insert_before(wd->bx, it->base.view, before->base.view);
|
|
|
|
evas_object_show(it->base.view);
|
2011-09-28 22:07:50 -07:00
|
|
|
_theme_hook_item(obj, it, scale, wd->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);
|
|
|
|
|
|
|
|
return it;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item *
|
|
|
|
elm_toolbar_item_insert_after(Evas_Object *obj, Elm_Toolbar_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(after, 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
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
|
|
|
|
Elm_Toolbar_Item *it = _item_new(obj, icon, label, func, data);
|
|
|
|
if (!it) return NULL;
|
2011-09-28 22:07:50 -07:00
|
|
|
double scale = (elm_widget_scale_get(obj) * _elm_config->scale);
|
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
|
|
|
|
|
|
|
wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
|
2011-04-01 04:20:18 -07:00
|
|
|
EINA_INLIST_GET(after));
|
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_box_insert_after(wd->bx, it->base.view, after->base.view);
|
2010-09-09 19:05:45 -07:00
|
|
|
evas_object_show(it->base.view);
|
2011-09-28 22:07:50 -07:00
|
|
|
_theme_hook_item(obj, it, scale, wd->icon_size);
|
2008-12-18 05:38:58 -08:00
|
|
|
_sizing_eval(obj);
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item *
|
|
|
|
elm_toolbar_first_item_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd || !wd->items) return NULL;
|
|
|
|
Elm_Toolbar_Item *it = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items);
|
|
|
|
return it;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item *
|
|
|
|
elm_toolbar_last_item_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd || !wd->items) return NULL;
|
|
|
|
Elm_Toolbar_Item *it = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items->last);
|
2009-02-25 07:54:26 -08:00
|
|
|
return it;
|
2008-12-18 05:38:58 -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
|
|
|
EAPI Elm_Toolbar_Item *
|
|
|
|
elm_toolbar_item_next_get(const Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *next;
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, 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
|
|
|
next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next);
|
|
|
|
return next;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item *
|
|
|
|
elm_toolbar_item_prev_get(const Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *prev;
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, 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
|
|
|
prev = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->prev);
|
|
|
|
return prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_toolbar_item_toolbar_get(const Elm_Toolbar_Item *item)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, 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
|
|
|
return item->base.widget;
|
|
|
|
}
|
|
|
|
|
[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
|
|
|
|
elm_toolbar_item_priority_set(Elm_Toolbar_Item *item, int priority)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2011-04-01 04:20:18 -07:00
|
|
|
if (item->prio.priority == priority) return;
|
|
|
|
item->prio.priority = priority;
|
|
|
|
_resize(item->base.widget, 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
|
2010-10-25 07:34:22 -07:00
|
|
|
elm_toolbar_item_priority_get(const Elm_Toolbar_Item *item)
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, 0);
|
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 item->prio.priority;
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
}
|
|
|
|
|
2010-10-14 15:21:40 -07:00
|
|
|
EAPI const char *
|
2010-12-03 02:58:46 -08:00
|
|
|
elm_toolbar_item_icon_get(const Elm_Toolbar_Item *item)
|
2010-10-14 15:21:40 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2010-10-14 15:21:40 -07:00
|
|
|
return item->icon_str;
|
|
|
|
}
|
|
|
|
|
2009-08-12 15:37:48 -07:00
|
|
|
EAPI const char *
|
2010-03-31 09:38:37 -07:00
|
|
|
elm_toolbar_item_label_get(const Elm_Toolbar_Item *item)
|
2009-08-12 15:37:48 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2009-08-12 15:37:48 -07:00
|
|
|
return item->label;
|
|
|
|
}
|
|
|
|
|
2010-10-29 11:40:59 -07:00
|
|
|
static void
|
|
|
|
_elm_toolbar_item_label_update(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
Evas_Coord mw = -1, mh = -1;
|
2011-08-06 20:42:28 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(item->base.widget);
|
2010-10-29 11:40:59 -07:00
|
|
|
edje_object_part_text_set(item->base.view, "elm.text", item->label);
|
|
|
|
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
edje_object_size_min_restricted_calc(item->base.view, &mw, &mh, mw, mh);
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2011-08-06 20:42:28 -07:00
|
|
|
if (wd->vertical)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(item->base.view, EVAS_HINT_EXPAND, -1.0);
|
|
|
|
evas_object_size_hint_align_set(item->base.view, EVAS_HINT_FILL, 0.5);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(item->base.view, -1.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(item->base.view, 0.5, EVAS_HINT_FILL);
|
|
|
|
}
|
2010-10-29 11:40:59 -07:00
|
|
|
evas_object_size_hint_min_set(item->base.view, mw, mh);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_toolbar_item_label_set_cb (void *data, Evas_Object *obj, const char *emission, const char *source)
|
|
|
|
{
|
|
|
|
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 (item->base.view, "elm,state,label,reset", "elm");
|
|
|
|
}
|
|
|
|
|
2010-11-05 11:23:59 -07:00
|
|
|
static void
|
|
|
|
_item_label_set(Elm_Toolbar_Item *item, const char *label, const char *signal)
|
2009-08-25 16:47:08 -07:00
|
|
|
{
|
2010-10-29 11:40:59 -07:00
|
|
|
const char *s;
|
2009-11-09 18:03:52 -08:00
|
|
|
|
2010-10-29 11:40:59 -07:00
|
|
|
if ((label) && (item->label) && (!strcmp(label, item->label))) return;
|
|
|
|
|
2010-03-13 13:01:26 -08:00
|
|
|
eina_stringshare_replace(&item->label, label);
|
2010-10-29 11:40:59 -07:00
|
|
|
s = edje_object_data_get(item->base.view, "transition_animation_on");
|
|
|
|
if ((s) && (atoi(s)))
|
|
|
|
{
|
|
|
|
edje_object_part_text_set(item->base.view, "elm.text_new", item->label);
|
2010-11-05 11:23:59 -07:00
|
|
|
edje_object_signal_emit (item->base.view, signal, "elm");
|
2010-10-29 11:40:59 -07:00
|
|
|
edje_object_signal_callback_add(item->base.view,
|
|
|
|
"elm,state,label_set,done", "elm",
|
|
|
|
_elm_toolbar_item_label_set_cb, item);
|
|
|
|
}
|
|
|
|
else
|
2011-04-01 04:20:18 -07:00
|
|
|
_elm_toolbar_item_label_update(item);
|
2010-11-10 04:38:47 -08:00
|
|
|
_resize(item->base.widget, NULL, NULL, NULL);
|
2010-10-29 11:40:59 -07:00
|
|
|
}
|
2009-10-30 07:10:41 -07:00
|
|
|
|
2010-11-05 11:23:59 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_label_set(Elm_Toolbar_Item *item, const char *label)
|
|
|
|
{
|
2010-11-08 08:55:26 -08:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2010-11-05 11:23:59 -07:00
|
|
|
_item_label_set(item, label, "elm,state,label_set");
|
|
|
|
}
|
|
|
|
|
2010-10-29 11:40:59 -07:00
|
|
|
static void
|
|
|
|
_elm_toolbar_item_icon_update(Elm_Toolbar_Item *item)
|
|
|
|
{
|
2010-10-29 11:57:55 -07:00
|
|
|
Elm_Toolbar_Item_State *it_state;
|
|
|
|
Eina_List *l;
|
2010-10-29 11:40:59 -07:00
|
|
|
Evas_Coord mw = -1, mh = -1;
|
2011-08-06 20:42:28 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(item->base.widget);
|
2010-10-29 11:40:59 -07:00
|
|
|
Evas_Object *old_icon = edje_object_part_swallow_get(item->base.view,
|
|
|
|
"elm.swallow.icon");
|
|
|
|
elm_widget_sub_object_del(item->base.view, old_icon);
|
2010-10-29 11:57:55 -07:00
|
|
|
evas_object_hide(old_icon);
|
2010-10-29 11:40:59 -07:00
|
|
|
edje_object_part_swallow(item->base.view, "elm.swallow.icon", item->icon);
|
2009-10-30 07:10:41 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2010-09-09 19:05:45 -07:00
|
|
|
edje_object_size_min_restricted_calc(item->base.view, &mw, &mh, mw, mh);
|
2009-10-30 07:10:41 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2011-08-06 20:42:28 -07:00
|
|
|
if (wd->vertical)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(item->base.view, EVAS_HINT_EXPAND, -1.0);
|
|
|
|
evas_object_size_hint_align_set(item->base.view, EVAS_HINT_FILL, 0.5);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(item->base.view, -1.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(item->base.view, 0.5, EVAS_HINT_FILL);
|
|
|
|
}
|
2010-09-09 19:05:45 -07:00
|
|
|
evas_object_size_hint_min_set(item->base.view, mw, mh);
|
2010-10-29 11:57:55 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(item->states, l, it_state)
|
|
|
|
if (it_state->icon == old_icon)
|
2011-04-01 04:20:18 -07:00
|
|
|
return;
|
2010-10-29 11:57:55 -07:00
|
|
|
evas_object_del(old_icon);
|
2009-08-25 16:47:08 -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
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_item_selected_get(const Elm_Toolbar_Item *item)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, 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
|
|
|
return item->selected;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(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
|
|
|
Widget_Data *wd = elm_widget_data_get(item->base.widget);
|
|
|
|
if (!wd) return;
|
|
|
|
|
|
|
|
if (item->selected == selected) return;
|
|
|
|
|
|
|
|
if (selected)
|
|
|
|
_item_select(item);
|
|
|
|
else
|
|
|
|
_item_unselect(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Toolbar_Item *
|
|
|
|
elm_toolbar_selected_item_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
return wd->selected_item;
|
|
|
|
}
|
2010-04-12 01:12:02 -07:00
|
|
|
|
2010-10-29 11:40:59 -07:00
|
|
|
static void
|
|
|
|
_elm_toolbar_item_icon_set_cb (void *data, Evas_Object *obj, const char *emission, const char *source)
|
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *item = data;
|
|
|
|
edje_object_part_unswallow(item->base.view, item->icon);
|
|
|
|
_elm_toolbar_item_icon_update(item);
|
|
|
|
edje_object_signal_callback_del(obj, emission, source,
|
|
|
|
_elm_toolbar_item_icon_set_cb);
|
|
|
|
edje_object_signal_emit (item->base.view, "elm,state,icon,reset", "elm");
|
|
|
|
}
|
|
|
|
|
2010-10-29 11:57:55 -07:00
|
|
|
static void
|
2010-11-05 11:23:59 -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 *signal)
|
2010-10-29 11:57:55 -07:00
|
|
|
{
|
|
|
|
Evas_Object *old_icon;
|
|
|
|
int ms = 0;
|
|
|
|
const char *s;
|
|
|
|
|
|
|
|
if (icon_str)
|
2011-04-01 04:20:18 -07:00
|
|
|
eina_stringshare_replace(&item->icon_str, icon_str);
|
2010-10-29 11:57:55 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
eina_stringshare_del(item->icon_str);
|
|
|
|
item->icon_str = NULL;
|
|
|
|
}
|
|
|
|
item->icon = icon_obj;
|
|
|
|
if (icon_obj)
|
|
|
|
{
|
|
|
|
ms = (icon_size * _elm_config->scale);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
s = edje_object_data_get(item->base.view, "transition_animation_on");
|
|
|
|
if ((s) && (atoi(s)))
|
|
|
|
{
|
|
|
|
old_icon = edje_object_part_swallow_get(item->base.view,
|
|
|
|
"elm.swallow.icon_new");
|
|
|
|
if (old_icon)
|
|
|
|
{
|
|
|
|
elm_widget_sub_object_del(item->base.view, old_icon);
|
|
|
|
evas_object_hide(old_icon);
|
|
|
|
}
|
|
|
|
edje_object_part_swallow(item->base.view, "elm.swallow.icon_new",
|
|
|
|
item->icon);
|
2010-11-05 11:23:59 -07:00
|
|
|
edje_object_signal_emit (item->base.view, signal, "elm");
|
2010-10-29 11:57:55 -07:00
|
|
|
edje_object_signal_callback_add(item->base.view,
|
|
|
|
"elm,state,icon_set,done", "elm",
|
|
|
|
_elm_toolbar_item_icon_set_cb, item);
|
|
|
|
}
|
|
|
|
else
|
2011-04-01 04:20:18 -07:00
|
|
|
_elm_toolbar_item_icon_update(item);
|
2010-11-10 04:38:47 -08:00
|
|
|
_resize(obj, NULL, NULL, NULL);
|
2010-10-29 11:57:55 -07:00
|
|
|
}
|
|
|
|
|
2010-10-29 11:40:59 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_icon_set(Elm_Toolbar_Item *item, const char *icon)
|
|
|
|
{
|
|
|
|
Evas_Object *icon_obj;
|
|
|
|
Widget_Data *wd;
|
2011-09-30 00:33:09 -07:00
|
|
|
Evas_Object *obj;
|
2010-10-29 11:40:59 -07:00
|
|
|
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2011-09-30 00:33:09 -07:00
|
|
|
obj = item->base.widget;
|
2010-10-29 11:40:59 -07:00
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
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))
|
2011-04-01 04:20:18 -07:00
|
|
|
_elm_toolbar_item_icon_obj_set(obj, item, icon_obj, icon, wd->icon_size,
|
|
|
|
"elm,state,icon_set");
|
2010-10-29 11:40:59 -07:00
|
|
|
else
|
|
|
|
{
|
2010-11-05 11:23:59 -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-09-28 16:07:18 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_item_icon_memfile_set(Elm_Toolbar_Item *item, const void *img, size_t size, const char *format, const char *key)
|
|
|
|
{
|
|
|
|
Evas_Object *icon_obj;
|
|
|
|
Widget_Data *wd;
|
2011-09-30 00:33:09 -07:00
|
|
|
Evas_Object *obj;
|
2011-09-28 16:07:18 -07:00
|
|
|
Eina_Bool ret;
|
|
|
|
|
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
|
2011-09-30 00:33:09 -07:00
|
|
|
obj = item->base.widget;
|
2011-09-28 16:07:18 -07:00
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (img && size)
|
|
|
|
{
|
|
|
|
icon_obj = _els_smart_icon_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_repeat_events_set(icon_obj, EINA_TRUE);
|
|
|
|
ret = _els_smart_icon_memfile_set(icon_obj, img, size, format, key);
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
evas_object_del(icon_obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
_elm_toolbar_item_icon_obj_set(obj, item, icon_obj, NULL, wd->icon_size,
|
|
|
|
"elm,state,icon_set");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_elm_toolbar_item_icon_obj_set(obj, item, NULL, NULL, 0, "elm,state,icon_set");
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2011-09-29 21:26:58 -07:00
|
|
|
EAPI Evas_Object *
|
2011-09-30 21:20:36 -07:00
|
|
|
elm_toolbar_item_object_get(const Elm_Toolbar_Item *item)
|
2011-09-29 21:26:58 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd;
|
2011-09-30 00:33:09 -07:00
|
|
|
Evas_Object *obj;
|
2011-09-29 21:26:58 -07:00
|
|
|
|
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2011-09-30 00:33:09 -07:00
|
|
|
obj = item->base.widget;
|
2011-09-29 21:26:58 -07:00
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
|
|
|
|
return item->base.view;
|
|
|
|
}
|
|
|
|
|
2011-09-28 16:07:18 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_toolbar_item_icon_object_get(Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
Widget_Data *wd;
|
2011-09-30 00:33:09 -07:00
|
|
|
Evas_Object *obj;
|
2011-09-28 16:07:18 -07:00
|
|
|
|
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2011-09-30 00:33:09 -07:00
|
|
|
obj = item->base.widget;
|
2011-09-28 16:07:18 -07:00
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
|
|
|
|
return item->icon;
|
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
EAPI void
|
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_del(Elm_Toolbar_Item *item)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2010-10-15 06:41:56 -07:00
|
|
|
Widget_Data *wd;
|
|
|
|
Evas_Object *obj2;
|
2011-09-29 16:46:55 -07:00
|
|
|
Elm_Toolbar_Item *next;
|
2009-08-25 15:46:19 -07:00
|
|
|
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(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
|
|
|
wd = elm_widget_data_get(item->base.widget);
|
2010-10-15 06:41:56 -07:00
|
|
|
if (!wd) return;
|
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
|
|
|
obj2 = item->base.widget;
|
2011-09-29 16:46:55 -07:00
|
|
|
next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next);
|
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
|
|
|
wd->items = eina_inlist_remove(wd->items, EINA_INLIST_GET(item));
|
2011-09-29 16:46:55 -07:00
|
|
|
if (!next) next = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items);
|
|
|
|
if (wd->always_select && item->selected && next) _item_select(next);
|
2010-11-09 13:21:46 -08:00
|
|
|
_item_del(item);
|
2008-12-18 20:26:24 -08:00
|
|
|
_theme_hook(obj2);
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
|
|
|
|
2009-11-21 08:21:35 -08:00
|
|
|
EAPI void
|
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_del_cb_set(Elm_Toolbar_Item *item, Evas_Smart_Cb func)
|
2009-11-21 08:21:35 -08:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(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
|
|
|
elm_widget_item_del_cb_set(item, func);
|
2008-12-18 05:38:58 -08:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI Eina_Bool
|
2010-10-25 07:34:22 -07:00
|
|
|
elm_toolbar_item_disabled_get(const Elm_Toolbar_Item *item)
|
2009-08-25 15:46:19 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
|
2009-08-25 15:46:19 -07:00
|
|
|
return item->disabled;
|
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_disabled_set(Elm_Toolbar_Item *item, Eina_Bool disabled)
|
2009-08-25 15:46:19 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2009-08-25 15:46:19 -07:00
|
|
|
_item_disable(item, disabled);
|
2010-11-10 04:38:47 -08:00
|
|
|
_resize(item->base.widget, NULL, NULL, NULL);
|
2009-08-25 15:46:19 -07:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_separator_set(Elm_Toolbar_Item *item, Eina_Bool separator)
|
2009-08-30 09:54:15 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2011-08-04 02:39:25 -07:00
|
|
|
Evas_Object *obj = item->base.widget;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
double scale;
|
2009-08-30 09:54:15 -07:00
|
|
|
if (item->separator == separator) return;
|
|
|
|
item->separator = separator;
|
2011-08-04 02:39:25 -07:00
|
|
|
scale = (elm_widget_scale_get(obj) * _elm_config->scale);
|
|
|
|
_theme_hook_item(obj, item, scale, wd->icon_size);
|
2009-08-30 09:54:15 -07:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI Eina_Bool
|
2010-10-25 07:34:22 -07:00
|
|
|
elm_toolbar_item_separator_get(const Elm_Toolbar_Item *item)
|
2009-08-30 09:54:15 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
|
2009-08-30 09:54:15 -07:00
|
|
|
return item->separator;
|
|
|
|
}
|
|
|
|
|
2008-12-18 05:38:58 -08:00
|
|
|
EAPI void
|
[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
|
|
|
elm_toolbar_mode_shrink_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mode)
|
2008-12-18 05:38:58 -08:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2008-12-18 05:38:58 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-10-21 12:57:43 -07:00
|
|
|
Eina_Bool bounce;
|
2009-08-25 15:46:19 -07:00
|
|
|
|
2009-08-26 07:29:18 -07:00
|
|
|
if (!wd) return;
|
[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
|
|
|
wd->shrink_mode = shrink_mode;
|
2010-10-22 14:41:22 -07:00
|
|
|
bounce = (_elm_config->thumbscroll_bounce_enable) &&
|
2010-10-21 12:57:43 -07:00
|
|
|
(shrink_mode == ELM_TOOLBAR_SHRINK_SCROLL);
|
|
|
|
elm_smart_scroller_bounce_allow_set(wd->scr, 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
|
|
|
|
|
|
|
if (wd->more_item)
|
|
|
|
{
|
2010-11-09 13:21:46 -08:00
|
|
|
_item_del(wd->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
|
|
|
wd->more_item = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (shrink_mode == ELM_TOOLBAR_SHRINK_MENU)
|
|
|
|
{
|
|
|
|
elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_OFF, ELM_SMART_SCROLLER_POLICY_OFF);
|
|
|
|
|
2010-11-09 13:21:46 -08:00
|
|
|
wd->more_item = _item_new(obj, "more_menu", "More",
|
2011-04-01 04:20:18 -07:00
|
|
|
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)
|
|
|
|
elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_OFF,
|
|
|
|
ELM_SMART_SCROLLER_POLICY_OFF);
|
[Elementary] Implement priority in Elm_Toolbar.
Toolbars can now be scrollable, non-scrollable, or hide icons selectively
according to a priority. This changed the API slightly, thus
elm_toolbar_scrollable_set(obj, 1)
Should be
elm_toolbar_mode_expand_set(obj, ELM_TOOLBAR_EXPAND_SCROLL)
Values for non-scrollable and scrollable remain the same, so if constants
aren't being used, just the function name should be changed.
The new mode, ELM_TOOLBAR_EXPAND_MENU, will create a menu of items when the
space isn't large enough to hold all the items. Which items will be kept on
the toolbar or which items will be added to the menu is controlled by the
priority of each item: higher ones will be kept if possible, lower ones will
be tratored on the first opportunity.
SVN revision: 53406
2010-10-14 08:27:25 -07:00
|
|
|
else
|
2010-10-26 03:30:45 -07:00
|
|
|
elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_AUTO,
|
|
|
|
ELM_SMART_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
|
2010-10-25 07:34:22 -07:00
|
|
|
elm_toolbar_mode_shrink_get(const Evas_Object *obj)
|
2010-04-26 22:43:54 -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
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) ELM_TOOLBAR_SHRINK_NONE;
|
2010-04-26 22:43:54 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
[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 (!wd) return ELM_TOOLBAR_SHRINK_NONE;
|
|
|
|
return wd->shrink_mode;
|
2010-04-26 22:43:54 -07:00
|
|
|
}
|
|
|
|
|
2009-09-30 03:53:08 -07:00
|
|
|
EAPI void
|
2011-05-03 21:53:39 -07:00
|
|
|
elm_toolbar_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous)
|
2009-09-30 03:53:08 -07:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-09-30 03:53:08 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
|
|
|
if (!wd) return;
|
2011-05-03 21:53:39 -07:00
|
|
|
wd->homogeneous = !!homogeneous;
|
2009-10-02 12:22:40 -07:00
|
|
|
evas_object_smart_calculate(wd->bx);
|
2009-09-30 03:53:08 -07:00
|
|
|
}
|
|
|
|
|
2011-05-03 21:53:39 -07:00
|
|
|
EINA_DEPRECATED EAPI void
|
|
|
|
elm_toolbar_homogenous_set(Evas_Object *obj, Eina_Bool homogenous)
|
|
|
|
{
|
|
|
|
elm_toolbar_homogeneous_set(obj, homogenous);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2010-06-05 06:12:45 -07:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
2010-04-26 22:43:54 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
2010-06-05 06:12:45 -07:00
|
|
|
if (!wd) return EINA_FALSE;
|
2010-04-26 22:43:54 -07:00
|
|
|
return wd->homogeneous;
|
|
|
|
}
|
|
|
|
|
2011-05-03 21:53:39 -07:00
|
|
|
EINA_DEPRECATED EAPI Eina_Bool
|
|
|
|
elm_toolbar_homogenous_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_toolbar_homogeneous_get(obj);
|
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
2009-10-06 08:08:41 -07:00
|
|
|
elm_toolbar_menu_parent_set(Evas_Object *obj, Evas_Object *parent)
|
|
|
|
{
|
2009-10-18 10:20:18 -07:00
|
|
|
Elm_Toolbar_Item *it;
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-10-18 10:20:18 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-10-07 10:11:41 -07:00
|
|
|
|
2010-12-03 06:08:33 -08:00
|
|
|
if (!wd) return;
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(parent);
|
2009-10-18 10:20:18 -07:00
|
|
|
wd->menu_parent = parent;
|
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
|
|
|
EINA_INLIST_FOREACH(wd->items, it)
|
2009-10-18 10:20:18 -07:00
|
|
|
{
|
2009-10-11 06:37:01 -07:00
|
|
|
if (it->o_menu)
|
2009-10-18 10:20:18 -07:00
|
|
|
elm_menu_parent_set(it->o_menu, wd->menu_parent);
|
|
|
|
}
|
2010-11-09 13:21:46 -08:00
|
|
|
if ((wd->more_item) && (wd->more_item->o_menu))
|
2011-04-01 04:20:18 -07:00
|
|
|
elm_menu_parent_set(wd->more_item->o_menu, wd->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
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
2010-10-14 11:18:34 -07:00
|
|
|
if (!wd) return NULL;
|
2010-04-26 22:43:54 -07:00
|
|
|
return wd->menu_parent;
|
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_align_set(Evas_Object *obj, double align)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-10-18 10:20:18 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-10-06 13:14:46 -07:00
|
|
|
|
2009-10-18 10:20:18 -07:00
|
|
|
if (!wd) return;
|
2010-03-09 03:42:53 -08:00
|
|
|
if (wd->align != align)
|
2009-10-18 10:20:18 -07:00
|
|
|
evas_object_size_hint_align_set(wd->bx, align, 0.5);
|
2010-03-09 03:42:53 -08:00
|
|
|
wd->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)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) 0.0;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
|
|
|
if (!wd) return 0.0;
|
|
|
|
return wd->align;
|
|
|
|
}
|
|
|
|
|
2009-10-06 13:14:46 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_menu_set(Elm_Toolbar_Item *item, Eina_Bool menu)
|
2009-10-06 08:08:41 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2010-09-09 19:05:45 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(item->base.widget);
|
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 (!wd) return;
|
2009-10-18 10:20:18 -07:00
|
|
|
|
2009-10-06 08:08:41 -07:00
|
|
|
if (item->menu == menu) return;
|
|
|
|
item->menu = menu;
|
[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 (menu) _item_menu_create(wd, item);
|
|
|
|
else _item_menu_destroy(item);
|
2009-10-06 08:08:41 -07:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
elm_toolbar_item_tooltip_text_set(Elm_Toolbar_Item *item, const char *text)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
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
|
|
|
elm_widget_item_tooltip_text_set(item, text);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_tooltip_content_cb_set(Elm_Toolbar_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
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
|
|
|
elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_tooltip_unset(Elm_Toolbar_Item *item)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
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
|
|
|
elm_widget_item_tooltip_unset(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_tooltip_style_set(Elm_Toolbar_Item *item, const char *style)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
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
|
|
|
elm_widget_item_tooltip_style_set(item, style);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
elm_toolbar_item_tooltip_style_get(const Elm_Toolbar_Item *item)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, 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
|
|
|
return elm_widget_item_tooltip_style_get(item);
|
|
|
|
}
|
2010-04-12 01:12:02 -07:00
|
|
|
|
2010-09-17 11:24:10 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_cursor_set(Elm_Toolbar_Item *item, const char *cursor)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2010-09-17 11:24:10 -07:00
|
|
|
elm_widget_item_cursor_set(item, cursor);
|
|
|
|
}
|
|
|
|
|
2010-11-04 17:46:54 -07:00
|
|
|
EAPI const char *
|
|
|
|
elm_toolbar_item_cursor_get(const Elm_Toolbar_Item *item)
|
|
|
|
{
|
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
|
|
|
return elm_widget_item_cursor_get(item);
|
|
|
|
}
|
|
|
|
|
2010-09-17 11:24:10 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_cursor_unset(Elm_Toolbar_Item *item)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2010-09-17 11:24:10 -07:00
|
|
|
elm_widget_item_cursor_unset(item);
|
|
|
|
}
|
|
|
|
|
2010-09-25 15:01:19 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_cursor_style_set(Elm_Toolbar_Item *item, const char *style)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2010-09-25 15:01:19 -07:00
|
|
|
elm_widget_item_cursor_style_set(item, style);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
elm_toolbar_item_cursor_style_get(const Elm_Toolbar_Item *item)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2010-09-25 15:01:19 -07:00
|
|
|
return elm_widget_item_cursor_style_get(item);
|
|
|
|
}
|
|
|
|
|
2010-09-25 15:03:37 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_cursor_engine_only_set(Elm_Toolbar_Item *item, Eina_Bool engine_only)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2010-09-25 15:03:37 -07:00
|
|
|
elm_widget_item_cursor_engine_only_set(item, engine_only);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_item_cursor_engine_only_get(const Elm_Toolbar_Item *item)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
|
2010-09-25 15:03:37 -07:00
|
|
|
return elm_widget_item_cursor_engine_only_get(item);
|
|
|
|
}
|
|
|
|
|
2009-10-18 10:20:18 -07:00
|
|
|
EAPI Evas_Object *
|
2011-10-02 19:25:30 -07:00
|
|
|
elm_toolbar_item_menu_get(const Elm_Toolbar_Item *item)
|
2009-10-06 08:08:41 -07:00
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2010-09-09 19:05:45 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(item->base.widget);
|
2011-10-02 19:25:30 -07:00
|
|
|
if ((!wd) || (!item->menu)) return NULL;
|
2009-10-11 06:37:01 -07:00
|
|
|
return item->o_menu;
|
2009-10-06 08:08:41 -07:00
|
|
|
}
|
2010-04-26 22:43:54 -07:00
|
|
|
|
|
|
|
EAPI Elm_Toolbar_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
|
|
|
elm_toolbar_item_find_by_label(const Evas_Object *obj, const char *label)
|
2010-04-26 22:43:54 -07:00
|
|
|
{
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
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
|
|
|
|
2010-04-26 22:43:54 -07:00
|
|
|
if (!wd) return 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
|
|
|
EINA_INLIST_FOREACH(wd->items, it)
|
2010-04-26 22:43:54 -07:00
|
|
|
{
|
|
|
|
if (!strcmp(it->label, label)) return it;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-10-26 06:15:32 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_item_data_set(Elm_Toolbar_Item *item, const void *data)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
|
2010-10-26 06:15:32 -07:00
|
|
|
elm_widget_item_data_set(item, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
|
|
|
elm_toolbar_item_data_get(const Elm_Toolbar_Item *item)
|
|
|
|
{
|
2010-11-02 04:26:59 -07:00
|
|
|
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
2010-10-26 06:15:32 -07:00
|
|
|
return elm_widget_item_data_get(item);
|
|
|
|
}
|
2010-11-05 11:23:15 -07:00
|
|
|
|
2011-09-29 16:46:55 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
if (always_select && (!wd->always_select) && wd->items)
|
|
|
|
_item_select(ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items));
|
|
|
|
wd->always_select = always_select;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_always_select_mode_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
return wd->always_select;
|
|
|
|
}
|
|
|
|
|
2010-11-05 11:23:15 -07:00
|
|
|
EAPI void
|
|
|
|
elm_toolbar_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
wd->no_select = no_select;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_no_select_mode_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
return wd->no_select;
|
|
|
|
}
|
2010-11-08 11:58:46 -08:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Elm_Toolbar_Item *it;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
|
|
|
|
wd->lookup_order = order;
|
|
|
|
EINA_INLIST_FOREACH(wd->items, it)
|
|
|
|
elm_icon_order_lookup_set(it->icon, order);
|
2010-11-09 13:21:46 -08:00
|
|
|
if (wd->more_item)
|
2011-04-01 04:20:18 -07:00
|
|
|
elm_icon_order_lookup_set(wd->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)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) ELM_ICON_LOOKUP_THEME_FDO;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return ELM_ICON_LOOKUP_THEME_FDO;
|
|
|
|
return wd->lookup_order;
|
|
|
|
}
|
2011-08-06 20:42:28 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_toolbar_orientation_set(Evas_Object *obj, Eina_Bool vertical)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
wd->vertical = vertical;
|
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_toolbar_orientation_get(Evas_Object *obj)
|
|
|
|
{
|
2011-08-06 20:54:23 -07:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
2011-08-06 20:42:28 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
return wd->vertical;
|
|
|
|
}
|