2 * @defgroup Controlbar Controlbar
5 * This is a Controlbar. It can contain label and icon objects.
6 * In edit mode, you can change the location of items.
12 #include <Elementary.h>
16 #define EAPI __attribute__ ((visibility("default")))
20 #define EDIT_ROW_NUM 4
22 #define ELM_MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2))
23 #define _EDJ(x) (Evas_Object *)elm_layout_edje_get(x)
29 // internal data structure of controlbar object
30 typedef struct _Widget_Data Widget_Data;
38 Evas_Object * view_content;
39 // Evas_Object * edit_box;
40 // Evas_Object * edit_table;
41 // Evas_Object * navigation;
45 Evas_Object * event_box;
46 Evas_Object * selected_box;
47 Evas_Object * focused_box;
48 Evas_Object * focused_box_left;
49 Evas_Object * focused_box_right;
51 Evas_Object * moving_obj;
52 Elm_Controlbar_Item * more_item;
53 Elm_Controlbar_Item * moving_item;
54 Elm_Controlbar_Item * pre_item;
55 Elm_Controlbar_Item * cur_item;
56 Evas_Coord x, y, w, h;
58 // Eina_Bool edit_mode;
65 Eina_List * visible_items;
67 Ecore_Event_Handler * move_event;
68 Ecore_Event_Handler * up_event;
69 Ecore_Event_Handler * bar_move_event;
70 Ecore_Event_Handler * bar_up_event;
72 void (*ani_func) (void *data, Evas_Object * obj, void *event_info);
74 Eina_Bool init_animation;
76 Ecore_Timer *effect_timer;
77 Eina_Bool selected_animation;
80 Elm_Xml_Animator *vxa;
82 const char *view_hide;
83 const char *view_show;
85 const char *pressed_signal;
86 const char *selected_signal;
89 struct _Elm_Controlbar_Item
93 Evas_Object * base_item;
94 // Evas_Object * edit;
95 // Evas_Object * edit_item;
98 Evas_Object * label_shadow;
100 Evas_Object * icon_shadow;
101 // Evas_Object * edit_label;
102 // Evas_Object * edit_label_shadow;
103 // Evas_Object * edit_icon;
104 // Evas_Object * edit_icon_shadow;
105 const char *icon_path;
107 void (*func) (void *data, Evas_Object * obj, void *event_info);
114 // Eina_Bool default_selected;
115 // Eina_Bool editable;
119 typedef struct _Animation_Data Animation_Data;
121 struct _Animation_Data
132 unsigned int start_time;
134 void (*func) (void *data, Evas_Object * obj);
136 Ecore_Animator * timer;
139 static const char *widtype = NULL;
141 static int check_bar_item_number(Widget_Data *wd);
142 static void selected_box(Elm_Controlbar_Item * it);
143 static int pressed_box(Elm_Controlbar_Item * it);
144 static void item_color_set(Elm_Controlbar_Item *item, const char *color_part);
145 //static void edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
146 //static void edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
147 //static void bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
148 //static void bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
150 /////////////////////////
152 ////////////////////////
155 print_all_items(Widget_Data *wd)
158 Elm_Controlbar_Item * item;
160 EINA_LIST_FOREACH(wd->items, l, item)
162 printf("item label : %s order : %d address : %p\n", item->text, item->order, item);
166 ///////////////////////////////////////////////////////////////////
168 // Smart Object basic function
170 ////////////////////////////////////////////////////////////////////
173 _controlbar_move(void *data, Evas_Object * obj)
176 Evas_Coord x, y, x_, y_, width;
178 wd = elm_widget_data_get((Evas_Object *) data);
180 evas_object_geometry_get(wd->edje, &x, &y, NULL, NULL);
183 evas_object_move(wd->edje, x, y);
184 evas_object_geometry_get(edje_object_part_object_get(wd->edje, "bg_image"), NULL, NULL, &width, NULL);
185 evas_object_geometry_get(wd->parent, &x_, &y_, NULL, NULL);
188 case ELM_CONTROLBAR_MODE_LEFT:
189 evas_object_move(wd->view, x + width, y);
191 case ELM_CONTROLBAR_MODE_RIGHT:
193 evas_object_move(wd->view, x, y);
196 // evas_object_move(wd->edit_box, x_, y_);
197 evas_object_move(wd->event_box, x, y);
201 _controlbar_resize(void *data, Evas_Object * obj)
204 Elm_Controlbar_Item *item;
206 Evas_Coord x, y, x_, y_, w, h, width, height;
208 wd = elm_widget_data_get((Evas_Object *) data);
210 evas_object_geometry_get(wd->edje, &x, &y, &w, &h);
213 evas_object_resize(wd->edje, w, h);
214 evas_object_geometry_get(edje_object_part_object_get(wd->edje, "bg_image"), NULL, NULL, &width, &height);
215 evas_object_geometry_get(wd->parent, &x_, &y_, NULL, NULL);
218 case ELM_CONTROLBAR_MODE_LEFT:
219 case ELM_CONTROLBAR_MODE_RIGHT:
220 evas_object_resize(wd->view, w - width, h);
221 // evas_object_resize(wd->edit_box, w + x - x_, h);
224 evas_object_resize(wd->view, w, h - height + 1);
225 // evas_object_resize(wd->edit_box, w, h + y - y_);
228 evas_object_resize(wd->event_box, w, h);
230 EINA_LIST_FOREACH(wd->items, l, item)
236 elm_label_wrap_width_set(item->label, (int)(wd->w/check_bar_item_number(wd))-20);
237 // elm_label_wrap_width_set(item->label_shadow, (int)(wd->w/check_bar_item_number(wd))-20);
241 elm_label_wrap_width_set(item->label, (int)(wd->w-20));
242 // elm_label_wrap_width_set(item->label_shadow, (int)(wd->w-20));
245 /* if(item->edit_label)
247 elm_label_wrap_width_set(item->edit_label, (int)(wd->w/check_bar_item_number(wd))-20);
248 elm_label_wrap_width_set(item->edit_label_shadow, (int)(wd->w/check_bar_item_number(wd))-20);
254 _controlbar_object_move(void *data, Evas * e, Evas_Object * obj,
257 _controlbar_move(data, obj);
261 _controlbar_object_resize(void *data, Evas * e, Evas_Object * obj,
264 _controlbar_resize(data, obj);
268 _controlbar_object_show(void *data, Evas * e, Evas_Object * obj,
273 wd = elm_widget_data_get((Evas_Object *) data);
275 evas_object_show(wd->view);
276 // evas_object_show(wd->edit_box);
277 evas_object_show(wd->edje);
278 evas_object_show(wd->box);
279 evas_object_show(wd->event_box);
283 _controlbar_object_hide(void *data, Evas * e, Evas_Object * obj,
288 wd = elm_widget_data_get((Evas_Object *) data);
290 evas_object_hide(wd->view);
291 // evas_object_hide(wd->edit_box);
292 evas_object_hide(wd->edje);
293 evas_object_hide(wd->box);
294 evas_object_hide(wd->event_box);
298 _item_del(Elm_Controlbar_Item *it)
301 Widget_Data *wd = elm_widget_data_get(it->obj);
304 if(it == wd->more_item)
306 evas_object_del(it->view);
308 eina_stringshare_del(it->text);
310 evas_object_del(it->label);
311 if (it->label_shadow)
312 evas_object_del(it->label_shadow);
314 eina_stringshare_del(it->icon_path);
316 evas_object_del(it->icon);
318 evas_object_del(it->icon_shadow);
321 if (it->style != OBJECT)
322 evas_object_del(it->base);
324 evas_object_hide(it->base);
327 evas_object_del(it->base_item);
329 // evas_object_del(it->edit);
330 // if (it->edit_item)
331 // evas_object_del(it->edit_item);
334 evas_object_hide(it->view);
339 _del_hook(Evas_Object * obj)
341 Widget_Data * wd = elm_widget_data_get(obj);
342 Elm_Controlbar_Item * item;
345 EINA_LIST_FREE(wd->items, item)
354 content = elm_layout_content_unset(wd->view, "elm.swallow.view");
355 evas_object_hide(content);
356 evas_object_del(wd->view);
361 evas_object_del(wd->edit_box);
365 // if (wd->navigation)
367 // evas_object_del(wd->navigation);
368 // wd->navigation = NULL;
372 evas_object_del(wd->bg);
378 evas_object_del(wd->edje);
383 evas_object_del(wd->focused_box);
386 if (wd->focused_box_left)
388 evas_object_del(wd->focused_box_left);
391 if (wd->focused_box_right)
393 evas_object_del(wd->focused_box_right);
398 evas_object_del(wd->box);
403 evas_object_del(wd->event_box);
404 wd->event_box = NULL;
409 elm_xml_animator_del(wd->xa);
412 if (wd->effect_timer)
414 ecore_timer_del(wd->effect_timer);
415 wd->effect_timer = NULL;
423 _theme_hook(Evas_Object * obj)
427 Elm_Controlbar_Item * item;
430 Widget_Data * wd = elm_widget_data_get(obj);
432 _elm_theme_object_set(obj, wd->edje, "controlbar", "base",
433 elm_widget_style_get(obj));
434 _elm_theme_object_set(obj, wd->bg, "controlbar", "background",
435 elm_widget_style_get(obj));
436 evas_object_color_get(wd->bg, &r, &g, &b, NULL);
437 evas_object_color_set(wd->bg, r, g, b, (int)(255 * wd->alpha / 100));
438 elm_layout_theme_set(wd->view, "controlbar", "view", elm_widget_style_get(obj));
439 // _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box",
440 // elm_widget_style_get(obj));
441 _elm_theme_object_set(obj, wd->focused_box, "controlbar", "item_bg_move", elm_widget_style_get(obj));
442 _elm_theme_object_set(obj, wd->focused_box_left, "controlbar", "item_bg_move", elm_widget_style_get(obj));
443 _elm_theme_object_set(obj, wd->focused_box_right, "controlbar", "item_bg_move", elm_widget_style_get(obj));
444 EINA_LIST_FOREACH(wd->items, l, item)
446 if (item->style != OBJECT)
448 elm_layout_theme_set(item->base, "controlbar", "item_bg",
449 elm_widget_style_get(obj));
450 // elm_layout_theme_set(item->edit, "controlbar", "item_bg",
451 // elm_widget_style_get(obj));
452 // if (!item->editable)
456 // edje_object_part_object_get(_EDJ(item->edit),
457 // "elm.item.uneditable.color");
459 // evas_object_color_get(color, &r, &g, &b, &a);
460 // evas_object_color_set(item->edit_item, r, g, b, a);
462 if (item->label && item->icon)
464 edje_object_signal_emit(_EDJ(item->base_item),
465 "elm,state,icon_text", "elm");
466 // edje_object_signal_emit(_EDJ(item->edit_item),
467 // "elm,state,icon_text", "elm");
478 _sub_del(void *data, Evas_Object * obj, void *event_info)
480 Widget_Data *wd = elm_widget_data_get(obj);
481 Evas_Object *sub = event_info;
482 Evas_Object *content;
487 content = elm_layout_content_unset(wd->view, "elm.swallow.view");
488 evas_object_hide(content);
493 _sizing_eval(Evas_Object * obj)
495 Widget_Data * wd = elm_widget_data_get(obj);
497 _controlbar_move(obj, obj);
498 _controlbar_resize(obj, obj);
501 /////////////////////////////////////////////////////////////
503 // animation function
505 /////////////////////////////////////////////////////////////
510 struct timeval timev;
512 gettimeofday(&timev, NULL);
513 return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
518 set_evas_map(Evas_Object * obj, Evas_Coord x, Evas_Coord y, Evas_Coord w,
525 Evas_Map * map = evas_map_new(4);
528 evas_map_smooth_set(map, EINA_TRUE);
529 evas_map_util_points_populate_from_object_full(map, obj, 0);
530 evas_object_map_enable_set(obj, EINA_TRUE);
531 evas_map_util_3d_perspective(map, x + w / 2, y + h / 2, 0, w * 10);
532 evas_map_util_points_populate_from_geometry(map, x, y, w, h, 0);
533 evas_object_map_set(obj, map);
538 move_evas_map(void *data)
548 Animation_Data * ad = (Animation_Data *) data;
549 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
550 dx = ad->tx - ad->fx;
551 dy = ad->ty - ad->fy;
552 dw = ad->tw - ad->fw;
553 dh = ad->th - ad->fh;
556 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
557 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
558 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
559 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
572 if (x == dx && y == dy && w == dw && h == dh)
574 ecore_animator_del(ad->timer);
576 set_evas_map(ad->obj, px, py, pw, ph);
577 if (ad->func != NULL)
578 ad->func(ad->data, ad->obj);
579 return ECORE_CALLBACK_CANCEL;
583 set_evas_map(ad->obj, px, py, pw, ph);
585 return ECORE_CALLBACK_RENEW;
590 move_evas_object(void *data)
600 Animation_Data * ad = (Animation_Data *) data;
601 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
602 dx = ad->tx - ad->fx;
603 dy = ad->ty - ad->fy;
604 dw = ad->tw - ad->fw;
605 dh = ad->th - ad->fh;
608 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
609 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
610 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
611 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
624 if (x == dx && y == dy && w == dw && h == dh)
626 ecore_animator_del(ad->timer);
628 evas_object_move(ad->obj, px, py);
629 evas_object_resize(ad->obj, pw, ph);
630 evas_object_show(ad->obj);
631 if (ad->func != NULL)
632 ad->func(ad->data, ad->obj);
633 return ECORE_CALLBACK_CANCEL;
637 evas_object_move(ad->obj, px, py);
638 evas_object_resize(ad->obj, pw, ph);
639 evas_object_show(ad->obj);
641 return ECORE_CALLBACK_RENEW;
645 move_object_with_animation(Evas_Object * obj, Evas_Coord x, Evas_Coord y,
646 Evas_Coord w, Evas_Coord h, Evas_Coord x_,
647 Evas_Coord y_, Evas_Coord w_, Evas_Coord h_,
648 double time, Eina_Bool (*mv_func) (void *data),
649 void (*func) (void *data,
650 Evas_Object * obj), void *data)
652 Animation_Data * ad = (Animation_Data *) malloc(sizeof(Animation_Data));
662 ad->start_time = current_time_get();
666 ad->timer = ecore_animator_add(mv_func, ad);
670 end_item_animation_effect(void *data, Evas_Object *obj)
672 Widget_Data *wd = (Widget_Data *)data;
673 elm_xml_animator_object_del(wd->xa, obj);
677 item_animation_effect(void *data)
679 Widget_Data *wd = (Widget_Data *)data;
681 Elm_Controlbar_Item * item;
685 wd->xa = elm_xml_animator_add(wd->object);
686 elm_xml_animator_file_set(wd->xa, "/usr/share/xmls/elementary.xml");
691 EINA_LIST_FOREACH(wd->items, l, item)
694 if(rand > 65 && item->order > 0)
700 elm_xml_animator_object_add(wd->xa, item->base_item, "test", end_item_animation_effect, wd);
703 elm_xml_animator_object_add(wd->xa, item->base_item, "test2", end_item_animation_effect, wd);
706 elm_xml_animator_object_add(wd->xa, item->base_item, "test3", end_item_animation_effect, wd);
709 elm_xml_animator_object_add(wd->xa, item->base_item, "test4", end_item_animation_effect, wd);
718 elm_xml_animator_run(wd->xa);
720 return ECORE_CALLBACK_RENEW;
723 /////////////////////////////////////////////////////////////
727 /////////////////////////////////////////////////////////////
730 sort_cb(const void *d1, const void *d2)
732 Elm_Controlbar_Item * item1, *item2;
733 item1 = (Elm_Controlbar_Item *) d1;
734 item2 = (Elm_Controlbar_Item *) d2;
735 if (item1->order <= 0) return 1;
736 if (item2->order <= 0) return -1;
737 return item1->order > item2->order ? 1 : -1;
742 done_button_cb(void *data, Evas_Object * obj, void *event_info)
744 Widget_Data * wd = (Widget_Data *) data;
746 wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb);
748 evas_object_smart_callback_call(wd->object, "edit,end", wd->items);
750 edje_object_signal_emit(wd->edit_box, "elm,state,hide,edit_box", "elm");
751 wd->edit_mode = EINA_FALSE;
754 ///////////////////////////////////////////////////////////////////
756 // basic utility function
758 ////////////////////////////////////////////////////////////////////
761 item_exist_check(Widget_Data *wd, Elm_Controlbar_Item *item)
764 Elm_Controlbar_Item *it;
766 if(!wd) return EINA_FALSE;
767 if(!wd->items) return EINA_FALSE;
769 EINA_LIST_FOREACH(wd->items, l, it)
771 if(it == item) return EINA_TRUE;
777 check_bar_item_number(Widget_Data *wd)
780 Elm_Controlbar_Item * item;
783 EINA_LIST_FOREACH(wd->items, l, item)
785 if(item->order > 0) num++;
792 item_insert_in_bar(Elm_Controlbar_Item * it, int order)
795 Elm_Controlbar_Item * item;
796 Widget_Data * wd = elm_widget_data_get(it->obj);
799 if(order == 0) return;
801 EINA_LIST_FOREACH(wd->items, l, item)
803 if (item->order == order && item != it)
808 EINA_LIST_FOREACH(wd->items, l, item)
811 elm_table_unpack(wd->box, item->base);
813 EINA_LIST_FOREACH(wd->items, l, item)
817 if (item->order >= order)
821 elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
825 elm_table_pack(wd->box, item->base, 0, item->order - 1, 1, 1);
827 evas_object_show(item->base);
834 elm_table_pack(wd->box, it->base, it->order - 1, 0, 1, 1);
838 elm_table_pack(wd->box, it->base, 0, it->order - 1, 1, 1);
840 evas_object_show(it->base);
844 item_delete_in_bar(Elm_Controlbar_Item * it)
847 Elm_Controlbar_Item * item;
848 Widget_Data * wd = elm_widget_data_get(it->obj);
851 EINA_LIST_FOREACH(wd->items, l, item)
857 elm_table_unpack(wd->box, it->base);
858 evas_object_hide(it->base);
863 EINA_LIST_FOREACH(wd->items, l, item)
868 elm_table_unpack(wd->box, item->base);
871 elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
875 elm_table_pack(wd->box, item->base, 0, item->order - 1, 1, 1);
883 item_visible_set(Elm_Controlbar_Item *it, Eina_Bool visible)
885 Elm_Controlbar_Item *item;
886 Eina_Bool check = EINA_TRUE;
889 if (it->obj == NULL) return;
890 Widget_Data * wd = elm_widget_data_get(it->obj);
891 if (!wd || !wd->items) return;
892 if (it->order <= 0) check = EINA_FALSE;
893 if (check == visible) return;
896 item = elm_controlbar_last_item_get(it->obj);
897 while(!elm_controlbar_item_visible_get(item)){
898 item = elm_controlbar_item_prev(item);
900 item_insert_in_bar(it, item->order + 1);
904 item_delete_in_bar(it);
906 wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb);
907 _sizing_eval(it->obj);
911 item_exchange_animation_cb(void *data, Evas_Object * obj)
913 Widget_Data * wd = (Widget_Data *) data;
915 if (wd->animating < 0)
917 printf("animation error\n");
920 evas_object_map_enable_set(obj, EINA_FALSE);
924 item_exchange_in_bar(Elm_Controlbar_Item * it1, Elm_Controlbar_Item * it2)
928 Evas_Coord x, y, w, h;
929 Evas_Coord x_, y_, w_, h_;
930 Widget_Data * wd = elm_widget_data_get(it1->obj);
931 evas_object_geometry_get(wd->moving_item->edit, &x, &y, &w, &h);
932 set_evas_map(wd->moving_obj, (wd->x + wd->w / 2), (wd->y + wd->h / 2), 0,
934 evas_object_geometry_get(it1->base, &x, &y, &w, &h);
935 evas_object_geometry_get(it2->base, &x_, &y_, &w_, &h_);
937 move_object_with_animation(it1->base, x, y, w, h, x_, y_, w_, h_, 0.25,
938 move_evas_map, item_exchange_animation_cb, wd);
940 move_object_with_animation(it2->base, x_, y_, w_, h_, x, y, w, h, 0.25,
941 move_evas_map, item_exchange_animation_cb, wd);
942 elm_table_unpack(wd->box, it1->base);
943 elm_table_unpack(wd->box, it2->base);
945 it1->order = it2->order;
949 elm_table_pack(wd->box, it1->base, it1->order - 1, 0, 1, 1);
950 elm_table_pack(wd->box, it2->base, it2->order - 1, 0, 1, 1);
954 elm_table_pack(wd->box, it1->base, 0, it1->order - 1, 1, 1);
955 elm_table_pack(wd->box, it2->base, 0, it2->order - 1, 1, 1);
960 item_change_animation_cb(void *data, Evas_Object * obj)
962 Evas_Coord x, y, w, h;
963 Widget_Data * wd = (Widget_Data *) data;
965 if (wd->animating < 0)
967 printf("animation error\n");
970 evas_object_map_enable_set(obj, EINA_FALSE);
971 evas_object_geometry_get(obj, &x, &y, &w, &h);
972 set_evas_map(obj, x, y, 0, 0);
973 evas_object_move(obj, -1000, -1000);
974 evas_object_geometry_get(wd->moving_item->base, &x, &y, &w, &h);
975 evas_object_move(wd->moving_obj, -1000, -1000);
976 evas_object_del(wd->moving_obj);
980 item_change_in_bar(Elm_Controlbar_Item * it)
982 Evas_Coord x, y, w, h;
983 Evas_Coord x_, y_, w_, h_;
984 Widget_Data * wd = elm_widget_data_get(it->obj);
987 if (wd->moving_item == NULL)
989 evas_object_geometry_get(wd->moving_item->edit, &x, &y, &w, &h);
990 set_evas_map(wd->moving_obj, x, y, w, h);
991 elm_table_unpack(wd->box, it->base);
992 wd->moving_item->order = it->order;
996 elm_table_pack(wd->box, wd->moving_item->base, wd->moving_item->order - 1, 0, 1, 1);
1000 elm_table_pack(wd->box, wd->moving_item->base, 0, wd->moving_item->order - 1, 1, 1);
1003 evas_object_show(wd->moving_item->base);
1004 evas_render_updates_free(evas_render_updates
1005 (evas_object_evas_get(wd->moving_item->base)));
1006 evas_object_geometry_get(it->base, &x, &y, &w, &h);
1007 evas_object_geometry_get(it->edit, &x_, &y_, &w_, &h_);
1009 move_object_with_animation(it->base, x, y, w, h, x_, y_, w_, h_, 0.25,
1010 move_evas_map, item_change_animation_cb, wd);
1011 evas_object_geometry_get(wd->moving_item->base, &x, &y, &w, &h);
1012 set_evas_map(wd->moving_item->base, x, y, w, h);
1016 hide_selected_box(void *data)
1018 Evas_Object *selected_box = (Evas_Object *)data;
1020 evas_object_hide(selected_box);
1022 return ECORE_CALLBACK_CANCEL;
1026 item_color_set(Elm_Controlbar_Item *item, const char *color_part)
1031 color = (Evas_Object *) edje_object_part_object_get(_EDJ(item->base), color_part);
1033 evas_object_color_get(color, &r, &g, &b, &a);
1034 evas_object_color_set(item->label, r, g, b, a);
1035 evas_object_color_set(item->icon, r, g, b, a);
1039 _end_selected_box(void *data, Evas_Object *obj)
1041 Widget_Data * wd = (Widget_Data *)data;
1043 edje_object_signal_emit(_EDJ(wd->cur_item->base), wd->selected_signal, "elm");
1044 edje_object_signal_emit(_EDJ(wd->cur_item->base_item), "elm,state,shadow_show", "elm");
1047 if (wd->animating < 0)
1049 printf("animation error\n");
1053 ecore_idler_add(hide_selected_box, wd->selected_box);
1057 move_selected_box(Widget_Data *wd, Elm_Controlbar_Item * fit, Elm_Controlbar_Item * tit)
1059 Evas_Coord fx, fy, fw, fh, tx, ty, tw, th;
1060 Evas_Object *from, *to;
1062 if(fit->order <= 0 && wd->auto_align)
1063 fit = wd->more_item;
1065 from = (Evas_Object *)edje_object_part_object_get(_EDJ(fit->base), "bg_img");
1066 evas_object_geometry_get(from, &fx, &fy, &fw, &fh);
1068 to = (Evas_Object *)edje_object_part_object_get(_EDJ(tit->base), "bg_img");
1069 evas_object_geometry_get(to, &tx, &ty, &tw, &th);
1071 edje_object_signal_emit(_EDJ(wd->pre_item->base), "elm,state,unselected", "elm");
1072 edje_object_signal_emit(_EDJ(wd->pre_item->base_item), "elm,state,shadow_hide", "elm");
1073 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,state,unselected", "elm");
1076 move_object_with_animation(wd->selected_box, fx, fy, fw, fh, tx, ty, tw, th,
1077 0.3, move_evas_object, _end_selected_box, wd);
1082 end_selected_box(void *data, Evas_Object *obj)
1084 Widget_Data * wd = (Widget_Data *)data;
1086 if(wd->pre_item) evas_object_hide(wd->pre_item->view);
1088 elm_layout_content_set(wd->view, "elm.swallow.view", obj);
1090 evas_object_show(obj);
1094 view_animation_push(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data)
1096 Evas_Coord x, y, w, h;
1098 evas_object_geometry_get(pre, &x, &y, &w, &h);
1099 move_object_with_animation(pre, x, y, w, h, x+20, y, w, h, 0.5, move_fade_out_object, NULL, NULL);
1100 move_object_with_animation(cur, x+120, y, w, h, x, y, w, h, 0.5, move_fade_in_object, end_selected_box, wd);
1104 view_animation_down(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data)
1106 Evas_Coord x, y, w, h;
1108 evas_object_geometry_get(pre, &x, &y, &w, &h);
1110 move_object_with_animation(cur, x, h, w, h, x, h, w, h, 0.5, move_evas_object, end_selected_box, wd);
1111 evas_object_raise(pre);
1112 move_object_with_animation(pre, x, y, w, h, x, h, w, 0, 0.5, move_evas_map, NULL, NULL);
1116 end_view_animation_effect(void *data, Evas_Object *obj)
1118 Widget_Data *wd = (Widget_Data *)data;
1119 elm_xml_animator_object_del(wd->vxa, obj);
1121 evas_object_hide(wd->pre_item->view);
1123 //if(wd->cur_item) elm_layout_content_set(wd->view, "elm.swallow.view", wd->cur_item->view);
1127 selected_box(Elm_Controlbar_Item * it)
1129 Widget_Data * wd = elm_widget_data_get(it->obj);
1131 Elm_Controlbar_Item * item, *fit = NULL;
1132 Evas_Object * content;
1134 if(wd->animating) return;
1139 wd->vxa = elm_xml_animator_add(wd->object);
1140 elm_xml_animator_file_set(wd->vxa, "/usr/share/xmls/elementary.xml");
1143 if(it->style == TABBAR){
1145 content = elm_layout_content_unset(wd->view, "elm.swallow.view");
1146 EINA_LIST_FOREACH(wd->items, l, item){
1147 if(item->selected) {
1151 item->selected = EINA_FALSE;
1153 it->selected = EINA_TRUE;
1156 if(fit != NULL && fit != it)
1158 move_selected_box(wd, fit, it);
1162 edje_object_signal_emit(_EDJ(it->base), wd->selected_signal, "elm");
1163 edje_object_signal_emit(_EDJ(wd->cur_item->base_item), "elm,state,shadow_show", "elm");
1168 // it->default_selected = EINA_FALSE;
1169 if(wd->more_item != it)
1170 evas_object_smart_callback_call(it->obj, "view,change,before", it);
1175 if(fit != NULL && fit != it)
1177 //view_animation_down(wd, fit->view, it->view, NULL);
1178 view_animation_push(wd, fit->view, it->view, NULL);
1179 //evas_object_hide(content);
1181 // evas_object_geometry_get(fit->view, &x, &y, &w, &h);
1182 // if(fit->order > it->order)
1184 // move_object_with_animation(fit->view, x, y, w, h, x+20, y, w, h, 0.5, move_fade_out_object, NULL, NULL);
1185 // 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);
1189 // move_object_with_animation(fit->view, x, y, w, h, x-120, y, w, h, 1.5, move_fade_out_object, NULL, NULL);
1190 // 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);
1195 end_selected_box(wd, it->view);
1198 //if(wd->pre_item) evas_object_hide(wd->pre_item->view);
1199 elm_layout_content_set(wd->view, "elm.swallow.view", it->view);
1201 //evas_object_move(it->view, -480, 94);
1202 //evas_object_resize(it->view, 480, 620);
1203 //evas_object_show(it->view);
1205 if(wd->pre_item && wd->pre_item != it)
1208 elm_xml_animator_object_add(wd->vxa, wd->pre_item->view, wd->view_hide, end_view_animation_effect, wd);
1210 evas_object_hide(wd->pre_item->view);
1212 elm_xml_animator_object_add(wd->vxa, it->view, wd->view_show, end_view_animation_effect, wd);
1216 elm_xml_animator_run(wd->vxa);
1218 // elm_layout_content_set(wd->view, "elm.swallow.view", it->view);
1219 //edje_object_part_swallow(wd->view, "elm.swallow.view", it->view);
1220 // evas_object_show(it->view);
1222 }else if(it->style == TOOLBAR){
1223 edje_object_signal_emit(_EDJ(it->base), "elm,state,text_unselected", "elm");
1226 it->func(it->data, it->obj, it);
1230 //if(item_exist_check(wd, it)) evas_object_smart_callback_call(it->obj, "clicked", it);
1234 unpressed_box_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1236 Widget_Data * wd = (Widget_Data *) data;
1238 Evas_Event_Mouse_Up * ev = event_info;
1239 Evas_Coord x, y, w, h;
1240 Elm_Controlbar_Item * item;
1242 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb);
1244 EINA_LIST_FOREACH(wd->items, l, item)
1246 if (item->style == TABBAR)
1250 edje_object_signal_emit(_EDJ(item->base), wd->selected_signal, "elm");
1254 edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm");
1255 edje_object_signal_emit(_EDJ(item->base_item), "elm,state,shadow_hide", "elm");
1258 else if (item->style == TOOLBAR)
1262 edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm");
1263 //item_color_set(item, "elm.item.default.color");
1268 if(item_exist_check(wd, wd->pre_item))
1270 evas_object_geometry_get(wd->pre_item->base, &x, &y, &w, &h);
1271 if(ev->output.x > x && ev->output.x < x+w && ev->output.y > y && ev->output.y < y+h)
1273 selected_box(wd->pre_item);
1280 pressed_box(Elm_Controlbar_Item * it)
1282 Widget_Data * wd = elm_widget_data_get(it->obj);
1285 Elm_Controlbar_Item * item;
1287 if(wd->animating) return EXIT_FAILURE;
1289 if(it->disable) return EXIT_FAILURE;
1291 EINA_LIST_FOREACH(wd->items, l, item)
1295 if (it->style == TABBAR)
1297 edje_object_signal_emit(_EDJ(it->base), wd->pressed_signal, "elm");
1299 else if (it->style == TOOLBAR)
1304 edje_object_signal_emit(_EDJ(it->base), "elm,state,toolbar_pressed", "elm");
1305 //item_color_set(it, "elm.toolbar.pressed.color");
1308 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb, (void *)wd);
1314 return EXIT_FAILURE;
1318 return EXIT_SUCCESS;
1321 static Evas_Object *
1322 create_item_label(Evas_Object *obj, Elm_Controlbar_Item * it, char *part)
1326 label = elm_label_add(obj);
1327 elm_object_style_set(label, "controlbar");
1328 elm_label_label_set(label, it->text);
1329 elm_label_text_align_set(label, "center");
1330 elm_label_text_color_set(label, 255, 255, 255, 255);
1331 elm_label_line_wrap_set(label, EINA_TRUE);
1332 elm_label_ellipsis_set(label, EINA_TRUE);
1333 elm_label_wrap_mode_set(label, 1);
1335 elm_layout_content_set(obj, part, label);
1340 static Evas_Object *
1341 create_item_icon(Evas_Object *obj, Elm_Controlbar_Item * it, char *part)
1345 icon = elm_icon_add(obj);
1346 if(!elm_icon_standard_set(icon, it->icon_path))
1348 elm_icon_file_set(icon, it->icon_path, NULL);
1351 evas_object_size_hint_min_set(icon, 40, 40);
1352 evas_object_size_hint_max_set(icon, 100, 100);
1353 evas_object_show(icon);
1355 elm_layout_content_set(obj, part, icon);
1360 static Evas_Object *
1361 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)
1365 obj = elm_layout_add(parent);
1368 fprintf(stderr, "Cannot load bg edj\n");
1371 elm_layout_theme_set(obj, "controlbar", "item_bg",
1372 elm_widget_style_get(it->obj));
1373 evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1374 evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
1376 *item = elm_layout_add(parent);
1379 fprintf(stderr, "Cannot load bg edj\n");
1382 elm_layout_theme_set(*item, "controlbar", "item",
1383 elm_widget_style_get(it->obj));
1384 elm_layout_content_set(obj, "item", *item);
1388 *label = create_item_label(*item, it, "elm.swallow.text");
1389 // *slabel = create_item_label(*item, it, "elm.swallow.text_shadow");
1390 // evas_object_color_set(*slabel, 0, 0, 0, 255);
1394 *icon = create_item_icon(*item, it, "elm.swallow.icon");
1395 *sicon = create_item_icon(*item, it, "elm.swallow.icon_shadow");
1396 evas_object_color_set(*sicon, 0, 0, 0, 255);
1398 if (*label && *icon)
1400 edje_object_signal_emit(_EDJ(*item), "elm,state,icon_text", "elm");
1401 elm_label_line_wrap_set(*label, EINA_FALSE);
1402 elm_label_wrap_mode_set(*label, 0);
1403 // elm_label_line_wrap_set(*slabel, EINA_FALSE);
1404 // elm_label_wrap_mode_set(*slabel, 0);
1411 edit_item_down_end_cb(void *data, Evas_Object * obj)
1413 Widget_Data * wd = (Widget_Data *) data;
1415 if (wd->animating < 0)
1417 printf("animation error\n");
1423 edit_item_return_cb(void *data, Evas_Object * obj)
1425 Evas_Coord x, y, w, h;
1426 Widget_Data * wd = (Widget_Data *) data;
1427 evas_object_geometry_get(wd->moving_item->edit, &x, &y, &w, &h);
1428 set_evas_map(obj, x, y, 0, 0);
1430 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb);
1431 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb);
1433 evas_object_data_set(wd->moving_obj, "returning", 0);
1435 if (wd->animating < 0)
1437 printf("animation error\n");
1443 edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1445 Evas_Event_Mouse_Move * ev = event_info;
1447 Elm_Controlbar_Item * item;
1448 Evas_Coord x, y, w, h;
1449 Widget_Data * wd = (Widget_Data *) data;
1452 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1455 x = ev->cur.output.x - w / 2;
1456 y = ev->cur.output.y - h;
1457 set_evas_map(wd->moving_obj, x, y, w, h);
1459 EINA_LIST_FOREACH(wd->items, l, item)
1461 if (wd->moving_item->edit == item->edit || item->style == OBJECT)
1463 evas_object_geometry_get(item->base, &x, &y, &w, &h);
1464 if (ev->cur.output.x > x && ev->cur.output.x < x + w && ev->cur.output.y > y && ev->cur.output.y < y + h
1467 edje_object_signal_emit(_EDJ(item->base), "elm,state,show,glow",
1472 edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
1480 edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1482 Evas_Event_Mouse_Up * ev = event_info;
1483 Evas_Coord x, y, w, h;
1484 Evas_Coord x_, y_, w_, h_;
1486 Elm_Controlbar_Item * item;
1487 Widget_Data * wd = (Widget_Data *) data;
1489 if ((int)evas_object_data_get(wd->moving_obj, "returning") == 1)
1491 evas_object_color_set(wd->moving_item->edit_item, 255, 255, 255, 255);
1493 // check which change or not
1494 EINA_LIST_FOREACH(wd->items, l, item)
1496 if (wd->moving_item->edit == item->edit)
1498 if (item->order <= 0)
1500 evas_object_geometry_get(item->base, &x, &y, &w, &h);
1501 if (ev->output.x > x && ev->output.x < x + w && ev->output.y > y && ev->output.y < y + h
1502 && item->style != OBJECT && item->editable)
1504 edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
1511 if (wd->moving_item->order > 0)
1513 item_exchange_in_bar(wd->moving_item, item);
1517 item_change_in_bar(item);
1519 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb);
1520 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb);
1525 // return moving object to original location
1526 evas_object_geometry_get(wd->moving_item->edit, &x_, &y_, &w_,
1528 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1531 x = ev->output.x - w / 2;
1532 y = ev->output.y - h;
1533 evas_object_data_set(wd->moving_obj, "returning", (void *)1);
1535 move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_,
1536 0.25, move_evas_map, edit_item_return_cb, wd);
1542 edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj,
1545 Evas_Event_Mouse_Down * ev = event_info;
1546 Evas_Coord x, y, w, h;
1547 Evas_Coord x_, y_, w_, h_;
1548 Widget_Data * wd = (Widget_Data *) data;
1551 Elm_Controlbar_Item * item;
1552 Evas_Object * color;
1557 EINA_LIST_FOREACH(wd->items, l, item)
1559 if (item->edit == obj)
1564 if (!item->editable)
1567 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb, (void *)wd);
1568 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb, (void *)wd);
1570 wd->moving_item = item;
1573 edje_object_part_object_get(_EDJ(wd->moving_item->edit),
1574 "elm.item.uneditable.color");
1576 evas_object_color_get(color, &r, &g, &b, &a);
1577 evas_object_color_set(item->edit_item, r, g, b, a);
1579 evas_object_del(wd->moving_obj);
1580 wd->moving_obj = NULL;
1581 wd->moving_obj = create_item_layout(obj, item, &(item->base_item), &(item->label), &(item->icon), &(item->icon_shadow), &(item->label_shadow));
1582 evas_object_geometry_get(obj, &x, &y, &w, &h);
1583 evas_object_move(wd->moving_obj, -1000, -1000);
1584 evas_object_resize(wd->moving_obj, w, h);
1585 evas_object_show(wd->moving_obj);
1588 x_ = ev->output.x - w_ / 2;
1589 y_ = ev->output.y - h_;
1591 move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_, 0.1,
1592 move_evas_map, edit_item_down_end_cb, wd);
1596 bar_item_move_end_cb(void *data, Evas_Object * obj)
1598 Widget_Data * wd = (Widget_Data *) data;
1601 Elm_Controlbar_Item * item;
1602 EINA_LIST_FOREACH(wd->items, l, item)
1604 if (item->base == obj)
1608 if (wd->animating < 0)
1610 printf("animation error\n");
1613 evas_object_data_set(obj, "animating", 0);
1614 evas_object_map_enable_set(obj, EINA_FALSE);
1618 bar_item_animation_end_check(void *data)
1622 Elm_Controlbar_Item * item;
1623 Widget_Data * wd = (Widget_Data *) data;
1625 return EXIT_FAILURE;
1626 EINA_LIST_FOREACH(wd->items, l, item)
1628 if (item->base == wd->moving_obj)
1633 printf("item is NULL\n");
1637 item->order = wd->empty_num;
1639 wd->moving_obj = NULL;
1641 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, bar_item_up_cb);
1642 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb);
1643 return ECORE_CALLBACK_CANCEL;
1647 bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1649 Evas_Event_Mouse_Move * ev = event_info;
1651 Elm_Controlbar_Item * item, *it;
1652 Widget_Data * wd = (Widget_Data *) data;
1653 Evas_Coord x, y, w, h, x_, y_, w_, h_;
1656 if (wd->moving_obj == NULL)
1658 printf("%s : moving_obj is NULL\n", __func__);
1661 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1662 x = ev->cur.output.x - w / 2;
1663 set_evas_map(wd->moving_obj, x, y, w, h);
1664 EINA_LIST_FOREACH(wd->items, l, item)
1666 if (item->base == wd->moving_obj)
1671 if ((int)evas_object_data_get(item->base, "animating") == 1)
1673 evas_object_geometry_get(item->base, &x, &y, &w, &h);
1674 if (ev->cur.output.x > x && ev->cur.output.x < x + w && item->editable)
1681 evas_object_geometry_get(wd->moving_obj, &x_, &y_, &w_, &h_);
1682 evas_object_move(wd->moving_obj, x, y);
1683 tmp = wd->empty_num;
1684 wd->empty_num = item->order;
1686 elm_table_unpack(wd->box, item->base);
1687 elm_table_unpack(wd->box, wd->moving_obj);
1690 elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
1691 elm_table_pack(wd->box, wd->moving_obj, wd->empty_num - 1, 0, 1, 1);
1695 elm_table_pack(wd->box, item->base, 0, item->order - 1, 1, 1);
1696 elm_table_pack(wd->box, wd->moving_obj, 0, wd->empty_num - 1, 1, 1);
1699 evas_object_data_set(item->base, "animating", (void *)1);
1700 move_object_with_animation(item->base, x, y, w, h, x_, y_, w_, h_,
1701 0.25, move_evas_map, bar_item_move_end_cb, wd);
1707 bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1709 Evas_Event_Mouse_Up * ev = event_info;
1710 Evas_Coord tx, x, y, w, h;
1711 Widget_Data * wd = (Widget_Data *) data;
1712 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1713 tx = ev->output.x - w / 2;
1715 evas_object_data_set(wd->moving_obj, "animating", (void *)1);
1716 move_object_with_animation(wd->moving_obj, tx, y, w, h, x, y, w, h, 0.25,
1717 move_evas_map, bar_item_move_end_cb, wd);
1718 ecore_timer_add(0.1, bar_item_animation_end_check, wd);
1724 bar_item_down_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info)
1726 Widget_Data * wd = (Widget_Data *) data;
1728 Elm_Controlbar_Item * item;
1729 if (wd->animating) return;
1731 EINA_LIST_FOREACH(wd->items, l, item)
1733 if (item->base == obj) break;
1735 if (item == NULL) return;
1736 /* if (wd->edit_mode)
1738 if (!item->editable)
1741 wd->moving_obj = obj;
1742 wd->empty_num = item->order;
1743 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, bar_item_up_cb, (void *)wd);
1744 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb, (void *)wd);
1752 static Elm_Controlbar_Item *
1753 create_tab_item(Evas_Object * obj, const char *icon_path, const char *label,
1756 Elm_Controlbar_Item * it;
1760 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1763 wd = elm_widget_data_get(obj);
1766 fprintf(stderr, "Cannot get smart data\n");
1769 it = ELM_NEW(Elm_Controlbar_Item);
1770 if (it == NULL) return NULL;
1772 it->text = eina_stringshare_add(label);
1773 it->icon_path = eina_stringshare_add(icon_path);
1774 it->selected = EINA_FALSE;
1775 //it->default_selected = EINA_FALSE;
1776 // it->editable = EINA_TRUE;
1781 it->base = create_item_layout(wd->edje, it, &(it->base_item), &(it->label), &(it->icon), &(it->icon_shadow), &(it->label_shadow));
1782 evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
1783 bar_item_down_cb, wd);
1784 evas_object_show(it->base);
1785 // 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));
1786 // evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN,
1787 // edit_item_down_cb, wd);
1788 // evas_object_show(it->edit);
1793 static Elm_Controlbar_Item *
1794 create_tool_item(Evas_Object * obj, const char *icon_path, const char *label,
1795 void (*func) (void *data, Evas_Object * obj,
1796 void *event_info), void *data)
1799 Elm_Controlbar_Item * it;
1803 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1806 wd = elm_widget_data_get(obj);
1809 fprintf(stderr, "Cannot get smart data\n");
1812 it = ELM_NEW(Elm_Controlbar_Item);
1816 it->text = eina_stringshare_add(label);
1817 it->icon_path = eina_stringshare_add(icon_path);
1818 it->selected = EINA_FALSE;
1819 // it->editable = EINA_TRUE;
1824 it->style = TOOLBAR;
1825 it->base = create_item_layout(wd->edje, it, &(it->base_item), &(it->label), &(it->icon), &(it->icon_shadow), &(it->label_shadow));
1826 evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
1827 bar_item_down_cb, wd);
1828 evas_object_show(it->base);
1829 //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));
1830 // evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN,
1831 // edit_item_down_cb, wd);
1832 // evas_object_show(it->edit);
1837 static Elm_Controlbar_Item *
1838 create_object_item(Evas_Object * obj, Evas_Object * obj_item, const int sel)
1840 Elm_Controlbar_Item * it;
1844 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1847 wd = elm_widget_data_get(obj);
1850 fprintf(stderr, "Cannot get smart data\n");
1853 it = ELM_NEW(Elm_Controlbar_Item);
1860 it->base = obj_item;
1865 repack_items(Widget_Data *wd)
1868 Elm_Controlbar_Item * item;
1870 EINA_LIST_FOREACH(wd->items, l, item)
1874 elm_table_unpack(wd->box, item->base);
1877 elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1);
1881 elm_table_pack(wd->box, item->base, 0, item->order - 1, item->sel, 1);
1888 set_items_position(Evas_Object * obj, Elm_Controlbar_Item * it,
1889 Elm_Controlbar_Item * mit, Eina_Bool bar)
1894 Elm_Controlbar_Item * item;
1897 int check = EINA_FALSE;
1905 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1908 wd = elm_widget_data_get(obj);
1911 fprintf(stderr, "Cannot get smart data\n");
1915 EINA_LIST_FOREACH(wd->items, l, item)
1917 if (item == mit && item->order > 0)
1921 it->order = mit->order;
1925 if(item->order > 0){
1926 elm_table_unpack(wd->box, item->base);
1927 item->order += it->sel;
1930 elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1);
1934 elm_table_pack(wd->box, item->base, 0, item->order - 1, item->sel, 1);
1937 // if (item->style != OBJECT && it->style != OBJECT)
1939 // elm_table_unpack(wd->edit_table, item->edit);
1940 // elm_table_pack(wd->edit_table, item->edit,
1941 // i % EDIT_ROW_NUM, i / EDIT_ROW_NUM, 1, 1);
1944 if (item->style != OBJECT)
1946 if(item->order > 0) order += item->sel;
1962 elm_table_pack(wd->box, it->base, it->order - 1, 0, it->sel, 1);
1966 elm_table_pack(wd->box, it->base, 0, it->order - 1, it->sel, 1);
1969 else evas_object_hide(it->base);
1970 // if (it->style != OBJECT)
1971 // elm_table_pack(wd->edit_table, it->edit, (edit - 1) % EDIT_ROW_NUM,
1972 // (edit - 1) / EDIT_ROW_NUM, 1, 1);
1976 list_clicked(void *data, Evas_Object *obj, void *event_info)
1978 Elm_Controlbar_Item *item = (Elm_Controlbar_Item *)data;
1979 Elm_Controlbar_Item *it;
1982 Evas_Object *content;
1983 Elm_List_Item *lit = (Elm_List_Item *) elm_list_selected_item_get(obj);
1984 if(lit == NULL) return;
1986 elm_list_item_selected_set(lit, 0);
1990 wd = elm_widget_data_get(item->obj);
1992 EINA_LIST_FOREACH(wd->items, l, it)
1994 it->selected = EINA_FALSE;
1997 if(item->style == TABBAR)
1999 content = elm_layout_content_unset(wd->view, "elm.swallow.view");
2000 evas_object_hide(content);
2001 item->selected = EINA_TRUE;
2002 evas_object_smart_callback_call(item->obj, "view,change,before", item);
2003 elm_layout_content_set(wd->view, "elm.swallow.view", item->view);
2006 if(item->style == TOOLBAR && item->func)
2007 item->func(item->data, item->obj, item);
2010 static Evas_Object *
2011 create_more_view(Widget_Data *wd)
2014 Elm_Controlbar_Item *item;
2018 list = elm_list_add( wd->object );
2019 elm_list_horizontal_mode_set( list, ELM_LIST_COMPRESS );
2021 EINA_LIST_FOREACH(wd->items, l, item)
2023 if(item->order <= 0)
2028 icon = create_item_icon(list, item, NULL);
2029 evas_object_color_set(icon, 0, 0, 0, 255);
2031 elm_list_item_append(list, item->text, icon, NULL, list_clicked, item);
2035 elm_list_go( list );
2040 static void _ctxpopup_cb(void *data, Evas_Object *obj, void *event_info)
2042 Elm_Controlbar_Item *it;
2044 Evas_Object *ctxpopup = obj;
2045 Widget_Data *wd = (Widget_Data *)data;
2047 EINA_LIST_FOREACH(wd->items, l, it)
2049 if(!strcmp(it->text, elm_ctxpopup_item_label_get((Elm_Ctxpopup_Item *) event_info))) break;
2054 it->func(it->data, it->obj, it);
2057 if(item_exist_check(wd, it)) evas_object_smart_callback_call(it->obj, "clicked", it);
2059 evas_object_del(ctxpopup);
2063 static void _ctxpopup_hide_cb(void *data, Evas_Object *obj, void *event_info)
2065 Evas_Object *ctxpopup = obj;
2067 evas_object_del(ctxpopup);
2072 create_more_func(void *data, Evas_Object *obj, void *event_info)
2074 Evas_Object *ctxpopup;
2075 Elm_Controlbar_Item *item;
2078 Evas_Coord x, y, w, h;
2079 Widget_Data *wd = elm_widget_data_get(obj);
2082 ctxpopup = elm_ctxpopup_add(wd->parent);
2083 evas_object_smart_callback_add( ctxpopup, "hide", _ctxpopup_hide_cb, wd);
2085 EINA_LIST_FOREACH(wd->items, l, item)
2087 if(item->order <= 0)
2092 icon = create_item_icon(ctxpopup, item, NULL);
2093 evas_object_color_set(icon, 0, 0, 0, 255);
2095 elm_ctxpopup_item_add(ctxpopup, icon, item->text, _ctxpopup_cb, wd);
2099 evas_object_geometry_get(wd->more_item->base, &x, &y, &w, &h);
2100 evas_object_move(ctxpopup, x + w/2, y + h/2);
2102 evas_object_show(ctxpopup);
2105 static Elm_Controlbar_Item *
2106 create_more_item(Widget_Data *wd, int style)
2108 Elm_Controlbar_Item * it;
2110 it = ELM_NEW(Elm_Controlbar_Item);
2111 if (it == NULL) return NULL;
2112 it->obj = wd->object;
2113 it->text = eina_stringshare_add("more");
2114 it->icon_path = eina_stringshare_add(CONTROLBAR_SYSTEM_ICON_MORE);
2115 it->selected = EINA_FALSE;
2118 it->view = create_more_view(wd);
2119 it->func = create_more_func;
2121 it->base = create_item_layout(wd->edje, it, &(it->base_item), &(it->label), &(it->icon), &(it->icon_shadow), &(it->label_shadow));
2122 evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
2123 bar_item_down_cb, wd);
2124 evas_object_show(it->base);
2125 // 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));
2126 // evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN,
2127 // edit_item_down_cb, wd);
2128 // evas_object_show(it->edit);
2130 set_items_position(it->obj, it, NULL, EINA_TRUE);
2132 wd->items = eina_list_append(wd->items, it);
2136 // elm_controlbar_item_editable_set(it, EINA_FALSE);
2138 wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb);
2143 ///////////////////////////////////////////////////////////////////
2147 ////////////////////////////////////////////////////////////////////
2150 * Add a new controlbar object
2152 * @param parent The parent object
2153 * @return The new object or NULL if it cannot be created
2155 * @ingroup Controlbar
2157 EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent)
2159 Evas_Object * obj = NULL;
2160 Evas_Object * bg = NULL;
2161 Widget_Data * wd = NULL;
2162 Evas_Coord x, y, w, h;
2163 // Evas_Object * r_button;
2164 wd = ELM_NEW(Widget_Data);
2165 wd->evas = evas_object_evas_get(parent);
2166 if (wd->evas == NULL) return NULL;
2167 obj = elm_widget_add(wd->evas);
2168 if (obj == NULL) return NULL;
2169 ELM_SET_WIDTYPE(widtype, "controlbar");
2170 elm_widget_type_set(obj, "controlbar");
2171 elm_widget_sub_object_add(parent, obj);
2172 elm_widget_data_set(obj, wd);
2173 elm_widget_del_hook_set(obj, _del_hook);
2174 elm_widget_theme_hook_set(obj, _theme_hook);
2177 wd->parent = parent;
2178 evas_object_geometry_get(parent, &x, &y, &w, &h);
2184 wd->mode = ELM_CONTROLBAR_MODE_DEFAULT;
2188 wd->vertical = EINA_FALSE;
2189 // wd->edit_mode = EINA_FALSE;
2190 wd->auto_align = EINA_FALSE;
2191 wd->init_animation = EINA_FALSE;
2192 wd->selected_animation = EINA_FALSE;
2193 wd->pressed_signal = eina_stringshare_add("elm,state,pressed");
2194 wd->selected_signal = eina_stringshare_add("elm,state,selected");
2195 wd->view = elm_layout_add(wd->parent); //edje_object_add(wd->evas);
2196 elm_layout_theme_set(wd->view, "controlbar", "view", "default");
2197 //_elm_theme_object_set(obj, wd->view, "controlbar", "view", "default");
2198 if (wd->view == NULL)
2200 printf("Cannot load bg edj\n");
2203 evas_object_show(wd->view);
2206 /* wd->edit_box = edje_object_add(wd->evas);
2207 _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box",
2209 if (wd->edit_box == NULL)
2211 printf("Cannot load bg edj\n");
2214 evas_object_show(wd->edit_box);
2216 // navigationbar will contribution. but not yet
2217 wd->navigation = elm_navigationbar_add(wd->edit_box);
2218 r_button = elm_button_add(wd->navigation);
2219 elm_button_label_set(r_button, "Done");
2220 evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd);
2221 elm_navigationbar_push(wd->navigation, "Configure", NULL, r_button, NULL, NULL);
2222 edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", wd->navigation);
2224 wd->edit_table = elm_table_add(wd->edit_box);
2225 elm_table_homogenous_set(wd->edit_table, EINA_TRUE);
2226 edje_object_part_swallow(wd->edit_box, "elm.swallow.table", wd->edit_table);
2229 /* load background edj */
2230 wd->edje = edje_object_add(wd->evas);
2231 _elm_theme_object_set(obj, wd->edje, "controlbar", "base", "default");
2232 if (wd->edje == NULL)
2234 printf("Cannot load base edj\n");
2237 evas_object_show(wd->edje);
2239 wd->bg = edje_object_add(wd->evas);
2240 _elm_theme_object_set(obj, wd->bg, "controlbar", "background", "default");
2243 printf("Cannot load bg edj\n");
2246 edje_object_part_swallow(wd->edje, "bg_image", wd->bg);
2249 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_RESIZE,
2250 _controlbar_object_resize, obj);
2251 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_MOVE,
2252 _controlbar_object_move, obj);
2253 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_SHOW,
2254 _controlbar_object_show, obj);
2255 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_HIDE,
2256 _controlbar_object_hide, obj);
2257 bg = (Evas_Object *)edje_object_part_object_get(wd->edje, "bg_image");
2258 evas_object_event_callback_add(bg, EVAS_CALLBACK_MOVE, _controlbar_object_move, obj);
2259 evas_object_event_callback_add(bg, EVAS_CALLBACK_RESIZE, _controlbar_object_resize, obj);
2261 wd->selected_box = wd->focused_box = edje_object_add(wd->evas);
2262 _elm_theme_object_set(obj, wd->focused_box, "controlbar", "item_bg_move", "default");
2263 evas_object_hide(wd->focused_box);
2265 wd->focused_box_left = edje_object_add(wd->evas);
2266 _elm_theme_object_set(obj, wd->focused_box_left, "controlbar", "item_bg_move_left", "default");
2267 evas_object_hide(wd->focused_box_left);
2269 wd->focused_box_right = edje_object_add(wd->evas);
2270 _elm_theme_object_set(obj, wd->focused_box_right, "controlbar", "item_bg_move_right", "default");
2271 evas_object_hide(wd->focused_box_right);
2274 wd->box = elm_table_add(wd->edje);
2275 elm_table_homogenous_set(wd->box, EINA_TRUE);
2276 evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND,
2278 evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
2279 edje_object_part_swallow(wd->edje, "elm.swallow.items", wd->box);
2280 evas_object_show(wd->box);
2282 wd->event_box = evas_object_rectangle_add(wd->evas);
2283 evas_object_color_set(wd->event_box, 255, 255, 255, 0);
2284 evas_object_repeat_events_set(wd->event_box, EINA_TRUE);
2285 evas_object_show(wd->event_box);
2287 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
2289 evas_object_smart_member_add(wd->view, obj);
2290 // evas_object_smart_member_add(wd->edit_box, obj);
2291 elm_widget_resize_object_set(obj, wd->edje);
2292 evas_object_smart_member_add(wd->focused_box, obj);
2293 evas_object_smart_member_add(wd->focused_box_left, obj);
2294 evas_object_smart_member_add(wd->focused_box_right, obj);
2295 evas_object_smart_member_add(wd->box, obj);
2296 evas_object_smart_member_add(wd->event_box, obj);
2304 * Append new tab item
2306 * @param obj The controlbar object
2307 * @param icon_path The icon path of item
2308 * @param label The label of item
2309 * @param view The view of item
2310 * @return The item of controlbar
2312 * @ingroup Controlbar
2314 EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj,
2321 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2322 Elm_Controlbar_Item * it;
2323 Elm_Controlbar_Item * lit;
2325 it = create_tab_item(obj, icon_path, label, view);
2326 if (it == NULL) return NULL;
2327 wd = elm_widget_data_get(obj);
2328 if(check_bar_item_number(wd) >= 5 && wd->auto_align){
2329 if(!wd->more_item) {
2330 lit = elm_controlbar_last_item_get(obj);
2331 item_visible_set(lit, EINA_FALSE);
2332 create_more_item(wd, TABBAR);
2334 set_items_position(obj, it, NULL, EINA_FALSE);
2337 set_items_position(obj, it, NULL, EINA_TRUE);
2339 if(wd->init_animation) evas_object_hide(it->base);
2340 wd->items = eina_list_append(wd->items, it);
2342 elm_controlbar_item_view_set(wd->more_item, create_more_view(wd));
2343 /* if (wd->num == 1)
2346 it->default_selected = EINA_TRUE;
2353 * Prepend new tab item
2355 * @param obj The controlbar object
2356 * @param icon_path The icon path of item
2357 * @param label The label of item
2358 * @param view The view of item
2359 * @return The item of controlbar
2361 * @ingroup Controlbar
2363 EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_prepend(Evas_Object *
2372 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2374 Elm_Controlbar_Item * it;
2375 Elm_Controlbar_Item * lit;
2376 Elm_Controlbar_Item * item;
2377 it = create_tab_item(obj, icon_path, label, view);
2378 if (it == NULL) return NULL;
2379 wd = elm_widget_data_get(obj);
2380 item = eina_list_data_get(wd->items);
2381 if(check_bar_item_number(wd) >= 5 && wd->auto_align){
2382 if(!wd->more_item) {
2383 lit = elm_controlbar_last_item_get(obj);
2384 item_visible_set(lit, EINA_FALSE);
2385 create_more_item(wd, TABBAR);
2387 lit = elm_controlbar_item_prev(wd->more_item);
2388 item_visible_set(lit, EINA_FALSE);
2389 set_items_position(obj, it, item, EINA_TRUE);
2392 set_items_position(obj, it, item, EINA_TRUE);
2394 wd->items = eina_list_prepend(wd->items, it);
2396 elm_controlbar_item_view_set(wd->more_item, create_more_view(wd));
2397 /* if (wd->num == 1)
2400 it->default_selected = EINA_TRUE;
2407 * Insert new tab item before given item
2409 * @param obj The controlbar object
2410 * @param before The given item
2411 * @param icon_path The icon path of item
2412 * @param label The label of item
2413 * @param view The view of item
2414 * @return The item of controlbar
2416 * @ingroup Controlbar
2418 EAPI Elm_Controlbar_Item *
2419 elm_controlbar_tab_item_insert_before(Evas_Object * obj,
2420 Elm_Controlbar_Item * before,
2421 const char *icon_path,
2422 const char *label, Evas_Object * view)
2424 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2426 Elm_Controlbar_Item * it;
2427 Elm_Controlbar_Item * lit;
2428 if (!before) return NULL;
2429 it = create_tab_item(obj, icon_path, label, view);
2430 if (it == NULL) return NULL;
2431 wd = elm_widget_data_get(obj);
2432 if(check_bar_item_number(wd) >= 5 && wd->auto_align){
2435 lit = elm_controlbar_last_item_get(obj);
2436 item_visible_set(lit, EINA_FALSE);
2437 create_more_item(wd, TABBAR);
2439 before = wd->more_item;
2440 if(before->order > 0)
2442 lit = elm_controlbar_item_prev(wd->more_item);
2443 item_visible_set(lit, EINA_FALSE);
2444 set_items_position(obj, it, before, EINA_TRUE);
2448 set_items_position(obj, it, before, EINA_FALSE);
2452 set_items_position(obj, it, before, EINA_TRUE);
2454 wd->items = eina_list_prepend_relative(wd->items, it, before);
2456 elm_controlbar_item_view_set(wd->more_item, create_more_view(wd));
2457 /* if (wd->num == 1)
2460 it->default_selected = EINA_TRUE;
2467 * Insert new tab item after given item
2469 * @param obj The controlbar object
2470 * @param after The given item
2471 * @param icon_path The icon path of item
2472 * @param label The label of item
2473 * @param view The view of item
2474 * @return The item of controlbar
2476 * @ingroup Controlbar
2478 EAPI Elm_Controlbar_Item *
2479 elm_controlbar_tab_item_insert_after(Evas_Object * obj,
2480 Elm_Controlbar_Item * after,
2481 const char *icon_path, const char *label,
2484 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2486 Elm_Controlbar_Item * it;
2487 Elm_Controlbar_Item * lit;
2488 Elm_Controlbar_Item * item;
2489 if (!after) return NULL;
2490 it = create_tab_item(obj, icon_path, label, view);
2491 if (it == NULL) return NULL;
2492 wd = elm_widget_data_get(obj);
2493 item = elm_controlbar_item_next(after);
2494 if(check_bar_item_number(wd) >= 5 && wd->auto_align){
2497 lit = elm_controlbar_last_item_get(obj);
2498 item_visible_set(lit, EINA_FALSE);
2499 create_more_item(wd, TABBAR);
2501 lit = elm_controlbar_item_prev(wd->more_item);
2502 if(lit != after && item->order > 0)
2504 item_visible_set(lit, EINA_FALSE);
2505 set_items_position(obj, it, item, EINA_TRUE);
2509 set_items_position(obj, it, NULL, EINA_FALSE);
2513 set_items_position(obj, it, item, EINA_TRUE);
2515 wd->items = eina_list_append_relative(wd->items, it, after);
2517 elm_controlbar_item_view_set(wd->more_item, create_more_view(wd));
2518 /* if (wd->num == 1)
2521 it->default_selected = EINA_TRUE;
2528 * Append new tool item
2530 * @param obj The controlbar object
2531 * @param icon_path The icon path of item
2532 * @param label The label of item
2533 * @param func Callback function of item
2534 * @param data The data of callback function
2535 * @return The item of controlbar
2537 * @ingroup Controlbar
2539 EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_append(Evas_Object *
2554 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2555 Elm_Controlbar_Item * it;
2556 Elm_Controlbar_Item * lit;
2558 it = create_tool_item(obj, icon_path, label, func, data);
2559 if (it == NULL) return NULL;
2560 wd = elm_widget_data_get(obj);
2561 if(check_bar_item_number(wd) >= 5 && wd->auto_align){
2562 if(!wd->more_item) {
2563 lit = elm_controlbar_last_item_get(obj);
2564 item_visible_set(lit, EINA_FALSE);
2565 create_more_item(wd, TOOLBAR);
2567 set_items_position(obj, it, NULL, EINA_FALSE);
2570 set_items_position(obj, it, NULL, EINA_TRUE);
2572 wd->items = eina_list_append(wd->items, it);
2578 * Prepend new tool item
2580 * @param obj The controlbar object
2581 * @param icon_path The icon path of item
2582 * @param label The label of item
2583 * @param func Callback function of item
2584 * @param data The data of callback function
2585 * @return The item of controlbar
2587 * @ingroup Controlbar
2589 EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_prepend(Evas_Object *
2605 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2607 Elm_Controlbar_Item * it;
2608 Elm_Controlbar_Item * lit;
2609 Elm_Controlbar_Item * item;
2610 it = create_tool_item(obj, icon_path, label, func, data);
2611 if (it == NULL) return NULL;
2612 wd = elm_widget_data_get(obj);
2613 item = eina_list_data_get(wd->items);
2614 if(check_bar_item_number(wd) >= 5 && wd->auto_align){
2615 if(!wd->more_item) {
2616 lit = elm_controlbar_last_item_get(obj);
2617 item_visible_set(lit, EINA_FALSE);
2618 create_more_item(wd, TOOLBAR);
2620 lit = elm_controlbar_item_prev(wd->more_item);
2621 item_visible_set(lit, EINA_FALSE);
2622 set_items_position(obj, it, item, EINA_TRUE);
2625 set_items_position(obj, it, item, EINA_TRUE);
2627 wd->items = eina_list_prepend(wd->items, it);
2633 * Insert new tool item before given item
2635 * @param obj The controlbar object
2636 * @param before The given item
2637 * @param icon_path The icon path of item
2638 * @param label The label of item
2639 * @param func Callback function of item
2640 * @param data The data of callback function
2641 * @return The item of controlbar
2643 * @ingroup Controlbar
2645 EAPI Elm_Controlbar_Item *
2646 elm_controlbar_tool_item_insert_before(Evas_Object * obj,
2647 Elm_Controlbar_Item * before,
2648 const char *icon_path,
2650 void (*func) (void *data,
2655 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2657 Elm_Controlbar_Item * it;
2658 Elm_Controlbar_Item * lit;
2659 if (!before) return NULL;
2660 it = create_tool_item(obj, icon_path, label, func, data);
2661 if (it == NULL) return NULL;
2662 wd = elm_widget_data_get(obj);
2663 if(check_bar_item_number(wd) >= 5 && wd->auto_align){
2666 lit = elm_controlbar_last_item_get(obj);
2667 item_visible_set(lit, EINA_FALSE);
2668 create_more_item(wd, TOOLBAR);
2670 before = wd->more_item;
2671 if(before->order > 0)
2673 lit = elm_controlbar_item_prev(wd->more_item);
2674 item_visible_set(lit, EINA_FALSE);
2675 set_items_position(obj, it, before, EINA_TRUE);
2679 set_items_position(obj, it, before, EINA_FALSE);
2683 set_items_position(obj, it, before, EINA_TRUE);
2685 wd->items = eina_list_prepend_relative(wd->items, it, before);
2691 * Insert new tool item after given item
2693 * @param obj The controlbar object
2694 * @param after The given item
2695 * @param icon_path The icon path of item
2696 * @param label The label of item
2697 * @param func Callback function of item
2698 * @param data The data of callback function
2699 * @return The item of controlbar
2701 * @ingroup Controlbar
2703 EAPI Elm_Controlbar_Item *
2704 elm_controlbar_tool_item_insert_after(Evas_Object * obj,
2705 Elm_Controlbar_Item * after,
2706 const char *icon_path,
2708 void (*func) (void *data,
2713 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2715 Elm_Controlbar_Item * it;
2716 Elm_Controlbar_Item * lit;
2717 Elm_Controlbar_Item * item;
2718 if (!after) return NULL;
2719 it = create_tool_item(obj, icon_path, label, func, data);
2720 if (it == NULL) return NULL;
2721 wd = elm_widget_data_get(obj);
2722 item = elm_controlbar_item_next(after);
2723 if(check_bar_item_number(wd) >= 5 && wd->auto_align){
2726 lit = elm_controlbar_last_item_get(obj);
2727 item_visible_set(lit, EINA_FALSE);
2728 create_more_item(wd, TOOLBAR);
2730 lit = elm_controlbar_item_prev(wd->more_item);
2731 if(lit != after && item->order > 0)
2733 item_visible_set(lit, EINA_FALSE);
2734 set_items_position(obj, it, item, EINA_TRUE);
2738 set_items_position(obj, it, NULL, EINA_FALSE);
2742 set_items_position(obj, it, item, EINA_TRUE);
2744 wd->items = eina_list_append_relative(wd->items, it, after);
2750 * Append new object item
2752 * @param obj The controlbar object
2753 * @param obj_item The object of item
2754 * @param sel The number of sel occupied
2755 * @return The item of controlbar
2757 * @ingroup Controlbar
2759 EAPI Elm_Controlbar_Item * elm_controlbar_object_item_append(Evas_Object *
2765 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2767 Elm_Controlbar_Item * it;
2768 it = create_object_item(obj, obj_item, sel);
2769 if (it == NULL) return NULL;
2770 wd = elm_widget_data_get(obj);
2771 set_items_position(obj, it, NULL, EINA_TRUE);
2772 wd->items = eina_list_append(wd->items, it);
2778 * Prepend new object item
2780 * @param obj The controlbar object
2781 * @param obj_item The object of item
2782 * @param sel The number of sel occupied
2783 * @return The item of controlbar
2785 * @ingroup Controlbar
2787 EAPI Elm_Controlbar_Item * elm_controlbar_object_item_prepend(Evas_Object *
2793 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2795 Elm_Controlbar_Item * it;
2796 Elm_Controlbar_Item * item;
2797 it = create_object_item(obj, obj_item, sel);
2798 if (it == NULL) return NULL;
2799 wd = elm_widget_data_get(obj);
2800 item = eina_list_data_get(wd->items);
2801 set_items_position(obj, it, item, EINA_TRUE);
2802 wd->items = eina_list_prepend(wd->items, it);
2808 * Insert new object item before given item
2810 * @param obj The controlbar object
2811 * @param before The given item
2812 * @param obj_item The object of item
2813 * @param sel The number of sel occupied
2814 * @return The item of controlbar
2816 * @ingroup Controlbar
2818 EAPI Elm_Controlbar_Item *
2819 elm_controlbar_object_item_insert_before(Evas_Object * obj,
2820 Elm_Controlbar_Item * before,
2821 Evas_Object * obj_item, const int sel)
2823 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2825 Elm_Controlbar_Item * it;
2826 if (!before) return NULL;
2827 it = create_object_item(obj, obj_item, sel);
2828 if (it == NULL) return NULL;
2829 wd = elm_widget_data_get(obj);
2830 set_items_position(obj, it, before, EINA_TRUE);
2831 wd->items = eina_list_prepend_relative(wd->items, it, before);
2837 * Insert new object item after given item
2839 * @param obj The controlbar object
2840 * @param after The given item
2841 * @param obj_item The object of item
2842 * @param sel The number of sel occupied
2843 * @return The item of controlbar
2845 * @ingroup Controlbar
2847 EAPI Elm_Controlbar_Item *
2848 elm_controlbar_object_item_insert_after(Evas_Object * obj,
2849 Elm_Controlbar_Item * after,
2850 Evas_Object * obj_item, const int sel)
2852 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2854 Elm_Controlbar_Item * it;
2855 Elm_Controlbar_Item * item;
2856 if (!after) return NULL;
2857 it = create_object_item(obj, obj_item, sel);
2858 if (it == NULL) return NULL;
2859 wd = elm_widget_data_get(obj);
2860 item = elm_controlbar_item_next(after);
2861 set_items_position(obj, it, item, EINA_TRUE);
2862 wd->items = eina_list_append_relative(wd->items, it, after);
2868 * Delete item from controlbar
2870 * @param it The item of controlbar
2872 * @ingroup Controlbar
2875 elm_controlbar_item_del(Elm_Controlbar_Item * it)
2881 Elm_Controlbar_Item * item;
2889 if (it->obj == NULL)
2891 printf("Invalid argument: controlbar object is NULL\n");
2894 wd = elm_widget_data_get(it->obj);
2897 printf("Cannot get smart data\n");
2904 elm_table_unpack(wd->box, it->base);
2906 EINA_LIST_FOREACH(wd->items, l, item)
2910 if (item->order > it->order)
2912 elm_table_unpack(wd->box, item->base);
2916 elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1);
2920 elm_table_pack(wd->box, item->base, 0, item->order - 1, item->sel, 1);
2933 if (it->edit_item != NULL)
2935 elm_table_unpack(wd->edit_table, it->edit);
2936 EINA_LIST_FOREACH(wd->items, l, item)
2940 if (item->edit_item != NULL)
2942 elm_table_unpack(wd->edit_table, item->edit);
2943 elm_table_pack(wd->edit_table, item->edit,
2944 (i - 1) % 4, (i - 1) / 4, 1, 1);
2947 if (it == item && item->style != OBJECT)
2952 if (item->style != OBJECT)
2957 // delete item in list
2959 wd->items = eina_list_remove(wd->items, it);
2962 wd->num = wd->num - 1;
2967 * Select item in controlbar
2969 * @param it The item of controlbar
2971 * @ingroup Controlbar
2974 elm_controlbar_item_select(Elm_Controlbar_Item * it)
2976 if (it == NULL) return;
2977 if (it->obj == NULL) return;
2978 Widget_Data * wd = elm_widget_data_get(it->obj);
2979 if (wd == NULL) return;
2980 // if (!wd->edit_mode)
2987 * Set the icon of item
2989 * @param it The item of controlbar
2990 * @param icon_path The icon path of the item
2991 * @return The icon object
2993 * @ingroup Controlbar
2996 elm_controlbar_item_icon_set(Elm_Controlbar_Item * it, const char *icon_path)
2998 if (it == NULL) return;
3000 eina_stringshare_del(it->icon_path);
3001 it->icon_path = eina_stringshare_add(icon_path);
3005 evas_object_del(it->icon);
3010 evas_object_del(it->icon_shadow);
3011 it->icon_shadow = NULL;
3013 /* if(it->edit_icon)
3015 evas_object_del(it->edit_icon);
3016 it->edit_icon = NULL;
3018 if(it->edit_icon_shadow)
3020 evas_object_del(it->edit_icon_shadow);
3021 it->edit_icon_shadow = NULL;
3024 it->icon = create_item_icon(it->base_item, it, "elm.swallow.icon");
3025 it->icon_shadow = create_item_icon(it->base_item, it, "elm.swallow.icon_shadow");
3026 // it->edit_icon = create_item_icon(it->edit_item, it, "elm.swallow.icon");
3027 // it->edit_icon_shadow = create_item_icon(it->edit_item, it, "elm.swallow.icon_shadow");
3029 if(it->label && it->icon)
3031 edje_object_signal_emit(_EDJ(it->base_item), "elm,state,icon_text", "elm");
3032 elm_label_line_wrap_set(it->label, EINA_FALSE);
3033 elm_label_wrap_mode_set(it->label, 0);
3034 // elm_label_line_wrap_set(it->label_shadow, EINA_FALSE);
3035 // elm_label_wrap_mode_set(it->label_shadow, 0);
3037 /* if(it->edit_label && it->edit_icon)
3039 edje_object_signal_emit(_EDJ(it->edit_item), "elm,state,icon_text", "elm");
3040 elm_label_line_wrap_set(it->edit_label, EINA_FALSE);
3041 elm_label_wrap_mode_set(it->edit_label, 0);
3042 elm_label_line_wrap_set(it->edit_label_shadow, EINA_FALSE);
3043 elm_label_wrap_mode_set(it->edit_label_shadow, 0);
3048 * Get the icon of item
3050 * @param it The item of controlbar
3051 * @return The icon object
3053 * @ingroup Controlbar
3056 elm_controlbar_item_icon_get(Elm_Controlbar_Item * it)
3062 * Set the label of item
3064 * @param it The item of controlbar
3065 * @param label The label of item
3067 * @ingroup Controlbar
3070 elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label)
3072 if (it == NULL) return;
3073 it->text = eina_stringshare_add(label);
3074 it->label = create_item_label(it->base_item, it, "elm.swallow.text");
3075 // it->edit_label = create_item_label(it->edit_item, it, "elm.swallow.text");
3077 if(it->label && it->icon){
3078 edje_object_signal_emit(_EDJ(it->base_item), "elm,state,icon_text", "elm");
3079 elm_label_line_wrap_set(it->label, EINA_FALSE);
3080 elm_label_wrap_mode_set(it->label, 0);
3081 // elm_label_line_wrap_set(it->label_shadow, EINA_FALSE);
3082 // elm_label_wrap_mode_set(it->label_shadow, 0);
3084 /* if(it->edit_label && it->edit_icon)
3086 edje_object_signal_emit(_EDJ(it->edit_item), "elm,state,icon_text", "elm");
3087 elm_label_line_wrap_set(it->edit_label, EINA_FALSE);
3088 elm_label_wrap_mode_set(it->edit_label, 0);
3089 elm_label_line_wrap_set(it->edit_label_shadow, EINA_FALSE);
3090 elm_label_wrap_mode_set(it->edit_label_shadow, 0);
3095 * Get the label of item
3097 * @param it The item of controlbar
3098 * @return The label of item
3100 * @ingroup Controlbar
3103 elm_controlbar_item_label_get(Elm_Controlbar_Item * it)
3109 * Get the selected item
3111 * @param obj The controlbar object
3112 * @return The item of controlbar
3114 * @ingroup Controlbar
3116 EAPI Elm_Controlbar_Item * elm_controlbar_selected_item_get(Evas_Object *
3119 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3122 Elm_Controlbar_Item * item;
3123 if (obj == NULL) return NULL;
3124 Widget_Data * wd = elm_widget_data_get(obj);
3125 if (!wd || !wd->items) return NULL;
3126 EINA_LIST_FOREACH(wd->items, l, item)
3128 if (item->selected) return item;
3134 * Get the first item
3136 * @param obj The controlbar object
3137 * @return The item of controlbar
3139 * @ingroup Controlbar
3141 EAPI Elm_Controlbar_Item * elm_controlbar_first_item_get(Evas_Object * obj)
3143 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3144 Widget_Data * wd = elm_widget_data_get(obj);
3145 if (!wd || !wd->items) return NULL;
3146 return eina_list_data_get(wd->items);
3152 * @param obj The controlbar object
3153 * @return The item of controlbar
3155 * @ingroup Controlbar
3157 EAPI Elm_Controlbar_Item * elm_controlbar_last_item_get(Evas_Object * obj)
3159 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3160 Widget_Data * wd = elm_widget_data_get(obj);
3161 if (!wd || !wd->items) return NULL;
3162 return eina_list_data_get(eina_list_last(wd->items));
3168 * @param obj The controlbar object
3169 * @return The list of the items
3171 * @ingroup Controlbar
3173 EAPI Eina_List * elm_controlbar_items_get(Evas_Object * obj)
3175 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3176 Widget_Data * wd = elm_widget_data_get(obj);
3177 if (!wd || !wd->items) return NULL;
3182 * Get the previous item
3184 * @param it The item of controlbar
3185 * @return The previous item of the parameter item
3187 * @ingroup Controlbar
3189 EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item *
3194 Elm_Controlbar_Item * item;
3195 if (it->obj == NULL) return NULL;
3196 Widget_Data * wd = elm_widget_data_get(it->obj);
3197 if (!wd || !wd->items) return NULL;
3198 EINA_LIST_FOREACH(wd->items, l, item)
3202 l = eina_list_prev(l);
3203 if (!l) return NULL;
3204 return eina_list_data_get(l);
3213 * @param obj The controlbar object
3214 * @return The next item of the parameter item
3216 * @ingroup Controlbar
3218 EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item *
3223 Elm_Controlbar_Item * item;
3224 if (it->obj == NULL) return NULL;
3225 Widget_Data * wd = elm_widget_data_get(it->obj);
3226 if (!wd || !wd->items) return NULL;
3227 EINA_LIST_FOREACH(wd->items, l, item)
3231 l = eina_list_next(l);
3232 if (!l) return NULL;
3233 return eina_list_data_get(l);
3240 elm_controlbar_edit_start(Evas_Object * obj)
3242 printf("\n==================================\n");
3243 printf("%s\n", __func__);
3244 printf("==================================\n");
3245 printf("This API is just for test.\n");
3246 printf("Please don't use it!!\n");
3247 printf("Thank you.\n");
3248 printf("==================================\n");
3250 ELM_CHECK_WIDTYPE(obj, widtype);
3251 Widget_Data *wd = elm_widget_data_get(obj);
3254 fprintf(stderr, "Cannot get smart data\n");
3257 edje_object_signal_emit(wd->edit_box, "elm,state,show,edit_box", "elm");
3258 wd->edit_mode = EINA_TRUE;
3262 * Set the visible status of item in bar
3264 * @param it The item of controlbar
3265 * @param bar EINA_TRUE or EINA_FALSE
3267 * @ingroup Controlbar
3270 elm_controlbar_item_visible_set(Elm_Controlbar_Item * it, Eina_Bool visible)
3273 if (it->obj == NULL) return;
3274 Widget_Data * wd = elm_widget_data_get(it->obj);
3278 item_visible_set(it, visible);
3282 * Get the result which or not item is visible in bar
3284 * @param it The item of controlbar
3285 * @return EINA_TRUE or EINA_FALSE
3287 * @ingroup Controlbar
3290 elm_controlbar_item_visible_get(Elm_Controlbar_Item * it)
3292 if(!it) return EINA_FALSE;
3294 if (it->obj == NULL) return EINA_FALSE;
3295 Widget_Data * wd = elm_widget_data_get(it->obj);
3296 if (!wd) return EINA_FALSE;
3297 if(it->order <= 0) return EINA_FALSE;
3303 elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable)
3305 Evas_Object * color;
3310 if(it->editable == editable) return;
3312 it->editable = editable;
3317 (Evas_Object *) edje_object_part_object_get(_EDJ(it->edit_item),
3318 "elm.item.uneditable.color");
3320 evas_object_color_get(color, &r, &g, &b, &a);
3321 evas_object_color_set(it->edit_item, r, g, b, a);
3328 * @param it The item of controlbar
3329 * @param bar EINA_TRUE or EINA_FALSE
3331 * @ingroup Controlbar
3334 elm_controlbar_item_disable_set(Elm_Controlbar_Item * it, Eina_Bool disable)
3338 if(it->disable == disable) return;
3340 it->disable = disable;
3344 item_color_set(it, "elm.item.disable.color");
3348 item_color_set(it, "elm.item.default.color");
3353 elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view)
3355 printf("\n==================================\n");
3356 printf("%s\n", __func__);
3357 printf("==================================\n");
3358 printf("This API is just for test.\n");
3359 printf("Please don't use it!!\n");
3360 printf("Thank you.\n");
3361 printf("==================================\n");
3363 ELM_CHECK_WIDTYPE(obj, widtype);
3364 Widget_Data *wd = elm_widget_data_get(obj);
3367 fprintf(stderr, "Cannot get smart data\n");
3370 wd->view_content = view;
3371 //edje_object_part_swallow(wd->view, "elm.swallow.view", wd->view_content);
3372 elm_layout_content_set(wd->view, "elm.swallow.view", wd->view_content);
3376 * Set the view of the item
3378 * @param it The item of controlbar
3379 * @param view The view for the item
3381 * @ingroup Controlbar
3384 elm_controlbar_item_view_set(Elm_Controlbar_Item *it, Evas_Object * view)
3392 * Get the view of the item
3394 * @param it The item of controlbar
3395 * @return The view for the item
3397 * @ingroup Controlbar
3400 elm_controlbar_item_view_get(Elm_Controlbar_Item *it)
3402 if(!it) return NULL;
3408 * Set the mode of the controlbar
3410 * @param obj The object of the controlbar
3411 * @param mode The mode of the controlbar
3413 * @ingroup Controlbar
3416 elm_controlbar_mode_set(Evas_Object *obj, int mode)
3418 ELM_CHECK_WIDTYPE(obj, widtype);
3419 Widget_Data *wd = elm_widget_data_get(obj);
3422 fprintf(stderr, "Cannot get smart data\n");
3426 if(wd->mode == mode) return;
3432 case ELM_CONTROLBAR_MODE_DEFAULT:
3433 edje_object_signal_emit(wd->edje, "elm,state,default", "elm");
3435 case ELM_CONTROLBAR_MODE_TRANSLUCENCE:
3436 elm_controlbar_alpha_set(obj, 85);
3438 case ELM_CONTROLBAR_MODE_TRANSPARENCY:
3439 elm_controlbar_alpha_set(obj, 0);
3441 case ELM_CONTROLBAR_MODE_LARGE:
3442 edje_object_signal_emit(wd->edje, "elm,state,large", "elm");
3444 case ELM_CONTROLBAR_MODE_SMALL:
3445 edje_object_signal_emit(wd->edje, "elm,state,small", "elm");
3447 case ELM_CONTROLBAR_MODE_LEFT:
3448 wd->selected_box = wd->focused_box_left;
3449 wd->selected_signal = eina_stringshare_add("elm,state,selected_left");
3450 wd->pressed_signal = eina_stringshare_add("elm,state,pressed_left");
3451 edje_object_signal_emit(wd->edje, "elm,state,left", "elm");
3454 case ELM_CONTROLBAR_MODE_RIGHT:
3455 wd->selected_box = wd->focused_box_right;
3456 wd->selected_signal = eina_stringshare_add("elm,state,selected_right");
3457 wd->pressed_signal = eina_stringshare_add("elm,state,pressed_right");
3458 edje_object_signal_emit(wd->edje, "elm,state,right", "elm");
3465 wd->selected_box = wd->focused_box;
3466 wd->selected_signal = eina_stringshare_add("elm,state,selected");
3467 wd->pressed_signal = eina_stringshare_add("elm,state,pressed");
3472 * Set the alpha of the controlbar
3474 * @param obj The object of the controlbar
3475 * @param alpha The alpha value of the controlbar (0-100)
3477 * @ingroup Controlbar
3480 elm_controlbar_alpha_set(Evas_Object *obj, int alpha)
3482 ELM_CHECK_WIDTYPE(obj, widtype);
3484 Widget_Data *wd = elm_widget_data_get(obj);
3487 fprintf(stderr, "Cannot get smart data\n");
3491 if(alpha < 0) wd->alpha = 0;
3492 else if(alpha > 100) wd->alpha = 100;
3493 else wd->alpha = alpha;
3495 evas_object_color_get(wd->bg, &r, &g, &b, NULL);
3496 evas_object_color_set(wd->bg, r, g, b, (int)(255 * wd->alpha / 100));
3501 * Set auto-align mode of the controlbar(It's not prepared yet)
3502 * If you set the auto-align and add items more than 5,
3503 * the "more" item will be made and the items more than 5 will be unvisible.
3505 * @param obj The object of the controlbar
3506 * @param auto_align The dicision that the controlbar use the auto-align
3508 * @ingroup Controlbar
3511 elm_controlbar_item_auto_align_set(Evas_Object *obj, Eina_Bool auto_align)
3513 ELM_CHECK_WIDTYPE(obj, widtype);
3514 Widget_Data *wd = elm_widget_data_get(obj);
3515 Elm_Controlbar_Item *item;
3520 fprintf(stderr, "Cannot get smart data\n");
3524 if(wd->auto_align == auto_align) return;
3528 if(check_bar_item_number(wd) >= 5 && !wd->more_item)
3531 EINA_LIST_FOREACH(wd->items, l, item)
3533 if(elm_controlbar_item_visible_get(item))
3536 item_delete_in_bar(item);
3539 item = elm_controlbar_last_item_get(obj);
3540 while(!elm_controlbar_item_visible_get(item)){
3541 item = elm_controlbar_item_prev(item);
3543 create_more_item(wd, item->style);
3551 if(wd->more_item->view)
3552 evas_object_del(wd->more_item->view);
3553 wd->items = eina_list_remove(wd->items, wd->more_item);
3554 eina_stringshare_del(wd->more_item->text);
3555 if (wd->more_item->icon)
3556 evas_object_del(wd->more_item->icon);
3557 if (wd->more_item->base)
3558 evas_object_del(wd->more_item->base);
3559 if (wd->more_item->base_item)
3560 evas_object_del(wd->more_item->base_item);
3561 // if (wd->more_item->edit)
3562 // evas_object_del(wd->more_item->edit);
3563 // if (wd->more_item->edit_item)
3564 // evas_object_del(wd->more_item->edit_item);
3565 free(wd->more_item);
3566 wd->more_item = NULL;
3568 // make all item is visible
3570 EINA_LIST_FOREACH(wd->items, l, item)
3572 if(!elm_controlbar_item_visible_get(item))
3573 item_insert_in_bar(item, i);
3578 wd->auto_align = auto_align;
3583 * Set the vertical mode of the controlbar
3585 * @param obj The object of the controlbar
3586 * @param vertical The vertical mode of the controlbar (TRUE = vertical, FALSE = horizontal)
3588 * @ingroup Controlbar
3591 elm_controlbar_vertical_set(Evas_Object *obj, Eina_Bool vertical)
3593 ELM_CHECK_WIDTYPE(obj, widtype);
3594 Widget_Data *wd = elm_widget_data_get(obj);
3597 fprintf(stderr, "Cannot get smart data\n");
3601 if(wd->vertical == vertical) return;
3602 wd->vertical = vertical;
3604 if(check_bar_item_number(wd) > 1)
3611 init_animation(void *data)
3614 Elm_Controlbar_Item * item;
3615 Widget_Data * wd = (Widget_Data *)data;
3617 wd->visible_items = eina_list_free(wd->visible_items);
3618 EINA_LIST_FOREACH(wd->items, l, item)
3622 wd->visible_items = eina_list_append(wd->visible_items, item->base);
3627 wd->ani_func(wd->ani_data, wd->object, wd->visible_items);
3629 return ECORE_CALLBACK_CANCEL;
3633 elm_controlbar_animation_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, void *event_info), void *data)
3635 printf("\n==================================\n");
3636 printf("%s\n", __func__);
3637 printf("==================================\n");
3638 printf("This API is just for test.\n");
3639 printf("Please don't use it!!\n");
3640 printf("Thank you.\n");
3641 printf("==================================\n");
3643 ELM_CHECK_WIDTYPE(obj, widtype);
3644 Widget_Data *wd = elm_widget_data_get(obj);
3647 fprintf(stderr, "Cannot get smart data\n");
3653 wd->init_animation = EINA_TRUE;
3655 wd->ani_func = func;
3656 wd->ani_data = data;
3658 ecore_idler_add(init_animation, wd);
3663 elm_controlbar_item_animation_set(Evas_Object *obj, Eina_Bool auto_animation, Eina_Bool selected_animation)
3665 printf("\n==================================\n");
3666 printf("%s\n", __func__);
3667 printf("==================================\n");
3668 printf("This API is just for test.\n");
3669 printf("Please don't use it!!\n");
3670 printf("Thank you.\n");
3671 printf("==================================\n");
3673 ELM_CHECK_WIDTYPE(obj, widtype);
3674 Widget_Data *wd = elm_widget_data_get(obj);
3677 fprintf(stderr, "Cannot get smart data\n");
3681 if(auto_animation && !wd->effect_timer)
3683 wd->effect_timer = ecore_timer_add(1.5, item_animation_effect, wd);
3687 if(wd->effect_timer) ecore_timer_del(wd->effect_timer);
3688 wd->effect_timer = NULL;
3691 wd->selected_animation = selected_animation;
3695 elm_controlbar_view_animation_set(Evas_Object *obj, const char *hide, const char *show)
3697 ELM_CHECK_WIDTYPE(obj, widtype);
3698 Widget_Data *wd = elm_widget_data_get(obj);
3701 fprintf(stderr, "Cannot get smart data\n");
3705 wd->view_hide = eina_stringshare_add(hide);
3706 wd->view_show = eina_stringshare_add(show);