struct _Widget_Data
{
- Evas_Object *scr, *bx;
+ Evas_Object *scr, *bx, *more, *bx_more, *bx_more2;
Evas_Object *menu_parent;
Eina_Inlist *items;
Elm_Toolbar_Item *more_item, *selected_item;
+ Elm_Toolbar_Item *reorder_from, *reorder_to;
Elm_Toolbar_Shrink_Mode shrink_mode;
Elm_Icon_Lookup_Order lookup_order;
int icon_size;
+ int standard_priority;
unsigned int item_count;
double align;
Elm_Object_Select_Mode select_mode;
Evas_Object *icon;
Evas_Object *object;
Evas_Object *o_menu;
+ Evas_Object *in_box;
Evas_Smart_Cb func;
struct
{
Widget_Data *wd = elm_widget_data_get(WIDGET(it));
Evas_Object *obj2;
Eina_Bool sel;
+ Evas_Coord w = 0, h = 0;
if (!wd) return;
if (elm_widget_item_disabled_get(it) || (it->separator) || (it->object)) return;
sel = it->selected;
+ if (it->object) evas_object_geometry_get(it->object, NULL, NULL, &w, &h);
+
if (wd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
{
if (sel)
{
- if (wd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS) return;
- _item_unselect(it);
+ if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
+ if (wd->more_item == it)
+ {
+ edje_object_signal_emit(elm_layout_edje_get(wd->more), "elm,state,close", "elm");
+ _item_unselect(it);
+ }
+ if (wd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS)
+ _item_unselect(it);
}
else
{
it->selected = EINA_TRUE;
wd->selected_item = it;
+ if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
+ {
+ if (wd->more_item == it)
+ {
+ if (!evas_object_box_children_get(wd->bx_more2))
+ edje_object_signal_emit(elm_layout_edje_get(wd->more), "elm,state,open", "elm");
+ else
+ edje_object_signal_emit(elm_layout_edje_get(wd->more), "elm,state,open2", "elm");
+ }
+ else
+ {
+ if (it->in_box != wd->bx)
+ {
+ edje_object_signal_emit(wd->VIEW(more_item), "elm,state,selected", "elm");
+ elm_widget_signal_emit(wd->more_item->icon, "elm,state,selected", "elm");
+ }
+ else
+ {
+ edje_object_signal_emit(wd->VIEW(more_item), "elm,state,unselected", "elm");
+ elm_widget_signal_emit(wd->more_item->icon, "elm,state,unselected", "elm");
+ }
+ edje_object_signal_emit(elm_layout_edje_get(wd->more), "elm,state,close", "elm");
+ }
+ }
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
_item_show(it);
free(it_state);
}
eina_stringshare_del(it->label);
+ if (it->label) edje_object_signal_emit(VIEW(it), "elm,state,text,hidden", "elm");
eina_stringshare_del(it->icon_str);
- if (it->icon) evas_object_del(it->icon);
+ if (it->icon)
+ {
+ edje_object_signal_emit(VIEW(it), "elm,state,icon,hidden", "elm");
+ evas_object_del(it->icon);
+ }
if (it->object) evas_object_del(it->object);
//TODO: See if checking for wd->menu_parent is necessary before deleting menu
if (it->o_menu) evas_object_del(it->o_menu);
if (!wd) return;
it = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items);
- while(it)
+ while (it)
{
next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
_item_del(it);
_mirrored_set_item(Evas_Object *obj __UNUSED__, Elm_Toolbar_Item *it, Eina_Bool mirrored)
{
edje_object_mirrored_set(VIEW(it), mirrored);
- elm_widget_mirrored_set(it->o_menu, mirrored);
+ if (it->o_menu) elm_widget_mirrored_set(it->o_menu, mirrored);
}
static void
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *view = VIEW(it);
- Evas_Coord mw, mh;
+ Evas_Coord mw, mh, minw, minh;
const char *style = elm_widget_style_get(obj);
_mirrored_set_item(obj, it, elm_widget_mirrored_get(obj));
evas_object_size_hint_min_set(it->icon, ms, ms);
evas_object_size_hint_max_set(it->icon, ms, ms);
edje_object_part_swallow(view, "elm.swallow.icon", it->icon);
+ edje_object_signal_emit(VIEW(it), "elm,state,icon,visible", "elm");
+ }
+ if (it->label)
+ {
+ edje_object_part_text_escaped_set(view, "elm.text", it->label);
+ edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm");
}
- edje_object_part_text_set(view, "elm.text", it->label);
}
else
{
}
}
- mw = mh = -1;
+ mw = mh = minw = minh = -1;
if (!it->separator && !it->object)
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(view, &mw, &mh, mw, mh);
if (!it->separator && !it->object)
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
- evas_object_size_hint_min_set(view, mw, mh);
+ evas_object_size_hint_min_get(view, &minw, &minh);
+ if ((minw < mw) && (minh < mh))
+ evas_object_size_hint_min_set(view, mw, mh);
+ else if ((minw < mw) && (minh > mh))
+ evas_object_size_hint_min_set(view, mw, minh);
+ else if ((minw > mw) && (minh < mh))
+ evas_object_size_hint_min_set(view, minw, mh);
}
static void
if (!wd) return;
_elm_widget_mirrored_reload(obj);
elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", elm_widget_style_get(obj));
+ elm_layout_theme_set(wd->more, "toolbar", "more", elm_widget_style_get(obj));
_mirrored_set(obj, elm_widget_mirrored_get(obj));
scale = (elm_widget_scale_get(obj) * _elm_config->scale);
edje_object_scale_set(wd->scr, scale);
{
double scale;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
if (part && strcmp(part, "object")) return;
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *) it;
Evas_Object *obj = WIDGET(item);
Widget_Data *wd = elm_widget_data_get(obj);
-
+ if (!wd || !obj) return;
if (item->object == content) return;
+
+ if (item->object) evas_object_del(item->object);
+
item->object = content;
- elm_widget_sub_object_add(obj, item->object);
+ if (item->object)
+ elm_widget_sub_object_add(obj, item->object);
scale = (elm_widget_scale_get(obj) * _elm_config->scale);
_theme_hook_item(obj, item, scale, wd->icon_size);
}
static Evas_Object *
_item_content_get_hook(const Elm_Object_Item *it, const char *part)
{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
if (part && strcmp(part, "object")) return NULL;
return ((Elm_Toolbar_Item *) it)->object;
}
Evas_Object *o;
double scale;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
if (part && strcmp(part, "object")) return NULL;
Elm_Toolbar_Item *item = (Elm_Toolbar_Item *) it;
Evas_Object *obj = WIDGET(item);
Widget_Data *wd = elm_widget_data_get(obj);
-
+
edje_object_part_unswallow(VIEW(it), item->object);
elm_widget_sub_object_del(obj, item->object);
o = item->object;
// minh = minh + (h - vh);
}
evas_object_resize(wd->bx, minw_bx, minh_bx);
+ evas_object_resize(wd->more, w, h);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, -1, -1);
}
static void
_item_menu_create(Widget_Data *wd, Elm_Toolbar_Item *item)
{
- item->o_menu = elm_menu_add(VIEW(item));
+ item->o_menu = elm_menu_add(WIDGET(item));
item->menu = EINA_TRUE;
if (wd->menu_parent)
elm_menu_parent_set(item->o_menu, wd->menu_parent);
if (!eti2) return 1;
if (!eti1) return -1;
+ if (eti2->prio.priority == eti1->prio.priority)
+ return -1;
+
return eti2->prio.priority - eti1->prio.priority;
}
static void
-_fix_items_visibility(Widget_Data *wd, Evas_Coord *iw, Evas_Coord vw)
+_fix_items_visibility(Widget_Data *wd, Evas_Coord *iw, Evas_Coord vw, Eina_Bool *more)
{
- Elm_Toolbar_Item *it;
+ Elm_Toolbar_Item *it, *prev;
Eina_List *sorted = NULL;
Evas_Coord ciw = 0, cih = 0;
+ int count = 0, i = 0;
+ *more = EINA_FALSE;
+
+ EINA_INLIST_FOREACH(wd->items, it)
+ {
+ if (it->separator)
+ {
+ prev = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
+ it->prio.priority = prev->prio.priority;
+ }
+ }
EINA_INLIST_FOREACH(wd->items, it)
{
if (wd->vertical) *iw += cih;
else *iw += ciw;
}
+
EINA_LIST_FREE(sorted, it)
{
- evas_object_geometry_get(VIEW(it), NULL, NULL, &ciw, &cih);
- if (wd->vertical) *iw += cih;
- else *iw += ciw;
- it->prio.visible = (*iw <= vw);
+ if (it->prio.priority > wd->standard_priority)
+ {
+ evas_object_geometry_get(VIEW(it), NULL, NULL, &ciw, &cih);
+ if (wd->vertical) *iw += cih;
+ else *iw += ciw;
+ it->prio.visible = (*iw <= vw);
+ it->in_box = wd->bx;
+ if (!it->separator) count++;
+ }
+ else
+ {
+ it->prio.visible = EINA_FALSE;
+ if (!it->separator) i++;
+ if (i <= (count + 1))
+ it->in_box = wd->bx_more;
+ else
+ it->in_box = wd->bx_more2;
+ *more = EINA_TRUE;
+ }
}
}
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord mw, mh, vw = 0, vh = 0, w = 0, h = 0;
Elm_Toolbar_Item *it;
+ Eina_List *list;
+ Eina_Bool more;
if (!wd) return;
wd->resize_job = NULL;
if (wd->vertical)
{
evas_object_resize(wd->bx, w, vh);
- _fix_items_visibility(wd, &ih, vh);
+ _fix_items_visibility(wd, &ih, vh, &more);
}
else
{
evas_object_resize(wd->bx, vw, h);
- _fix_items_visibility(wd, &iw, vw);
+ _fix_items_visibility(wd, &iw, vw, &more);
}
evas_object_geometry_get(wd->VIEW(more_item), NULL, NULL,
&more_w, &more_h);
* items won't trigger a resize. Items are be readded below. */
evas_object_box_remove_all(wd->bx, EINA_FALSE);
if (((wd->vertical) && (ih > vh)) ||
- ((!wd->vertical) && (iw > vw)))
+ ((!wd->vertical) && (iw > vw)) || more)
{
Evas_Object *menu;
if (wd->vertical)
{
evas_object_resize(wd->bx, w, vh);
- _fix_items_visibility(wd, &ih, vh);
+ _fix_items_visibility(wd, &ih, vh, &more);
}
else
{
evas_object_resize(wd->bx, vw, h);
- _fix_items_visibility(wd, &iw, vw);
+ _fix_items_visibility(wd, &iw, vw, &more);
}
evas_object_box_remove_all(wd->bx, EINA_FALSE);
if (((wd->vertical) && (ih > vh)) ||
- ((!wd->vertical) && (iw > vw)))
+ ((!wd->vertical) && (iw > vw)) || more)
{
EINA_INLIST_FOREACH(wd->items, it)
{
}
else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
{
+ Evas_Coord iw = 0, ih = 0;
if ((vw >= mw) && (vh >= mh))
evas_object_resize(wd->bx, vw, vh);
else if (vw < mw)
evas_object_resize(wd->bx, mw, vh);
else if (vh < mh)
evas_object_resize(wd->bx, vw, mh);
+
+ if (wd->vertical)
+ _fix_items_visibility(wd, &ih, vh, &more);
+ else
+ _fix_items_visibility(wd, &iw, vw, &more);
+
+ evas_object_box_remove_all(wd->bx, EINA_FALSE);
+ evas_object_box_remove_all(wd->bx_more, EINA_FALSE);
+ evas_object_box_remove_all(wd->bx_more2, EINA_FALSE);
+ EINA_INLIST_FOREACH(wd->items, it)
+ {
+ if (it->in_box)
+ {
+ evas_object_box_append(it->in_box, VIEW(it));
+ evas_object_show(VIEW(it));
+ }
+ }
+ if (more)
+ {
+ evas_object_box_append(wd->bx, wd->VIEW(more_item));
+ evas_object_show(wd->VIEW(more_item));
+ }
+ else
+ evas_object_hide(wd->VIEW(more_item));
}
else
{
}
}
+ // Remove the first or last separator since it is not neccessary
+ list = evas_object_box_children_get(wd->bx_more);
+ EINA_INLIST_FOREACH(wd->items, it)
+ {
+ if (it->separator && ((VIEW(it) == eina_list_data_get(list)) ||
+ (VIEW(it) == eina_list_nth(list, eina_list_count(list)-1))))
+ {
+ evas_object_box_remove(wd->bx_more, VIEW(it));
+ evas_object_move(VIEW(it), -9999, -9999);
+ evas_object_hide(VIEW(it));
+ }
+ }
+ list = evas_object_box_children_get(wd->bx_more2);
+ EINA_INLIST_FOREACH(wd->items, it)
+ {
+ if (it->separator && ((VIEW(it) == eina_list_data_get(list)) ||
+ (VIEW(it) == eina_list_nth(list, eina_list_count(list)-1))))
+ {
+ evas_object_box_remove(wd->bx_more2, VIEW(it));
+ evas_object_move(VIEW(it), -9999, -9999);
+ evas_object_hide(VIEW(it));
+ }
+ }
+
_mirrored_set(obj, elm_widget_mirrored_get(obj));
}
_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
+ Evas_Coord x, y, h;
+ evas_object_geometry_get(data, &x, &y, NULL, &h);
+ evas_object_move(wd->more, x, y + h);
if (!wd->resize_job)
wd->resize_job = ecore_job_add(_resize_job, data);
}
static void
+_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+ Evas_Coord x, y, h;
+ evas_object_geometry_get(data, &x, &y, NULL, &h);
+ evas_object_move(wd->more, x, y + h);
+}
+
+static void
_select_filter(Elm_Toolbar_Item *it, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
{
int button;
}
}
+static void
+_change_items(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ Elm_Toolbar_Item *prev = NULL, *next = NULL;
+ int tmp;
+
+ if ((wd->reorder_from) && (wd->reorder_to) &&
+ (!wd->reorder_from->separator) && (!wd->reorder_to->separator))
+ {
+ prev = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(wd->reorder_from)->prev);
+ if (!prev)
+ next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(wd->reorder_from)->next);
+
+ wd->items = eina_inlist_remove(wd->items, EINA_INLIST_GET(wd->reorder_from));
+ wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(wd->reorder_from),
+ EINA_INLIST_GET(wd->reorder_to));
+
+ wd->items = eina_inlist_remove(wd->items, EINA_INLIST_GET(wd->reorder_to));
+ if (prev)
+ wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(wd->reorder_to),
+ EINA_INLIST_GET(prev));
+ else if (next)
+ wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(wd->reorder_to),
+ EINA_INLIST_GET(next));
+ tmp = wd->reorder_from->prio.priority;
+ wd->reorder_from->prio.priority = wd->reorder_to->prio.priority;
+ wd->reorder_to->prio.priority = tmp;
+ }
+ _resize(obj, NULL, NULL, NULL);
+}
+
+static void
+_reorder_mouse_move(Elm_Toolbar_Item *it, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Move *ev)
+{
+ Widget_Data *wd = elm_widget_data_get(WIDGET(it));
+ if (!wd) return;
+ Evas_Coord w, h;
+ evas_object_geometry_get(VIEW(it), NULL, NULL, &w, &h);
+ evas_object_move(VIEW(it), ev->cur.canvas.x - (w / 2), ev->cur.canvas.y - (h /2));
+ evas_object_show(VIEW(it));
+}
+
+static void
+_reorder_mouse_up(Elm_Toolbar_Item *it, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Up *ev)
+{
+ Widget_Data *wd = elm_widget_data_get(WIDGET(it));
+ if (!wd) return;
+ Evas_Coord x, y, w, h;
+
+ evas_object_event_callback_del_full(wd->scr, EVAS_CALLBACK_MOUSE_MOVE,
+ (Evas_Object_Event_Cb)_reorder_mouse_move, it);
+ evas_object_event_callback_del_full(wd->more, EVAS_CALLBACK_MOUSE_MOVE,
+ (Evas_Object_Event_Cb)_reorder_mouse_move, it);
+ evas_object_event_callback_del_full(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
+ (Evas_Object_Event_Cb)_reorder_mouse_move, it);
+ evas_object_event_callback_del_full(wd->scr, EVAS_CALLBACK_MOUSE_UP,
+ (Evas_Object_Event_Cb)_reorder_mouse_up, it);
+ evas_object_event_callback_del_full(wd->more, EVAS_CALLBACK_MOUSE_UP,
+ (Evas_Object_Event_Cb)_reorder_mouse_up, it);
+ _item_del(it);
+ elm_widget_item_free(it);
+
+ EINA_INLIST_FOREACH(wd->items, it)
+ {
+ evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
+ if ((x < ev->canvas.x) && (ev->canvas.x < x + w) &&
+ (y < ev->canvas.y) && (ev->canvas.y < y + h))
+ {
+ wd->reorder_to = it;
+ _change_items(WIDGET(it));
+ }
+ }
+}
+
+static void
+_item_reorder_start(Elm_Toolbar_Item *item)
+{
+ Evas_Object *obj = WIDGET(item);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Object *icon_obj;
+ Evas_Coord x, y, w, h;
+ Elm_Toolbar_Item *it;
+
+ wd->reorder_from = item;
+
+ icon_obj = elm_icon_add(obj);
+ elm_icon_order_lookup_set(icon_obj, wd->lookup_order);
+ if (!icon_obj) return;
+ it = elm_widget_item_new(obj, Elm_Toolbar_Item);
+ if (!it)
+ {
+ evas_object_del(icon_obj);
+ return;
+ }
+
+ it->label = eina_stringshare_add(item->label);
+ VIEW(it) = edje_object_add(evas_object_evas_get(obj));
+
+ if (_item_icon_set(icon_obj, "toolbar/", item->icon_str))
+ {
+ it->icon = icon_obj;
+ it->icon_str = eina_stringshare_add(item->icon_str);
+ }
+ else
+ {
+ it->icon = NULL;
+ it->icon_str = NULL;
+ evas_object_del(icon_obj);
+ }
+
+ _elm_theme_object_set(obj, VIEW(it), "toolbar", "item",
+ elm_widget_style_get(obj));
+ 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(VIEW(it), "elm.swallow.icon", it->icon);
+ edje_object_signal_emit(VIEW(it), "elm,state,icon,visible", "elm");
+ evas_object_show(it->icon);
+ elm_widget_sub_object_add(obj, it->icon);
+ }
+ if (it->label)
+ {
+ edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label);
+ edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm");
+ }
+
+ edje_object_signal_emit(VIEW(it), "elm,state,moving", "elm");
+
+ evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_MOVE,
+ (Evas_Object_Event_Cb)_reorder_mouse_move, it);
+
+ evas_object_event_callback_add(wd->more, EVAS_CALLBACK_MOUSE_MOVE,
+ (Evas_Object_Event_Cb)_reorder_mouse_move, it);
+
+ evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
+ (Evas_Object_Event_Cb)_reorder_mouse_move, it);
+
+ evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_UP,
+ (Evas_Object_Event_Cb)_reorder_mouse_up, it);
+
+ evas_object_event_callback_add(wd->more, EVAS_CALLBACK_MOUSE_UP,
+ (Evas_Object_Event_Cb)_reorder_mouse_up, it);
+
+ evas_object_geometry_get(VIEW(item), &x, &y, &w, &h);
+ evas_object_resize(VIEW(it), w, h);
+ evas_object_move(VIEW(it), x, y);
+ evas_object_show(VIEW(it));
+}
+
static Eina_Bool
_long_press(Elm_Toolbar_Item *it)
{
Widget_Data *wd = elm_widget_data_get(WIDGET(it));
wd->long_timer = NULL;
wd->long_press = EINA_TRUE;
+
+ if ((wd->more_item != it) &&
+ (wd->more_item == (Elm_Toolbar_Item *)elm_toolbar_selected_item_get(WIDGET(it))))
+ _item_reorder_start(it);
+
evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
return ECORE_CALLBACK_CANCEL;
}
static void
+_mouse_move(Elm_Toolbar_Item *it, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Move *ev)
+{
+ Widget_Data *wd = elm_widget_data_get(WIDGET(it));
+ if (!wd) return;
+ Evas_Coord x, y, w, h;
+ evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
+
+ if ((wd->long_timer) &&
+ ((x > ev->cur.canvas.x) || (ev->cur.canvas.x > x + w) ||
+ (y > ev->cur.canvas.y) || (ev->cur.canvas.y > y + h)))
+ {
+ ecore_timer_del(wd->long_timer);
+ wd->long_timer = NULL;
+ }
+}
+
+static void
_mouse_down(Elm_Toolbar_Item *it, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Down *ev)
{
Widget_Data *wd = elm_widget_data_get(WIDGET(it));
wd->long_press = EINA_FALSE;
if (wd->long_timer) ecore_timer_interval_set(wd->long_timer, _elm_config->longpress_timeout);
else wd->long_timer = ecore_timer_add(_elm_config->longpress_timeout, (Ecore_Task_Cb)_long_press, it);
+ evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
+ (Evas_Object_Event_Cb)_mouse_move, it);
}
static void
ecore_timer_del(wd->long_timer);
wd->long_timer = NULL;
}
+ evas_object_event_callback_del_full(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
+ (Evas_Object_Event_Cb)_mouse_move, it);
}
static void
evas_object_size_hint_min_set(it->icon, ms, ms);
evas_object_size_hint_max_set(it->icon, ms, ms);
edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon);
+ edje_object_signal_emit(VIEW(it), "elm,state,icon,visible", "elm");
evas_object_show(it->icon);
elm_widget_sub_object_add(obj, it->icon);
}
- edje_object_part_text_set(VIEW(it), "elm.text", it->label);
+ if (it->label)
+ {
+ edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label);
+ edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm");
+ }
mw = mh = -1;
- elm_coords_finger_size_adjust(1, &mw, 1, &mh);
+ if (!it->separator && !it->object)
+ elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh);
- elm_coords_finger_size_adjust(1, &mw, 1, &mh);
+ if (!it->separator && !it->object)
+ elm_coords_finger_size_adjust(1, &mw, 1, &mh);
if (wd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
{
if (wd->vertical)
_resize_item, obj);
if ((!wd->items) && (wd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS))
_item_select(it);
- wd->item_count++;
return it;
}
static void
_elm_toolbar_item_label_update(Elm_Toolbar_Item *item)
{
- Evas_Coord mw = -1, mh = -1;
+ Evas_Coord mw = -1, mh = -1, minw = -1, minh = -1;
Widget_Data *wd = elm_widget_data_get(WIDGET(item));
- edje_object_part_text_set(VIEW(item), "elm.text", item->label);
+ edje_object_part_text_escaped_set(VIEW(item), "elm.text", item->label);
+ edje_object_signal_emit(VIEW(item), "elm,state,text,visible", "elm");
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh);
evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
}
- evas_object_size_hint_min_set(VIEW(item), mw, mh);
+ evas_object_size_hint_min_get(VIEW(item), &minw, &minh);
+ if ((minw < mw) && (minh < mh))
+ evas_object_size_hint_min_set(VIEW(item), mw, mh);
+ else if ((minw < mw) && (minh > mh))
+ evas_object_size_hint_min_set(VIEW(item), mw, minh);
+ else if ((minw > mw) && (minh < mh))
+ evas_object_size_hint_min_set(VIEW(item), minw, mh);
}
static void
s = edje_object_data_get(VIEW(item), "transition_animation_on");
if ((s) && (atoi(s)))
{
- edje_object_part_text_set(VIEW(item), "elm.text_new", item->label);
+ edje_object_part_text_escaped_set(VIEW(item), "elm.text_new", item->label);
edje_object_signal_emit (VIEW(item), sig, "elm");
edje_object_signal_callback_add(VIEW(item),
"elm,state,label_set,done", "elm",
{
Elm_Toolbar_Item_State *it_state;
Eina_List *l;
- Evas_Coord mw = -1, mh = -1;
+ Evas_Coord mw = -1, mh = -1, minw = -1, minh = -1;
Widget_Data *wd = elm_widget_data_get(WIDGET(item));
Evas_Object *old_icon = edje_object_part_swallow_get(VIEW(item),
"elm.swallow.icon");
elm_widget_sub_object_del(VIEW(item), old_icon);
- evas_object_hide(old_icon);
+ /* edje_object_part_unswallow(VIEW(item), old_icon); */
edje_object_part_swallow(VIEW(item), "elm.swallow.icon", item->icon);
+ edje_object_signal_emit(VIEW(item), "elm,state,icon,visible", "elm");
+ evas_object_hide(old_icon);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
}
- evas_object_size_hint_min_set(VIEW(item), mw, mh);
+ evas_object_size_hint_min_get(VIEW(item), &minw, &minh);
+ if ((minw < mw) && (minh < mh))
+ evas_object_size_hint_min_set(VIEW(item), mw, mh);
+ else if ((minw < mw) && (minh > mh))
+ evas_object_size_hint_min_set(VIEW(item), mw, minh);
+ else if ((minw > mw) && (minh < mh))
+ evas_object_size_hint_min_set(VIEW(item), minw, mh);
EINA_LIST_FOREACH(item->states, l, it_state)
{
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_translate_hook_set(obj, _translate_hook);
- elm_widget_can_focus_set(obj, EINA_FALSE);
+ elm_widget_can_focus_set(obj, EINA_TRUE);
wd->more_item = NULL;
wd->selected_item = NULL;
+ wd->standard_priority = -99999;
wd->scr = elm_smart_scroller_add(e);
elm_smart_scroller_widget_set(wd->scr, obj);
elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", "default");
ELM_SMART_SCROLLER_POLICY_AUTO,
ELM_SMART_SCROLLER_POLICY_OFF);
-
wd->icon_size = _elm_toolbar_icon_size_get(wd);
elm_smart_scroller_child_set(wd->scr, wd->bx);
evas_object_show(wd->bx);
+ wd->more = elm_layout_add(obj);
+ elm_layout_theme_set(wd->more, "toolbar", "more", "default");
+ elm_widget_sub_object_add(obj, wd->more);
+ evas_object_show(wd->more);
+
+ wd->bx_more = evas_object_box_add(e);
+ evas_object_size_hint_align_set(wd->bx_more, wd->align, 0.5);
+ evas_object_box_layout_set(wd->bx_more, _layout, obj, NULL);
+ elm_widget_sub_object_add(obj, wd->bx_more);
+ elm_object_part_content_set(wd->more, "elm.swallow.content", wd->bx_more);
+ evas_object_show(wd->bx_more);
+
+ wd->bx_more2 = evas_object_box_add(e);
+ evas_object_size_hint_align_set(wd->bx_more2, wd->align, 0.5);
+ evas_object_box_layout_set(wd->bx_more2, _layout, obj, NULL);
+ elm_widget_sub_object_add(obj, wd->bx_more2);
+ elm_object_part_content_set(wd->more, "elm.swallow.content2", wd->bx_more2);
+ evas_object_show(wd->bx_more2);
+
elm_toolbar_shrink_mode_set(obj, _elm_config->toolbar_shrink_mode);
evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, _resize, obj);
+ evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOVE, _move, obj);
evas_object_event_callback_add(wd->bx, EVAS_CALLBACK_RESIZE, _resize, obj);
elm_toolbar_icon_order_lookup_set(obj, ELM_ICON_LOOKUP_THEME_FDO);
_theme_hook_item(obj, it, scale, wd->icon_size);
_sizing_eval(obj);
+ wd->item_count++;
return (Elm_Object_Item *)it;
}
evas_object_show(VIEW(it));
_theme_hook_item(obj, it, scale, wd->icon_size);
_sizing_eval(obj);
+ wd->item_count++;
return (Elm_Object_Item *)it;
}
evas_object_show(VIEW(it));
_theme_hook_item(obj, it, scale, wd->icon_size);
_sizing_eval(obj);
+ wd->item_count++;
return (Elm_Object_Item *)it;
}
evas_object_show(VIEW(it));
_theme_hook_item(obj, it, scale, wd->icon_size);
_sizing_eval(obj);
+ wd->item_count++;
return (Elm_Object_Item *)it;
}
return (Elm_Object_Item *) wd->selected_item;
}
+EAPI Elm_Object_Item *
+elm_toolbar_more_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 (Elm_Object_Item *) wd->more_item;
+}
+
EAPI void
elm_toolbar_item_icon_set(Elm_Object_Item *it, const char *icon)
{
item->separator = separator;
scale = (elm_widget_scale_get(obj) * _elm_config->scale);
_theme_hook_item(obj, item, scale, wd->icon_size);
+ evas_object_size_hint_min_set(VIEW(item), -1, -1);
}
EAPI Eina_Bool
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);
+ else if (shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
+ {
+ elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_AUTO,
+ ELM_SMART_SCROLLER_POLICY_OFF);
+ wd->more_item = _item_new(obj, "more_menu", "More", NULL, NULL);
+ }
else
elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_AUTO,
ELM_SMART_SCROLLER_POLICY_OFF);
}
EAPI void
+elm_toolbar_standard_priority_set(Evas_Object *obj, int priority)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ wd->standard_priority = priority;
+ _resize(obj, NULL, NULL, NULL);
+}
+
+EAPI int
+elm_toolbar_standard_priority_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return 0;
+ return wd->standard_priority;
+}
+
+EAPI void
elm_toolbar_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode)
{
ELM_CHECK_WIDTYPE(obj, widtype);