2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
5 * @defgroup Controlbar Controlbar
8 * This is a Controlbar. It can contain label and icon objects.
9 * In edit mode, you can change the location of items.
16 #include <Elementary.h>
20 #define EAPI __attribute__ ((visibility("default")))
24 #define EDIT_ROW_NUM 4
26 #define ELM_MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2))
27 #define _EDJ(x) (Evas_Object *)elm_layout_edje_get(x)
33 // internal data structure of controlbar object
34 typedef struct _Widget_Data Widget_Data;
42 Evas_Object * view_content;
43 Evas_Object * edit_box;
44 Evas_Object * edit_table;
45 Evas_Object * navigation;
48 Evas_Object * event_box;
49 Evas_Object * selected_box;
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;
63 Eina_List * visible_items;
65 Ecore_Event_Handler * move_event;
66 Ecore_Event_Handler * up_event;
67 Ecore_Event_Handler * bar_move_event;
68 Ecore_Event_Handler * bar_up_event;
70 void (*ani_func) (const void *data, Evas_Object * obj, void *event_info);
72 Eina_Bool init_animation;
74 Ecore_Timer *effect_timer;
75 Eina_Bool *selected_animation;
78 struct _Elm_Controlbar_Item
82 Evas_Object * edit_item;
85 const char *icon_path;
87 void (*func) (const void *data, Evas_Object * obj, void *event_info);
97 typedef struct _Animation_Data Animation_Data;
99 struct _Animation_Data
110 unsigned int start_time;
112 void (*func) (void *data, Evas_Object * obj);
114 Ecore_Animator * timer;
119 static void selected_box(Elm_Controlbar_Item * it);
120 static int pressed_box(Elm_Controlbar_Item * it);
121 static void object_color_set(Evas_Object *ly, const char *color_part, const char *obj_part);
122 static void edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
123 static void edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
124 static void bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
125 static void bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
127 /////////////////////////
129 ////////////////////////
132 print_all_items(Widget_Data *wd)
135 Elm_Controlbar_Item * item;
137 EINA_LIST_FOREACH(wd->items, l, item)
139 printf("item label : %s order : %d\n", item->label, item->order);
143 ///////////////////////////////////////////////////////////////////
145 // Smart Object basic function
147 ////////////////////////////////////////////////////////////////////
150 _controlbar_move(void *data, Evas_Object * obj)
153 const Evas_Object *bg;
157 wd = elm_widget_data_get((Evas_Object *) data);
160 evas_object_geometry_get(wd->edje, &x, &y, NULL, NULL);
163 evas_object_move(wd->edje, x, y);
164 evas_object_move(wd->view, x, y);
165 evas_object_geometry_get(wd->parent, &x, &y, NULL, NULL);
166 evas_object_move(wd->edit_box, x, y);
167 evas_object_move(wd->event_box, x, y);
168 bg = edje_object_part_object_get(wd->edje, "bg_image");
169 evas_object_geometry_get(bg, &x, &y, NULL, NULL);
170 evas_object_move(wd->box, x, y);
174 _controlbar_resize(void *data, Evas_Object * obj)
177 const Evas_Object *bg;
178 Evas_Coord y, y_, w, h, height;
181 wd = elm_widget_data_get((Evas_Object *) data);
184 evas_object_geometry_get(wd->edje, NULL, &y, &w, &h);
187 evas_object_resize(wd->edje, w, h);
188 evas_object_geometry_get(edje_object_part_object_get(wd->edje, "bg_image"),
189 NULL, NULL, NULL, &height);
190 evas_object_resize(wd->view, w, h - height + 1);
191 evas_object_geometry_get(wd->parent, NULL, &y_, NULL, NULL);
192 evas_object_resize(wd->edit_box, w, h + y - y_);
193 evas_object_resize(wd->event_box, w, h + y - y_);
194 bg = edje_object_part_object_get(wd->edje, "bg_image");
195 evas_object_geometry_get(bg, NULL, NULL, &w, &h);
196 evas_object_resize(wd->box, w, h);
200 _controlbar_object_move(void *data, Evas * e, Evas_Object * obj,
203 _controlbar_move(data, obj);
207 _controlbar_object_resize(void *data, Evas * e, Evas_Object * obj,
210 _controlbar_resize(data, obj);
214 _controlbar_object_show(void *data, Evas * e, Evas_Object * obj,
220 wd = elm_widget_data_get((Evas_Object *) data);
223 evas_object_show(wd->view);
224 evas_object_show(wd->edit_box);
225 evas_object_show(wd->edje);
226 evas_object_show(wd->box);
227 evas_object_show(wd->event_box);
231 _controlbar_object_hide(void *data, Evas * e, Evas_Object * obj,
237 wd = elm_widget_data_get((Evas_Object *) data);
240 evas_object_hide(wd->view);
241 evas_object_hide(wd->edit_box);
242 evas_object_hide(wd->edje);
243 evas_object_hide(wd->box);
244 evas_object_hide(wd->event_box);
248 _del_hook(Evas_Object * obj)
250 Widget_Data * wd = elm_widget_data_get(obj);
251 Elm_Controlbar_Item * item;
252 Evas_Object * content;
256 EINA_LIST_FREE(wd->items, item)
258 eina_stringshare_del(item->label);
260 evas_object_del(item->icon);
262 evas_object_del(item->base);
264 evas_object_del(item->edit_item);
270 content = elm_layout_content_unset(wd->view, "elm.swallow.view");
271 evas_object_hide(content);
272 evas_object_del(wd->view);
277 evas_object_del(wd->edit_box);
282 evas_object_del(wd->navigation);
283 wd->navigation = NULL;
287 evas_object_del(wd->edje);
290 if (wd->selected_box)
292 evas_object_del(wd->selected_box);
297 evas_object_del(wd->box);
302 evas_object_del(wd->event_box);
303 wd->event_box = NULL;
305 if (wd->effect_timer)
307 ecore_timer_del(wd->effect_timer);
308 wd->effect_timer = NULL;
316 _theme_hook(Evas_Object * obj)
320 Elm_Controlbar_Item * item;
324 Widget_Data * wd = elm_widget_data_get(obj);
327 _elm_theme_object_set(obj, wd->edje, "controlbar", "base",
328 elm_widget_style_get(obj));
329 elm_layout_theme_set(wd->view, "controlbar", "view", elm_widget_style_get(obj));
330 //_elm_theme_object_set(obj, wd->view, "controlbar", "view",
331 // elm_widget_style_get(obj));
332 _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box",
333 elm_widget_style_get(obj));
334 EINA_LIST_FOREACH(wd->items, l, item)
336 if (item->style != OBJECT)
338 elm_layout_theme_set(item->base, "controlbar", "item",
339 elm_widget_style_get(obj));
340 object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
341 elm_layout_theme_set(item->edit_item, "controlbar", "item",
342 elm_widget_style_get(obj));
347 edje_object_part_object_get(_EDJ(item->edit_item),
348 "elm.edit.item.color");
350 evas_object_color_get(color, &r, &g, &b, &a);
351 evas_object_color_set(item->edit_item, r, g, b, a);
355 edje_object_part_text_set(_EDJ(item->base), "elm.text",
357 edje_object_part_text_set(_EDJ(item->edit_item), "elm.text",
360 if (item->label && item->icon)
362 edje_object_signal_emit(_EDJ(item->base),
363 "elm,state,icon_text", "elm");
364 edje_object_signal_emit(_EDJ(item->edit_item),
365 "elm,state,icon_text", "elm");
376 _sub_del(void *data, Evas_Object * obj, void *event_info)
378 Widget_Data * wd = elm_widget_data_get(obj);
380 //Evas_Object *sub = event_info;
385 * if (sub == wd->icon)
387 * edje_object_signal_emit(wd->btn, "elm,state,icon,hidden", "elm");
388 * evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
389 * _changed_size_hints, obj);
391 * edje_object_message_signal_process(wd->btn);
398 _sizing_eval(Evas_Object * obj)
400 Widget_Data * wd = elm_widget_data_get(obj);
403 _controlbar_move(obj, obj);
404 _controlbar_resize(obj, obj);
407 /////////////////////////////////////////////////////////////
409 // animation function
411 /////////////////////////////////////////////////////////////
416 struct timeval timev;
418 gettimeofday(&timev, NULL);
419 return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
423 set_evas_map(Evas_Object * obj, Evas_Coord x, Evas_Coord y, Evas_Coord w,
430 Evas_Map * map = evas_map_new(4);
433 evas_map_smooth_set(map, EINA_TRUE);
434 evas_map_util_points_populate_from_object_full(map, obj, 0);
435 evas_object_map_enable_set(obj, EINA_TRUE);
436 evas_map_util_3d_perspective(map, x + w / 2, y + h / 2, 0, w * 10);
437 evas_map_util_points_populate_from_geometry(map, x, y, w, h, 0);
438 evas_object_map_set(obj, map);
443 move_evas_map(void *data)
453 Animation_Data * ad = (Animation_Data *) data;
454 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
455 dx = ad->tx - ad->fx;
456 dy = ad->ty - ad->fy;
457 dw = ad->tw - ad->fw;
458 dh = ad->th - ad->fh;
461 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
462 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
463 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
464 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
477 if (x == dx && y == dy && w == dw && h == dh)
479 ecore_animator_del(ad->timer);
481 set_evas_map(ad->obj, px, py, pw, ph);
482 if (ad->func != NULL)
483 ad->func(ad->data, ad->obj);
487 set_evas_map(ad->obj, px, py, pw, ph);
494 move_evas_object(void *data)
504 Animation_Data * ad = (Animation_Data *) data;
505 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
506 dx = ad->tx - ad->fx;
507 dy = ad->ty - ad->fy;
508 dw = ad->tw - ad->fw;
509 dh = ad->th - ad->fh;
512 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
513 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
514 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
515 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
528 if (x == dx && y == dy && w == dw && h == dh)
530 ecore_animator_del(ad->timer);
532 evas_object_move(ad->obj, px, py);
533 evas_object_resize(ad->obj, pw, ph);
534 evas_object_show(ad->obj);
535 if (ad->func != NULL)
536 ad->func(ad->data, ad->obj);
540 evas_object_move(ad->obj, px, py);
541 evas_object_resize(ad->obj, pw, ph);
542 evas_object_show(ad->obj);
548 move_fade_out_object(void *data)
552 int dx, dy, dw, dh, da;
554 int px, py, pw, ph, pa;
560 Animation_Data * ad = (Animation_Data *) data;
561 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
562 dx = ad->tx - ad->fx;
563 dy = ad->ty - ad->fy;
564 dw = ad->tw - ad->fw;
565 dh = ad->th - ad->fh;
569 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
570 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
571 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
572 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
573 a = (1 * sin((t / ad->time) * (M_PI / 2)) * da);
588 if (x == dx && y == dy && w == dw && h == dh)
590 ecore_animator_del(ad->timer);
592 evas_object_move(ad->obj, px, py);
593 //evas_object_resize(ad->obj, 480, 600);
594 evas_object_resize(ad->obj, pw, ph);
595 evas_object_color_get(ad->obj, &r, &g, &b, &a);
596 evas_object_color_set(ad->obj, r, g, b, pa);
597 evas_object_show(ad->obj);
598 if (ad->func != NULL)
599 ad->func(ad->data, ad->obj);
603 evas_object_move(ad->obj, px, py);
604 //evas_object_resize(ad->obj, 480, 600);
605 evas_object_resize(ad->obj, pw, ph);
606 evas_object_color_get(ad->obj, &r, &g, &b, &a);
607 evas_object_color_set(ad->obj, r, g, b, pa);
608 evas_object_show(ad->obj);
614 move_fade_in_object(void *data)
618 int dx, dy, dw, dh, da;
620 int px, py, pw, ph, pa;
626 Animation_Data * ad = (Animation_Data *) data;
627 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
628 dx = ad->tx - ad->fx;
629 dy = ad->ty - ad->fy;
630 dw = ad->tw - ad->fw;
631 dh = ad->th - ad->fh;
635 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
636 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
637 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
638 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
639 a = (1 * sin((t / ad->time) * (M_PI / 2)) * da);
654 if (x == dx && y == dy && w == dw && h == dh)
656 ecore_animator_del(ad->timer);
658 evas_object_move(ad->obj, px, py);
659 //evas_object_resize(ad->obj, 480, 600);
660 evas_object_resize(ad->obj, pw, ph);
661 evas_object_color_get(ad->obj, &r, &g, &b, &a);
662 evas_object_color_set(ad->obj, r, g, b, pa);
663 evas_object_show(ad->obj);
664 if (ad->func != NULL)
665 ad->func(ad->data, ad->obj);
669 evas_object_move(ad->obj, px, py);
670 //evas_object_resize(ad->obj, 480, 600);
671 evas_object_resize(ad->obj, pw, ph);
672 evas_object_color_get(ad->obj, &r, &g, &b, &a);
673 evas_object_color_set(ad->obj, r, g, b, pa);
674 evas_object_show(ad->obj);
680 move_object_with_animation(Evas_Object * obj, Evas_Coord x, Evas_Coord y,
681 Evas_Coord w, Evas_Coord h, Evas_Coord x_,
682 Evas_Coord y_, Evas_Coord w_, Evas_Coord h_,
683 double time, int (*mv_func) (void *data),
684 void (*func) (void *data,
685 Evas_Object * obj), void *data)
687 Animation_Data * ad = (Animation_Data *) malloc(sizeof(Animation_Data));
697 ad->start_time = current_time_get();
701 ad->timer = ecore_animator_add(mv_func, ad);
706 item_animation_effect(void *data)
708 Widget_Data *wd = (Widget_Data *)data;
710 Elm_Controlbar_Item * item;
715 EINA_LIST_FOREACH(wd->items, l, item)
718 // printf("rand :: %d\n", rand);
719 if(rand > 65 && item->order > 0)
725 edje_object_signal_emit(_EDJ(item->base), "elm,animation,pop", "elm");
728 edje_object_signal_emit(_EDJ(item->base), "elm,animation,vibration", "elm");
731 edje_object_signal_emit(_EDJ(item->base), "elm,animation,jump", "elm");
742 /////////////////////////////////////////////////////////////
746 /////////////////////////////////////////////////////////////
749 sort_cb(const void *d1, const void *d2)
751 Elm_Controlbar_Item * item1, *item2;
752 item1 = (Elm_Controlbar_Item *) d1;
753 item2 = (Elm_Controlbar_Item *) d2;
754 if (item1->order <= 0)
756 if (item2->order <= 0)
758 return item1->order > item2->order ? 1 : -1;
762 sort_reverse_cb(const void *d1, const void *d2)
764 Elm_Controlbar_Item * item1, *item2;
765 item1 = (Elm_Controlbar_Item *) d1;
766 item2 = (Elm_Controlbar_Item *) d2;
767 if (item1->order <= 0)
769 if (item2->order <= 0)
771 return item1->order > item2->order ? -1 : 1;
775 done_button_cb(void *data, Evas_Object * obj, void *event_info)
777 Widget_Data * wd = (Widget_Data *) data;
779 wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb);
781 evas_object_smart_callback_call(wd->object, "edit,end", wd->items);
783 edje_object_signal_emit(wd->edit_box, "elm,state,hide,edit_box", "elm");
784 wd->edit_mode = EINA_FALSE;
787 ///////////////////////////////////////////////////////////////////
789 // basic utility function
791 ////////////////////////////////////////////////////////////////////
794 check_bar_item_number(Widget_Data *wd)
797 Elm_Controlbar_Item * item;
800 EINA_LIST_FOREACH(wd->items, l, item)
802 if(item->order > 0) num++;
809 item_insert_in_bar(Elm_Controlbar_Item * it, int order)
813 Elm_Controlbar_Item * item;
814 Widget_Data * wd = elm_widget_data_get(it->obj);
817 EINA_LIST_FOREACH(wd->items, l, item)
819 if (item->order == order && item != it)
824 EINA_LIST_FOREACH(wd->items, l, item)
827 elm_table_unpack(wd->box, item->base);
829 EINA_LIST_FOREACH(wd->items, l, item)
833 if (item->order >= order)
835 elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
836 evas_object_show(item->base);
841 elm_table_pack(wd->box, it->base, order - 1, 0, 1, 1);
842 evas_object_show(it->base);
846 item_delete_in_bar(Elm_Controlbar_Item * it)
849 Elm_Controlbar_Item * item;
850 Widget_Data * wd = elm_widget_data_get(it->obj);
853 EINA_LIST_FOREACH(wd->items, l, item)
859 elm_table_unpack(wd->box, it->base);
860 evas_object_hide(it->base);
865 EINA_LIST_FOREACH(wd->items, l, item)
870 elm_table_unpack(wd->box, item->base);
871 elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
878 item_exchange_animation_cb(void *data, Evas_Object * obj)
880 Widget_Data * wd = (Widget_Data *) data;
882 if (wd->animating < 0)
884 printf("animation error\n");
887 evas_object_map_enable_set(obj, EINA_FALSE);
891 item_exchange_in_bar(Elm_Controlbar_Item * it1, Elm_Controlbar_Item * it2)
895 Evas_Coord x, y, w, h;
896 Evas_Coord x_, y_, w_, h_;
897 Widget_Data * wd = elm_widget_data_get(it1->obj);
898 evas_object_geometry_get(wd->moving_item->edit_item, &x, &y, &w, &h);
899 set_evas_map(wd->moving_obj, (wd->x + wd->w / 2), (wd->y + wd->h / 2), 0,
901 evas_object_geometry_get(it1->base, &x, &y, &w, &h);
902 evas_object_geometry_get(it2->base, &x_, &y_, &w_, &h_);
904 move_object_with_animation(it1->base, x, y, w, h, x_, y_, w_, h_, 0.25,
905 move_evas_map, item_exchange_animation_cb, wd);
907 move_object_with_animation(it2->base, x_, y_, w_, h_, x, y, w, h, 0.25,
908 move_evas_map, item_exchange_animation_cb, wd);
909 elm_table_unpack(wd->box, it1->base);
910 elm_table_unpack(wd->box, it2->base);
912 it1->order = it2->order;
914 elm_table_pack(wd->box, it1->base, it1->order - 1, 0, 1, 1);
915 elm_table_pack(wd->box, it2->base, it2->order - 1, 0, 1, 1);
919 item_change_animation_cb(void *data, Evas_Object * obj)
921 Evas_Coord x, y, w, h;
922 Widget_Data * wd = (Widget_Data *) data;
924 if (wd->animating < 0)
926 printf("animation error\n");
929 evas_object_map_enable_set(obj, EINA_FALSE);
930 evas_object_geometry_get(obj, &x, &y, &w, &h);
931 set_evas_map(obj, x, y, 0, 0);
932 evas_object_move(obj, -1000, -1000);
933 evas_object_geometry_get(wd->moving_item->base, &x, &y, &w, &h);
934 evas_object_move(wd->moving_obj, -1000, -1000);
935 evas_object_del(wd->moving_obj);
939 item_change_in_bar(Elm_Controlbar_Item * it)
941 Evas_Coord x, y, w, h;
942 Evas_Coord x_, y_, w_, h_;
943 Widget_Data * wd = elm_widget_data_get(it->obj);
946 if (wd->moving_item == NULL)
948 evas_object_geometry_get(wd->moving_item->edit_item, &x, &y, &w, &h);
949 set_evas_map(wd->moving_obj, x, y, w, h);
950 elm_table_unpack(wd->box, it->base);
951 wd->moving_item->order = it->order;
953 elm_table_pack(wd->box, wd->moving_item->base, wd->moving_item->order - 1,
955 evas_object_show(wd->moving_item->base);
956 evas_render_updates_free(evas_render_updates
957 (evas_object_evas_get(wd->moving_item->base)));
958 evas_object_geometry_get(it->base, &x, &y, &w, &h);
959 evas_object_geometry_get(it->edit_item, &x_, &y_, &w_, &h_);
961 move_object_with_animation(it->base, x, y, w, h, x_, y_, w_, h_, 0.25,
962 move_evas_map, item_change_animation_cb, wd);
963 evas_object_geometry_get(wd->moving_item->base, &x, &y, &w, &h);
964 set_evas_map(wd->moving_item->base, x, y, w, h);
968 hide_selected_box(void *data)
970 Evas_Object *selected_box = (Evas_Object *)data;
972 evas_object_hide(selected_box);
978 object_color_set(Evas_Object *ly, const char *color_part, const char *obj_part)
984 (Evas_Object *) edje_object_part_object_get(_EDJ(ly), color_part);
986 evas_object_color_get(color, &r, &g, &b, &a);
988 edje_object_part_swallow_get(_EDJ(ly), obj_part);
989 evas_object_color_set(color, r, g, b, a);
993 _end_selected_box(void *data, Evas_Object *obj)
995 Widget_Data * wd = (Widget_Data *)data;
998 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,state,selected", "elm");
999 // item animation effect
1000 if(wd->selected_animation)
1008 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,animation,pop", "elm");
1011 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,animation,vibration", "elm");
1014 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,animation,jump", "elm");
1022 if (wd->animating < 0)
1024 printf("animation error\n");
1028 ecore_idler_add(hide_selected_box, wd->selected_box);
1032 move_selected_box(Widget_Data *wd, Elm_Controlbar_Item * fit, Elm_Controlbar_Item * tit)
1034 Evas_Coord fx, fy, fw, fh, tx, ty, tw, th;
1035 Evas_Object *from, *to;
1037 from = (Evas_Object *)edje_object_part_object_get(_EDJ(fit->base), "bg_img");
1038 evas_object_geometry_get(from, &fx, &fy, &fw, &fh);
1040 to = (Evas_Object *)edje_object_part_object_get(_EDJ(tit->base), "bg_img");
1041 evas_object_geometry_get(to, &tx, &ty, &tw, &th);
1043 edje_object_signal_emit(_EDJ(wd->pre_item->base), "elm,state,unselected", "elm");
1044 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,state,unselected", "elm");
1047 move_object_with_animation(wd->selected_box, fx, fy, fw, fh, tx, ty, tw, th,
1048 0.3, move_evas_object, _end_selected_box, wd);
1052 end_selected_box(void *data, Evas_Object *obj)
1054 Widget_Data * wd = (Widget_Data *)data;
1056 //wd->pre_item->selected = EINA_FALSE;
1057 // elm_layout_content_unset(wd->view, "elm.swallow.view");
1058 //edje_object_part_unswallow(wd->view, wd->pre_item->view);
1059 if(wd->pre_item) evas_object_hide(wd->pre_item->view);
1061 elm_layout_content_set(wd->view, "elm.swallow.view", obj);
1062 //edje_object_part_swallow(wd->view, "elm.swallow.view", obj);
1063 evas_object_show(obj);
1067 view_animation_push(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data)
1069 Evas_Coord x, y, w, h;
1071 evas_object_geometry_get(pre, &x, &y, &w, &h);
1072 move_object_with_animation(pre, x, y, w, h, x+20, y, w, h, 0.5, move_fade_out_object, NULL, NULL);
1073 move_object_with_animation(cur, x+120, y, w, h, x, y, w, h, 0.5, move_fade_in_object, end_selected_box, wd);
1077 view_animation_down(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data)
1079 Evas_Coord x, y, w, h;
1081 evas_object_geometry_get(pre, &x, &y, &w, &h);
1082 // evas_object_move(cur, x, y);
1083 // evas_object_resize(cur, w, h);
1084 // evas_object_show(cur);
1086 move_object_with_animation(cur, x, h, w, h, x, h, w, h, 0.5, move_evas_object, end_selected_box, wd);
1087 evas_object_raise(pre);
1088 move_object_with_animation(pre, x, y, w, h, x, h, w, 0, 0.5, move_evas_map, NULL, NULL);
1092 selected_box(Elm_Controlbar_Item * it)
1094 Widget_Data * wd = elm_widget_data_get(it->obj);
1096 Elm_Controlbar_Item * item, *fit = NULL;
1097 Evas_Object * content;
1099 if(wd->animating) return;
1103 if(it->style == TABBAR){
1105 content = elm_layout_content_unset(wd->view, "elm.swallow.view");
1106 EINA_LIST_FOREACH(wd->items, l, item){
1107 if(item->selected) {
1111 item->selected = EINA_FALSE;
1112 //edje_object_part_unswallow(wd->view, item->view);
1113 //evas_object_hide(item->view);
1115 it->selected = EINA_TRUE;
1116 evas_object_smart_callback_call(it->obj, "view,change,before", it);
1117 object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon");
1119 if(fit != NULL && fit != it)
1120 move_selected_box(wd, fit, it);
1122 edje_object_signal_emit(_EDJ(it->base), "elm,state,selected", "elm");
1125 if(fit != NULL && fit != it)
1127 //view_animation_down(wd, fit->view, it->view, NULL);
1128 view_animation_push(wd, fit->view, it->view, NULL);
1129 //evas_object_hide(content);
1131 // evas_object_geometry_get(fit->view, &x, &y, &w, &h);
1132 // if(fit->order > it->order)
1134 // move_object_with_animation(fit->view, x, y, w, h, x+20, y, w, h, 0.5, move_fade_out_object, NULL, NULL);
1135 // 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);
1139 // move_object_with_animation(fit->view, x, y, w, h, x-120, y, w, h, 1.5, move_fade_out_object, NULL, NULL);
1140 // 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);
1145 end_selected_box(wd, it->view);
1148 if(wd->pre_item) evas_object_hide(wd->pre_item->view);
1149 elm_layout_content_set(wd->view, "elm.swallow.view", it->view);
1151 // elm_layout_content_set(wd->view, "elm.swallow.view", it->view);
1152 //edje_object_part_swallow(wd->view, "elm.swallow.view", it->view);
1153 // evas_object_show(it->view);
1155 }else if(it->style == TOOLBAR){
1157 it->func(it->data, it->obj, it);
1158 object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
1159 edje_object_signal_emit(_EDJ(it->base), "elm,state,text_unselected", "elm");
1162 evas_object_smart_callback_call(it->obj, "clicked", it);
1166 unpressed_box_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1168 Widget_Data * wd = (Widget_Data *) data;
1170 Evas_Event_Mouse_Up * ev = event_info;
1171 Evas_Coord x, y, w, h;
1173 Elm_Controlbar_Item * item;
1174 EINA_LIST_FOREACH(wd->items, l, item)
1176 if (item->style == TABBAR)
1180 object_color_set(item->base, "elm.tabbar.selected.color", "elm.swallow.icon");
1181 edje_object_signal_emit(_EDJ(item->base), "elm,state,selected", "elm");
1185 object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
1186 edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm");
1189 else if (item->style == TOOLBAR)
1191 object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
1192 edje_object_signal_emit(_EDJ(item->base), "elm,state,text_unselected", "elm");
1196 evas_object_geometry_get(wd->pre_item->base, &x, &y, &w, &h);
1197 if(ev->output.x > x && ev->output.x < x+w && ev->output.y > y && ev->output.y < y+h)
1199 selected_box(wd->pre_item);
1202 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb);
1208 pressed_box(Elm_Controlbar_Item * it)
1210 Widget_Data * wd = elm_widget_data_get(it->obj);
1213 Elm_Controlbar_Item * item;
1215 if(wd->animating) return EXIT_FAILURE;
1217 EINA_LIST_FOREACH(wd->items, l, item)
1221 if (it->style == TABBAR)
1224 object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon");
1225 edje_object_signal_emit(_EDJ(it->base), "elm,state,pressed",
1228 else if (it->style == TOOLBAR)
1231 object_color_set(it->base, "elm.toolbar.pressed.color", "elm.swallow.icon");
1232 edje_object_signal_emit(_EDJ(it->base), "elm,state,text_selected",
1235 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb, (void *)wd);
1241 return EXIT_FAILURE;
1245 return EXIT_SUCCESS;
1248 static Evas_Object *
1249 create_item_layout(Evas_Object * parent, Elm_Controlbar_Item * it)
1253 obj = elm_layout_add(parent);
1256 fprintf(stderr, "Cannot load bg edj\n");
1259 elm_layout_theme_set(obj, "controlbar", "item",
1260 elm_widget_style_get(it->obj));
1261 evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1262 evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
1265 edje_object_part_text_set(_EDJ(obj), "elm.text", it->label);
1269 icon = elm_icon_add(obj);
1270 if(!elm_icon_standard_set(icon, it->icon_path))
1272 elm_icon_file_set(icon, it->icon_path, NULL);
1275 evas_object_size_hint_min_set(icon, 40, 40);
1276 evas_object_size_hint_max_set(icon, 100, 100);
1277 evas_object_show(icon);
1278 edje_object_part_swallow(_EDJ(obj), "elm.swallow.icon", icon);
1281 if (it->label && it->icon)
1283 edje_object_signal_emit(_EDJ(obj), "elm,state,icon_text", "elm");
1289 edit_item_down_end_cb(void *data, Evas_Object * obj)
1291 Widget_Data * wd = (Widget_Data *) data;
1293 if (wd->animating < 0)
1295 printf("animation error\n");
1301 edit_item_return_cb(void *data, Evas_Object * obj)
1303 Evas_Coord x, y, w, h;
1304 Widget_Data * wd = (Widget_Data *) data;
1305 evas_object_geometry_get(wd->moving_item->edit_item, &x, &y, &w, &h);
1306 set_evas_map(obj, x, y, 0, 0);
1308 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb);
1309 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb);
1311 evas_object_data_set(wd->moving_obj, "returning", 0);
1313 if (wd->animating < 0)
1315 printf("animation error\n");
1321 edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1323 Evas_Event_Mouse_Move * ev = event_info;
1325 Elm_Controlbar_Item * item;
1326 Evas_Coord x, y, w, h;
1327 Widget_Data * wd = (Widget_Data *) data;
1330 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1333 x = ev->cur.output.x - w / 2;
1334 y = ev->cur.output.y - h;
1335 set_evas_map(wd->moving_obj, x, y, w, h);
1337 EINA_LIST_FOREACH(wd->items, l, item)
1339 if (wd->moving_item->edit_item == item->edit_item || item->style == OBJECT)
1341 evas_object_geometry_get(item->base, &x, &y, &w, &h);
1342 if (ev->cur.output.x > x && ev->cur.output.x < x + w && ev->cur.output.y > y && ev->cur.output.y < y + h
1345 edje_object_signal_emit(_EDJ(item->base), "elm,state,show,glow",
1350 edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
1358 edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1360 Evas_Event_Mouse_Up * ev = event_info;
1361 Evas_Coord x, y, w, h;
1362 Evas_Coord x_, y_, w_, h_;
1364 Elm_Controlbar_Item * item;
1365 Widget_Data * wd = (Widget_Data *) data;
1367 if ((int)evas_object_data_get(wd->moving_obj, "returning") == 1)
1369 evas_object_color_set(wd->moving_item->edit_item, 255, 255, 255, 255);
1371 // check which change or not
1372 EINA_LIST_FOREACH(wd->items, l, item)
1374 if (wd->moving_item->edit_item == item->edit_item)
1376 if (item->order <= 0)
1378 evas_object_geometry_get(item->base, &x, &y, &w, &h);
1379 if (ev->output.x > x && ev->output.x < x + w && ev->output.y > y && ev->output.y < y + h
1380 && item->style != OBJECT && item->editable)
1382 edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
1389 if (wd->moving_item->order > 0)
1391 item_exchange_in_bar(wd->moving_item, item);
1395 item_change_in_bar(item);
1397 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb);
1398 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb);
1403 // return moving object to original location
1404 evas_object_geometry_get(wd->moving_item->edit_item, &x_, &y_, &w_,
1406 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1409 x = ev->output.x - w / 2;
1410 y = ev->output.y - h;
1411 evas_object_data_set(wd->moving_obj, "returning", (void *)1);
1413 move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_,
1414 0.25, move_evas_map, edit_item_return_cb, wd);
1420 edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj,
1423 Evas_Event_Mouse_Down * ev = event_info;
1424 Evas_Coord x, y, w, h;
1425 Evas_Coord x_, y_, w_, h_;
1426 Widget_Data * wd = (Widget_Data *) data;
1429 Elm_Controlbar_Item * item;
1430 Evas_Object * color;
1435 EINA_LIST_FOREACH(wd->items, l, item)
1437 if (item->edit_item == obj)
1442 if (!item->editable)
1445 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb, (void *)wd);
1446 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb, (void *)wd);
1448 wd->moving_item = item;
1451 edje_object_part_object_get(_EDJ(wd->moving_item->edit_item),
1452 "elm.edit.item.color");
1454 evas_object_color_get(color, &r, &g, &b, &a);
1455 evas_object_color_set(item->edit_item, r, g, b, a);
1457 evas_object_del(wd->moving_obj);
1458 wd->moving_obj = NULL;
1459 wd->moving_obj = create_item_layout(obj, item);
1460 evas_object_geometry_get(obj, &x, &y, &w, &h);
1461 evas_object_move(wd->moving_obj, -1000, -1000);
1462 evas_object_resize(wd->moving_obj, w, h);
1463 evas_object_show(wd->moving_obj);
1466 x_ = ev->output.x - w_ / 2;
1467 y_ = ev->output.y - h_;
1469 move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_, 0.1,
1470 move_evas_map, edit_item_down_end_cb, wd);
1474 bar_item_move_end_cb(void *data, Evas_Object * obj)
1476 Widget_Data * wd = (Widget_Data *) data;
1479 Elm_Controlbar_Item * item;
1480 EINA_LIST_FOREACH(wd->items, l, item)
1482 if (item->base == obj)
1486 if (wd->animating < 0)
1488 printf("animation error\n");
1491 evas_object_data_set(obj, "animating", 0);
1492 evas_object_map_enable_set(obj, EINA_FALSE);
1496 bar_item_animation_end_check(void *data)
1500 Elm_Controlbar_Item * item;
1501 Widget_Data * wd = (Widget_Data *) data;
1503 return EXIT_FAILURE;
1504 EINA_LIST_FOREACH(wd->items, l, item)
1506 if (item->base == wd->moving_obj)
1511 printf("item is NULL\n");
1515 item->order = wd->empty_num;
1517 wd->moving_obj = NULL;
1519 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, bar_item_up_cb);
1520 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb);
1521 return EXIT_SUCCESS;
1525 bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1527 Evas_Event_Mouse_Move * ev = event_info;
1529 Elm_Controlbar_Item * item, *it;
1530 Widget_Data * wd = (Widget_Data *) data;
1531 Evas_Coord x, y, w, h, x_, y_, w_, h_;
1534 if (wd->moving_obj == NULL)
1536 printf("%s : moving_obj is NULL\n", __func__);
1539 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1540 x = ev->cur.output.x - w / 2;
1541 set_evas_map(wd->moving_obj, x, y, w, h);
1542 EINA_LIST_FOREACH(wd->items, l, item)
1544 if (item->base == wd->moving_obj)
1549 if ((int)evas_object_data_get(item->base, "animating") == 1)
1551 evas_object_geometry_get(item->base, &x, &y, &w, &h);
1552 if (ev->cur.output.x > x && ev->cur.output.x < x + w && item->editable)
1559 evas_object_geometry_get(wd->moving_obj, &x_, &y_, &w_, &h_);
1560 evas_object_move(wd->moving_obj, x, y);
1561 tmp = wd->empty_num;
1562 wd->empty_num = item->order;
1564 elm_table_unpack(wd->box, item->base);
1565 elm_table_unpack(wd->box, wd->moving_obj);
1566 elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
1567 elm_table_pack(wd->box, wd->moving_obj, wd->empty_num - 1, 0, 1, 1);
1569 evas_object_data_set(item->base, "animating", (void *)1);
1570 move_object_with_animation(item->base, x, y, w, h, x_, y_, w_, h_,
1571 0.25, move_evas_map, bar_item_move_end_cb, wd);
1577 bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1579 Evas_Event_Mouse_Up * ev = event_info;
1580 Evas_Coord tx, x, y, w, h;
1581 Widget_Data * wd = (Widget_Data *) data;
1582 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1583 tx = ev->output.x - w / 2;
1585 evas_object_data_set(wd->moving_obj, "animating", (void *)1);
1586 move_object_with_animation(wd->moving_obj, tx, y, w, h, x, y, w, h, 0.25,
1587 move_evas_map, bar_item_move_end_cb, wd);
1588 ecore_timer_add(0.1, bar_item_animation_end_check, wd);
1593 bar_item_down_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info)
1595 Widget_Data * wd = (Widget_Data *) data;
1597 Elm_Controlbar_Item * item;
1600 EINA_LIST_FOREACH(wd->items, l, item)
1602 if (item->base == obj)
1609 if (!item->editable)
1612 wd->moving_obj = obj;
1613 wd->empty_num = item->order;
1614 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, bar_item_up_cb, (void *)wd);
1615 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb, (void *)wd);
1623 static Elm_Controlbar_Item *
1624 create_tab_item(Evas_Object * obj, const char *icon_path, const char *label,
1627 Elm_Controlbar_Item * it;
1631 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1634 wd = elm_widget_data_get(obj);
1637 fprintf(stderr, "Cannot get smart data\n");
1640 it = ELM_NEW(Elm_Controlbar_Item);
1644 it->label = eina_stringshare_add(label);
1645 it->icon_path = icon_path;
1646 it->selected = EINA_FALSE;
1647 it->editable = EINA_TRUE;
1652 it->base = create_item_layout(wd->edje, it);
1653 evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
1654 bar_item_down_cb, wd);
1655 //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm",
1656 // clicked_box_cb, wd);
1657 object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
1658 evas_object_show(it->base);
1659 it->edit_item = create_item_layout(wd->edje, it);
1660 evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN,
1661 edit_item_down_cb, wd);
1662 evas_object_show(it->edit_item);
1667 static Elm_Controlbar_Item *
1668 create_tool_item(Evas_Object * obj, const char *icon_path, const char *label,
1669 void (*func) (const void *data, Evas_Object * obj,
1670 void *event_info), const void *data)
1672 Elm_Controlbar_Item * it;
1676 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1679 wd = elm_widget_data_get(obj);
1682 fprintf(stderr, "Cannot get smart data\n");
1685 it = ELM_NEW(Elm_Controlbar_Item);
1689 it->label = eina_stringshare_add(label);
1690 it->icon_path = icon_path;
1691 it->selected = EINA_FALSE;
1692 it->editable = EINA_TRUE;
1697 it->style = TOOLBAR;
1698 it->base = create_item_layout(wd->edje, it);
1699 evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
1700 bar_item_down_cb, wd);
1701 //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm",
1702 // clicked_box_cb, wd);
1703 object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
1704 evas_object_show(it->base);
1705 it->edit_item = create_item_layout(wd->edje, it);
1706 evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN,
1707 edit_item_down_cb, wd);
1708 evas_object_show(it->edit_item);
1712 static Elm_Controlbar_Item *
1713 create_object_item(Evas_Object * obj, Evas_Object * obj_item, const int sel)
1715 Elm_Controlbar_Item * it;
1719 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1722 wd = elm_widget_data_get(obj);
1725 fprintf(stderr, "Cannot get smart data\n");
1728 it = ELM_NEW(Elm_Controlbar_Item);
1735 it->base = obj_item;
1740 set_items_position(Evas_Object * obj, Elm_Controlbar_Item * it,
1741 Elm_Controlbar_Item * mit, Eina_Bool bar)
1746 Elm_Controlbar_Item * item;
1749 int check = EINA_FALSE;
1757 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1760 wd = elm_widget_data_get(obj);
1763 fprintf(stderr, "Cannot get smart data\n");
1767 EINA_LIST_FOREACH(wd->items, l, item)
1769 if (item == mit && item->order > 0)
1773 it->order = mit->order;
1777 if(item->order > 0){
1778 // printf("%s +_+_+_+_+_+ %d \n", item->label, item->order);
1779 elm_table_unpack(wd->box, item->base);
1780 item->order += it->sel;
1781 elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1);
1783 if (item->style != OBJECT && it->style != OBJECT)
1785 // printf("%s +_+_+_+_+_+ edit :: %d\n", item->label, i);
1786 elm_table_unpack(wd->edit_table, item->edit_item);
1787 elm_table_pack(wd->edit_table, item->edit_item,
1788 i % EDIT_ROW_NUM, i / EDIT_ROW_NUM, 1, 1);
1791 if (item->style != OBJECT)
1793 if(item->order > 0) order += item->sel;
1804 if(bar) elm_table_pack(wd->box, it->base, it->order - 1, 0, it->sel, 1);
1805 else evas_object_hide(it->base);
1806 if (it->style != OBJECT)
1807 elm_table_pack(wd->edit_table, it->edit_item, (edit - 1) % EDIT_ROW_NUM,
1808 (edit - 1) / EDIT_ROW_NUM, 1, 1);
1811 static Elm_Controlbar_Item *
1812 create_more_item(Widget_Data *wd)
1814 Elm_Controlbar_Item * it;
1816 it = ELM_NEW(Elm_Controlbar_Item);
1819 it->obj = wd->object;
1820 it->label = eina_stringshare_add("more");
1821 it->icon_path = CONTROLBAR_SYSTEM_ICON_MORE;
1822 it->selected = EINA_FALSE;
1827 it->base = create_item_layout(wd->edje, it);
1828 evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
1829 bar_item_down_cb, wd);
1830 object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
1831 evas_object_show(it->base);
1832 it->edit_item = create_item_layout(wd->edje, it);
1833 evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN,
1834 edit_item_down_cb, wd);
1835 evas_object_show(it->edit_item);
1837 set_items_position(it->obj, it, NULL, EINA_TRUE);
1839 wd->items = eina_list_append(wd->items, it);
1843 elm_controlbar_item_editable_set(it, EINA_FALSE);
1845 wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb);
1848 ///////////////////////////////////////////////////////////////////
1852 ////////////////////////////////////////////////////////////////////
1855 * Add a new controlbar object
1857 * @param parent The parent object
1858 * @return The new object or NULL if it cannot be created
1860 * @ingroup Controlbar
1862 EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent)
1864 Evas_Object * obj = NULL;
1865 Evas_Object * bg = NULL;
1866 Widget_Data * wd = NULL;
1867 Evas_Coord x, y, w, h;
1868 Evas_Object * r_button;
1869 wd = ELM_NEW(Widget_Data);
1870 wd->evas = evas_object_evas_get(parent);
1871 if (wd->evas == NULL)
1873 obj = elm_widget_add(wd->evas);
1876 elm_widget_type_set(obj, "controlbar");
1877 elm_widget_sub_object_add(parent, obj);
1878 elm_widget_data_set(obj, wd);
1879 elm_widget_del_hook_set(obj, _del_hook);
1880 elm_widget_theme_hook_set(obj, _theme_hook);
1883 wd->parent = parent;
1884 evas_object_geometry_get(parent, &x, &y, &w, &h);
1890 wd->mode = ELM_CONTROLBAR_MODE_DEFAULT;
1893 wd->edit_mode = EINA_FALSE;
1894 wd->more_mode = EINA_FALSE;
1895 wd->init_animation = EINA_FALSE;
1896 wd->selected_animation = EINA_FALSE;
1897 wd->view = elm_layout_add(wd->parent); //edje_object_add(wd->evas);
1898 elm_layout_theme_set(wd->view, "controlbar", "view", "default");
1899 //_elm_theme_object_set(obj, wd->view, "controlbar", "view", "default");
1900 if (wd->view == NULL)
1902 printf("Cannot load bg edj\n");
1905 evas_object_show(wd->view);
1908 wd->edit_box = edje_object_add(wd->evas);
1909 _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box",
1911 if (wd->edit_box == NULL)
1913 printf("Cannot load bg edj\n");
1916 evas_object_show(wd->edit_box);
1918 //instead of navigationbar
1919 /* r_button = elm_button_add(wd->edit_box);
1920 elm_button_label_set(r_button, "Done");
1921 evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd);
1922 edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", r_button);
1924 // navigationbar will contribution. but not yet
1925 wd->navigation = elm_navigationbar_add(wd->edit_box);
1926 r_button = elm_button_add(wd->navigation);
1927 elm_button_label_set(r_button, "Done");
1928 evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd);
1929 elm_navigationbar_push(wd->navigation, "Configure", NULL, r_button, NULL, NULL);
1930 edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", wd->navigation);
1932 wd->edit_table = elm_table_add(wd->edit_box);
1933 elm_table_homogenous_set(wd->edit_table, EINA_TRUE);
1934 edje_object_part_swallow(wd->edit_box, "elm.swallow.table", wd->edit_table);
1936 /* load background edj */
1937 wd->edje = edje_object_add(wd->evas);
1938 _elm_theme_object_set(obj, wd->edje, "controlbar", "base", "default");
1939 if (wd->edje == NULL)
1941 printf("Cannot load bg edj\n");
1944 evas_object_show(wd->edje);
1947 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_RESIZE,
1948 _controlbar_object_resize, obj);
1949 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_MOVE,
1950 _controlbar_object_move, obj);
1951 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_SHOW,
1952 _controlbar_object_show, obj);
1953 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_HIDE,
1954 _controlbar_object_hide, obj);
1955 bg = (Evas_Object *)edje_object_part_object_get(wd->edje, "bg_image");
1956 evas_object_event_callback_add(bg, EVAS_CALLBACK_MOVE, _controlbar_object_move, obj);
1957 evas_object_event_callback_add(bg, EVAS_CALLBACK_RESIZE, _controlbar_object_resize, obj);
1959 wd->selected_box = edje_object_add(wd->evas);
1960 _elm_theme_object_set(obj, wd->selected_box, "controlbar", "item_bg", "default");
1961 evas_object_hide(wd->selected_box);
1964 wd->box = elm_table_add(wd->edje);
1965 elm_table_homogenous_set(wd->box, EINA_TRUE);
1966 evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND,
1968 evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
1969 // edje_object_part_swallow(wd->edje, "elm.swallow.items", wd->box);
1970 evas_object_clip_set(wd->box, wd->edje);
1971 evas_object_show(wd->box);
1973 wd->event_box = evas_object_rectangle_add(wd->evas);
1974 evas_object_color_set(wd->event_box, 255, 255, 255, 0);
1975 evas_object_repeat_events_set(wd->event_box, EINA_TRUE);
1976 evas_object_show(wd->event_box);
1979 // evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
1980 evas_object_smart_member_add(wd->view, obj);
1981 evas_object_smart_member_add(wd->edit_box, obj);
1982 elm_widget_resize_object_set(obj, wd->edje);
1983 evas_object_smart_member_add(wd->selected_box, obj);
1984 evas_object_smart_member_add(wd->box, obj);
1985 evas_object_smart_member_add(wd->event_box, obj);
1993 * Append new tab item
1995 * @param obj The controlbar object
1996 * @param icon_path The icon path of item
1997 * @param label The label of item
1998 * @param view The view of item
1999 * @return The item of controlbar
2001 * @ingroup Controlbar
2003 EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj,
2010 Elm_Controlbar_Item * it;
2011 Elm_Controlbar_Item * lit;
2013 it = create_tab_item(obj, icon_path, label, view);
2016 wd = elm_widget_data_get(obj);
2017 if(check_bar_item_number(wd) >= 5 && wd->more_mode){
2018 if(!wd->more_item) {
2019 lit = elm_controlbar_last_item_get(obj);
2020 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2021 create_more_item(wd);
2023 set_items_position(obj, it, NULL, EINA_FALSE);
2026 set_items_position(obj, it, NULL, EINA_TRUE);
2028 if(wd->init_animation) evas_object_hide(it->base);
2029 wd->items = eina_list_append(wd->items, it);
2037 * Prepend new tab item
2039 * @param obj The controlbar object
2040 * @param icon_path The icon path of item
2041 * @param label The label of item
2042 * @param view The view of item
2043 * @return The item of controlbar
2045 * @ingroup Controlbar
2047 EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_prepend(Evas_Object *
2057 Elm_Controlbar_Item * it;
2058 Elm_Controlbar_Item * lit;
2059 Elm_Controlbar_Item * item;
2060 it = create_tab_item(obj, icon_path, label, view);
2063 wd = elm_widget_data_get(obj);
2064 item = eina_list_data_get(wd->items);
2065 if(check_bar_item_number(wd) >= 5 && wd->more_mode){
2066 if(!wd->more_item) {
2067 lit = elm_controlbar_last_item_get(obj);
2068 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2069 create_more_item(wd);
2071 lit = elm_controlbar_item_prev(wd->more_item);
2072 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2073 set_items_position(obj, it, item, EINA_TRUE);
2076 set_items_position(obj, it, item, EINA_TRUE);
2078 wd->items = eina_list_prepend(wd->items, it);
2086 * Insert new tab item before given item
2088 * @param obj The controlbar object
2089 * @param before The given item
2090 * @param icon_path The icon path of item
2091 * @param label The label of item
2092 * @param view The view of item
2093 * @return The item of controlbar
2095 * @ingroup Controlbar
2097 EAPI Elm_Controlbar_Item *
2098 elm_controlbar_tab_item_insert_before(Evas_Object * obj,
2099 Elm_Controlbar_Item * before,
2100 const char *icon_path,
2101 const char *label, Evas_Object * view)
2104 Elm_Controlbar_Item * it;
2105 Elm_Controlbar_Item * lit;
2108 it = create_tab_item(obj, icon_path, label, view);
2111 wd = elm_widget_data_get(obj);
2112 if(check_bar_item_number(wd) >= 5 && wd->more_mode){
2115 lit = elm_controlbar_last_item_get(obj);
2116 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2117 create_more_item(wd);
2119 if(before->order > 0)
2121 lit = elm_controlbar_item_prev(wd->more_item);
2122 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2123 set_items_position(obj, it, before, EINA_TRUE);
2127 set_items_position(obj, it, before, EINA_FALSE);
2131 set_items_position(obj, it, before, EINA_TRUE);
2133 wd->items = eina_list_prepend_relative(wd->items, it, before);
2141 * Insert new tab item after given item
2143 * @param obj The controlbar object
2144 * @param after The given item
2145 * @param icon_path The icon path of item
2146 * @param label The label of item
2147 * @param view The view of item
2148 * @return The item of controlbar
2150 * @ingroup Controlbar
2152 EAPI Elm_Controlbar_Item *
2153 elm_controlbar_tab_item_insert_after(Evas_Object * obj,
2154 Elm_Controlbar_Item * after,
2155 const char *icon_path, const char *label,
2159 Elm_Controlbar_Item * it;
2160 Elm_Controlbar_Item * lit;
2161 Elm_Controlbar_Item * item;
2164 it = create_tab_item(obj, icon_path, label, view);
2167 wd = elm_widget_data_get(obj);
2168 item = elm_controlbar_item_next(after);
2169 if(check_bar_item_number(wd) >= 5 && wd->more_mode){
2172 lit = elm_controlbar_last_item_get(obj);
2173 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2174 create_more_item(wd);
2178 lit = elm_controlbar_item_prev(wd->more_item);
2179 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2180 set_items_position(obj, it, item, EINA_TRUE);
2184 set_items_position(obj, it, item, EINA_FALSE);
2188 set_items_position(obj, it, item, EINA_TRUE);
2190 wd->items = eina_list_append_relative(wd->items, it, after);
2198 * Append new tool item
2200 * @param obj The controlbar object
2201 * @param icon_path The icon path of item
2202 * @param label The label of item
2203 * @param func Callback function of item
2204 * @param data The data of callback function
2205 * @return The item of controlbar
2207 * @ingroup Controlbar
2209 EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_append(Evas_Object *
2224 Elm_Controlbar_Item * it;
2226 it = create_tool_item(obj, icon_path, label, func, data);
2229 wd = elm_widget_data_get(obj);
2230 set_items_position(obj, it, NULL, EINA_TRUE);
2231 wd->items = eina_list_append(wd->items, it);
2237 * Prepend new tool item
2239 * @param obj The controlbar object
2240 * @param icon_path The icon path of item
2241 * @param label The label of item
2242 * @param func Callback function of item
2243 * @param data The data of callback function
2244 * @return The item of controlbar
2246 * @ingroup Controlbar
2248 EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_prepend(Evas_Object *
2265 Elm_Controlbar_Item * it;
2266 Elm_Controlbar_Item * item;
2267 it = create_tool_item(obj, icon_path, label, func, data);
2270 wd = elm_widget_data_get(obj);
2271 item = eina_list_data_get(wd->items);
2272 set_items_position(obj, it, item, EINA_TRUE);
2273 wd->items = eina_list_prepend(wd->items, it);
2279 * Insert new tool item before given item
2281 * @param obj The controlbar object
2282 * @param before The given item
2283 * @param icon_path The icon path of item
2284 * @param label The label of item
2285 * @param func Callback function of item
2286 * @param data The data of callback function
2287 * @return The item of controlbar
2289 * @ingroup Controlbar
2291 EAPI Elm_Controlbar_Item *
2292 elm_controlbar_tool_item_insert_before(Evas_Object * obj,
2293 Elm_Controlbar_Item * before,
2294 const char *icon_path,
2296 void (*func) (const void *data,
2302 Elm_Controlbar_Item * it;
2305 it = create_tool_item(obj, icon_path, label, func, data);
2308 wd = elm_widget_data_get(obj);
2309 set_items_position(obj, it, before, EINA_TRUE);
2310 wd->items = eina_list_prepend_relative(wd->items, it, before);
2316 * Insert new tool item after given item
2318 * @param obj The controlbar object
2319 * @param after The given item
2320 * @param icon_path The icon path of item
2321 * @param label The label of item
2322 * @param func Callback function of item
2323 * @param data The data of callback function
2324 * @return The item of controlbar
2326 * @ingroup Controlbar
2328 EAPI Elm_Controlbar_Item *
2329 elm_controlbar_tool_item_insert_after(Evas_Object * obj,
2330 Elm_Controlbar_Item * after,
2331 const char *icon_path,
2333 void (*func) (const void *data,
2339 Elm_Controlbar_Item * it;
2340 Elm_Controlbar_Item * item;
2343 it = create_tool_item(obj, icon_path, label, func, data);
2346 wd = elm_widget_data_get(obj);
2347 item = elm_controlbar_item_next(after);
2348 set_items_position(obj, it, item, EINA_TRUE);
2349 wd->items = eina_list_append_relative(wd->items, it, after);
2355 * Append new object item
2357 * @param obj The controlbar object
2358 * @param obj_item The object of item
2359 * @param sel The number of sel occupied
2360 * @return The item of controlbar
2362 * @ingroup Controlbar
2364 EAPI Elm_Controlbar_Item * elm_controlbar_object_item_append(Evas_Object *
2371 Elm_Controlbar_Item * it;
2372 it = create_object_item(obj, obj_item, sel);
2375 wd = elm_widget_data_get(obj);
2376 set_items_position(obj, it, NULL, EINA_TRUE);
2377 wd->items = eina_list_append(wd->items, it);
2383 * Prepend new object item
2385 * @param obj The controlbar object
2386 * @param obj_item The object of item
2387 * @param sel The number of sel occupied
2388 * @return The item of controlbar
2390 * @ingroup Controlbar
2392 EAPI Elm_Controlbar_Item * elm_controlbar_object_item_prepend(Evas_Object *
2399 Elm_Controlbar_Item * it;
2400 Elm_Controlbar_Item * item;
2401 it = create_object_item(obj, obj_item, sel);
2404 wd = elm_widget_data_get(obj);
2405 item = eina_list_data_get(wd->items);
2406 set_items_position(obj, it, item, EINA_TRUE);
2407 wd->items = eina_list_prepend(wd->items, it);
2413 * Insert new object item before given item
2415 * @param obj The controlbar object
2416 * @param before The given item
2417 * @param obj_item The object of item
2418 * @param sel The number of sel occupied
2419 * @return The item of controlbar
2421 * @ingroup Controlbar
2423 EAPI Elm_Controlbar_Item *
2424 elm_controlbar_object_item_insert_before(Evas_Object * obj,
2425 Elm_Controlbar_Item * before,
2426 Evas_Object * obj_item, const int sel)
2429 Elm_Controlbar_Item * it;
2432 it = create_object_item(obj, obj_item, sel);
2435 wd = elm_widget_data_get(obj);
2436 set_items_position(obj, it, before, EINA_TRUE);
2437 wd->items = eina_list_prepend_relative(wd->items, it, before);
2443 * Insert new object item after given item
2445 * @param obj The controlbar object
2446 * @param after The given item
2447 * @param obj_item The object of item
2448 * @param sel The number of sel occupied
2449 * @return The item of controlbar
2451 * @ingroup Controlbar
2453 EAPI Elm_Controlbar_Item *
2454 elm_controlbar_object_item_insert_after(Evas_Object * obj,
2455 Elm_Controlbar_Item * after,
2456 Evas_Object * obj_item, const int sel)
2459 Elm_Controlbar_Item * it;
2460 Elm_Controlbar_Item * item;
2463 it = create_object_item(obj, obj_item, sel);
2466 wd = elm_widget_data_get(obj);
2467 item = elm_controlbar_item_next(after);
2468 set_items_position(obj, it, item, EINA_TRUE);
2469 wd->items = eina_list_append_relative(wd->items, it, after);
2475 * Delete item from controlbar
2477 * @param it The item of controlbar
2479 * @ingroup Controlbar
2482 elm_controlbar_item_del(Elm_Controlbar_Item * it)
2488 Elm_Controlbar_Item * item;
2496 if (it->obj == NULL)
2498 printf("Invalid argument: controlbar object is NULL\n");
2501 wd = elm_widget_data_get(it->obj);
2504 printf("Cannot get smart data\n");
2511 elm_table_unpack(wd->box, it->base);
2513 EINA_LIST_FOREACH(wd->items, l, item)
2517 if (item->order > it->order)
2519 elm_table_unpack(wd->box, item->base);
2521 elm_table_pack(wd->box, item->base, item->order - 1, 0,
2534 if (it->edit_item != NULL)
2536 elm_table_unpack(wd->edit_table, it->edit_item);
2537 EINA_LIST_FOREACH(wd->items, l, item)
2541 if (item->edit_item != NULL)
2543 elm_table_unpack(wd->edit_table, item->edit_item);
2544 elm_table_pack(wd->edit_table, item->edit_item,
2545 (i - 1) % 4, (i - 1) / 4, 1, 1);
2548 if (it == item && item->style != OBJECT)
2553 if (item->style != OBJECT)
2558 // delete item in list
2560 eina_stringshare_del(it->label);
2562 evas_object_del(it->icon);
2565 if (it->style != OBJECT)
2566 evas_object_del(it->base);
2569 evas_object_hide(it->base);
2573 //edje_object_part_unswallow(wd->view, it->view);
2574 if(it->selected) elm_layout_content_unset(wd->view, "elm.swallow.view");
2575 evas_object_hide(it->view);
2578 evas_object_del(it->edit_item);
2579 wd->items = eina_list_remove(wd->items, it);
2580 wd->num = wd->num - 1;
2585 * Select item in controlbar
2587 * @param it The item of controlbar
2589 * @ingroup Controlbar
2592 elm_controlbar_item_select(Elm_Controlbar_Item * it)
2594 if (it->obj == NULL)
2596 Widget_Data * wd = elm_widget_data_get(it->obj);
2606 * Get the icon of item
2608 * @param it The item of controlbar
2609 * @return The icon object
2611 * @ingroup Controlbar
2613 EAPI Evas_Object * elm_controlbar_item_icon_get(Elm_Controlbar_Item * it)
2619 * Get the label of item
2621 * @param it The item of controlbar
2622 * @return The label of item
2624 * @ingroup Controlbar
2627 elm_controlbar_item_label_get(Elm_Controlbar_Item * it)
2633 * Set the label of item
2635 * @param it The item of controlbar
2636 * @param label The label of item
2638 * @ingroup Controlbar
2641 elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label)
2645 edje_object_part_text_set(it->base, "elm.text", label);
2649 * Get the selected item.
2651 * @param obj The controlbar object
2652 * @return The item of controlbar
2654 * @ingroup Controlbar
2656 EAPI Elm_Controlbar_Item * elm_controlbar_selected_item_get(Evas_Object *
2661 Elm_Controlbar_Item * item;
2664 Widget_Data * wd = elm_widget_data_get(obj);
2665 if (!wd || !wd->items)
2667 EINA_LIST_FOREACH(wd->items, l, item)
2676 * Get the first item.
2678 * @param obj The controlbar object
2679 * @return The item of controlbar
2681 * @ingroup Controlbar
2683 EAPI Elm_Controlbar_Item * elm_controlbar_first_item_get(Evas_Object * obj)
2687 Widget_Data * wd = elm_widget_data_get(obj);
2688 if (!wd || !wd->items)
2690 return eina_list_data_get(wd->items);
2694 * Get the last item.
2696 * @param obj The controlbar object
2697 * @return The item of controlbar
2699 * @ingroup Controlbar
2701 EAPI Elm_Controlbar_Item * elm_controlbar_last_item_get(Evas_Object * obj)
2705 Widget_Data * wd = elm_widget_data_get(obj);
2706 if (!wd || !wd->items)
2708 return eina_list_data_get(eina_list_last(wd->items));
2714 * @param obj The controlbar object
2715 * @return The list of the items
2717 * @ingroup Controlbar
2719 EAPI Eina_List * elm_controlbar_items_get(Evas_Object * obj)
2723 Widget_Data * wd = elm_widget_data_get(obj);
2724 if (!wd || !wd->items)
2730 * Get the previous item.
2732 * @param it The item of controlbar
2733 * @return The previous item of the parameter item
2735 * @ingroup Controlbar
2737 EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item *
2742 Elm_Controlbar_Item * item;
2743 if (it->obj == NULL)
2745 Widget_Data * wd = elm_widget_data_get(it->obj);
2746 if (!wd || !wd->items)
2748 EINA_LIST_FOREACH(wd->items, l, item)
2752 l = eina_list_prev(l);
2755 return eina_list_data_get(l);
2762 * Get the next item.
2764 * @param obj The controlbar object
2765 * @return The next item of the parameter item
2767 * @ingroup Controlbar
2769 EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item *
2774 Elm_Controlbar_Item * item;
2775 if (it->obj == NULL)
2777 Widget_Data * wd = elm_widget_data_get(it->obj);
2778 if (!wd || !wd->items)
2780 EINA_LIST_FOREACH(wd->items, l, item)
2784 l = eina_list_next(l);
2787 return eina_list_data_get(l);
2796 * @param The controlbar object
2798 * @ingroup Controlbar
2801 elm_controlbar_edit_start(Evas_Object * obj)
2803 printf("\n==================================\n");
2804 printf("%s\n", __func__);
2805 printf("==================================\n");
2806 printf("This API is just for test.\n");
2807 printf("Please don't use it!!\n");
2808 printf("Thank you.\n");
2809 printf("==================================\n");
2814 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
2817 wd = elm_widget_data_get(obj);
2820 fprintf(stderr, "Cannot get smart data\n");
2823 edje_object_signal_emit(wd->edit_box, "elm,state,show,edit_box", "elm");
2824 wd->edit_mode = EINA_TRUE;
2830 * @param it The item of controlbar
2831 * @param bar true or false
2833 * @ingroup Controlbar
2836 elm_controlbar_item_visible_set(Elm_Controlbar_Item * it, Eina_Bool bar)
2838 Eina_Bool check = EINA_TRUE;
2839 if (it->obj == NULL)
2841 Widget_Data * wd = elm_widget_data_get(it->obj);
2842 if (!wd || !wd->items)
2850 item_insert_in_bar(it, 0);
2854 item_delete_in_bar(it);
2856 wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb);
2857 _sizing_eval(it->obj);
2863 * @param it The item of controlbar
2864 * @param bar true or false
2866 * @ingroup Controlbar
2869 elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable)
2871 Evas_Object * color;
2874 it->editable = editable;
2876 (Evas_Object *) edje_object_part_object_get(_EDJ(it->edit_item),
2877 "elm.edit.item.color");
2879 evas_object_color_get(color, &r, &g, &b, &a);
2880 evas_object_color_set(it->edit_item, r, g, b, a);
2884 * Set the default view
2886 * @param obj The controlbar object
2887 * @param view The default view
2889 * @ingroup Controlbar
2892 elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view)
2894 printf("\n==================================\n");
2895 printf("%s\n", __func__);
2896 printf("==================================\n");
2897 printf("This API is just for test.\n");
2898 printf("Please don't use it!!\n");
2899 printf("Thank you.\n");
2900 printf("==================================\n");
2905 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
2908 wd = elm_widget_data_get(obj);
2911 fprintf(stderr, "Cannot get smart data\n");
2914 wd->view_content = view;
2915 //edje_object_part_swallow(wd->view, "elm.swallow.view", wd->view_content);
2916 elm_layout_content_set(wd->view, "elm.swallow.view", wd->view_content);
2920 * Set the view of the item
2922 * @param it The item of controlbar
2923 * @param view The view for the item
2925 * @ingroup Controlbar
2928 elm_controlbar_item_view_set(Elm_Controlbar_Item *it, Evas_Object * view)
2934 * Set the mode of the controlbar
2936 * @param obj The object of the controlbar
2937 * @param mode The mode of the controlbar
2939 * @ingroup Controlbar
2942 elm_controlbar_mode_set(Evas_Object *obj, int mode)
2948 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
2951 wd = elm_widget_data_get(obj);
2954 fprintf(stderr, "Cannot get smart data\n");
2958 if(wd->mode == mode) return;
2962 case ELM_CONTROLBAR_MODE_DEFAULT:
2963 edje_object_signal_emit(wd->edje, "elm,state,default", "elm");
2965 case ELM_CONTROLBAR_MODE_LARGE:
2966 edje_object_signal_emit(wd->edje, "elm,state,large", "elm");
2968 case ELM_CONTROLBAR_MODE_SMALL:
2969 edje_object_signal_emit(wd->edje, "elm,state,small", "elm");
2977 init_animation(void *data)
2980 Elm_Controlbar_Item * item;
2981 Widget_Data * wd = (Widget_Data *)data;
2983 wd->visible_items = eina_list_free(wd->visible_items);
2984 EINA_LIST_FOREACH(wd->items, l, item)
2988 wd->visible_items = eina_list_append(wd->visible_items, item->base);
2993 wd->ani_func(wd->ani_data, wd->object, wd->visible_items);
2995 return EXIT_SUCCESS;
3000 * Set the animation of the controlbar
3002 * @param obj The object of the controlbar
3003 * @param mode The mode of the controlbar
3005 * @ingroup Controlbar
3008 elm_controlbar_animation_set(Evas_Object *obj, void (*func) (const void *data, Evas_Object *obj, void *event_info), const void *data)
3010 printf("\n==================================\n");
3011 printf("%s\n", __func__);
3012 printf("==================================\n");
3013 printf("This API is just for test.\n");
3014 printf("Please don't use it!!\n");
3015 printf("Thank you.\n");
3016 printf("==================================\n");
3021 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
3024 wd = elm_widget_data_get(obj);
3027 fprintf(stderr, "Cannot get smart data\n");
3033 wd->init_animation = EINA_TRUE;
3035 wd->ani_func = func;
3036 wd->ani_data = data;
3038 ecore_idler_add(init_animation, wd);
3043 * Set the animation of the controlbar
3045 * @param obj The object of the controlbar
3046 * @param mode The mode of the controlbar
3048 * @ingroup Controlbar
3051 elm_controlbar_item_animation_set(Evas_Object *obj, Eina_Bool auto_animation, Eina_Bool selected_animation)
3053 printf("\n==================================\n");
3054 printf("%s\n", __func__);
3055 printf("==================================\n");
3056 printf("This API is just for test.\n");
3057 printf("Please don't use it!!\n");
3058 printf("Thank you.\n");
3059 printf("==================================\n");
3064 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
3067 wd = elm_widget_data_get(obj);
3070 fprintf(stderr, "Cannot get smart data\n");
3074 if(auto_animation && !wd->effect_timer)
3076 wd->effect_timer = ecore_timer_add(1, item_animation_effect, wd);
3080 if(wd->effect_timer) ecore_timer_del(wd->effect_timer);
3081 wd->effect_timer = NULL;
3084 wd->selected_animation = selected_animation;