From f854380eb384a8ee3bf01045596ee9e628a11a93 Mon Sep 17 00:00:00 2001 From: Jeahwan Kim Date: Fri, 3 Dec 2010 15:24:08 +0900 Subject: [PATCH] [controlbar] launching time issue delete edit mode delete shadow label --- src/lib/elm_controlbar.c | 1865 ++++++++++++++++++++++++---------------------- 1 file changed, 964 insertions(+), 901 deletions(-) diff --git a/src/lib/elm_controlbar.c b/src/lib/elm_controlbar.c index 24c5ec7..9cc1b6b 100644 --- a/src/lib/elm_controlbar.c +++ b/src/lib/elm_controlbar.c @@ -5,27 +5,27 @@ * This is a Controlbar. It can contain label and icon objects. * In edit mode, you can change the location of items. */ - + #include #include - + #include #include "elm_priv.h" - + #ifndef EAPI #define EAPI __attribute__ ((visibility("default"))) #endif #define MAX_ARGS 512 #define EDIT_ROW_NUM 4 - + #define ELM_MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2)) #define _EDJ(x) (Evas_Object *)elm_layout_edje_get(x) - + #define TABBAR 0 #define TOOLBAR 1 #define OBJECT 2 - + // internal data structure of controlbar object typedef struct _Widget_Data Widget_Data; @@ -36,9 +36,9 @@ struct _Widget_Data Evas_Object * parent; Evas_Object * view; Evas_Object * view_content; - Evas_Object * edit_box; - Evas_Object * edit_table; - Evas_Object * navigation; + // Evas_Object * edit_box; + // Evas_Object * edit_table; + // Evas_Object * navigation; Evas_Object * edje; Evas_Object * bg; Evas_Object * box; @@ -47,7 +47,7 @@ struct _Widget_Data Evas_Object * focused_box; Evas_Object * focused_box_left; Evas_Object * focused_box_right; - + Evas_Object * moving_obj; Elm_Controlbar_Item * more_item; Elm_Controlbar_Item * moving_item; @@ -55,7 +55,7 @@ struct _Widget_Data Elm_Controlbar_Item * cur_item; Evas_Coord x, y, w, h; Eina_Bool vertical; - Eina_Bool edit_mode; + // Eina_Bool edit_mode; Eina_Bool auto_align; int mode; int alpha; @@ -68,7 +68,7 @@ struct _Widget_Data Ecore_Event_Handler * up_event; Ecore_Event_Handler * bar_move_event; Ecore_Event_Handler * bar_up_event; - + void (*ani_func) (void *data, Evas_Object * obj, void *event_info); void *ani_data; Eina_Bool init_animation; @@ -81,7 +81,7 @@ struct _Widget_Data const char *view_hide; const char *view_show; - + const char *pressed_signal; const char *selected_signal; }; @@ -91,17 +91,17 @@ struct _Elm_Controlbar_Item Evas_Object * obj; Evas_Object * base; Evas_Object * base_item; - Evas_Object * edit; - Evas_Object * edit_item; + // Evas_Object * edit; + // Evas_Object * edit_item; Evas_Object * view; Evas_Object * label; Evas_Object * label_shadow; Evas_Object * icon; Evas_Object * icon_shadow; - Evas_Object * edit_label; - Evas_Object * edit_label_shadow; - Evas_Object * edit_icon; - Evas_Object * edit_icon_shadow; + // Evas_Object * edit_label; + // Evas_Object * edit_label_shadow; + // Evas_Object * edit_icon; + // Evas_Object * edit_icon_shadow; const char *icon_path; const char *text; void (*func) (void *data, Evas_Object * obj, void *event_info); @@ -111,7 +111,7 @@ struct _Elm_Controlbar_Item int style; int badge; Eina_Bool selected; - Eina_Bool editable; + // Eina_Bool editable; Eina_Bool disable; }; @@ -141,10 +141,10 @@ static int check_bar_item_number(Widget_Data *wd); static void selected_box(Elm_Controlbar_Item * it); static int pressed_box(Elm_Controlbar_Item * it); static void item_color_set(Elm_Controlbar_Item *item, const char *color_part); -static void edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); +//static void edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); +//static void edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); +//static void bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); +//static void bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); ///////////////////////// // temp function @@ -167,7 +167,7 @@ print_all_items(Widget_Data *wd) // Smart Object basic function // //////////////////////////////////////////////////////////////////// - + static void _controlbar_move(void *data, Evas_Object * obj) { @@ -194,7 +194,7 @@ _controlbar_move(void *data, Evas_Object * obj) evas_object_move(wd->view, x, y); break; } - evas_object_move(wd->edit_box, x_, y_); + // evas_object_move(wd->edit_box, x_, y_); evas_object_move(wd->event_box, x, y); } @@ -221,11 +221,11 @@ _controlbar_resize(void *data, Evas_Object * obj) case ELM_CONTROLBAR_MODE_LEFT: case ELM_CONTROLBAR_MODE_RIGHT: evas_object_resize(wd->view, w - width, h); - evas_object_resize(wd->edit_box, w + x - x_, h); + // evas_object_resize(wd->edit_box, w + x - x_, h); break; default: evas_object_resize(wd->view, w, h - height + 1); - evas_object_resize(wd->edit_box, w, h + y - y_); + // evas_object_resize(wd->edit_box, w, h + y - y_); break; } evas_object_resize(wd->event_box, w, h); @@ -237,47 +237,48 @@ _controlbar_resize(void *data, Evas_Object * obj) if(!wd->vertical) { elm_label_wrap_width_set(item->label, (int)(wd->w/check_bar_item_number(wd))-20); - elm_label_wrap_width_set(item->label_shadow, (int)(wd->w/check_bar_item_number(wd))-20); + // elm_label_wrap_width_set(item->label_shadow, (int)(wd->w/check_bar_item_number(wd))-20); } else { elm_label_wrap_width_set(item->label, (int)(wd->w-20)); - elm_label_wrap_width_set(item->label_shadow, (int)(wd->w-20)); + // elm_label_wrap_width_set(item->label_shadow, (int)(wd->w-20)); } } - if(item->edit_label) - { - elm_label_wrap_width_set(item->edit_label, (int)(wd->w/check_bar_item_number(wd))-20); - elm_label_wrap_width_set(item->edit_label_shadow, (int)(wd->w/check_bar_item_number(wd))-20); - } + /* if(item->edit_label) + { + elm_label_wrap_width_set(item->edit_label, (int)(wd->w/check_bar_item_number(wd))-20); + elm_label_wrap_width_set(item->edit_label_shadow, (int)(wd->w/check_bar_item_number(wd))-20); + }*/ } } static void _controlbar_object_move(void *data, Evas * e, Evas_Object * obj, - void *event_info) + void *event_info) { _controlbar_move(data, obj); } static void _controlbar_object_resize(void *data, Evas * e, Evas_Object * obj, - void *event_info) + void *event_info) { _controlbar_resize(data, obj); } static void _controlbar_object_show(void *data, Evas * e, Evas_Object * obj, - void *event_info) + void *event_info) { Widget_Data * wd; - if (!data) return; + if (!data) + return; wd = elm_widget_data_get((Evas_Object *) data); - if (!wd) return; - + if (!wd) + return; evas_object_show(wd->view); - evas_object_show(wd->edit_box); + // evas_object_show(wd->edit_box); evas_object_show(wd->edje); evas_object_show(wd->box); evas_object_show(wd->event_box); @@ -285,15 +286,16 @@ _controlbar_object_show(void *data, Evas * e, Evas_Object * obj, static void _controlbar_object_hide(void *data, Evas * e, Evas_Object * obj, - void *event_info) + void *event_info) { Widget_Data * wd; - if (!data) return; + if (!data) + return; wd = elm_widget_data_get((Evas_Object *) data); - if (!wd) return; - + if (!wd) + return; evas_object_hide(wd->view); - evas_object_hide(wd->edit_box); + // evas_object_hide(wd->edit_box); evas_object_hide(wd->edje); evas_object_hide(wd->box); evas_object_hide(wd->event_box); @@ -307,8 +309,8 @@ _item_del(Elm_Controlbar_Item *it) if(!wd) return; if(it == wd->more_item) - if(it->view) - evas_object_del(it->view); + if(it->view) + evas_object_del(it->view); if (it->text) eina_stringshare_del(it->text); if (it->label) @@ -325,15 +327,16 @@ _item_del(Elm_Controlbar_Item *it) { if (it->style != OBJECT) evas_object_del(it->base); + else evas_object_hide(it->base); } if (it->base_item) evas_object_del(it->base_item); - if (it->edit) - evas_object_del(it->edit); - if (it->edit_item) - evas_object_del(it->edit_item); + // if (it->edit) + // evas_object_del(it->edit); + // if (it->edit_item) + // evas_object_del(it->edit_item); if (it->view) { evas_object_hide(it->view); @@ -345,8 +348,9 @@ _del_hook(Evas_Object * obj) { Widget_Data * wd = elm_widget_data_get(obj); Elm_Controlbar_Item * item; - //Evas_Object * content; - if (!wd) return; + Evas_Object * content; + if (!wd) + return; EINA_LIST_FREE(wd->items, item) { @@ -355,70 +359,70 @@ _del_hook(Evas_Object * obj) item = NULL; } /* - if (wd->view) - { - content = elm_layout_content_unset(wd->view, "elm.swallow.view"); - evas_object_hide(content); - evas_object_del(wd->view); - wd->view = NULL; - } - if (wd->edit_box) - { - evas_object_del(wd->edit_box); - wd->edit_box = NULL; - } - */ - if (wd->navigation) - { - evas_object_del(wd->navigation); - wd->navigation = NULL; - } + if (wd->view) + { + content = elm_layout_content_unset(wd->view, "elm.swallow.view"); + evas_object_hide(content); + evas_object_del(wd->view); + wd->view = NULL; + } + if (wd->edit_box) + { + evas_object_del(wd->edit_box); + wd->edit_box = NULL; + } + */ + // if (wd->navigation) + // { + // evas_object_del(wd->navigation); + // wd->navigation = NULL; + // } if (wd->bg) { - evas_object_del(wd->bg); - wd->bg = NULL; + evas_object_del(wd->bg); + wd->bg = NULL; } /* - if (wd->edje) - { - evas_object_del(wd->edje); - wd->edje = NULL; - } - if (wd->focused_box) - { - evas_object_del(wd->focused_box); - wd->edje = NULL; - } - if (wd->focused_box_left) - { - evas_object_del(wd->focused_box_left); - wd->edje = NULL; - } - if (wd->focused_box_right) - { - evas_object_del(wd->focused_box_right); - wd->edje = NULL; - } - if (wd->box) - { - evas_object_del(wd->box); - wd->box = NULL; - } - if (wd->event_box) - { - evas_object_del(wd->event_box); - wd->event_box = NULL; - } - */ + if (wd->edje) + { + evas_object_del(wd->edje); + wd->edje = NULL; + } + if (wd->focused_box) + { + evas_object_del(wd->focused_box); + wd->edje = NULL; + } + if (wd->focused_box_left) + { + evas_object_del(wd->focused_box_left); + wd->edje = NULL; + } + if (wd->focused_box_right) + { + evas_object_del(wd->focused_box_right); + wd->edje = NULL; + } + if (wd->box) + { + evas_object_del(wd->box); + wd->box = NULL; + } + if (wd->event_box) + { + evas_object_del(wd->event_box); + wd->event_box = NULL; + } + */ if (wd->xa) { - elm_xml_animator_del(wd->xa); - wd->xa = NULL; + elm_xml_animator_del(wd->xa); + wd->xa = NULL; } if (wd->effect_timer) { - ecore_timer_del(wd->effect_timer); - wd->effect_timer = NULL; + ecore_timer_del(wd->effect_timer); + wd->effect_timer = NULL; } free(wd); @@ -435,7 +439,8 @@ _theme_hook(Evas_Object * obj) int r, g, b, a; Widget_Data * wd = elm_widget_data_get(obj); - if (!wd) return; + if (!wd) + return; _elm_theme_object_set(obj, wd->edje, "controlbar", "base", elm_widget_style_get(obj)); _elm_theme_object_set(obj, wd->bg, "controlbar", "background", @@ -443,8 +448,8 @@ _theme_hook(Evas_Object * obj) evas_object_color_get(wd->bg, &r, &g, &b, NULL); evas_object_color_set(wd->bg, r, g, b, (int)(255 * wd->alpha / 100)); elm_layout_theme_set(wd->view, "controlbar", "view", elm_widget_style_get(obj)); - _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box", - elm_widget_style_get(obj)); + // _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box", + // elm_widget_style_get(obj)); _elm_theme_object_set(obj, wd->focused_box, "controlbar", "item_bg_move", elm_widget_style_get(obj)); _elm_theme_object_set(obj, wd->focused_box_left, "controlbar", "item_bg_move", elm_widget_style_get(obj)); _elm_theme_object_set(obj, wd->focused_box_right, "controlbar", "item_bg_move", elm_widget_style_get(obj)); @@ -454,24 +459,24 @@ _theme_hook(Evas_Object * obj) { elm_layout_theme_set(item->base, "controlbar", "item_bg", elm_widget_style_get(obj)); - elm_layout_theme_set(item->edit, "controlbar", "item_bg", - elm_widget_style_get(obj)); - if (!item->editable) - { - color = - (Evas_Object *) - edje_object_part_object_get(_EDJ(item->edit), - "elm.item.uneditable.color"); - if (color) - evas_object_color_get(color, &r, &g, &b, &a); - evas_object_color_set(item->edit_item, r, g, b, a); - } + // elm_layout_theme_set(item->edit, "controlbar", "item_bg", + // elm_widget_style_get(obj)); + // if (!item->editable) + // { + // color = + // (Evas_Object *) + // edje_object_part_object_get(_EDJ(item->edit), + // "elm.item.uneditable.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 && item->icon) { edje_object_signal_emit(_EDJ(item->base_item), "elm,state,icon_text", "elm"); - edje_object_signal_emit(_EDJ(item->edit_item), - "elm,state,icon_text", "elm"); + // edje_object_signal_emit(_EDJ(item->edit_item), + // "elm,state,icon_text", "elm"); } if (item->selected) { @@ -492,7 +497,7 @@ _sub_del(void *data, Evas_Object * obj, void *event_info) if (sub == wd->view) { content = elm_layout_content_unset(wd->view, "elm.swallow.view"); - evas_object_hide(content); + evas_object_hide(content); } } @@ -511,7 +516,7 @@ _sizing_eval(Evas_Object * obj) // animation function // ///////////////////////////////////////////////////////////// - + static unsigned int current_time_get() { @@ -520,15 +525,18 @@ current_time_get() gettimeofday(&timev, NULL); return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000)); } - + static void set_evas_map(Evas_Object * obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, - Evas_Coord h) + Evas_Coord h) { - if (obj == NULL) return; + if (obj == NULL) + { + return; + } Evas_Map * map = evas_map_new(4); - if (map == NULL) 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); @@ -781,11 +789,11 @@ move_fade_in_object(void *data) 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, Eina_Bool (*mv_func) (void *data), - void (*func) (void *data, - Evas_Object * obj), void *data) + Evas_Coord w, Evas_Coord h, Evas_Coord x_, + Evas_Coord y_, Evas_Coord w_, Evas_Coord h_, + double time, Eina_Bool (*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; @@ -819,11 +827,10 @@ item_animation_effect(void *data) Elm_Controlbar_Item * item; int rand; - if(!wd->xa) - { + if(!wd->xa){ wd->xa = elm_xml_animator_add(wd->object); elm_xml_animator_file_set(wd->xa, "/usr/share/xmls/elementary.xml"); - } + } srand(time(NULL)); @@ -890,10 +897,10 @@ sort_reverse_cb(const void *d1, const void *d2) return -1; return item1->order > item2->order ? -1 : 1; } - -static void -done_button_cb(void *data, Evas_Object * obj, void *event_info) -{ +/* + static void + done_button_cb(void *data, Evas_Object * obj, void *event_info) + { Widget_Data * wd = (Widget_Data *) data; wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb); @@ -902,8 +909,8 @@ done_button_cb(void *data, Evas_Object * obj, void *event_info) edje_object_signal_emit(wd->edit_box, "elm,state,hide,edit_box", "elm"); wd->edit_mode = EINA_FALSE; -} - + } + */ /////////////////////////////////////////////////////////////////// // // basic utility function @@ -1036,20 +1043,22 @@ item_visible_set(Elm_Controlbar_Item *it, Eina_Bool visible) Elm_Controlbar_Item *item; Eina_Bool check = EINA_TRUE; - if(!it || !it->obj) return; - + if(!it) return; + if (it->obj == NULL) + return; Widget_Data * wd = elm_widget_data_get(it->obj); - if (!wd || !wd->items) return; + if (!wd || !wd->items) + return; if (it->order <= 0) check = EINA_FALSE; - if (check == visible) return; + if (check == visible) + return; if (visible) { item = elm_controlbar_last_item_get(it->obj); - while(!elm_controlbar_item_visible_get(item)) - { + while(!elm_controlbar_item_visible_get(item)){ item = elm_controlbar_item_prev(item); - } + } item_insert_in_bar(it, item->order + 1); } else @@ -1067,15 +1076,15 @@ item_exchange_animation_cb(void *data, Evas_Object * obj) wd->animating--; if (wd->animating < 0) { - printf("animation error\n"); - wd->animating = 0; + printf("animation error\n"); + wd->animating = 0; } evas_object_map_enable_set(obj, EINA_FALSE); } - -static void -item_exchange_in_bar(Elm_Controlbar_Item * it1, Elm_Controlbar_Item * it2) -{ +/* + static void + item_exchange_in_bar(Elm_Controlbar_Item * it1, Elm_Controlbar_Item * it2) + { int order; Evas_Coord x, y, w, h; @@ -1083,43 +1092,43 @@ item_exchange_in_bar(Elm_Controlbar_Item * it1, Elm_Controlbar_Item * it2) Widget_Data * wd = elm_widget_data_get(it1->obj); evas_object_geometry_get(wd->moving_item->edit, &x, &y, &w, &h); set_evas_map(wd->moving_obj, (wd->x + wd->w / 2), (wd->y + wd->h / 2), 0, - 0); + 0); evas_object_geometry_get(it1->base, &x, &y, &w, &h); 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, - move_evas_map, 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, - move_evas_map, 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; it1->order = it2->order; it2->order = order; if(!wd->vertical) - { - elm_table_pack(wd->box, it1->base, it1->order - 1, 0, 1, 1); - elm_table_pack(wd->box, it2->base, it2->order - 1, 0, 1, 1); - } + { + elm_table_pack(wd->box, it1->base, it1->order - 1, 0, 1, 1); + elm_table_pack(wd->box, it2->base, it2->order - 1, 0, 1, 1); + } else - { - elm_table_pack(wd->box, it1->base, 0, it1->order - 1, 1, 1); - elm_table_pack(wd->box, it2->base, 0, it2->order - 1, 1, 1); - } -} + { + elm_table_pack(wd->box, it1->base, 0, it1->order - 1, 1, 1); + elm_table_pack(wd->box, it2->base, 0, it2->order - 1, 1, 1); + } + } -static void -item_change_animation_cb(void *data, Evas_Object * obj) -{ + static void + item_change_animation_cb(void *data, Evas_Object * obj) + { Evas_Coord x, y, w, h; Widget_Data * wd = (Widget_Data *) data; wd->animating--; if (wd->animating < 0) - { - printf("animation error\n"); - wd->animating = 0; - } + { + printf("animation error\n"); + wd->animating = 0; + } evas_object_map_enable_set(obj, EINA_FALSE); evas_object_geometry_get(obj, &x, &y, &w, &h); set_evas_map(obj, x, y, 0, 0); @@ -1127,42 +1136,44 @@ item_change_animation_cb(void *data, Evas_Object * obj) evas_object_geometry_get(wd->moving_item->base, &x, &y, &w, &h); evas_object_move(wd->moving_obj, -1000, -1000); evas_object_del(wd->moving_obj); -} + } -static void -item_change_in_bar(Elm_Controlbar_Item * it) -{ + static void + item_change_in_bar(Elm_Controlbar_Item * it) + { Evas_Coord x, y, w, h; Evas_Coord x_, y_, w_, h_; Widget_Data * wd = elm_widget_data_get(it->obj); - if (!wd) return; - if (!wd->moving_item) return; + if (wd == NULL) + return; + if (wd->moving_item == NULL) + return; evas_object_geometry_get(wd->moving_item->edit, &x, &y, &w, &h); set_evas_map(wd->moving_obj, x, y, w, h); elm_table_unpack(wd->box, it->base); wd->moving_item->order = it->order; - it->order = 0; - if(!wd->vertical) - { - elm_table_pack(wd->box, wd->moving_item->base, wd->moving_item->order - 1, 0, 1, 1); - } - else - { - elm_table_pack(wd->box, wd->moving_item->base, 0, wd->moving_item->order - 1, 1, 1); - } - - evas_object_show(wd->moving_item->base); - evas_render_updates_free(evas_render_updates - (evas_object_evas_get(wd->moving_item->base))); - evas_object_geometry_get(it->base, &x, &y, &w, &h); - evas_object_geometry_get(it->edit, &x_, &y_, &w_, &h_); - wd->animating++; - move_object_with_animation(it->base, x, y, w, h, x_, y_, w_, h_, 0.25, - 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); +it->order = 0; +if(!wd->vertical) +{ + elm_table_pack(wd->box, wd->moving_item->base, wd->moving_item->order - 1, 0, 1, 1); +} +else +{ + elm_table_pack(wd->box, wd->moving_item->base, 0, wd->moving_item->order - 1, 1, 1); } +evas_object_show(wd->moving_item->base); +evas_render_updates_free(evas_render_updates + (evas_object_evas_get(wd->moving_item->base))); +evas_object_geometry_get(it->base, &x, &y, &w, &h); +evas_object_geometry_get(it->edit, &x_, &y_, &w_, &h_); +wd->animating++; +move_object_with_animation(it->base, x, y, w, h, x_, y_, w_, h_, 0.25, + 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); +} +*/ static Eina_Bool hide_selected_box(void *data) { @@ -1239,20 +1250,20 @@ end_selected_box(void *data, Evas_Object *obj) evas_object_show(obj); } - -static void -view_animation_push(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data) -{ +/* + static void + view_animation_push(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data) + { Evas_Coord x, y, w, h; evas_object_geometry_get(pre, &x, &y, &w, &h); move_object_with_animation(pre, x, y, w, h, x+20, y, w, h, 0.5, move_fade_out_object, NULL, NULL); move_object_with_animation(cur, x+120, y, w, h, x, y, w, h, 0.5, move_fade_in_object, end_selected_box, wd); -} + } -static void -view_animation_down(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data) -{ + static void + view_animation_down(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data) + { Evas_Coord x, y, w, h; evas_object_geometry_get(pre, &x, &y, &w, &h); @@ -1260,17 +1271,16 @@ view_animation_down(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *d move_object_with_animation(cur, x, h, w, h, x, h, w, h, 0.5, move_evas_object, end_selected_box, wd); evas_object_raise(pre); move_object_with_animation(pre, x, y, w, h, x, h, w, 0, 0.5, move_evas_map, NULL, NULL); -} - + } + */ static void end_view_animation_effect(void *data, Evas_Object *obj) { Widget_Data *wd = (Widget_Data *)data; elm_xml_animator_object_del(wd->vxa, obj); - if(wd->pre_item) - { + if(wd->pre_item) { evas_object_hide(wd->pre_item->view); - } + } //if(wd->cur_item) elm_layout_content_set(wd->view, "elm.swallow.view", wd->cur_item->view); } @@ -1286,25 +1296,21 @@ selected_box(Elm_Controlbar_Item * it) wd->cur_item = it; - if(!wd->vxa) - { + if(!wd->vxa){ wd->vxa = elm_xml_animator_add(wd->object); elm_xml_animator_file_set(wd->vxa, "/usr/share/xmls/elementary.xml"); - } + } - if(it->style == TABBAR) - { + if(it->style == TABBAR){ content = elm_layout_content_unset(wd->view, "elm.swallow.view"); - EINA_LIST_FOREACH(wd->items, l, item) - { - if(item->selected) - { + EINA_LIST_FOREACH(wd->items, l, item){ + if(item->selected) { fit = item; wd->pre_item = fit; - } + } item->selected = EINA_FALSE; - } + } it->selected = EINA_TRUE; if(wd->more_item != it) @@ -1320,64 +1326,61 @@ selected_box(Elm_Controlbar_Item * it) edje_object_signal_emit(_EDJ(wd->cur_item->base_item), "elm,state,shadow_show", "elm"); } -/* - if(fit != NULL && fit != it) - { - //view_animation_down(wd, fit->view, it->view, NULL); - view_animation_push(wd, fit->view, it->view, NULL); - //evas_object_hide(content); - -// evas_object_geometry_get(fit->view, &x, &y, &w, &h); - // if(fit->order > it->order) - // { -// move_object_with_animation(fit->view, x, y, w, h, x+20, y, w, h, 0.5, move_fade_out_object, NULL, NULL); -// move_object_with_animation(it->view, x+120, y, w, h, x, y, w, h, 0.5, move_fade_in_object, end_selected_box, wd); - // } - // else - // { - // move_object_with_animation(fit->view, x, y, w, h, x-120, y, w, h, 1.5, move_fade_out_object, NULL, NULL); - // move_object_with_animation(it->view, x-120, y, w, h, x, y, w, h, 1.5, move_fade_in_object, end_selected_box, wd); - // } - } - else - { - end_selected_box(wd, it->view); - } -*/ - //if(wd->pre_item) evas_object_hide(wd->pre_item->view); - elm_layout_content_set(wd->view, "elm.swallow.view", it->view); - - //evas_object_move(it->view, -480, 94); - //evas_object_resize(it->view, 480, 620); - //evas_object_show(it->view); - - if(wd->pre_item && wd->pre_item != it) - { - if(wd->view_hide) - elm_xml_animator_object_add(wd->vxa, wd->pre_item->view, wd->view_hide, end_view_animation_effect, wd); - else - evas_object_hide(wd->pre_item->view); - if(wd->view_show) - { - elm_xml_animator_object_add(wd->vxa, it->view, wd->view_show, end_view_animation_effect, wd); - } + /* + if(fit != NULL && fit != it) + { + //view_animation_down(wd, fit->view, it->view, NULL); + view_animation_push(wd, fit->view, it->view, NULL); + //evas_object_hide(content); + + // evas_object_geometry_get(fit->view, &x, &y, &w, &h); + // if(fit->order > it->order) + // { + // move_object_with_animation(fit->view, x, y, w, h, x+20, y, w, h, 0.5, move_fade_out_object, NULL, NULL); + // move_object_with_animation(it->view, x+120, y, w, h, x, y, w, h, 0.5, move_fade_in_object, end_selected_box, wd); + // } + // else + // { + // move_object_with_animation(fit->view, x, y, w, h, x-120, y, w, h, 1.5, move_fade_out_object, NULL, NULL); + // move_object_with_animation(it->view, x-120, y, w, h, x, y, w, h, 1.5, move_fade_in_object, end_selected_box, wd); + // } + } + else + { + end_selected_box(wd, it->view); + } + */ + //if(wd->pre_item) evas_object_hide(wd->pre_item->view); + elm_layout_content_set(wd->view, "elm.swallow.view", it->view); + + //evas_object_move(it->view, -480, 94); + //evas_object_resize(it->view, 480, 620); + //evas_object_show(it->view); + + if(wd->pre_item && wd->pre_item != it) + { + if(wd->view_hide) + elm_xml_animator_object_add(wd->vxa, wd->pre_item->view, wd->view_hide, end_view_animation_effect, wd); + else + evas_object_hide(wd->pre_item->view); + if(wd->view_show) { + elm_xml_animator_object_add(wd->vxa, it->view, wd->view_show, end_view_animation_effect, wd); } + } - elm_xml_animator_run(wd->vxa); + elm_xml_animator_run(wd->vxa); -// elm_layout_content_set(wd->view, "elm.swallow.view", it->view); - //edje_object_part_swallow(wd->view, "elm.swallow.view", it->view); -// evas_object_show(it->view); + // elm_layout_content_set(wd->view, "elm.swallow.view", it->view); + //edje_object_part_swallow(wd->view, "elm.swallow.view", it->view); + // evas_object_show(it->view); - } - else if(it->style == TOOLBAR) - { + }else if(it->style == TOOLBAR){ if (it->func) { it->func(it->data, it->obj, it); } if(item_exist_check(wd, it)) edje_object_signal_emit(_EDJ(it->base), "elm,state,text_unselected", "elm"); - } + } if(item_exist_check(wd, it)) evas_object_smart_callback_call(it->obj, "clicked", it); } @@ -1473,6 +1476,7 @@ pressed_box(Elm_Controlbar_Item * it) static Evas_Object * create_item_label(Evas_Object *obj, Elm_Controlbar_Item * it, char *part) { + Evas_Object *label; label = elm_label_add(obj); elm_object_style_set(label, "controlbar"); @@ -1491,6 +1495,7 @@ create_item_label(Evas_Object *obj, Elm_Controlbar_Item * it, char *part) static Evas_Object * create_item_icon(Evas_Object *obj, Elm_Controlbar_Item * it, char *part) { + Evas_Object *icon; icon = elm_icon_add(obj); if(!elm_icon_standard_set(icon, it->icon_path)) @@ -1510,6 +1515,7 @@ create_item_icon(Evas_Object *obj, Elm_Controlbar_Item * it, char *part) static Evas_Object * create_item_layout(Evas_Object * parent, Elm_Controlbar_Item * it, Evas_Object **item, Evas_Object **label, Evas_Object **icon, Evas_Object **sicon, Evas_Object **slabel) { + Evas_Object * obj; obj = elm_layout_add(parent); if (obj == NULL) @@ -1535,8 +1541,8 @@ create_item_layout(Evas_Object * parent, Elm_Controlbar_Item * it, Evas_Object * if (it->text) { *label = create_item_label(*item, it, "elm.swallow.text"); - *slabel = create_item_label(*item, it, "elm.swallow.text_shadow"); - evas_object_color_set(*slabel, 0, 0, 0, 255); + // *slabel = create_item_label(*item, it, "elm.swallow.text_shadow"); + // evas_object_color_set(*slabel, 0, 0, 0, 255); } if (it->icon_path) { @@ -1549,28 +1555,28 @@ create_item_layout(Evas_Object * parent, Elm_Controlbar_Item * it, Evas_Object * edje_object_signal_emit(_EDJ(*item), "elm,state,icon_text", "elm"); elm_label_line_wrap_set(*label, EINA_FALSE); elm_label_wrap_mode_set(*label, 0); - elm_label_line_wrap_set(*slabel, EINA_FALSE); - elm_label_wrap_mode_set(*slabel, 0); + // elm_label_line_wrap_set(*slabel, EINA_FALSE); + // elm_label_wrap_mode_set(*slabel, 0); } return obj; } - -static void -edit_item_down_end_cb(void *data, Evas_Object * obj) -{ +/* + static void + edit_item_down_end_cb(void *data, Evas_Object * obj) + { Widget_Data * wd = (Widget_Data *) data; wd->animating--; if (wd->animating < 0) - { - printf("animation error\n"); - wd->animating = 0; - } -} + { + printf("animation error\n"); + wd->animating = 0; + } + } -static void -edit_item_return_cb(void *data, Evas_Object * obj) -{ + static void + edit_item_return_cb(void *data, Evas_Object * obj) + { Evas_Coord x, y, w, h; Widget_Data * wd = (Widget_Data *) data; evas_object_geometry_get(wd->moving_item->edit, &x, &y, &w, &h); @@ -1582,21 +1588,22 @@ edit_item_return_cb(void *data, Evas_Object * obj) evas_object_data_set(wd->moving_obj, "returning", 0); wd->animating--; if (wd->animating < 0) - { - printf("animation error\n"); - wd->animating = 0; - } -} + { + printf("animation error\n"); + wd->animating = 0; + } + } -static void -edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ + static void + edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) + { Evas_Event_Mouse_Move * ev = event_info; const Eina_List *l; Elm_Controlbar_Item * item; Evas_Coord x, y, w, h; Widget_Data * wd = (Widget_Data *) data; - if (wd->animating) return; + if (wd->animating) + return; evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h); w *= 2.0; h *= 2.0; @@ -1606,23 +1613,25 @@ edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) EINA_LIST_FOREACH(wd->items, l, item) { - if (wd->moving_item->edit == item->edit || 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"); - } + if (wd->moving_item->edit == item->edit || 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 + static void edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_Up * ev = event_info; @@ -1633,9 +1642,9 @@ 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; + 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) { @@ -1681,11 +1690,12 @@ edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_, 0.25, move_evas_map, edit_item_return_cb, wd); } + return; } static void edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj, - void *event_info) + void *event_info) { Evas_Event_Mouse_Down * ev = event_info; Evas_Coord x, y, w, h; @@ -1697,15 +1707,18 @@ edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj, Evas_Object * color; int r, g, b, a; - if (wd->animating) return; + if (wd->animating) + return; EINA_LIST_FOREACH(wd->items, l, item) { if (item->edit == obj) break; } - - if (!item || !item->editable) return; - + if (item == NULL) + return; + if (!item->editable) + 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); @@ -1713,7 +1726,7 @@ edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj, color = (Evas_Object *) edje_object_part_object_get(_EDJ(wd->moving_item->edit), - "elm.item.uneditable.color"); + "elm.item.uneditable.color"); if (color) evas_object_color_get(color, &r, &g, &b, &a); evas_object_color_set(item->edit_item, r, g, b, a); @@ -1755,7 +1768,7 @@ bar_item_move_end_cb(void *data, Evas_Object * obj) evas_object_data_set(obj, "animating", 0); evas_object_map_enable_set(obj, EINA_FALSE); } - + static Eina_Bool bar_item_animation_end_check(void *data) { @@ -1763,7 +1776,8 @@ bar_item_animation_end_check(void *data) Elm_Controlbar_Item * item; Widget_Data * wd = (Widget_Data *) data; - if (wd->animating) return EXIT_FAILURE; + if (wd->animating) + return EXIT_FAILURE; EINA_LIST_FOREACH(wd->items, l, item) { if (item->base == wd->moving_obj) @@ -1796,50 +1810,50 @@ 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; + printf("%s : moving_obj is NULL\n", __func__); + 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_); - evas_object_move(wd->moving_obj, x, y); - tmp = wd->empty_num; - wd->empty_num = item->order; - item->order = tmp; - elm_table_unpack(wd->box, item->base); - elm_table_unpack(wd->box, wd->moving_obj); - if(!wd->vertical) - { - elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1); - elm_table_pack(wd->box, wd->moving_obj, wd->empty_num - 1, 0, 1, 1); - } - else - { - elm_table_pack(wd->box, item->base, 0, item->order - 1, 1, 1); - elm_table_pack(wd->box, wd->moving_obj, 0, wd->empty_num - 1, 1, 1); - } - 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, move_evas_map, bar_item_move_end_cb, wd); + evas_object_geometry_get(wd->moving_obj, &x_, &y_, &w_, &h_); + evas_object_move(wd->moving_obj, x, y); + tmp = wd->empty_num; + wd->empty_num = item->order; + item->order = tmp; + elm_table_unpack(wd->box, item->base); + elm_table_unpack(wd->box, wd->moving_obj); + if(!wd->vertical) + { + elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1); + elm_table_pack(wd->box, wd->moving_obj, wd->empty_num - 1, 0, 1, 1); + } + else + { + elm_table_pack(wd->box, item->base, 0, item->order - 1, 1, 1); + elm_table_pack(wd->box, wd->moving_obj, 0, wd->empty_num - 1, 1, 1); + } + 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, move_evas_map, bar_item_move_end_cb, wd); } return; } @@ -1855,43 +1869,46 @@ bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) wd->animating++; evas_object_data_set(wd->moving_obj, "animating", (void *)1); move_object_with_animation(wd->moving_obj, tx, y, w, h, x, y, w, h, 0.25, - move_evas_map, bar_item_move_end_cb, wd); + move_evas_map, bar_item_move_end_cb, wd); ecore_timer_add(0.1, bar_item_animation_end_check, wd); return; } +*/ static void bar_item_down_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info) { Widget_Data * wd = (Widget_Data *) data; const Eina_List *l; Elm_Controlbar_Item * item; - if (wd->animating) return; + if (wd->animating) + return; EINA_LIST_FOREACH(wd->items, l, item) { if (item->base == obj) break; } - if (!item) return; - if (wd->edit_mode) - { + if (item == NULL) + 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); - } - else - { - pressed_box(item); - } + } + else + {*/ + pressed_box(item); + // } } static Elm_Controlbar_Item * create_tab_item(Evas_Object * obj, const char *icon_path, const char *label, - Evas_Object * view) + Evas_Object * view) { Elm_Controlbar_Item * it; Widget_Data * wd; @@ -1907,12 +1924,13 @@ create_tab_item(Evas_Object * obj, const char *icon_path, const char *label, return NULL; } it = ELM_NEW(Elm_Controlbar_Item); - if (!it) return NULL; + if (it == NULL) + return NULL; it->obj = obj; it->text = eina_stringshare_add(label); it->icon_path = eina_stringshare_add(icon_path); it->selected = EINA_FALSE; - it->editable = EINA_TRUE; + // it->editable = EINA_TRUE; it->badge = 0; it->sel = 1; it->view = view; @@ -1921,19 +1939,20 @@ create_tab_item(Evas_Object * obj, const char *icon_path, const char *label, evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN, bar_item_down_cb, wd); evas_object_show(it->base); - it->edit = create_item_layout(wd->edje, it, &(it->edit_item), &(it->edit_label), &(it->edit_icon), &(it->edit_icon_shadow), &(it->edit_label_shadow)); - evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN, - edit_item_down_cb, wd); - evas_object_show(it->edit); + // it->edit = create_item_layout(wd->edje, it, &(it->edit_item), &(it->edit_label), &(it->edit_icon), &(it->edit_icon_shadow), &(it->edit_label_shadow)); + // evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN, + // edit_item_down_cb, wd); + // evas_object_show(it->edit); return it; } static Elm_Controlbar_Item * create_tool_item(Evas_Object * obj, const char *icon_path, const char *label, - void (*func) (void *data, Evas_Object * obj, - void *event_info), void *data) + void (*func) (void *data, Evas_Object * obj, + void *event_info), void *data) { + Elm_Controlbar_Item * it; Widget_Data * wd; if (obj == NULL) @@ -1948,12 +1967,13 @@ create_tool_item(Evas_Object * obj, const char *icon_path, const char *label, return NULL; } it = ELM_NEW(Elm_Controlbar_Item); - if (!it) return NULL; - it->obj = obj; + if (it == NULL) + return NULL; + it->obj = obj; it->text = eina_stringshare_add(label); it->icon_path = eina_stringshare_add(icon_path); it->selected = EINA_FALSE; - it->editable = EINA_TRUE; + // it->editable = EINA_TRUE; it->badge = 0; it->sel = 1; it->func = func; @@ -1963,10 +1983,11 @@ create_tool_item(Evas_Object * obj, const char *icon_path, const char *label, evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN, bar_item_down_cb, wd); evas_object_show(it->base); - it->edit = create_item_layout(wd->edje, it, &(it->edit_item), &(it->edit_label), &(it->edit_icon), &(it->edit_icon_shadow), &(it->edit_label_shadow)); - evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN, - edit_item_down_cb, wd); - evas_object_show(it->edit); + //it->edit = create_item_layout(wd->edje, it, &(it->edit_item), &(it->edit_label), &(it->edit_icon), &(it->edit_icon_shadow), &(it->edit_label_shadow)); + // evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN, + // edit_item_down_cb, wd); + // evas_object_show(it->edit); + return it; } @@ -2022,65 +2043,68 @@ repack_items(Widget_Data *wd) static void set_items_position(Evas_Object * obj, Elm_Controlbar_Item * it, - Elm_Controlbar_Item * mit, Eina_Bool bar) + Elm_Controlbar_Item * mit, Eina_Bool bar) { Widget_Data * wd; const Eina_List *l; + Elm_Controlbar_Item * item; int i = 1; + int check = EINA_FALSE; - int edit = 1; + + // int edit = 1; + int order = 1; if (obj == NULL) { - fprintf(stderr, "Invalid argument: controlbar object is NULL\n"); - return; + 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; + fprintf(stderr, "Cannot get smart data\n"); + return; } EINA_LIST_FOREACH(wd->items, l, item) - { - if (item == mit && item->order > 0) - { - check = EINA_TRUE; - edit = i; - it->order = mit->order; - } - if (check) - { - if(item->order > 0) - { - elm_table_unpack(wd->box, item->base); - item->order += it->sel; - if(!wd->vertical) - { - elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1); - } - else - { - elm_table_pack(wd->box, item->base, 0, item->order - 1, item->sel, 1); - } - } - if (item->style != OBJECT && it->style != OBJECT) - { - elm_table_unpack(wd->edit_table, item->edit); - elm_table_pack(wd->edit_table, item->edit, - i % EDIT_ROW_NUM, i / EDIT_ROW_NUM, 1, 1); + { + if (item == mit && item->order > 0) + { + check = EINA_TRUE; + // edit = i; + it->order = mit->order; + } + if (check) + { + if(item->order > 0){ + elm_table_unpack(wd->box, item->base); + item->order += it->sel; + if(!wd->vertical) + { + elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1); + } + else + { + elm_table_pack(wd->box, item->base, 0, item->order - 1, item->sel, 1); + } } - } - if (item->style != OBJECT) - i++; - if(item->order > 0) order += item->sel; - } + // if (item->style != OBJECT && it->style != OBJECT) + // { + // elm_table_unpack(wd->edit_table, item->edit); + // elm_table_pack(wd->edit_table, item->edit, + // i % EDIT_ROW_NUM, i / EDIT_ROW_NUM, 1, 1); + // } + } + if (item->style != OBJECT) + i++; + if(item->order > 0) order += item->sel; + } if (!check) { - edit = i; + // edit = i; if(bar) it->order = order; else @@ -2100,9 +2124,9 @@ set_items_position(Evas_Object * obj, Elm_Controlbar_Item * it, } } else evas_object_hide(it->base); - if (it->style != OBJECT) - elm_table_pack(wd->edit_table, it->edit, (edit - 1) % EDIT_ROW_NUM, - (edit - 1) / EDIT_ROW_NUM, 1, 1); + // if (it->style != OBJECT) + // elm_table_pack(wd->edit_table, it->edit, (edit - 1) % EDIT_ROW_NUM, + // (edit - 1) / EDIT_ROW_NUM, 1, 1); } static void @@ -2114,30 +2138,30 @@ list_clicked(void *data, Evas_Object *obj, void *event_info) Widget_Data *wd; Evas_Object *content; Elm_List_Item *lit = (Elm_List_Item *) elm_list_selected_item_get(obj); - if(!lit) return; - + if(lit == NULL) return; + elm_list_item_selected_set(lit, 0); if(!item) return; - + wd = elm_widget_data_get(item->obj); EINA_LIST_FOREACH(wd->items, l, it) { - it->selected = EINA_FALSE; + it->selected = EINA_FALSE; } if(item->style == TABBAR) { - content = elm_layout_content_unset(wd->view, "elm.swallow.view"); - evas_object_hide(content); - item->selected = EINA_TRUE; - evas_object_smart_callback_call(item->obj, "view,change,before", item); - elm_layout_content_set(wd->view, "elm.swallow.view", item->view); + content = elm_layout_content_unset(wd->view, "elm.swallow.view"); + evas_object_hide(content); + item->selected = EINA_TRUE; + evas_object_smart_callback_call(item->obj, "view,change,before", item); + elm_layout_content_set(wd->view, "elm.swallow.view", item->view); } if(item->style == TOOLBAR && item->func) - item->func(item->data, item->obj, item); + item->func(item->data, item->obj, item); } static Evas_Object * @@ -2148,21 +2172,21 @@ create_more_view(Widget_Data *wd) const Eina_List *l; Evas_Object *icon; - list = elm_list_add(wd->object); + list = elm_list_add( wd->object ); elm_list_horizontal_mode_set( list, ELM_LIST_COMPRESS ); EINA_LIST_FOREACH(wd->items, l, item) { - if(item->order <= 0) - { - icon = NULL; - if(item->icon_path) - { - icon = create_item_icon(list, item, NULL); - evas_object_color_set(icon, 0, 0, 0, 255); - } - elm_list_item_append(list, item->text, icon, NULL, list_clicked, item); - } + if(item->order <= 0) + { + icon = NULL; + if(item->icon_path) + { + icon = create_item_icon(list, item, NULL); + evas_object_color_set(icon, 0, 0, 0, 255); + } + elm_list_item_append(list, item->text, icon, NULL, list_clicked, item); + } } elm_list_go( list ); @@ -2179,12 +2203,12 @@ static void _ctxpopup_cb(void *data, Evas_Object *obj, void *event_info) EINA_LIST_FOREACH(wd->items, l, it) { - if(!strcmp(it->text, elm_ctxpopup_item_label_get((Elm_Ctxpopup_Item *) event_info))) break; + if(!strcmp(it->text, elm_ctxpopup_item_label_get((Elm_Ctxpopup_Item *) event_info))) break; } if(it->func) { - it->func(it->data, it->obj, it); + it->func(it->data, it->obj, it); } if(item_exist_check(wd, it)) evas_object_smart_callback_call(it->obj, "clicked", it); @@ -2196,7 +2220,7 @@ static void _ctxpopup_cb(void *data, Evas_Object *obj, void *event_info) static void _ctxpopup_hide_cb(void *data, Evas_Object *obj, void *event_info) { Evas_Object *ctxpopup = obj; - + evas_object_del(ctxpopup); ctxpopup = NULL; } @@ -2217,16 +2241,16 @@ create_more_func(void *data, Evas_Object *obj, void *event_info) EINA_LIST_FOREACH(wd->items, l, item) { - if(item->order <= 0) - { - icon = NULL; - if(item->icon_path) - { - icon = create_item_icon(ctxpopup, item, NULL); - evas_object_color_set(icon, 0, 0, 0, 255); - } - elm_ctxpopup_item_add(ctxpopup, icon, item->text, _ctxpopup_cb, wd); - } + if(item->order <= 0) + { + icon = NULL; + if(item->icon_path) + { + icon = create_item_icon(ctxpopup, item, NULL); + evas_object_color_set(icon, 0, 0, 0, 255); + } + elm_ctxpopup_item_add(ctxpopup, icon, item->text, _ctxpopup_cb, wd); + } } evas_object_geometry_get(wd->more_item->base, &x, &y, &w, &h); @@ -2254,12 +2278,12 @@ create_more_item(Widget_Data *wd, int style) it->style = style; it->base = create_item_layout(wd->edje, it, &(it->base_item), &(it->label), &(it->icon), &(it->icon_shadow), &(it->label_shadow)); evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN, - bar_item_down_cb, wd); + bar_item_down_cb, wd); evas_object_show(it->base); - it->edit = create_item_layout(wd->edje, it, &(it->edit_item), &(it->edit_label), &(it->edit_icon), &(it->edit_icon_shadow), &(it->edit_label_shadow)); - evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN, - edit_item_down_cb, wd); - evas_object_show(it->edit); + // it->edit = create_item_layout(wd->edje, it, &(it->edit_item), &(it->edit_label), &(it->edit_icon), &(it->edit_icon_shadow), &(it->edit_label_shadow)); + // evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN, + // edit_item_down_cb, wd); + // evas_object_show(it->edit); set_items_position(it->obj, it, NULL, EINA_TRUE); @@ -2267,8 +2291,8 @@ create_more_item(Widget_Data *wd, int style) wd->more_item = it; - elm_controlbar_item_editable_set(it, EINA_FALSE); - + // elm_controlbar_item_editable_set(it, EINA_FALSE); + wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb); return it; @@ -2279,7 +2303,7 @@ create_more_item(Widget_Data *wd, int style) // API function // //////////////////////////////////////////////////////////////////// - + /** * Add a new controlbar object * @@ -2288,8 +2312,7 @@ create_more_item(Widget_Data *wd, int style) * * @ingroup Controlbar */ -EAPI Evas_Object * -elm_controlbar_add(Evas_Object * parent) +EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent) { Evas_Object * obj = NULL; Evas_Object * bg = NULL; @@ -2298,17 +2321,19 @@ elm_controlbar_add(Evas_Object * parent) Evas_Object * r_button; wd = ELM_NEW(Widget_Data); wd->evas = evas_object_evas_get(parent); - if (!wd->evas == NULL) return NULL; + if (wd->evas == NULL) + return NULL; obj = elm_widget_add(wd->evas); - if (!obj) return NULL; + if (obj == NULL) + return NULL; ELM_SET_WIDTYPE(widtype, "controlbar"); elm_widget_type_set(obj, "controlbar"); elm_widget_sub_object_add(parent, obj); elm_widget_data_set(obj, wd); elm_widget_del_hook_set(obj, _del_hook); elm_widget_theme_hook_set(obj, _theme_hook); - - // initialization + + // initialization wd->parent = parent; evas_object_geometry_get(parent, &x, &y, &w, &h); wd->object = obj; @@ -2321,7 +2346,7 @@ elm_controlbar_add(Evas_Object * parent) wd->num = 0; wd->animating = 0; wd->vertical = EINA_FALSE; - wd->edit_mode = EINA_FALSE; + // wd->edit_mode = EINA_FALSE; wd->auto_align = EINA_FALSE; wd->init_animation = EINA_FALSE; wd->selected_animation = EINA_FALSE; @@ -2332,28 +2357,22 @@ elm_controlbar_add(Evas_Object * parent) //_elm_theme_object_set(obj, wd->view, "controlbar", "view", "default"); if (wd->view == NULL) { - printf("Cannot load bg edj\n"); - return NULL; + printf("Cannot load bg edj\n"); + return NULL; } evas_object_show(wd->view); // edit box - wd->edit_box = edje_object_add(wd->evas); - _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box", - "default"); - if (wd->edit_box == NULL) - { - printf("Cannot load bg edj\n"); - return NULL; - } - evas_object_show(wd->edit_box); + /* wd->edit_box = edje_object_add(wd->evas); + _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box", + "default"); + if (wd->edit_box == NULL) + { + printf("Cannot load bg edj\n"); + return NULL; + } + evas_object_show(wd->edit_box); - //instead of navigationbar - /* r_button = elm_button_add(wd->edit_box); - elm_button_label_set(r_button, "Done"); - 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); @@ -2365,23 +2384,24 @@ elm_controlbar_add(Evas_Object * parent) 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); _elm_theme_object_set(obj, wd->edje, "controlbar", "base", "default"); - if (!wd->edje) + if (wd->edje == NULL) { - printf("Cannot load base edj\n"); - return NULL; + printf("Cannot load base edj\n"); + return NULL; } evas_object_show(wd->edje); - + wd->bg = edje_object_add(wd->evas); _elm_theme_object_set(obj, wd->bg, "controlbar", "background", "default"); - if (!wd->bg) + if (wd->bg == NULL) { - printf("Cannot load bg edj\n"); - return NULL; + printf("Cannot load bg edj\n"); + return NULL; } edje_object_part_swallow(wd->edje, "bg_image", wd->bg); @@ -2427,7 +2447,7 @@ elm_controlbar_add(Evas_Object * parent) 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); + // evas_object_smart_member_add(wd->edit_box, obj); elm_widget_resize_object_set(obj, wd->edje); evas_object_smart_member_add(wd->focused_box, obj); evas_object_smart_member_add(wd->focused_box_left, obj); @@ -2436,6 +2456,7 @@ elm_controlbar_add(Evas_Object * parent) evas_object_smart_member_add(wd->event_box, obj); _sizing_eval(obj); + return obj; } @@ -2450,32 +2471,32 @@ elm_controlbar_add(Evas_Object * parent) * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * -elm_controlbar_tab_item_append(Evas_Object * obj, - const char *icon_path, - const char *label, - Evas_Object *view) +EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj, + const char + *icon_path, + const char *label, + Evas_Object * + view) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Elm_Controlbar_Item * it; Elm_Controlbar_Item * lit; Widget_Data * wd; it = create_tab_item(obj, icon_path, label, view); - if (!it == NULL) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); - if(check_bar_item_number(wd) >= 5 && wd->auto_align) - { + if(check_bar_item_number(wd) >= 5 && wd->auto_align){ if(!wd->more_item) { lit = elm_controlbar_last_item_get(obj); item_visible_set(lit, EINA_FALSE); create_more_item(wd, TABBAR); } set_items_position(obj, it, NULL, EINA_FALSE); - } - else - { + } + else{ set_items_position(obj, it, NULL, EINA_TRUE); - } + } if(wd->init_animation) evas_object_hide(it->base); wd->items = eina_list_append(wd->items, it); if(wd->more_item) @@ -2498,11 +2519,14 @@ elm_controlbar_tab_item_append(Evas_Object * obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * -elm_controlbar_tab_item_prepend(Evas_Object *obj, - const char *icon_path, - const char *label, - Evas_Object *view) +EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_prepend(Evas_Object * + obj, + const char + *icon_path, + const char + *label, + Evas_Object * + view) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd; @@ -2510,25 +2534,23 @@ elm_controlbar_tab_item_prepend(Evas_Object *obj, Elm_Controlbar_Item * lit; Elm_Controlbar_Item * item; it = create_tab_item(obj, icon_path, label, view); - if (!it == NULL) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); item = eina_list_data_get(wd->items); - if(check_bar_item_number(wd) >= 5 && wd->auto_align) - { - if(!wd->more_item) - { + if(check_bar_item_number(wd) >= 5 && wd->auto_align){ + if(!wd->more_item) { lit = elm_controlbar_last_item_get(obj); item_visible_set(lit, EINA_FALSE); create_more_item(wd, TABBAR); - } + } lit = elm_controlbar_item_prev(wd->more_item); item_visible_set(lit, EINA_FALSE); set_items_position(obj, it, item, EINA_TRUE); - } - else - { + } + else{ set_items_position(obj, it, item, EINA_TRUE); - } + } wd->items = eina_list_prepend(wd->items, it); if(wd->more_item) elm_controlbar_item_view_set(wd->more_item, create_more_view(wd)); @@ -2554,19 +2576,19 @@ EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_insert_before(Evas_Object * obj, Elm_Controlbar_Item * before, const char *icon_path, - const char *label, - Evas_Object * view) + const char *label, Evas_Object * view) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd; Elm_Controlbar_Item * it; Elm_Controlbar_Item * lit; - if (!before) return NULL; + if (!before) + return NULL; it = create_tab_item(obj, icon_path, label, view); - if (!it) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); - if(check_bar_item_number(wd) >= 5 && wd->auto_align) - { + if(check_bar_item_number(wd) >= 5 && wd->auto_align){ if(!wd->more_item) { lit = elm_controlbar_last_item_get(obj); @@ -2584,11 +2606,10 @@ elm_controlbar_tab_item_insert_before(Evas_Object * obj, { set_items_position(obj, it, before, EINA_FALSE); } - } - else - { + } + else{ set_items_position(obj, it, before, EINA_TRUE); - } + } wd->items = eina_list_prepend_relative(wd->items, it, before); if(wd->more_item) elm_controlbar_item_view_set(wd->more_item, create_more_view(wd)); @@ -2612,9 +2633,8 @@ elm_controlbar_tab_item_insert_before(Evas_Object * obj, */ EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_insert_after(Evas_Object * obj, - Elm_Controlbar_Item * after, - const char *icon_path, - const char *label, + Elm_Controlbar_Item * after, + const char *icon_path, const char *label, Evas_Object * view) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; @@ -2622,13 +2642,14 @@ elm_controlbar_tab_item_insert_after(Evas_Object * obj, Elm_Controlbar_Item * it; Elm_Controlbar_Item * lit; Elm_Controlbar_Item * item; - if (!after) return NULL; + if (!after) + return NULL; it = create_tab_item(obj, icon_path, label, view); - if (!it) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); item = elm_controlbar_item_next(after); - if(check_bar_item_number(wd) >= 5 && wd->auto_align) - { + if(check_bar_item_number(wd) >= 5 && wd->auto_align){ if(!wd->more_item) { lit = elm_controlbar_last_item_get(obj); @@ -2645,11 +2666,10 @@ elm_controlbar_tab_item_insert_after(Evas_Object * obj, { set_items_position(obj, it, NULL, EINA_FALSE); } - } - else - { + } + else{ set_items_position(obj, it, item, EINA_TRUE); - } + } wd->items = eina_list_append_relative(wd->items, it, after); if(wd->more_item) elm_controlbar_item_view_set(wd->more_item, create_more_view(wd)); @@ -2671,34 +2691,40 @@ elm_controlbar_tab_item_insert_after(Evas_Object * obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * -elm_controlbar_tool_item_append(Evas_Object *obj, - const char *icon_path, - const char *label, - void (*func)(void *data, Evas_Object *obj, void *event_info), - void *data) +EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_append(Evas_Object * + obj, + const char + *icon_path, + const char + *label, + void (*func) + (void *data, + Evas_Object * + obj, + void + *event_info), + void *data) + { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Elm_Controlbar_Item * it; Elm_Controlbar_Item * lit; Widget_Data * wd; it = create_tool_item(obj, icon_path, label, func, data); - if (!it) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); - if(check_bar_item_number(wd) >= 5 && wd->auto_align) - { - if(!wd->more_item) - { + if(check_bar_item_number(wd) >= 5 && wd->auto_align){ + if(!wd->more_item) { lit = elm_controlbar_last_item_get(obj); item_visible_set(lit, EINA_FALSE); create_more_item(wd, TOOLBAR); - } + } set_items_position(obj, it, NULL, EINA_FALSE); - } - else - { + } + else{ set_items_position(obj, it, NULL, EINA_TRUE); - } + } wd->items = eina_list_append(wd->items, it); _sizing_eval(obj); return it; @@ -2716,12 +2742,21 @@ elm_controlbar_tool_item_append(Evas_Object *obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * -elm_controlbar_tool_item_prepend(Evas_Object *obj, - const char *icon_path, - const char *label, - void (*func)(void *data, Evas_Object *obj, void *event_info), - void *data) +EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_prepend(Evas_Object * + obj, + const char + *icon_path, + const char + *label, + void (*func) + (void + *data, + Evas_Object * + obj, + void + *event_info), + void + *data) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd; @@ -2729,25 +2764,23 @@ elm_controlbar_tool_item_prepend(Evas_Object *obj, Elm_Controlbar_Item * lit; Elm_Controlbar_Item * item; it = create_tool_item(obj, icon_path, label, func, data); - if (!it) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); item = eina_list_data_get(wd->items); - if(check_bar_item_number(wd) >= 5 && wd->auto_align) - { - if(!wd->more_item) - { + if(check_bar_item_number(wd) >= 5 && wd->auto_align){ + if(!wd->more_item) { lit = elm_controlbar_last_item_get(obj); item_visible_set(lit, EINA_FALSE); create_more_item(wd, TOOLBAR); - } + } lit = elm_controlbar_item_prev(wd->more_item); item_visible_set(lit, EINA_FALSE); set_items_position(obj, it, item, EINA_TRUE); - } - else - { + } + else{ set_items_position(obj, it, item, EINA_TRUE); - } + } wd->items = eina_list_prepend(wd->items, it); _sizing_eval(obj); return it; @@ -2768,22 +2801,25 @@ elm_controlbar_tool_item_prepend(Evas_Object *obj, */ EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_insert_before(Evas_Object * obj, - Elm_Controlbar_Item * before, - const char *icon_path, - const char *label, - void (*func) (void *data, Evas_Object * obj, void *event_info), - void *data) + Elm_Controlbar_Item * before, + const char *icon_path, + const char *label, + void (*func) (void *data, + Evas_Object * obj, + void *event_info), + void *data) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd; Elm_Controlbar_Item * it; Elm_Controlbar_Item * lit; - if (!before) return NULL; + if (!before) + return NULL; it = create_tool_item(obj, icon_path, label, func, data); - if (!it) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); - if(check_bar_item_number(wd) >= 5 && wd->auto_align) - { + if(check_bar_item_number(wd) >= 5 && wd->auto_align){ if(!wd->more_item) { lit = elm_controlbar_last_item_get(obj); @@ -2801,11 +2837,10 @@ elm_controlbar_tool_item_insert_before(Evas_Object * obj, { set_items_position(obj, it, before, EINA_FALSE); } - } - else - { + } + else{ set_items_position(obj, it, before, EINA_TRUE); - } + } wd->items = eina_list_prepend_relative(wd->items, it, before); _sizing_eval(obj); return it; @@ -2826,24 +2861,27 @@ elm_controlbar_tool_item_insert_before(Evas_Object * obj, */ EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_insert_after(Evas_Object * obj, - Elm_Controlbar_Item * after, - const char *icon_path, - const char *label, - void (*func) (void *data, Evas_Object * obj, void *event_info), - void *data) + Elm_Controlbar_Item * after, + const char *icon_path, + const char *label, + void (*func) (void *data, + Evas_Object * obj, + void *event_info), + void *data) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd; Elm_Controlbar_Item * it; Elm_Controlbar_Item * lit; Elm_Controlbar_Item * item; - if (!after) return NULL; + if (!after) + return NULL; it = create_tool_item(obj, icon_path, label, func, data); - if (!it) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); item = elm_controlbar_item_next(after); - if(check_bar_item_number(wd) >= 5 && wd->auto_align) - { + if(check_bar_item_number(wd) >= 5 && wd->auto_align){ if(!wd->more_item) { lit = elm_controlbar_last_item_get(obj); @@ -2860,11 +2898,10 @@ elm_controlbar_tool_item_insert_after(Evas_Object * obj, { set_items_position(obj, it, NULL, EINA_FALSE); } - } - else - { + } + else{ set_items_position(obj, it, item, EINA_TRUE); - } + } wd->items = eina_list_append_relative(wd->items, it, after); _sizing_eval(obj); return it; @@ -2880,16 +2917,18 @@ elm_controlbar_tool_item_insert_after(Evas_Object * obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * -elm_controlbar_object_item_append(Evas_Object *obj, - Evas_Object *obj_item, - const int sel) +EAPI Elm_Controlbar_Item * elm_controlbar_object_item_append(Evas_Object * + obj, + Evas_Object * + obj_item, + const int sel) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd; Elm_Controlbar_Item * it; it = create_object_item(obj, obj_item, sel); - if (!it) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); set_items_position(obj, it, NULL, EINA_TRUE); wd->items = eina_list_append(wd->items, it); @@ -2907,17 +2946,19 @@ elm_controlbar_object_item_append(Evas_Object *obj, * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * -elm_controlbar_object_item_prepend(Evas_Object *obj, - Evas_Object *obj_item, - const int sel) +EAPI Elm_Controlbar_Item * elm_controlbar_object_item_prepend(Evas_Object * + obj, + Evas_Object * + obj_item, + const int sel) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd; Elm_Controlbar_Item * it; Elm_Controlbar_Item * item; it = create_object_item(obj, obj_item, sel); - if (!it) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); item = eina_list_data_get(wd->items); set_items_position(obj, it, item, EINA_TRUE); @@ -2939,16 +2980,17 @@ elm_controlbar_object_item_prepend(Evas_Object *obj, */ EAPI Elm_Controlbar_Item * elm_controlbar_object_item_insert_before(Evas_Object * obj, - Elm_Controlbar_Item * before, - Evas_Object * obj_item, - const int sel) + Elm_Controlbar_Item * before, + Evas_Object * obj_item, const int sel) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd; Elm_Controlbar_Item * it; - if (!before) return NULL; + if (!before) + return NULL; it = create_object_item(obj, obj_item, sel); - if (!it) return NULL; + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); set_items_position(obj, it, before, EINA_TRUE); wd->items = eina_list_prepend_relative(wd->items, it, before); @@ -2969,18 +3011,18 @@ elm_controlbar_object_item_insert_before(Evas_Object * obj, */ EAPI Elm_Controlbar_Item * elm_controlbar_object_item_insert_after(Evas_Object * obj, - Elm_Controlbar_Item * after, - Evas_Object * obj_item, - const int sel) + Elm_Controlbar_Item * after, + Evas_Object * obj_item, const int sel) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd; Elm_Controlbar_Item * it; Elm_Controlbar_Item * item; - if (!after) return NULL; + if (!after) + return NULL; it = create_object_item(obj, obj_item, sel); - if (it == NULL) return NULL; - + if (it == NULL) + return NULL; wd = elm_widget_data_get(obj); item = elm_controlbar_item_next(after); set_items_position(obj, it, item, EINA_TRUE); @@ -3002,80 +3044,83 @@ elm_controlbar_item_del(Elm_Controlbar_Item * it) Evas_Object * obj; Widget_Data * wd; const Eina_List *l; + Elm_Controlbar_Item * item; int check = 0; + int i = 1; + int sel = 1; obj = it->obj; if (it->obj == NULL) { - printf("Invalid argument: controlbar object is NULL\n"); - return; + printf("Invalid argument: controlbar object is NULL\n"); + return; } wd = elm_widget_data_get(it->obj); if (wd == NULL) { - printf("Cannot get smart data\n"); - return; + printf("Cannot get smart data\n"); + return; } - + // unpack 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; - if(!wd->vertical) - { - elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1); - } - else - { - elm_table_pack(wd->box, item->base, 0, item->order - 1, item->sel, 1); - } - } - } - if (it == item) - { - check = 1; - } - } - } - + 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; + if(!wd->vertical) + { + elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1); + } + else + { + elm_table_pack(wd->box, item->base, 0, item->order - 1, item->sel, 1); + } + } + } + if (it == item) + { + check = 1; + } + } + } + /* // unpack edit item check = 0; if (it->edit_item != NULL) - { - elm_table_unpack(wd->edit_table, it->edit); - EINA_LIST_FOREACH(wd->items, l, item) - { - if (check) - { - if (item->edit_item != NULL) - { - elm_table_unpack(wd->edit_table, item->edit); - elm_table_pack(wd->edit_table, item->edit, - (i - 1) % 4, (i - 1) / 4, 1, 1); - } - } - if (it == item && item->style != OBJECT) - { - check = 1; - i--; - } - if (item->style != OBJECT) - i++; - } - } - + { + elm_table_unpack(wd->edit_table, it->edit); + EINA_LIST_FOREACH(wd->items, l, item) + { + if (check) + { + if (item->edit_item != NULL) + { + elm_table_unpack(wd->edit_table, item->edit); + elm_table_pack(wd->edit_table, item->edit, + (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 _item_del(it); wd->items = eina_list_remove(wd->items, it); @@ -3095,13 +3140,15 @@ elm_controlbar_item_del(Elm_Controlbar_Item * it) EAPI void elm_controlbar_item_select(Elm_Controlbar_Item * it) { - if (!it || !it->obj) return; + if (it == NULL) return; + if (it->obj == NULL) return; Widget_Data * wd = elm_widget_data_get(it->obj); - if (!wd) return; - if (!wd->edit_mode) - { - selected_box(it); - } + if (wd == NULL) + return; + // if (!wd->edit_mode) + // { + selected_box(it); + // } } /** @@ -3116,53 +3163,54 @@ elm_controlbar_item_select(Elm_Controlbar_Item * it) EAPI void elm_controlbar_item_icon_set(Elm_Controlbar_Item * it, const char *icon_path) { - if (!it) return; + if (it == NULL) + return; if(it->icon_path) eina_stringshare_del(it->icon_path); it->icon_path = eina_stringshare_add(icon_path); if(it->icon) { - evas_object_del(it->icon); - it->icon = NULL; + evas_object_del(it->icon); + it->icon = NULL; } if(it->icon_shadow) { - evas_object_del(it->icon_shadow); - it->icon_shadow = NULL; - } - if(it->edit_icon) - { - evas_object_del(it->edit_icon); - it->edit_icon = NULL; - } - if(it->edit_icon_shadow) - { - evas_object_del(it->edit_icon_shadow); - it->edit_icon_shadow = NULL; + evas_object_del(it->icon_shadow); + it->icon_shadow = NULL; } - + /* if(it->edit_icon) + { + evas_object_del(it->edit_icon); + it->edit_icon = NULL; + } + if(it->edit_icon_shadow) + { + evas_object_del(it->edit_icon_shadow); + it->edit_icon_shadow = NULL; + } + */ it->icon = create_item_icon(it->base_item, it, "elm.swallow.icon"); it->icon_shadow = create_item_icon(it->base_item, it, "elm.swallow.icon_shadow"); - it->edit_icon = create_item_icon(it->edit_item, it, "elm.swallow.icon"); - it->edit_icon_shadow = create_item_icon(it->edit_item, it, "elm.swallow.icon_shadow"); + // it->edit_icon = create_item_icon(it->edit_item, it, "elm.swallow.icon"); + // it->edit_icon_shadow = create_item_icon(it->edit_item, it, "elm.swallow.icon_shadow"); if(it->label && it->icon) { - edje_object_signal_emit(_EDJ(it->base_item), "elm,state,icon_text", "elm"); - elm_label_line_wrap_set(it->label, EINA_FALSE); - elm_label_wrap_mode_set(it->label, 0); - elm_label_line_wrap_set(it->label_shadow, EINA_FALSE); - elm_label_wrap_mode_set(it->label_shadow, 0); - } - if(it->edit_label && it->edit_icon) - { - edje_object_signal_emit(_EDJ(it->edit_item), "elm,state,icon_text", "elm"); - elm_label_line_wrap_set(it->edit_label, EINA_FALSE); - elm_label_wrap_mode_set(it->edit_label, 0); - elm_label_line_wrap_set(it->edit_label_shadow, EINA_FALSE); - elm_label_wrap_mode_set(it->edit_label_shadow, 0); + edje_object_signal_emit(_EDJ(it->base_item), "elm,state,icon_text", "elm"); + elm_label_line_wrap_set(it->label, EINA_FALSE); + elm_label_wrap_mode_set(it->label, 0); + // elm_label_line_wrap_set(it->label_shadow, EINA_FALSE); + // elm_label_wrap_mode_set(it->label_shadow, 0); } + /* if(it->edit_label && it->edit_icon) + { + edje_object_signal_emit(_EDJ(it->edit_item), "elm,state,icon_text", "elm"); + elm_label_line_wrap_set(it->edit_label, EINA_FALSE); + elm_label_wrap_mode_set(it->edit_label, 0); + elm_label_line_wrap_set(it->edit_label_shadow, EINA_FALSE); + elm_label_wrap_mode_set(it->edit_label_shadow, 0); + }*/ } /** @@ -3190,27 +3238,27 @@ elm_controlbar_item_icon_get(Elm_Controlbar_Item * it) EAPI void elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label) { - if (!it) return; + if (it == NULL) + return; it->text = eina_stringshare_add(label); it->label = create_item_label(it->base_item, it, "elm.swallow.text"); - it->edit_label = create_item_label(it->edit_item, it, "elm.swallow.text"); + // it->edit_label = create_item_label(it->edit_item, it, "elm.swallow.text"); - if(it->label && it->icon) - { + if(it->label && it->icon){ edje_object_signal_emit(_EDJ(it->base_item), "elm,state,icon_text", "elm"); elm_label_line_wrap_set(it->label, EINA_FALSE); elm_label_wrap_mode_set(it->label, 0); - elm_label_line_wrap_set(it->label_shadow, EINA_FALSE); - elm_label_wrap_mode_set(it->label_shadow, 0); - } - if(it->edit_label && it->edit_icon) - { + // elm_label_line_wrap_set(it->label_shadow, EINA_FALSE); + // elm_label_wrap_mode_set(it->label_shadow, 0); + } + /* if(it->edit_label && it->edit_icon) + { edje_object_signal_emit(_EDJ(it->edit_item), "elm,state,icon_text", "elm"); elm_label_line_wrap_set(it->edit_label, EINA_FALSE); elm_label_wrap_mode_set(it->edit_label, 0); elm_label_line_wrap_set(it->edit_label_shadow, EINA_FALSE); elm_label_wrap_mode_set(it->edit_label_shadow, 0); - } + }*/ } /** @@ -3235,16 +3283,18 @@ elm_controlbar_item_label_get(Elm_Controlbar_Item * it) * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * -elm_controlbar_selected_item_get(Evas_Object *obj) +EAPI Elm_Controlbar_Item * elm_controlbar_selected_item_get(Evas_Object * + obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; const Eina_List *l; Elm_Controlbar_Item * item; - if (!obj) return NULL; + if (obj == NULL) + return NULL; Widget_Data * wd = elm_widget_data_get(obj); - if (!wd || !wd->items) return NULL; + if (!wd || !wd->items) + return NULL; EINA_LIST_FOREACH(wd->items, l, item) { if (item->selected) @@ -3261,12 +3311,12 @@ elm_controlbar_selected_item_get(Evas_Object *obj) * * @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) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd = elm_widget_data_get(obj); - if (!wd || !wd->items) return NULL; + if (!wd || !wd->items) + return NULL; return eina_list_data_get(wd->items); } @@ -3278,12 +3328,12 @@ 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) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd = elm_widget_data_get(obj); - if (!wd || !wd->items) return NULL; + if (!wd || !wd->items) + return NULL; return eina_list_data_get(eina_list_last(wd->items)); } @@ -3295,12 +3345,12 @@ 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) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data * wd = elm_widget_data_get(obj); - if (!wd || !wd->items) return NULL; + if (!wd || !wd->items) + return NULL; return wd->items; } @@ -3312,21 +3362,24 @@ elm_controlbar_items_get(Evas_Object * obj) * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * -elm_controlbar_item_prev(Elm_Controlbar_Item *it) +EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item * + it) { const Eina_List *l; Elm_Controlbar_Item * item; - if (!it->obj == NULL) return NULL; + if (it->obj == NULL) + return NULL; Widget_Data * wd = elm_widget_data_get(it->obj); - if (!wd || !wd->items) return NULL; + if (!wd || !wd->items) + return NULL; EINA_LIST_FOREACH(wd->items, l, item) { if (it == item) { l = eina_list_prev(l); - if (!l) return NULL; + if (!l) + return NULL; return eina_list_data_get(l); } } @@ -3341,8 +3394,8 @@ elm_controlbar_item_prev(Elm_Controlbar_Item *it) * * @ingroup Controlbar */ -EAPI Elm_Controlbar_Item * -elm_controlbar_item_next(Elm_Controlbar_Item *it) +EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item * + it) { const Eina_List *l; @@ -3353,21 +3406,21 @@ elm_controlbar_item_next(Elm_Controlbar_Item *it) if (!wd || !wd->items) 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; } - -EAPI void -elm_controlbar_edit_start(Evas_Object * obj) -{ +/* + EAPI void + elm_controlbar_edit_start(Evas_Object * obj) + { printf("\n==================================\n"); printf("%s\n", __func__); printf("==================================\n"); @@ -3379,14 +3432,14 @@ elm_controlbar_edit_start(Evas_Object * obj) ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (wd == NULL) - { - fprintf(stderr, "Cannot get smart data\n"); - return; - } + { + fprintf(stderr, "Cannot get smart data\n"); + return; + } edje_object_signal_emit(wd->edit_box, "elm,state,show,edit_box", "elm"); wd->edit_mode = EINA_TRUE; -} - + } + */ /** * Set the visible status of item in bar * @@ -3398,9 +3451,12 @@ elm_controlbar_edit_start(Evas_Object * obj) EAPI void elm_controlbar_item_visible_set(Elm_Controlbar_Item * it, Eina_Bool visible) { - if(!it || !it->obj) return; + if(!it) return; + if (it->obj == NULL) + return; Widget_Data * wd = elm_widget_data_get(it->obj); - if (!wd) return; + if (!wd) + return; if(!wd->auto_align) item_visible_set(it, visible); @@ -3417,40 +3473,43 @@ elm_controlbar_item_visible_set(Elm_Controlbar_Item * it, Eina_Bool visible) EAPI Eina_Bool elm_controlbar_item_visible_get(Elm_Controlbar_Item * it) { - if (!it || !it->obj) return EINA_FALSE; + if(!it) return EINA_FALSE; + + if (it->obj == NULL) + return EINA_FALSE; Widget_Data * wd = elm_widget_data_get(it->obj); - if (!wd) return EINA_FALSE; + if (!wd) + return EINA_FALSE; - if (it->order <= 0) - return EINA_FALSE; + if(it->order <= 0) + return EINA_FALSE; return EINA_TRUE; } - -EAPI void -elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable) -{ +/* + EAPI void + elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable) + { Evas_Object * color; int r, g, b, a; - if(!it || it->editable == editable) return; + if(!it) return; - it->editable = editable; - if(it->editable) - { + if(it->editable == editable) return; - } - else - { - color = - (Evas_Object *) edje_object_part_object_get(_EDJ(it->edit_item), - "elm.item.uneditable.color"); - if (color) - evas_object_color_get(color, &r, &g, &b, &a); - evas_object_color_set(it->edit_item, r, g, b, a); - } -} + it->editable = editable; + if(it->editable){ + }else{ + color = + (Evas_Object *) edje_object_part_object_get(_EDJ(it->edit_item), + "elm.item.uneditable.color"); + if (color) + evas_object_color_get(color, &r, &g, &b, &a); + evas_object_color_set(it->edit_item, r, g, b, a); + } + } + */ /** * Set item disable * @@ -3469,9 +3528,13 @@ elm_controlbar_item_disable_set(Elm_Controlbar_Item * it, Eina_Bool disable) it->disable = disable; if(it->disable) - item_color_set(it, "elm.item.disable.color"); + { + item_color_set(it, "elm.item.disable.color"); + } else - item_color_set(it, "elm.item.default.color"); + { + item_color_set(it, "elm.item.default.color"); + } } EAPI void @@ -3485,12 +3548,12 @@ elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view) printf("Thank you.\n"); printf("==================================\n"); - ELM_CHECK_WIDTYPE(obj, widtype); + ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); if (wd == NULL) { - fprintf(stderr, "Cannot get smart data\n"); - return; + fprintf(stderr, "Cannot get smart data\n"); + return; } wd->view_content = view; //edje_object_part_swallow(wd->view, "elm.swallow.view", wd->view_content); @@ -3544,8 +3607,8 @@ elm_controlbar_mode_set(Evas_Object *obj, int mode) Widget_Data *wd = elm_widget_data_get(obj); if (wd == NULL) { - fprintf(stderr, "Cannot get smart data\n"); - return; + fprintf(stderr, "Cannot get smart data\n"); + return; } if(wd->mode == mode) return; @@ -3555,36 +3618,36 @@ elm_controlbar_mode_set(Evas_Object *obj, int mode) switch(wd->mode) { case ELM_CONTROLBAR_MODE_DEFAULT: - edje_object_signal_emit(wd->edje, "elm,state,default", "elm"); - break; + edje_object_signal_emit(wd->edje, "elm,state,default", "elm"); + break; case ELM_CONTROLBAR_MODE_TRANSLUCENCE: - elm_controlbar_alpha_set(obj, 85); - break; + elm_controlbar_alpha_set(obj, 85); + break; case ELM_CONTROLBAR_MODE_TRANSPARENCY: - elm_controlbar_alpha_set(obj, 0); - break; + elm_controlbar_alpha_set(obj, 0); + break; case ELM_CONTROLBAR_MODE_LARGE: - edje_object_signal_emit(wd->edje, "elm,state,large", "elm"); - break; + 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; + edje_object_signal_emit(wd->edje, "elm,state,small", "elm"); + break; case ELM_CONTROLBAR_MODE_LEFT: - wd->selected_box = wd->focused_box_left; - wd->selected_signal = eina_stringshare_add("elm,state,selected_left"); - wd->pressed_signal = eina_stringshare_add("elm,state,pressed_left"); - edje_object_signal_emit(wd->edje, "elm,state,left", "elm"); - _sizing_eval(obj); - return; + wd->selected_box = wd->focused_box_left; + wd->selected_signal = eina_stringshare_add("elm,state,selected_left"); + wd->pressed_signal = eina_stringshare_add("elm,state,pressed_left"); + edje_object_signal_emit(wd->edje, "elm,state,left", "elm"); + _sizing_eval(obj); + return; case ELM_CONTROLBAR_MODE_RIGHT: - wd->selected_box = wd->focused_box_right; - wd->selected_signal = eina_stringshare_add("elm,state,selected_right"); - wd->pressed_signal = eina_stringshare_add("elm,state,pressed_right"); - edje_object_signal_emit(wd->edje, "elm,state,right", "elm"); - _sizing_eval(obj); - return; + wd->selected_box = wd->focused_box_right; + wd->selected_signal = eina_stringshare_add("elm,state,selected_right"); + wd->pressed_signal = eina_stringshare_add("elm,state,pressed_right"); + edje_object_signal_emit(wd->edje, "elm,state,right", "elm"); + _sizing_eval(obj); + return; default: - break; + break; } wd->selected_box = wd->focused_box; @@ -3645,66 +3708,66 @@ elm_controlbar_item_auto_align_set(Evas_Object *obj, Eina_Bool auto_align) int i; if (wd == NULL) { - fprintf(stderr, "Cannot get smart data\n"); - return; + fprintf(stderr, "Cannot get smart data\n"); + return; } if(wd->auto_align == auto_align) return; if(auto_align) { - if(check_bar_item_number(wd) >= 5 && !wd->more_item) - { - i = 0; - EINA_LIST_FOREACH(wd->items, l, item) - { - if(elm_controlbar_item_visible_get(item)) - i++; - if(i >= 5){ - item_delete_in_bar(item); - } - } - item = elm_controlbar_last_item_get(obj); - while(!elm_controlbar_item_visible_get(item)){ - item = elm_controlbar_item_prev(item); - } - create_more_item(wd, item->style); - } + if(check_bar_item_number(wd) >= 5 && !wd->more_item) + { + i = 0; + EINA_LIST_FOREACH(wd->items, l, item) + { + if(elm_controlbar_item_visible_get(item)) + i++; + if(i >= 5){ + item_delete_in_bar(item); + } + } + item = elm_controlbar_last_item_get(obj); + while(!elm_controlbar_item_visible_get(item)){ + item = elm_controlbar_item_prev(item); + } + create_more_item(wd, item->style); + } } else { - if(wd->more_item) - { - // delete more item - if(wd->more_item->view) - evas_object_del(wd->more_item->view); - wd->items = eina_list_remove(wd->items, wd->more_item); - eina_stringshare_del(wd->more_item->text); - if (wd->more_item->icon) - evas_object_del(wd->more_item->icon); - if (wd->more_item->base) - evas_object_del(wd->more_item->base); - if (wd->more_item->base_item) - evas_object_del(wd->more_item->base_item); - if (wd->more_item->edit) - evas_object_del(wd->more_item->edit); - if (wd->more_item->edit_item) - evas_object_del(wd->more_item->edit_item); - free(wd->more_item); - wd->more_item = NULL; - - // make all item is visible - i = 1; - EINA_LIST_FOREACH(wd->items, l, item) - { - if(!elm_controlbar_item_visible_get(item)) - item_insert_in_bar(item, i); - i++; - } - } - } - wd->auto_align = auto_align; - _sizing_eval(obj); + if(wd->more_item) + { + // delete more item + if(wd->more_item->view) + evas_object_del(wd->more_item->view); + wd->items = eina_list_remove(wd->items, wd->more_item); + eina_stringshare_del(wd->more_item->text); + if (wd->more_item->icon) + evas_object_del(wd->more_item->icon); + if (wd->more_item->base) + evas_object_del(wd->more_item->base); + if (wd->more_item->base_item) + evas_object_del(wd->more_item->base_item); + // if (wd->more_item->edit) + // evas_object_del(wd->more_item->edit); + // if (wd->more_item->edit_item) + // evas_object_del(wd->more_item->edit_item); + free(wd->more_item); + wd->more_item = NULL; + + // make all item is visible + i = 1; + EINA_LIST_FOREACH(wd->items, l, item) + { + if(!elm_controlbar_item_visible_get(item)) + item_insert_in_bar(item, i); + i++; + } + } + } + wd->auto_align = auto_align; + _sizing_eval(obj); } /** @@ -3722,17 +3785,17 @@ elm_controlbar_vertical_set(Evas_Object *obj, Eina_Bool vertical) Widget_Data *wd = elm_widget_data_get(obj); if (wd == NULL) { - fprintf(stderr, "Cannot get smart data\n"); - return; + fprintf(stderr, "Cannot get smart data\n"); + return; } if(wd->vertical == vertical) - return; + return; wd->vertical = vertical; if(check_bar_item_number(wd) > 1) { - repack_items(wd); + repack_items(wd); } } @@ -3746,14 +3809,14 @@ init_animation(void *data) wd->visible_items = eina_list_free(wd->visible_items); EINA_LIST_FOREACH(wd->items, l, item) { - if(item->order > 0) - { - wd->visible_items = eina_list_append(wd->visible_items, item->base); - } + if(item->order > 0) + { + wd->visible_items = eina_list_append(wd->visible_items, item->base); + } } - + if(wd->ani_func) - wd->ani_func(wd->ani_data, wd->object, wd->visible_items); + wd->ani_func(wd->ani_data, wd->object, wd->visible_items); return ECORE_CALLBACK_CANCEL; } @@ -3777,15 +3840,15 @@ elm_controlbar_animation_set(Evas_Object *obj, void (*func) (void *data, Evas_Ob return; } -// if(!func) - // { - wd->init_animation = EINA_TRUE; + // if(!func) + // { + wd->init_animation = EINA_TRUE; - wd->ani_func = func; - wd->ani_data = data; + wd->ani_func = func; + wd->ani_data = data; - ecore_idler_add(init_animation, wd); - // } + ecore_idler_add(init_animation, wd); + // } } EAPI void @@ -3827,8 +3890,8 @@ elm_controlbar_view_animation_set(Evas_Object *obj, const char *hide, const char Widget_Data *wd = elm_widget_data_get(obj); if (wd == NULL) { - fprintf(stderr, "Cannot get smart data\n"); - return; + fprintf(stderr, "Cannot get smart data\n"); + return; } wd->view_hide = eina_stringshare_add(hide); -- 2.7.4