From 35b7c0fe5b466f8f7501ac89ebdbdb71c76db6e1 Mon Sep 17 00:00:00 2001 From: jaehwan Date: Mon, 26 Jul 2010 16:16:27 +0900 Subject: [PATCH] [controlbar] mode set, item animation --- src/lib/Elementary.h.in | 8 + src/lib/elm_controlbar.c | 1127 +++++++++++++++++++++++++++++----------------- 2 files changed, 720 insertions(+), 415 deletions(-) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index b3604bd..7ff396d 100755 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -2096,6 +2096,12 @@ extern "C" { #define CONTROLBAR_SYSTEM_ICON_FAVORITES "controlbar_favorites" #define CONTROLBAR_SYSTEM_ICON_LOGS "controlbar_logs" + typedef enum _Elm_Controlbar_Mode_Type{ + ELM_CONTROLBAR_MODE_DEFAULT = 0, + ELM_CONTROLBAR_MODE_LARGE, + ELM_CONTROLBAR_MODE_SMALL + } Elm_Controlbar_Mode_Type; + typedef struct _Elm_Controlbar_Item Elm_Controlbar_Item; EAPI Evas_Object *elm_controlbar_add(Evas_Object *parent); @@ -2126,6 +2132,8 @@ extern "C" { EAPI Elm_Controlbar_Item *elm_controlbar_item_next(Elm_Controlbar_Item *it); EAPI void elm_controlbar_edit_start(Evas_Object *obj); EAPI void elm_controlbar_view_set(Evas_Object *obj, Evas_Object *view); + EAPI void elm_controlbar_item_view_set(Elm_Controlbar_Item *it, Evas_Object * view); + EAPI void elm_controlbar_mode_set(Evas_Object *obj, int mode); /* diskcontroller */ diff --git a/src/lib/elm_controlbar.c b/src/lib/elm_controlbar.c index 5949f60..7a0ce5c 100644 --- a/src/lib/elm_controlbar.c +++ b/src/lib/elm_controlbar.c @@ -47,12 +47,13 @@ struct _Widget_Data Evas_Object * box; Evas_Object * event_box; - //Evas_Object *center_box; - Evas_Object * rect; Evas_Object * moving_obj; Elm_Controlbar_Item * moving_item; + Elm_Controlbar_Item * pre_item; + Elm_Controlbar_Item * cur_item; Evas_Coord x, y, w, h; Eina_Bool edit_mode; + int mode; int empty_num; int num; Eina_List * items; @@ -97,7 +98,7 @@ struct _Animation_Data Evas_Coord th; unsigned int start_time; double time; - void (*func) (void *data, Evas_Object * obj); + int (*func) (void *data, Evas_Object * obj); void *data; Ecore_Animator * timer; }; @@ -244,17 +245,17 @@ _del_hook(Evas_Object * obj) wd->event_box = NULL; } EINA_LIST_FREE(wd->items, item) - { - eina_stringshare_del(item->label); - if (item->icon) - evas_object_del(item->icon); - if (item->base) - evas_object_del(item->base); - if (item->edit_item) - evas_object_del(item->edit_item); - free(item); - item = NULL; - } + { + eina_stringshare_del(item->label); + if (item->icon) + evas_object_del(item->icon); + if (item->base) + evas_object_del(item->base); + if (item->edit_item) + evas_object_del(item->edit_item); + free(item); + item = NULL; + } free(wd); wd = NULL; } @@ -278,44 +279,44 @@ _theme_hook(Evas_Object * obj) _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box", elm_widget_style_get(obj)); EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->style != OBJECT) - { - elm_layout_theme_set(item->base, "controlbar", "item", - elm_widget_style_get(obj)); - object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon"); - elm_layout_theme_set(item->edit_item, "controlbar", "item", - elm_widget_style_get(obj)); - if (!item->editable) - { - color = - (Evas_Object *) - edje_object_part_object_get(_EDJ(item->edit_item), - "elm.edit.item.color"); - if (color) - evas_object_color_get(color, &r, &g, &b, &a); - evas_object_color_set(item->edit_item, r, g, b, a); - } - if (item->label) - { - edje_object_part_text_set(_EDJ(item->base), "elm.text", - item->label); - edje_object_part_text_set(_EDJ(item->edit_item), "elm.text", - item->label); - } - if (item->label && item->icon) - { - edje_object_signal_emit(_EDJ(item->base), - "elm,state,icon_text", "elm"); - edje_object_signal_emit(_EDJ(item->edit_item), - "elm,state,icon_text", "elm"); - } - if (item->selected) - { - selected_box(item); - } - } - } + { + if (item->style != OBJECT) + { + elm_layout_theme_set(item->base, "controlbar", "item", + elm_widget_style_get(obj)); + object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon"); + elm_layout_theme_set(item->edit_item, "controlbar", "item", + elm_widget_style_get(obj)); + if (!item->editable) + { + color = + (Evas_Object *) + edje_object_part_object_get(_EDJ(item->edit_item), + "elm.edit.item.color"); + if (color) + evas_object_color_get(color, &r, &g, &b, &a); + evas_object_color_set(item->edit_item, r, g, b, a); + } + if (item->label) + { + edje_object_part_text_set(_EDJ(item->base), "elm.text", + item->label); + edje_object_part_text_set(_EDJ(item->edit_item), "elm.text", + item->label); + } + if (item->label && item->icon) + { + edje_object_signal_emit(_EDJ(item->base), + "elm,state,icon_text", "elm"); + edje_object_signal_emit(_EDJ(item->edit_item), + "elm,state,icon_text", "elm"); + } + if (item->selected) + { + selected_box(item); + } + } + } } static void @@ -369,11 +370,13 @@ static void set_evas_map(Evas_Object * obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { - if (!obj) return; - + if (obj == NULL) + { + return; + } Evas_Map * map = evas_map_new(4); - if (!map) return; - + if (map == NULL) + return; evas_map_smooth_set(map, EINA_TRUE); evas_map_util_points_populate_from_object_full(map, obj, 0); evas_object_map_enable_set(obj, EINA_TRUE); @@ -433,13 +436,198 @@ move_evas_map(void *data) return EXIT_FAILURE; } + +static int +move_evas_object(void *data) +{ + double t; + + int dx, dy, dw, dh; + + int px, py, pw, ph; + + int x, y, w, h; + + Animation_Data * ad = (Animation_Data *) data; + t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000; + dx = ad->tx - ad->fx; + dy = ad->ty - ad->fy; + dw = ad->tw - ad->fw; + dh = ad->th - ad->fh; + if (t <= ad->time) + { + x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx); + y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy); + w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw); + h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh); + } + else + { + x = dx; + y = dy; + w = dw; + h = dh; + } + px = ad->fx + x; + py = ad->fy + y; + pw = ad->fw + w; + ph = ad->fh + h; + if (x == dx && y == dy && w == dw && h == dh) + { + ecore_animator_del(ad->timer); + ad->timer = NULL; + evas_object_move(ad->obj, px, py); + evas_object_resize(ad->obj, pw, ph); + if (ad->func != NULL) + ad->func(ad->data, ad->obj); + } + else + { + evas_object_move(ad->obj, px, py); + evas_object_resize(ad->obj, pw, ph); + } + return EXIT_FAILURE; +} + +static int +move_fade_out_object(void *data) +{ + double t; + + int dx, dy, dw, dh, da; + + int px, py, pw, ph, pa; + + int x, y, w, h, a; + + int r, g, b; + + Animation_Data * ad = (Animation_Data *) data; + t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000; + dx = ad->tx - ad->fx; + dy = ad->ty - ad->fy; + dw = ad->tw - ad->fw; + dh = ad->th - ad->fh; + da = 255; + if (t <= ad->time) + { + x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx); + y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy); + w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw); + h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh); + a = (1 * sin((t / ad->time) * (M_PI / 2)) * da); + } + else + { + x = dx; + y = dy; + w = dw; + h = dh; + a = da; + } + px = ad->fx + x; + py = ad->fy + y; + pw = ad->fw + w; + ph = ad->fh + h; + pa = 255 - a; + if (x == dx && y == dy && w == dw && h == dh) + { + ecore_animator_del(ad->timer); + ad->timer = NULL; + evas_object_move(ad->obj, px, py); + //evas_object_resize(ad->obj, 480, 600); + evas_object_resize(ad->obj, pw, ph); + evas_object_color_get(ad->obj, &r, &g, &b, &a); + evas_object_color_set(ad->obj, r, g, b, pa); + evas_object_show(ad->obj); + if (ad->func != NULL) + ad->func(ad->data, ad->obj); + } + else + { + evas_object_move(ad->obj, px, py); + //evas_object_resize(ad->obj, 480, 600); + evas_object_resize(ad->obj, pw, ph); + evas_object_color_get(ad->obj, &r, &g, &b, &a); + evas_object_color_set(ad->obj, r, g, b, pa); + evas_object_show(ad->obj); + } + return EXIT_FAILURE; +} + +static int +move_fade_in_object(void *data) +{ + double t; + + int dx, dy, dw, dh, da; + + int px, py, pw, ph, pa; + + int x, y, w, h, a; + + int r, g, b; + + Animation_Data * ad = (Animation_Data *) data; + t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000; + dx = ad->tx - ad->fx; + dy = ad->ty - ad->fy; + dw = ad->tw - ad->fw; + dh = ad->th - ad->fh; + da = 255; + if (t <= ad->time) + { + x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx); + y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy); + w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw); + h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh); + a = (1 * sin((t / ad->time) * (M_PI / 2)) * da); + } + else + { + x = dx; + y = dy; + w = dw; + h = dh; + a = da; + } + px = ad->fx + x; + py = ad->fy + y; + pw = ad->fw + w; + ph = ad->fh + h; + pa = a; + if (x == dx && y == dy && w == dw && h == dh) + { + ecore_animator_del(ad->timer); + ad->timer = NULL; + evas_object_move(ad->obj, px, py); + //evas_object_resize(ad->obj, 480, 600); + evas_object_resize(ad->obj, pw, ph); + evas_object_color_get(ad->obj, &r, &g, &b, &a); + evas_object_color_set(ad->obj, r, g, b, pa); + evas_object_show(ad->obj); + if (ad->func != NULL) + ad->func(ad->data, ad->obj); + } + else + { + evas_object_move(ad->obj, px, py); + //evas_object_resize(ad->obj, 480, 600); + evas_object_resize(ad->obj, pw, ph); + evas_object_color_get(ad->obj, &r, &g, &b, &a); + evas_object_color_set(ad->obj, r, g, b, pa); + evas_object_show(ad->obj); + } + return EXIT_FAILURE; +} + static void move_object_with_animation(Evas_Object * obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Evas_Coord x_, Evas_Coord y_, Evas_Coord w_, Evas_Coord h_, - double time, void (*func) (void *data, - Evas_Object * obj), - void *data) + double time, int (*mv_func) (void *data), + void (*func) (void *data, + Evas_Object * obj), void *data) { Animation_Data * ad = (Animation_Data *) malloc(sizeof(Animation_Data)); ad->obj = obj; @@ -455,7 +643,7 @@ move_object_with_animation(Evas_Object * obj, Evas_Coord x, Evas_Coord y, ad->time = time; ad->func = func; ad->data = data; - ad->timer = ecore_animator_add(move_evas_map, ad); + ad->timer = ecore_animator_add(mv_func, ad); } ///////////////////////////////////////////////////////////// @@ -519,27 +707,27 @@ item_insert_in_bar(Elm_Controlbar_Item * it, int order) int check = 0; EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->order == order && item != it) - check = 1; - } + { + if (item->order == order && item != it) + check = 1; + } if (check) { EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->order > 0) - elm_table_unpack(wd->box, item->base); - } + { + if (item->order > 0) + elm_table_unpack(wd->box, item->base); + } EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->order > 0) - { - if (item->order >= order) - item->order += 1; - elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1); - evas_object_show(item->base); - } - } + { + if (item->order > 0) + { + if (item->order >= order) + item->order += 1; + elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1); + evas_object_show(item->base); + } + } } it->order = order; elm_table_pack(wd->box, it->base, order - 1, 0, 1, 1); @@ -556,26 +744,26 @@ item_delete_in_bar(Elm_Controlbar_Item * it) int i = 0; EINA_LIST_FOREACH(wd->items, l, item) - { - if (item == it) - { - i = it->order; - it->order = 0; - elm_table_unpack(wd->box, it->base); - evas_object_hide(it->base); - } - } + { + if (item == it) + { + i = it->order; + it->order = 0; + elm_table_unpack(wd->box, it->base); + evas_object_hide(it->base); + } + } if (i) { EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->order > i) - { - item->order--; - elm_table_unpack(wd->box, item->base); - elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1); - } - } + { + if (item->order > i) + { + item->order--; + elm_table_unpack(wd->box, item->base); + elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1); + } + } } } @@ -606,10 +794,10 @@ item_exchange_in_bar(Elm_Controlbar_Item * it1, Elm_Controlbar_Item * it2) evas_object_geometry_get(it2->base, &x_, &y_, &w_, &h_); wd->animating++; move_object_with_animation(it1->base, x, y, w, h, x_, y_, w_, h_, 0.25, - item_exchange_animation_cb, wd); + move_evas_map, item_exchange_animation_cb, wd); wd->animating++; move_object_with_animation(it2->base, x_, y_, w_, h_, x, y, w, h, 0.25, - item_exchange_animation_cb, wd); + move_evas_map, item_exchange_animation_cb, wd); elm_table_unpack(wd->box, it1->base); elm_table_unpack(wd->box, it2->base); order = it1->order; @@ -662,7 +850,7 @@ item_change_in_bar(Elm_Controlbar_Item * it) evas_object_geometry_get(it->edit_item, &x_, &y_, &w_, &h_); wd->animating++; move_object_with_animation(it->base, x, y, w, h, x_, y_, w_, h_, 0.25, - item_change_animation_cb, wd); + move_evas_map, item_change_animation_cb, wd); evas_object_geometry_get(wd->moving_item->base, &x, &y, &w, &h); set_evas_map(wd->moving_item->base, x, y, w, h); } @@ -670,107 +858,169 @@ item_change_in_bar(Elm_Controlbar_Item * it) static void object_color_set(Evas_Object *ly, const char *color_part, const char *obj_part) { - Evas_Object *color; - int r, g, b, a; + Evas_Object *color; + int r, g, b, a; - color = - (Evas_Object *) edje_object_part_object_get(_EDJ(ly), color_part); - if (color) - evas_object_color_get(color, &r, &g, &b, &a); - color = - edje_object_part_swallow_get(_EDJ(ly), obj_part); - evas_object_color_set(color, r, g, b, a); + color = + (Evas_Object *) edje_object_part_object_get(_EDJ(ly), color_part); + if (color) + evas_object_color_get(color, &r, &g, &b, &a); + color = + edje_object_part_swallow_get(_EDJ(ly), obj_part); + evas_object_color_set(color, r, g, b, a); } -static void -selected_box(Elm_Controlbar_Item * it) +static void +_end_selected_box(void *data, Evas_Object *obj) { - Widget_Data * wd = elm_widget_data_get(it->obj); + Widget_Data * wd = (Widget_Data *)data; - if(it->style == TABBAR) - { - it->selected = EINA_TRUE; - evas_object_smart_callback_call(it->obj, "view,change,before", it); - object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon"); - edje_object_signal_emit(_EDJ(it->base), "elm,state,selected", - "elm"); - edje_object_part_swallow(wd->view, "elm.swallow.view", - it->view); - evas_object_show(it->view); + edje_object_signal_emit(_EDJ(wd->pre_item->base), "elm,state,unselected", "elm"); + edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,state,selected", "elm"); - } - else if(it->style == TOOLBAR) + wd->animating--; + if (wd->animating < 0) { - if (it->func) - it->func(it->data, it->obj, it); + printf("animation error\n"); + wd->animating = 0; } +} - evas_object_smart_callback_call(it->obj, "clicked", it); +static void +move_selected_box(Widget_Data *wd, Elm_Controlbar_Item * fit, Elm_Controlbar_Item * tit) +{ + Evas_Coord fx, fy, fw, fh, tx, ty, tw, th; + Evas_Object *from, *to; + + from = (Evas_Object *)edje_object_part_object_get(_EDJ(fit->base), "bg_img"); + evas_object_geometry_get(from, &fx, &fy, &fw, &fh); + + to = (Evas_Object *)edje_object_part_object_get(_EDJ(tit->base), "bg_img"); + evas_object_geometry_get(to, &tx, &ty, &tw, &th); + + edje_object_signal_emit(_EDJ(wd->pre_item->base), "elm,state,unselected", "elm"); + edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,state,selected", "elm"); + printf("layer from : %d to : %d \n", evas_object_layer_get(fit->base),evas_object_layer_get(tit->base)); + + Evas_Object *icon = (Evas_Object *)edje_object_part_object_get(_EDJ(tit->base), "elm.swallow.icon"); + //evas_object_stack_below(from, icon); + //evas_object_raise(from); + evas_object_layer_set(fit->base, 123); + wd->animating++; + move_object_with_animation(to, fx, fy, fw, fh, tx, ty, tw, th, + 0.6, move_evas_object, _end_selected_box, wd); } static void -clicked_box_cb(void *data, Evas_Object * obj, const char *emission, - const char *source) +end_selected_box(void *data, Evas_Object *obj) { - Widget_Data * wd = (Widget_Data *) data; + Widget_Data * wd = (Widget_Data *)data; + + printf("end selected box\n"); + wd->pre_item->selected = EINA_FALSE; + edje_object_part_unswallow(wd->view, wd->pre_item->view); + evas_object_hide(wd->pre_item->view); + + edje_object_part_swallow(wd->view, "elm.swallow.view", obj); + evas_object_show(obj); +} + +static void +selected_box(Elm_Controlbar_Item * it) +{ + Widget_Data * wd = elm_widget_data_get(it->obj); const Eina_List *l; + Elm_Controlbar_Item * item, *fit = NULL; + Evas_Coord x, y, w, h; - Elm_Controlbar_Item * item; - if (wd == NULL) - return; - if (wd->edit_mode) - return; - EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->style == TABBAR) - { - object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon"); - edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm"); - edje_object_signal_emit(_EDJ(item->base), "elm,state,text_unselected", "elm"); - } - if (_EDJ(item->base) == obj) - { - selected_box(item); - } - else - { - item->selected = EINA_FALSE; - edje_object_part_unswallow(wd->view, item->view); - evas_object_hide(item->view); - } - } + if(wd->animating) return; + + wd->cur_item = it; + + if(it->style == TABBAR){ + + EINA_LIST_FOREACH(wd->items, l, item){ + if(item->selected) { + fit = item; + wd->pre_item = fit; + } + item->selected = EINA_FALSE; + edje_object_part_unswallow(wd->view, item->view); + evas_object_hide(item->view); + } + it->selected = EINA_TRUE; + evas_object_smart_callback_call(it->obj, "view,change,before", it); + object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon"); + + if(fit != NULL && fit != it) + move_selected_box(wd, fit, it); + else + edje_object_signal_emit(_EDJ(it->base), "elm,state,selected", "elm"); + + + if(fit != NULL && fit != it){ + evas_object_geometry_get(fit->view, &x, &y, &w, &h); +// move_object_with_animation(fit->view, x, y, w, h, x, y, w, h, 0.5, move_fade_out_object, NULL, NULL); +// if(fit->order > it->order) +// move_object_with_animation(it->view, x+20, y, w, h, x, y, w, h, 0.5, move_fade_in_object, NULL, NULL); +// else +// move_object_with_animation(it->view, x-20, y, w, h, x, y, w, h, 0.5, move_fade_in_object, NULL, NULL); + + + //fit->selected = EINA_FALSE; + //edje_object_part_unswallow(wd->view, fit->view); + //evas_object_hide(fit->view); + + + } + edje_object_part_swallow(wd->view, "elm.swallow.view", it->view); + evas_object_show(it->view); + + }else if(it->style == TOOLBAR){ + if (it->func) + it->func(it->data, it->obj, it); + } + + evas_object_smart_callback_call(it->obj, "clicked", it); } -static int -unfocused_box_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) +static void +unpressed_box_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { Widget_Data * wd = (Widget_Data *) data; const Eina_List *l; + Evas_Event_Mouse_Up * ev = event_info; + Evas_Coord x, y, w, h; Elm_Controlbar_Item * item; EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->style == TABBAR) - { - if(item->selected){ - object_color_set(item->base, "elm.tabbar.selected.color", "elm.swallow.icon"); - edje_object_signal_emit(_EDJ(item->base), "elm,state,selected", "elm"); - } - else - { - object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon"); - edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm"); - } - } - else if (item->style == TOOLBAR) - { - object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon"); - edje_object_signal_emit(_EDJ(item->base), "elm,state,text_unselected", "elm"); + { + evas_object_geometry_get(item->base, &x, &y, &w, &h); + if(ev->output.x > x && ev->output.x < x+w && ev->output.y > y && ev->output.y < y+h){ + selected_box(item); + }else{ + if (item->style == TABBAR) + { + if(item->selected){ + object_color_set(item->base, "elm.tabbar.selected.color", "elm.swallow.icon"); + edje_object_signal_emit(_EDJ(item->base), "elm,state,selected", "elm"); + } + else + { + object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon"); + edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm"); + } + } + else if (item->style == TOOLBAR) + { + object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon"); + edje_object_signal_emit(_EDJ(item->base), "elm,state,text_unselected", "elm"); + } } - } - evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unfocused_box_cb); + } + evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb); - return EXIT_SUCCESS; + return; } static int @@ -780,28 +1030,32 @@ pressed_box(Elm_Controlbar_Item * it) int check = 0; const Eina_List *l; Elm_Controlbar_Item * item; + + if(wd->animating) return; EINA_LIST_FOREACH(wd->items, l, item) - { - if (it == item) - { - if (it->style == TABBAR) - { - object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon"); - edje_object_signal_emit(_EDJ(it->base), "elm,state,pressed", - "elm"); - } - else if (it->style == TOOLBAR) - { - object_color_set(it->base, "elm.toolbar.pressed.color", "elm.swallow.icon"); - edje_object_signal_emit(_EDJ(it->base), "elm,state,text_selected", - "elm"); - } - evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unfocused_box_cb, (void *)wd); - - check = EINA_TRUE; - } - } + { + if (it == item) + { + if (it->style == TABBAR) + { + + object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon"); + edje_object_signal_emit(_EDJ(it->base), "elm,state,pressed", + "elm"); + } + else if (it->style == TOOLBAR) + { + + object_color_set(it->base, "elm.toolbar.pressed.color", "elm.swallow.icon"); + edje_object_signal_emit(_EDJ(it->base), "elm,state,text_selected", + "elm"); + } + evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb, (void *)wd); + + check = EINA_TRUE; + } + } if (!check) return EXIT_FAILURE; @@ -887,7 +1141,7 @@ edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) Evas_Coord x, y, w, h; Widget_Data * wd = (Widget_Data *) data; if (wd->animating) - return EXIT_FAILURE; + return; evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h); w *= 2.0; h *= 2.0; @@ -896,23 +1150,23 @@ edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) set_evas_map(wd->moving_obj, x, y, w, h); EINA_LIST_FOREACH(wd->items, l, item) - { - if (wd->moving_item->edit_item == item->edit_item || item->style == OBJECT) - continue; - evas_object_geometry_get(item->base, &x, &y, &w, &h); - if (ev->cur.output.x > x && ev->cur.output.x < x + w && ev->cur.output.y > y && ev->cur.output.y < y + h - && item->editable) - { - edje_object_signal_emit(_EDJ(item->base), "elm,state,show,glow", - "elm"); - } - else - { - edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow", - "elm"); - } - } - return EXIT_SUCCESS; + { + if (wd->moving_item->edit_item == item->edit_item || item->style == OBJECT) + continue; + evas_object_geometry_get(item->base, &x, &y, &w, &h); + if (ev->cur.output.x > x && ev->cur.output.x < x + w && ev->cur.output.y > y && ev->cur.output.y < y + h + && item->editable) + { + edje_object_signal_emit(_EDJ(item->base), "elm,state,show,glow", + "elm"); + } + else + { + edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow", + "elm"); + } + } + return; } static void @@ -926,25 +1180,25 @@ edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) Widget_Data * wd = (Widget_Data *) data; if (wd->moving_obj) if ((int)evas_object_data_get(wd->moving_obj, "returning") == 1) - return EXIT_FAILURE; + return; evas_object_color_set(wd->moving_item->edit_item, 255, 255, 255, 255); - // check which change or not - EINA_LIST_FOREACH(wd->items, l, item) - { - if (wd->moving_item->edit_item == item->edit_item) - continue; - if (item->order <= 0) - continue; - evas_object_geometry_get(item->base, &x, &y, &w, &h); - if (ev->output.x > x && ev->output.x < x + w && ev->output.y > y && ev->output.y < y + h - && item->style != OBJECT && item->editable) - { - edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow", - "elm"); - break; - } - } + // check which change or not + EINA_LIST_FOREACH(wd->items, l, item) + { + if (wd->moving_item->edit_item == item->edit_item) + continue; + if (item->order <= 0) + continue; + evas_object_geometry_get(item->base, &x, &y, &w, &h); + if (ev->output.x > x && ev->output.x < x + w && ev->output.y > y && ev->output.y < y + h + && item->style != OBJECT && item->editable) + { + edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow", + "elm"); + break; + } + } if (item != NULL) { if (wd->moving_item->order > 0) @@ -955,15 +1209,15 @@ edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { item_change_in_bar(item); } - evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb); - evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb); + evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb); + evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb); } else { - - // return moving object to original location - evas_object_geometry_get(wd->moving_item->edit_item, &x_, &y_, &w_, - &h_); + + // return moving object to original location + evas_object_geometry_get(wd->moving_item->edit_item, &x_, &y_, &w_, + &h_); evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h); w *= 2.0; h *= 2.0; @@ -972,9 +1226,9 @@ edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) evas_object_data_set(wd->moving_obj, "returning", (void *)1); wd->animating++; move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_, - 0.25, edit_item_return_cb, wd); + 0.25, move_evas_map, edit_item_return_cb, wd); } - return EXIT_SUCCESS; + return; } static void @@ -994,15 +1248,15 @@ edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj, if (wd->animating) return; EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->edit_item == obj) - break; - } + { + if (item->edit_item == obj) + break; + } if (item == NULL) - return; + return; if (!item->editable) - return; - + return; + evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb, (void *)wd); evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb, (void *)wd); @@ -1010,12 +1264,12 @@ edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj, color = (Evas_Object *) edje_object_part_object_get(_EDJ(wd->moving_item->edit_item), - "elm.edit.item.color"); + "elm.edit.item.color"); if (color) - evas_object_color_get(color, &r, &g, &b, &a); + evas_object_color_get(color, &r, &g, &b, &a); evas_object_color_set(item->edit_item, r, g, b, a); if (wd->moving_obj) - evas_object_del(wd->moving_obj); + evas_object_del(wd->moving_obj); wd->moving_obj = NULL; wd->moving_obj = create_item_layout(obj, item); evas_object_geometry_get(obj, &x, &y, &w, &h); @@ -1028,7 +1282,7 @@ edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj, y_ = ev->output.y - h_; wd->animating++; move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_, 0.1, - edit_item_down_end_cb, wd); + move_evas_map, edit_item_down_end_cb, wd); } static void @@ -1039,10 +1293,10 @@ bar_item_move_end_cb(void *data, Evas_Object * obj) Elm_Controlbar_Item * item; EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->base == obj) - break; - } + { + if (item->base == obj) + break; + } wd->animating--; if (wd->animating < 0) { @@ -1060,12 +1314,12 @@ bar_item_animation_end_check(void *data) Elm_Controlbar_Item * item; Widget_Data * wd = (Widget_Data *) data; if (wd->animating) - return EXIT_FAILURE; + return EXIT_FAILURE; EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->base == wd->moving_obj) - break; - } + { + if (item->base == wd->moving_obj) + break; + } if (item == NULL) { printf("item is NULL\n"); @@ -1094,26 +1348,26 @@ bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) if (wd->moving_obj == NULL) { printf("%s : moving_obj is NULL\n", __func__); - return EXIT_FAILURE; + return; } evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h); x = ev->cur.output.x - w / 2; set_evas_map(wd->moving_obj, x, y, w, h); EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->base == wd->moving_obj) - { - it = item; - continue; - } - if ((int)evas_object_data_get(item->base, "animating") == 1) - continue; - evas_object_geometry_get(item->base, &x, &y, &w, &h); - if (ev->cur.output.x > x && ev->cur.output.x < x + w && item->editable) - { - break; - } - } + { + if (item->base == wd->moving_obj) + { + it = item; + continue; + } + if ((int)evas_object_data_get(item->base, "animating") == 1) + continue; + evas_object_geometry_get(item->base, &x, &y, &w, &h); + if (ev->cur.output.x > x && ev->cur.output.x < x + w && item->editable) + { + break; + } + } if (item) { evas_object_geometry_get(wd->moving_obj, &x_, &y_, &w_, &h_); @@ -1128,9 +1382,9 @@ bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) wd->animating++; evas_object_data_set(item->base, "animating", (void *)1); move_object_with_animation(item->base, x, y, w, h, x_, y_, w_, h_, - 0.25, bar_item_move_end_cb, wd); + 0.25, move_evas_map, bar_item_move_end_cb, wd); } - return EXIT_SUCCESS; + return; } static void @@ -1142,9 +1396,9 @@ bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h); tx = ev->output.x - w / 2; move_object_with_animation(wd->moving_obj, tx, y, w, h, x, y, w, h, 0.25, - NULL, NULL); + move_evas_map, NULL, NULL); ecore_timer_add(0.1, bar_item_animation_end_check, wd); - return EXIT_SUCCESS; + return; } static void @@ -1156,21 +1410,21 @@ bar_item_down_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info) if (wd->animating) return; EINA_LIST_FOREACH(wd->items, l, item) - { - if (item->base == obj) - break; - } + { + if (item->base == obj) + break; + } if (item == NULL) - return; + return; if (wd->edit_mode) { if (!item->editable) - return; + return; wd->moving_obj = obj; wd->empty_num = item->order; evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, bar_item_up_cb, (void *)wd); - evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb, (void *)wd); + evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb, (void *)wd); } else { @@ -1210,14 +1464,15 @@ create_tab_item(Evas_Object * obj, const char *icon_path, const char *label, it->base = create_item_layout(wd->edje, it); evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN, bar_item_down_cb, wd); - edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm", - clicked_box_cb, wd); + //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm", + // clicked_box_cb, wd); object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon"); evas_object_show(it->base); it->edit_item = create_item_layout(wd->edje, it); evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN, edit_item_down_cb, wd); evas_object_show(it->edit_item); + return it; } @@ -1255,8 +1510,8 @@ create_tool_item(Evas_Object * obj, const char *icon_path, const char *label, it->base = create_item_layout(wd->edje, it); evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN, bar_item_down_cb, wd); - edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm", - clicked_box_cb, wd); + //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm", + // clicked_box_cb, wd); object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon"); evas_object_show(it->base); it->edit_item = create_item_layout(wd->edje, it); @@ -1371,7 +1626,7 @@ set_items_position(Evas_Object * obj, Elm_Controlbar_Item * it, * * @ingroup Controlbar */ -EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent) + EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent) { Evas_Object * obj = NULL; Widget_Data * wd = NULL; @@ -1398,6 +1653,7 @@ EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent) wd->y = y; wd->w = w; wd->h = h; + wd->mode = ELM_CONTROLBAR_MODE_DEFAULT; wd->num = 0; wd->animating = 0; wd->edit_mode = EINA_FALSE; @@ -1409,11 +1665,11 @@ EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent) return NULL; } evas_object_show(wd->view); - - // edit box - wd->edit_box = edje_object_add(wd->evas); + + // edit box + wd->edit_box = edje_object_add(wd->evas); _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box", - "default"); + "default"); if (wd->edit_box == NULL) { printf("Cannot load bg edj\n"); @@ -1432,31 +1688,31 @@ EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent) evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd); edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", r_button); */ - // navigationbar will contribution. but not yet - wd->navigation = elm_navigationbar_add(wd->edit_box); - r_button = elm_button_add(wd->navigation); - elm_button_label_set(r_button, "Done"); - evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd); - elm_navigationbar_push(wd->navigation, "Configure", NULL, r_button, NULL, NULL); - edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", wd->navigation); - - wd->edit_table = elm_table_add(wd->edit_box); + // navigationbar will contribution. but not yet + wd->navigation = elm_navigationbar_add(wd->edit_box); + r_button = elm_button_add(wd->navigation); + elm_button_label_set(r_button, "Done"); + evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd); + elm_navigationbar_push(wd->navigation, "Configure", NULL, r_button, NULL, NULL); + edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", wd->navigation); + + wd->edit_table = elm_table_add(wd->edit_box); elm_table_homogenous_set(wd->edit_table, EINA_TRUE); edje_object_part_swallow(wd->edit_box, "elm.swallow.table", wd->edit_table); - - /* load background edj */ - wd->edje = edje_object_add(wd->evas); - - // snprintf(buf, sizeof(buf), "bg_portrait_%d", wd->view_slot_num); - _elm_theme_object_set(obj, wd->edje, "controlbar", "base", "default"); + + /* load background edj */ + wd->edje = edje_object_add(wd->evas); + +// snprintf(buf, sizeof(buf), "bg_portrait_%d", wd->view_slot_num); + _elm_theme_object_set(obj, wd->edje, "controlbar", "base", "default"); if (wd->edje == NULL) { printf("Cannot load bg edj\n"); return NULL; } evas_object_show(wd->edje); - - // initialization + + // initialization evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_RESIZE, _controlbar_object_resize, obj); evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, @@ -1466,22 +1722,22 @@ EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent) evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _controlbar_object_hide, obj); - // items container + // items container wd->box = elm_table_add(wd->edje); elm_table_homogenous_set(wd->box, EINA_TRUE); evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, EVAS_HINT_FILL); edje_object_part_swallow(wd->edje, "elm.swallow.items", wd->box); elm_widget_sub_object_add(obj, wd->box); - - //FIXME - // evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + //FIXME + // evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); evas_object_smart_member_add(wd->view, obj); evas_object_smart_member_add(wd->edit_box, obj); elm_widget_resize_object_set(obj, wd->edje); - - // initialization + + // initialization _sizing_eval(obj); return obj; } @@ -1497,7 +1753,7 @@ EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent) * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj, + EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj, const char *icon_path, const char *label, @@ -1508,12 +1764,12 @@ EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj, Widget_Data * wd; it = create_tab_item(obj, icon_path, label, view); if (it == NULL) - return NULL; + return NULL; wd = elm_widget_data_get(obj); set_items_position(obj, it, NULL); wd->items = eina_list_append(wd->items, it); if (wd->num == 1) - selected_box(it); + selected_box(it); _sizing_eval(obj); return it; } @@ -1529,7 +1785,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_prepend(Evas_Object * + EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_prepend(Evas_Object * obj, const char *icon_path, @@ -1566,7 +1822,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_prepend(Evas_Object * * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * + EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_insert_before(Evas_Object * obj, Elm_Controlbar_Item * before, const char *icon_path, @@ -1600,7 +1856,7 @@ elm_controlbar_tab_item_insert_before(Evas_Object * obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * + EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_insert_after(Evas_Object * obj, Elm_Controlbar_Item * after, const char *icon_path, const char *label, @@ -1636,7 +1892,7 @@ elm_controlbar_tab_item_insert_after(Evas_Object * obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_append(Evas_Object * + EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_append(Evas_Object * obj, const char *icon_path, @@ -1675,7 +1931,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_append(Evas_Object * * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_prepend(Evas_Object * + EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_prepend(Evas_Object * obj, const char *icon_path, @@ -1718,7 +1974,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_prepend(Evas_Object * * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * + EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_insert_before(Evas_Object * obj, Elm_Controlbar_Item * before, const char *icon_path, @@ -1755,7 +2011,7 @@ elm_controlbar_tool_item_insert_before(Evas_Object * obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * + EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_insert_after(Evas_Object * obj, Elm_Controlbar_Item * after, const char *icon_path, @@ -1791,7 +2047,7 @@ elm_controlbar_tool_item_insert_after(Evas_Object * obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_object_item_append(Evas_Object * + EAPI Elm_Controlbar_Item * elm_controlbar_object_item_append(Evas_Object * obj, Evas_Object * obj_item, @@ -1850,7 +2106,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_object_item_append(Evas_Object * * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * + EAPI Elm_Controlbar_Item * elm_controlbar_object_item_insert_before(Evas_Object * obj, Elm_Controlbar_Item * before, Evas_Object * obj_item, const int sel) @@ -1880,7 +2136,7 @@ elm_controlbar_object_item_insert_before(Evas_Object * obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * + EAPI Elm_Controlbar_Item * elm_controlbar_object_item_insert_after(Evas_Object * obj, Elm_Controlbar_Item * after, Evas_Object * obj_item, const int sel) @@ -1908,7 +2164,7 @@ elm_controlbar_object_item_insert_after(Evas_Object * obj, * @ingroup Controlbar */ -EAPI void + EAPI void elm_controlbar_item_del(Elm_Controlbar_Item * it) { Evas_Object * obj; @@ -1935,68 +2191,68 @@ elm_controlbar_item_del(Elm_Controlbar_Item * it) return; } - // delete base item - if (it->order > 0) + // delete base item + if (it->order > 0) { elm_table_unpack(wd->box, it->base); sel = it->sel; EINA_LIST_FOREACH(wd->items, l, item) - { - if (it != item) - { - if (item->order > it->order) - { - elm_table_unpack(wd->box, item->base); - item->order -= sel; - elm_table_pack(wd->box, item->base, item->order - 1, 0, - item->sel, 1); - } - } - if (it == item) - { - check = 1; - } - } + { + if (it != item) + { + if (item->order > it->order) + { + elm_table_unpack(wd->box, item->base); + item->order -= sel; + elm_table_pack(wd->box, item->base, item->order - 1, 0, + item->sel, 1); + } + } + if (it == item) + { + check = 1; + } + } } - - // delete edit item - check = 0; + + // delete edit item + check = 0; if (it->edit_item != NULL) { elm_table_unpack(wd->edit_table, it->edit_item); EINA_LIST_FOREACH(wd->items, l, item) - { - if (check) - { - if (item->edit_item != NULL) - { - elm_table_unpack(wd->edit_table, item->edit_item); - elm_table_pack(wd->edit_table, item->edit_item, - (i - 1) % 4, (i - 1) / 4, 1, 1); - } - } - if (it == item && item->style != OBJECT) - { - check = 1; - i--; - } - if (item->style != OBJECT) - i++; - } + { + if (check) + { + if (item->edit_item != NULL) + { + elm_table_unpack(wd->edit_table, item->edit_item); + elm_table_pack(wd->edit_table, item->edit_item, + (i - 1) % 4, (i - 1) / 4, 1, 1); + } + } + if (it == item && item->style != OBJECT) + { + check = 1; + i--; + } + if (item->style != OBJECT) + i++; + } } - - // delete item in list - if (it->label) - eina_stringshare_del(it->label); + + // delete item in list + if (it->label) + eina_stringshare_del(it->label); if (it->icon) - evas_object_del(it->icon); + evas_object_del(it->icon); if (it->base) { if (it->style != OBJECT) - evas_object_del(it->base); - + evas_object_del(it->base); + else - evas_object_hide(it->base); + evas_object_hide(it->base); } if (it->view) { @@ -2004,7 +2260,7 @@ elm_controlbar_item_del(Elm_Controlbar_Item * it) evas_object_hide(it->view); } if (it->edit_item) - evas_object_del(it->edit_item); + evas_object_del(it->edit_item); wd->items = eina_list_remove(wd->items, it); wd->num = wd->num - 1; _sizing_eval(obj); @@ -2017,7 +2273,7 @@ elm_controlbar_item_del(Elm_Controlbar_Item * it) * @ingroup Controlbar */ -EAPI void + EAPI void elm_controlbar_item_select(Elm_Controlbar_Item * it) { if (it->obj == NULL) @@ -2039,7 +2295,7 @@ elm_controlbar_item_select(Elm_Controlbar_Item * it) * * @ingroup Controlbar */ -EAPI Evas_Object * elm_controlbar_item_icon_get(Elm_Controlbar_Item * it) + EAPI Evas_Object * elm_controlbar_item_icon_get(Elm_Controlbar_Item * it) { return it->icon; } @@ -2066,7 +2322,7 @@ elm_controlbar_item_label_get(Elm_Controlbar_Item * it) * * @ingroup Controlbar */ -EAPI void + EAPI void elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label) { if (!it->base) @@ -2082,7 +2338,7 @@ elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label) * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_selected_item_get(Evas_Object * + EAPI Elm_Controlbar_Item * elm_controlbar_selected_item_get(Evas_Object * obj) { const Eina_List *l; @@ -2109,7 +2365,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_selected_item_get(Evas_Object * * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_first_item_get(Evas_Object * obj) + EAPI Elm_Controlbar_Item * elm_controlbar_first_item_get(Evas_Object * obj) { if (obj == NULL) return NULL; @@ -2127,7 +2383,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_first_item_get(Evas_Object * obj) * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_last_item_get(Evas_Object * obj) + EAPI Elm_Controlbar_Item * elm_controlbar_last_item_get(Evas_Object * obj) { if (obj == NULL) return NULL; @@ -2145,7 +2401,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_last_item_get(Evas_Object * obj) * * @ingroup Controlbar */ -EAPI Eina_List * elm_controlbar_items_get(Evas_Object * obj) + EAPI Eina_List * elm_controlbar_items_get(Evas_Object * obj) { if (obj == NULL) return NULL; @@ -2163,7 +2419,7 @@ EAPI Eina_List * elm_controlbar_items_get(Evas_Object * obj) * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item * + EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item * it) { const Eina_List *l; @@ -2173,17 +2429,17 @@ EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item * return NULL; Widget_Data * wd = elm_widget_data_get(it->obj); if (!wd || !wd->items) - return NULL; + return NULL; EINA_LIST_FOREACH(wd->items, l, item) - { - if (it == item) - { - l = eina_list_prev(l); - if (!l) - return NULL; - return eina_list_data_get(l); - } - } + { + if (it == item) + { + l = eina_list_prev(l); + if (!l) + return NULL; + return eina_list_data_get(l); + } + } return NULL; } @@ -2195,7 +2451,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item * * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item * + EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item * it) { const Eina_List *l; @@ -2205,17 +2461,17 @@ EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item * return NULL; Widget_Data * wd = elm_widget_data_get(it->obj); if (!wd || !wd->items) - return NULL; + return NULL; EINA_LIST_FOREACH(wd->items, l, item) - { - if (it == item) - { - l = eina_list_next(l); - if (!l) - return NULL; - return eina_list_data_get(l); - } - } + { + if (it == item) + { + l = eina_list_next(l); + if (!l) + return NULL; + return eina_list_data_get(l); + } + } return NULL; } @@ -2226,7 +2482,7 @@ EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item * * @ingroup Controlbar */ -EAPI void + EAPI void elm_controlbar_edit_start(Evas_Object * obj) { Widget_Data * wd; @@ -2253,14 +2509,14 @@ elm_controlbar_edit_start(Evas_Object * obj) * * @ingroup Controlbar */ -EAPI void + EAPI void elm_controlbar_item_visible_set(Elm_Controlbar_Item * it, Eina_Bool bar) { Eina_Bool check = EINA_TRUE; if (it->order <= 0) - check = EINA_FALSE; + check = EINA_FALSE; if (check == bar) - return; + return; if (bar) { item_insert_in_bar(it, 0); @@ -2280,7 +2536,7 @@ elm_controlbar_item_visible_set(Elm_Controlbar_Item * it, Eina_Bool bar) * * @ingroup Controlbar */ -EAPI void + EAPI void elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable) { Evas_Object * color; @@ -2303,7 +2559,7 @@ elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable) * * @ingroup Controlbar */ -EAPI void + EAPI void elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view) { Widget_Data * wd; @@ -2322,7 +2578,6 @@ elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view) edje_object_part_swallow(wd->view, "elm.swallow.view", wd->view_content); } - /** * Set the view of the item * @@ -2331,9 +2586,51 @@ elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view) * * @ingroup Controlbar */ -EAPI void + EAPI void elm_controlbar_item_view_set(Elm_Controlbar_Item *it, Evas_Object * view) { - it->view = view; + it->view = view; +} + +/** + * Set the mode of the controlbar + * + * @param obj The object of the controlbar + * @param mode The mode of the controlbar + * + * @ingroup Controlbar + */ + EAPI void +elm_controlbar_mode_set(Evas_Object *obj, int mode) +{ + Widget_Data * wd; + if (obj == NULL) + { + fprintf(stderr, "Invalid argument: controlbar object is NULL\n"); + return; + } + wd = elm_widget_data_get(obj); + if (wd == NULL) + { + fprintf(stderr, "Cannot get smart data\n"); + return; + } + + if(wd->mode == mode) return; + + switch(mode){ + case ELM_CONTROLBAR_MODE_DEFAULT: + edje_object_signal_emit(wd->edje, "elm,state,default", "elm"); + break; + case ELM_CONTROLBAR_MODE_LARGE: + edje_object_signal_emit(wd->edje, "elm,state,large", "elm"); + break; + case ELM_CONTROLBAR_MODE_SMALL: + edje_object_signal_emit(wd->edje, "elm,state,small", "elm"); + break; + default: + break; + } } + -- 2.7.4