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;
62 Eina_List * visible_items;
64 Ecore_Event_Handler * move_event;
65 Ecore_Event_Handler * up_event;
66 Ecore_Event_Handler * bar_move_event;
67 Ecore_Event_Handler * bar_up_event;
69 void (*ani_func) (const void *data, Evas_Object * obj, void *event_info);
71 Eina_Bool init_animation;
73 Ecore_Timer *effect_timer;
74 Eina_Bool *selected_animation;
77 struct _Elm_Controlbar_Item
81 Evas_Object * edit_item;
84 const char *icon_path;
86 void (*func) (const void *data, Evas_Object * obj, void *event_info);
96 typedef struct _Animation_Data Animation_Data;
98 struct _Animation_Data
109 unsigned int start_time;
111 void (*func) (void *data, Evas_Object * obj);
113 Ecore_Animator * timer;
118 static void selected_box(Elm_Controlbar_Item * it);
119 static int pressed_box(Elm_Controlbar_Item * it);
120 static void object_color_set(Evas_Object *ly, const char *color_part, const char *obj_part);
121 static void edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
122 static void edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
123 static void bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
124 static void bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
126 /////////////////////////
128 ////////////////////////
131 print_all_items(Widget_Data *wd)
134 Elm_Controlbar_Item * item;
136 EINA_LIST_FOREACH(wd->items, l, item)
138 printf("item label : %s order : %d\n", item->label, item->order);
142 ///////////////////////////////////////////////////////////////////
144 // Smart Object basic function
146 ////////////////////////////////////////////////////////////////////
149 _controlbar_move(void *data, Evas_Object * obj)
152 const Evas_Object *bg;
156 wd = elm_widget_data_get((Evas_Object *) data);
159 evas_object_geometry_get(wd->edje, &x, &y, NULL, NULL);
162 evas_object_move(wd->edje, x, y);
163 evas_object_move(wd->view, x, y);
164 evas_object_geometry_get(wd->parent, &x, &y, NULL, NULL);
165 evas_object_move(wd->edit_box, x, y);
166 evas_object_move(wd->event_box, x, y);
167 bg = edje_object_part_object_get(wd->edje, "bg_image");
168 evas_object_geometry_get(bg, &x, &y, NULL, NULL);
169 evas_object_move(wd->box, x, y);
173 _controlbar_resize(void *data, Evas_Object * obj)
176 const Evas_Object *bg;
177 Evas_Coord y, y_, w, h, height;
180 wd = elm_widget_data_get((Evas_Object *) data);
183 evas_object_geometry_get(wd->edje, NULL, &y, &w, &h);
186 evas_object_resize(wd->edje, w, h);
187 evas_object_geometry_get(edje_object_part_object_get(wd->edje, "bg_image"),
188 NULL, NULL, NULL, &height);
189 evas_object_resize(wd->view, w, h - height + 1);
190 evas_object_geometry_get(wd->parent, NULL, &y_, NULL, NULL);
191 evas_object_resize(wd->edit_box, w, h + y - y_);
192 evas_object_resize(wd->event_box, w, h + y - y_);
193 bg = edje_object_part_object_get(wd->edje, "bg_image");
194 evas_object_geometry_get(bg, NULL, NULL, &w, &h);
195 evas_object_resize(wd->box, w, h);
199 _controlbar_object_move(void *data, Evas * e, Evas_Object * obj,
202 _controlbar_move(data, obj);
206 _controlbar_object_resize(void *data, Evas * e, Evas_Object * obj,
209 _controlbar_resize(data, obj);
213 _controlbar_object_show(void *data, Evas * e, Evas_Object * obj,
219 wd = elm_widget_data_get((Evas_Object *) data);
222 evas_object_show(wd->view);
223 evas_object_show(wd->edit_box);
224 evas_object_show(wd->edje);
225 evas_object_show(wd->box);
226 evas_object_show(wd->event_box);
230 _controlbar_object_hide(void *data, Evas * e, Evas_Object * obj,
236 wd = elm_widget_data_get((Evas_Object *) data);
239 evas_object_hide(wd->view);
240 evas_object_hide(wd->edit_box);
241 evas_object_hide(wd->edje);
242 evas_object_hide(wd->box);
243 evas_object_hide(wd->event_box);
247 _del_hook(Evas_Object * obj)
249 Widget_Data * wd = elm_widget_data_get(obj);
250 Elm_Controlbar_Item * item;
251 Evas_Object * content;
255 EINA_LIST_FREE(wd->items, item)
257 eina_stringshare_del(item->label);
259 evas_object_del(item->icon);
261 evas_object_del(item->base);
263 evas_object_del(item->edit_item);
269 content = elm_layout_content_unset(wd->view, "elm.swallow.view");
270 evas_object_hide(content);
271 evas_object_del(wd->view);
276 evas_object_del(wd->edit_box);
281 evas_object_del(wd->navigation);
282 wd->navigation = NULL;
286 evas_object_del(wd->edje);
289 if (wd->selected_box)
291 evas_object_del(wd->selected_box);
296 evas_object_del(wd->box);
301 evas_object_del(wd->event_box);
302 wd->event_box = NULL;
304 if (wd->effect_timer)
306 ecore_timer_del(wd->effect_timer);
307 wd->effect_timer = NULL;
315 _theme_hook(Evas_Object * obj)
319 Elm_Controlbar_Item * item;
323 Widget_Data * wd = elm_widget_data_get(obj);
326 _elm_theme_object_set(obj, wd->edje, "controlbar", "base",
327 elm_widget_style_get(obj));
328 elm_layout_theme_set(wd->view, "controlbar", "view", elm_widget_style_get(obj));
329 //_elm_theme_object_set(obj, wd->view, "controlbar", "view",
330 // elm_widget_style_get(obj));
331 _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box",
332 elm_widget_style_get(obj));
333 EINA_LIST_FOREACH(wd->items, l, item)
335 if (item->style != OBJECT)
337 elm_layout_theme_set(item->base, "controlbar", "item",
338 elm_widget_style_get(obj));
339 object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
340 elm_layout_theme_set(item->edit_item, "controlbar", "item",
341 elm_widget_style_get(obj));
346 edje_object_part_object_get(_EDJ(item->edit_item),
347 "elm.edit.item.color");
349 evas_object_color_get(color, &r, &g, &b, &a);
350 evas_object_color_set(item->edit_item, r, g, b, a);
354 edje_object_part_text_set(_EDJ(item->base), "elm.text",
356 edje_object_part_text_set(_EDJ(item->edit_item), "elm.text",
359 if (item->label && item->icon)
361 edje_object_signal_emit(_EDJ(item->base),
362 "elm,state,icon_text", "elm");
363 edje_object_signal_emit(_EDJ(item->edit_item),
364 "elm,state,icon_text", "elm");
375 _sub_del(void *data, Evas_Object * obj, void *event_info)
377 Widget_Data * wd = elm_widget_data_get(obj);
379 //Evas_Object *sub = event_info;
384 * if (sub == wd->icon)
386 * edje_object_signal_emit(wd->btn, "elm,state,icon,hidden", "elm");
387 * evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
388 * _changed_size_hints, obj);
390 * edje_object_message_signal_process(wd->btn);
397 _sizing_eval(Evas_Object * obj)
399 Widget_Data * wd = elm_widget_data_get(obj);
402 _controlbar_move(obj, obj);
403 _controlbar_resize(obj, obj);
406 /////////////////////////////////////////////////////////////
408 // animation function
410 /////////////////////////////////////////////////////////////
415 struct timeval timev;
417 gettimeofday(&timev, NULL);
418 return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
422 set_evas_map(Evas_Object * obj, Evas_Coord x, Evas_Coord y, Evas_Coord w,
429 Evas_Map * map = evas_map_new(4);
432 evas_map_smooth_set(map, EINA_TRUE);
433 evas_map_util_points_populate_from_object_full(map, obj, 0);
434 evas_object_map_enable_set(obj, EINA_TRUE);
435 evas_map_util_3d_perspective(map, x + w / 2, y + h / 2, 0, w * 10);
436 evas_map_util_points_populate_from_geometry(map, x, y, w, h, 0);
437 evas_object_map_set(obj, map);
442 move_evas_map(void *data)
452 Animation_Data * ad = (Animation_Data *) data;
453 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
454 dx = ad->tx - ad->fx;
455 dy = ad->ty - ad->fy;
456 dw = ad->tw - ad->fw;
457 dh = ad->th - ad->fh;
460 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
461 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
462 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
463 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
476 if (x == dx && y == dy && w == dw && h == dh)
478 ecore_animator_del(ad->timer);
480 set_evas_map(ad->obj, px, py, pw, ph);
481 if (ad->func != NULL)
482 ad->func(ad->data, ad->obj);
486 set_evas_map(ad->obj, px, py, pw, ph);
493 move_evas_object(void *data)
503 Animation_Data * ad = (Animation_Data *) data;
504 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
505 dx = ad->tx - ad->fx;
506 dy = ad->ty - ad->fy;
507 dw = ad->tw - ad->fw;
508 dh = ad->th - ad->fh;
511 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
512 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
513 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
514 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
527 if (x == dx && y == dy && w == dw && h == dh)
529 ecore_animator_del(ad->timer);
531 evas_object_move(ad->obj, px, py);
532 evas_object_resize(ad->obj, pw, ph);
533 evas_object_show(ad->obj);
534 if (ad->func != NULL)
535 ad->func(ad->data, ad->obj);
539 evas_object_move(ad->obj, px, py);
540 evas_object_resize(ad->obj, pw, ph);
541 evas_object_show(ad->obj);
547 move_fade_out_object(void *data)
551 int dx, dy, dw, dh, da;
553 int px, py, pw, ph, pa;
559 Animation_Data * ad = (Animation_Data *) data;
560 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
561 dx = ad->tx - ad->fx;
562 dy = ad->ty - ad->fy;
563 dw = ad->tw - ad->fw;
564 dh = ad->th - ad->fh;
568 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
569 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
570 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
571 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
572 a = (1 * sin((t / ad->time) * (M_PI / 2)) * da);
587 if (x == dx && y == dy && w == dw && h == dh)
589 ecore_animator_del(ad->timer);
591 evas_object_move(ad->obj, px, py);
592 //evas_object_resize(ad->obj, 480, 600);
593 evas_object_resize(ad->obj, pw, ph);
594 evas_object_color_get(ad->obj, &r, &g, &b, &a);
595 evas_object_color_set(ad->obj, r, g, b, pa);
596 evas_object_show(ad->obj);
597 if (ad->func != NULL)
598 ad->func(ad->data, ad->obj);
602 evas_object_move(ad->obj, px, py);
603 //evas_object_resize(ad->obj, 480, 600);
604 evas_object_resize(ad->obj, pw, ph);
605 evas_object_color_get(ad->obj, &r, &g, &b, &a);
606 evas_object_color_set(ad->obj, r, g, b, pa);
607 evas_object_show(ad->obj);
613 move_fade_in_object(void *data)
617 int dx, dy, dw, dh, da;
619 int px, py, pw, ph, pa;
625 Animation_Data * ad = (Animation_Data *) data;
626 t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
627 dx = ad->tx - ad->fx;
628 dy = ad->ty - ad->fy;
629 dw = ad->tw - ad->fw;
630 dh = ad->th - ad->fh;
634 x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
635 y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
636 w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
637 h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
638 a = (1 * sin((t / ad->time) * (M_PI / 2)) * da);
653 if (x == dx && y == dy && w == dw && h == dh)
655 ecore_animator_del(ad->timer);
657 evas_object_move(ad->obj, px, py);
658 //evas_object_resize(ad->obj, 480, 600);
659 evas_object_resize(ad->obj, pw, ph);
660 evas_object_color_get(ad->obj, &r, &g, &b, &a);
661 evas_object_color_set(ad->obj, r, g, b, pa);
662 evas_object_show(ad->obj);
663 if (ad->func != NULL)
664 ad->func(ad->data, ad->obj);
668 evas_object_move(ad->obj, px, py);
669 //evas_object_resize(ad->obj, 480, 600);
670 evas_object_resize(ad->obj, pw, ph);
671 evas_object_color_get(ad->obj, &r, &g, &b, &a);
672 evas_object_color_set(ad->obj, r, g, b, pa);
673 evas_object_show(ad->obj);
679 move_object_with_animation(Evas_Object * obj, Evas_Coord x, Evas_Coord y,
680 Evas_Coord w, Evas_Coord h, Evas_Coord x_,
681 Evas_Coord y_, Evas_Coord w_, Evas_Coord h_,
682 double time, int (*mv_func) (void *data),
683 void (*func) (void *data,
684 Evas_Object * obj), void *data)
686 Animation_Data * ad = (Animation_Data *) malloc(sizeof(Animation_Data));
696 ad->start_time = current_time_get();
700 ad->timer = ecore_animator_add(mv_func, ad);
705 item_animation_effect(void *data)
707 Widget_Data *wd = (Widget_Data *)data;
709 Elm_Controlbar_Item * item;
714 EINA_LIST_FOREACH(wd->items, l, item)
717 // printf("rand :: %d\n", rand);
718 if(rand > 65 && item->order > 0)
724 edje_object_signal_emit(_EDJ(item->base), "elm,animation,pop", "elm");
727 edje_object_signal_emit(_EDJ(item->base), "elm,animation,vibration", "elm");
730 edje_object_signal_emit(_EDJ(item->base), "elm,animation,jump", "elm");
741 /////////////////////////////////////////////////////////////
745 /////////////////////////////////////////////////////////////
748 sort_cb(const void *d1, const void *d2)
750 Elm_Controlbar_Item * item1, *item2;
751 item1 = (Elm_Controlbar_Item *) d1;
752 item2 = (Elm_Controlbar_Item *) d2;
753 if (item1->order <= 0)
755 if (item2->order <= 0)
757 return item1->order > item2->order ? 1 : -1;
761 sort_reverse_cb(const void *d1, const void *d2)
763 Elm_Controlbar_Item * item1, *item2;
764 item1 = (Elm_Controlbar_Item *) d1;
765 item2 = (Elm_Controlbar_Item *) d2;
766 if (item1->order <= 0)
768 if (item2->order <= 0)
770 return item1->order > item2->order ? -1 : 1;
774 done_button_cb(void *data, Evas_Object * obj, void *event_info)
776 Widget_Data * wd = (Widget_Data *) data;
778 wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb);
780 evas_object_smart_callback_call(wd->object, "edit,end", wd->items);
782 edje_object_signal_emit(wd->edit_box, "elm,state,hide,edit_box", "elm");
783 wd->edit_mode = EINA_FALSE;
786 ///////////////////////////////////////////////////////////////////
788 // basic utility function
790 ////////////////////////////////////////////////////////////////////
793 check_bar_item_number(Widget_Data *wd)
796 Elm_Controlbar_Item * item;
799 EINA_LIST_FOREACH(wd->items, l, item)
801 if(item->order > 0) num++;
808 item_insert_in_bar(Elm_Controlbar_Item * it, int order)
812 Elm_Controlbar_Item * item;
813 Widget_Data * wd = elm_widget_data_get(it->obj);
816 EINA_LIST_FOREACH(wd->items, l, item)
818 if (item->order == order && item != it)
823 EINA_LIST_FOREACH(wd->items, l, item)
826 elm_table_unpack(wd->box, item->base);
828 EINA_LIST_FOREACH(wd->items, l, item)
832 if (item->order >= order)
834 elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
835 evas_object_show(item->base);
840 elm_table_pack(wd->box, it->base, order - 1, 0, 1, 1);
841 evas_object_show(it->base);
845 item_delete_in_bar(Elm_Controlbar_Item * it)
848 Elm_Controlbar_Item * item;
849 Widget_Data * wd = elm_widget_data_get(it->obj);
852 EINA_LIST_FOREACH(wd->items, l, item)
858 elm_table_unpack(wd->box, it->base);
859 evas_object_hide(it->base);
864 EINA_LIST_FOREACH(wd->items, l, item)
869 elm_table_unpack(wd->box, item->base);
870 elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
877 item_exchange_animation_cb(void *data, Evas_Object * obj)
879 Widget_Data * wd = (Widget_Data *) data;
881 if (wd->animating < 0)
883 printf("animation error\n");
889 item_exchange_in_bar(Elm_Controlbar_Item * it1, Elm_Controlbar_Item * it2)
893 Evas_Coord x, y, w, h;
894 Evas_Coord x_, y_, w_, h_;
895 Widget_Data * wd = elm_widget_data_get(it1->obj);
896 evas_object_geometry_get(wd->moving_item->edit_item, &x, &y, &w, &h);
897 set_evas_map(wd->moving_obj, (wd->x + wd->w / 2), (wd->y + wd->h / 2), 0,
899 evas_object_geometry_get(it1->base, &x, &y, &w, &h);
900 evas_object_geometry_get(it2->base, &x_, &y_, &w_, &h_);
902 move_object_with_animation(it1->base, x, y, w, h, x_, y_, w_, h_, 0.25,
903 move_evas_map, item_exchange_animation_cb, wd);
905 move_object_with_animation(it2->base, x_, y_, w_, h_, x, y, w, h, 0.25,
906 move_evas_map, item_exchange_animation_cb, wd);
907 elm_table_unpack(wd->box, it1->base);
908 elm_table_unpack(wd->box, it2->base);
910 it1->order = it2->order;
912 elm_table_pack(wd->box, it1->base, it1->order - 1, 0, 1, 1);
913 elm_table_pack(wd->box, it2->base, it2->order - 1, 0, 1, 1);
917 item_change_animation_cb(void *data, Evas_Object * obj)
919 Evas_Coord x, y, w, h;
920 Widget_Data * wd = (Widget_Data *) data;
922 if (wd->animating < 0)
924 printf("animation error\n");
927 evas_object_geometry_get(obj, &x, &y, &w, &h);
928 set_evas_map(obj, x, y, 0, 0);
929 evas_object_move(obj, -1000, -1000);
930 evas_object_geometry_get(wd->moving_item->base, &x, &y, &w, &h);
931 evas_object_move(wd->moving_obj, -1000, -1000);
932 evas_object_del(wd->moving_obj);
936 item_change_in_bar(Elm_Controlbar_Item * it)
938 Evas_Coord x, y, w, h;
939 Evas_Coord x_, y_, w_, h_;
940 Widget_Data * wd = elm_widget_data_get(it->obj);
943 if (wd->moving_item == NULL)
945 evas_object_geometry_get(wd->moving_item->edit_item, &x, &y, &w, &h);
946 set_evas_map(wd->moving_obj, x, y, w, h);
947 elm_table_unpack(wd->box, it->base);
948 wd->moving_item->order = it->order;
950 elm_table_pack(wd->box, wd->moving_item->base, wd->moving_item->order - 1,
952 evas_object_show(wd->moving_item->base);
953 evas_render_updates_free(evas_render_updates
954 (evas_object_evas_get(wd->moving_item->base)));
955 evas_object_geometry_get(it->base, &x, &y, &w, &h);
956 evas_object_geometry_get(it->edit_item, &x_, &y_, &w_, &h_);
958 move_object_with_animation(it->base, x, y, w, h, x_, y_, w_, h_, 0.25,
959 move_evas_map, item_change_animation_cb, wd);
960 evas_object_geometry_get(wd->moving_item->base, &x, &y, &w, &h);
961 set_evas_map(wd->moving_item->base, x, y, w, h);
965 hide_selected_box(void *data)
967 Evas_Object *selected_box = (Evas_Object *)data;
969 evas_object_hide(selected_box);
975 object_color_set(Evas_Object *ly, const char *color_part, const char *obj_part)
981 (Evas_Object *) edje_object_part_object_get(_EDJ(ly), color_part);
983 evas_object_color_get(color, &r, &g, &b, &a);
985 edje_object_part_swallow_get(_EDJ(ly), obj_part);
986 evas_object_color_set(color, r, g, b, a);
990 _end_selected_box(void *data, Evas_Object *obj)
992 Widget_Data * wd = (Widget_Data *)data;
995 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,state,selected", "elm");
996 // item animation effect
997 if(wd->selected_animation)
1005 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,animation,pop", "elm");
1008 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,animation,vibration", "elm");
1011 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,animation,jump", "elm");
1019 if (wd->animating < 0)
1021 printf("animation error\n");
1025 ecore_idler_add(hide_selected_box, wd->selected_box);
1029 move_selected_box(Widget_Data *wd, Elm_Controlbar_Item * fit, Elm_Controlbar_Item * tit)
1031 Evas_Coord fx, fy, fw, fh, tx, ty, tw, th;
1032 Evas_Object *from, *to;
1034 from = (Evas_Object *)edje_object_part_object_get(_EDJ(fit->base), "bg_img");
1035 evas_object_geometry_get(from, &fx, &fy, &fw, &fh);
1037 to = (Evas_Object *)edje_object_part_object_get(_EDJ(tit->base), "bg_img");
1038 evas_object_geometry_get(to, &tx, &ty, &tw, &th);
1040 edje_object_signal_emit(_EDJ(wd->pre_item->base), "elm,state,unselected", "elm");
1041 edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,state,unselected", "elm");
1044 move_object_with_animation(wd->selected_box, fx, fy, fw, fh, tx, ty, tw, th,
1045 0.3, move_evas_object, _end_selected_box, wd);
1049 end_selected_box(void *data, Evas_Object *obj)
1051 Widget_Data * wd = (Widget_Data *)data;
1053 //wd->pre_item->selected = EINA_FALSE;
1054 // elm_layout_content_unset(wd->view, "elm.swallow.view");
1055 //edje_object_part_unswallow(wd->view, wd->pre_item->view);
1056 if(wd->pre_item) evas_object_hide(wd->pre_item->view);
1058 elm_layout_content_set(wd->view, "elm.swallow.view", obj);
1059 //edje_object_part_swallow(wd->view, "elm.swallow.view", obj);
1060 evas_object_show(obj);
1064 view_animation_push(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data)
1066 Evas_Coord x, y, w, h;
1068 evas_object_geometry_get(pre, &x, &y, &w, &h);
1069 move_object_with_animation(pre, x, y, w, h, x+20, y, w, h, 0.5, move_fade_out_object, NULL, NULL);
1070 move_object_with_animation(cur, x+120, y, w, h, x, y, w, h, 0.5, move_fade_in_object, end_selected_box, wd);
1074 view_animation_down(Widget_Data *wd, Evas_Object *pre, Evas_Object *cur, void *data)
1076 Evas_Coord x, y, w, h;
1078 evas_object_geometry_get(pre, &x, &y, &w, &h);
1079 // evas_object_move(cur, x, y);
1080 // evas_object_resize(cur, w, h);
1081 // evas_object_show(cur);
1083 move_object_with_animation(cur, x, h, w, h, x, h, w, h, 0.5, move_evas_object, end_selected_box, wd);
1084 evas_object_raise(pre);
1085 move_object_with_animation(pre, x, y, w, h, x, h, w, 0, 0.5, move_evas_map, NULL, NULL);
1089 selected_box(Elm_Controlbar_Item * it)
1091 Widget_Data * wd = elm_widget_data_get(it->obj);
1093 Elm_Controlbar_Item * item, *fit = NULL;
1094 Evas_Object * content;
1096 if(wd->animating) return;
1100 if(it->style == TABBAR){
1102 content = elm_layout_content_unset(wd->view, "elm.swallow.view");
1103 EINA_LIST_FOREACH(wd->items, l, item){
1104 if(item->selected) {
1108 item->selected = EINA_FALSE;
1109 //edje_object_part_unswallow(wd->view, item->view);
1110 //evas_object_hide(item->view);
1112 it->selected = EINA_TRUE;
1113 evas_object_smart_callback_call(it->obj, "view,change,before", it);
1114 object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon");
1116 if(fit != NULL && fit != it)
1117 move_selected_box(wd, fit, it);
1119 edje_object_signal_emit(_EDJ(it->base), "elm,state,selected", "elm");
1122 if(fit != NULL && fit != it)
1124 //view_animation_down(wd, fit->view, it->view, NULL);
1125 view_animation_push(wd, fit->view, it->view, NULL);
1126 //evas_object_hide(content);
1128 // evas_object_geometry_get(fit->view, &x, &y, &w, &h);
1129 // if(fit->order > it->order)
1131 // move_object_with_animation(fit->view, x, y, w, h, x+20, y, w, h, 0.5, move_fade_out_object, NULL, NULL);
1132 // 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);
1136 // move_object_with_animation(fit->view, x, y, w, h, x-120, y, w, h, 1.5, move_fade_out_object, NULL, NULL);
1137 // 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);
1142 end_selected_box(wd, it->view);
1145 if(wd->pre_item) evas_object_hide(wd->pre_item->view);
1146 elm_layout_content_set(wd->view, "elm.swallow.view", it->view);
1148 // elm_layout_content_set(wd->view, "elm.swallow.view", it->view);
1149 //edje_object_part_swallow(wd->view, "elm.swallow.view", it->view);
1150 // evas_object_show(it->view);
1152 }else if(it->style == TOOLBAR){
1154 it->func(it->data, it->obj, it);
1155 object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
1156 edje_object_signal_emit(_EDJ(it->base), "elm,state,text_unselected", "elm");
1159 evas_object_smart_callback_call(it->obj, "clicked", it);
1163 unpressed_box_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1165 Widget_Data * wd = (Widget_Data *) data;
1167 Evas_Event_Mouse_Up * ev = event_info;
1168 Evas_Coord x, y, w, h;
1170 Elm_Controlbar_Item * item;
1171 EINA_LIST_FOREACH(wd->items, l, item)
1173 if (item->style == TABBAR)
1177 object_color_set(item->base, "elm.tabbar.selected.color", "elm.swallow.icon");
1178 edje_object_signal_emit(_EDJ(item->base), "elm,state,selected", "elm");
1182 object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
1183 edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm");
1186 else if (item->style == TOOLBAR)
1188 object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
1189 edje_object_signal_emit(_EDJ(item->base), "elm,state,text_unselected", "elm");
1193 evas_object_geometry_get(wd->pre_item->base, &x, &y, &w, &h);
1194 if(ev->output.x > x && ev->output.x < x+w && ev->output.y > y && ev->output.y < y+h)
1196 selected_box(wd->pre_item);
1199 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb);
1205 pressed_box(Elm_Controlbar_Item * it)
1207 Widget_Data * wd = elm_widget_data_get(it->obj);
1210 Elm_Controlbar_Item * item;
1212 if(wd->animating) return EXIT_FAILURE;
1214 EINA_LIST_FOREACH(wd->items, l, item)
1218 if (it->style == TABBAR)
1221 object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon");
1222 edje_object_signal_emit(_EDJ(it->base), "elm,state,pressed",
1225 else if (it->style == TOOLBAR)
1228 object_color_set(it->base, "elm.toolbar.pressed.color", "elm.swallow.icon");
1229 edje_object_signal_emit(_EDJ(it->base), "elm,state,text_selected",
1232 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb, (void *)wd);
1238 return EXIT_FAILURE;
1242 return EXIT_SUCCESS;
1245 static Evas_Object *
1246 create_item_layout(Evas_Object * parent, Elm_Controlbar_Item * it)
1250 obj = elm_layout_add(parent);
1253 fprintf(stderr, "Cannot load bg edj\n");
1256 elm_layout_theme_set(obj, "controlbar", "item",
1257 elm_widget_style_get(it->obj));
1258 evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1259 evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
1260 elm_widget_sub_object_add(it->obj, obj);
1263 edje_object_part_text_set(_EDJ(obj), "elm.text", it->label);
1267 icon = elm_icon_add(obj);
1268 if(!elm_icon_standard_set(icon, it->icon_path))
1270 elm_icon_file_set(icon, it->icon_path, NULL);
1273 evas_object_size_hint_min_set(icon, 40, 40);
1274 evas_object_size_hint_max_set(icon, 100, 100);
1275 evas_object_show(icon);
1276 edje_object_part_swallow(_EDJ(obj), "elm.swallow.icon", icon);
1279 if (it->label && it->icon)
1281 edje_object_signal_emit(_EDJ(obj), "elm,state,icon_text", "elm");
1287 edit_item_down_end_cb(void *data, Evas_Object * obj)
1289 Widget_Data * wd = (Widget_Data *) data;
1291 if (wd->animating < 0)
1293 printf("animation error\n");
1299 edit_item_return_cb(void *data, Evas_Object * obj)
1301 Evas_Coord x, y, w, h;
1302 Widget_Data * wd = (Widget_Data *) data;
1303 evas_object_geometry_get(wd->moving_item->edit_item, &x, &y, &w, &h);
1304 set_evas_map(obj, x, y, 0, 0);
1306 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb);
1307 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb);
1309 evas_object_data_set(wd->moving_obj, "returning", 0);
1311 if (wd->animating < 0)
1313 printf("animation error\n");
1319 edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1321 Evas_Event_Mouse_Move * ev = event_info;
1323 Elm_Controlbar_Item * item;
1324 Evas_Coord x, y, w, h;
1325 Widget_Data * wd = (Widget_Data *) data;
1328 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1331 x = ev->cur.output.x - w / 2;
1332 y = ev->cur.output.y - h;
1333 set_evas_map(wd->moving_obj, x, y, w, h);
1335 EINA_LIST_FOREACH(wd->items, l, item)
1337 if (wd->moving_item->edit_item == item->edit_item || item->style == OBJECT)
1339 evas_object_geometry_get(item->base, &x, &y, &w, &h);
1340 if (ev->cur.output.x > x && ev->cur.output.x < x + w && ev->cur.output.y > y && ev->cur.output.y < y + h
1343 edje_object_signal_emit(_EDJ(item->base), "elm,state,show,glow",
1348 edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
1356 edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1358 Evas_Event_Mouse_Up * ev = event_info;
1359 Evas_Coord x, y, w, h;
1360 Evas_Coord x_, y_, w_, h_;
1362 Elm_Controlbar_Item * item;
1363 Widget_Data * wd = (Widget_Data *) data;
1365 if ((int)evas_object_data_get(wd->moving_obj, "returning") == 1)
1367 evas_object_color_set(wd->moving_item->edit_item, 255, 255, 255, 255);
1369 // check which change or not
1370 EINA_LIST_FOREACH(wd->items, l, item)
1372 if (wd->moving_item->edit_item == item->edit_item)
1374 if (item->order <= 0)
1376 evas_object_geometry_get(item->base, &x, &y, &w, &h);
1377 if (ev->output.x > x && ev->output.x < x + w && ev->output.y > y && ev->output.y < y + h
1378 && item->style != OBJECT && item->editable)
1380 edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
1387 if (wd->moving_item->order > 0)
1389 item_exchange_in_bar(wd->moving_item, item);
1393 item_change_in_bar(item);
1395 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb);
1396 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb);
1401 // return moving object to original location
1402 evas_object_geometry_get(wd->moving_item->edit_item, &x_, &y_, &w_,
1404 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1407 x = ev->output.x - w / 2;
1408 y = ev->output.y - h;
1409 evas_object_data_set(wd->moving_obj, "returning", (void *)1);
1411 move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_,
1412 0.25, move_evas_map, edit_item_return_cb, wd);
1418 edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj,
1421 Evas_Event_Mouse_Down * ev = event_info;
1422 Evas_Coord x, y, w, h;
1423 Evas_Coord x_, y_, w_, h_;
1424 Widget_Data * wd = (Widget_Data *) data;
1427 Elm_Controlbar_Item * item;
1428 Evas_Object * color;
1433 EINA_LIST_FOREACH(wd->items, l, item)
1435 if (item->edit_item == obj)
1440 if (!item->editable)
1443 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb, (void *)wd);
1444 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb, (void *)wd);
1446 wd->moving_item = item;
1449 edje_object_part_object_get(_EDJ(wd->moving_item->edit_item),
1450 "elm.edit.item.color");
1452 evas_object_color_get(color, &r, &g, &b, &a);
1453 evas_object_color_set(item->edit_item, r, g, b, a);
1455 evas_object_del(wd->moving_obj);
1456 wd->moving_obj = NULL;
1457 wd->moving_obj = create_item_layout(obj, item);
1458 evas_object_geometry_get(obj, &x, &y, &w, &h);
1459 evas_object_move(wd->moving_obj, -1000, -1000);
1460 evas_object_resize(wd->moving_obj, w, h);
1461 evas_object_show(wd->moving_obj);
1464 x_ = ev->output.x - w_ / 2;
1465 y_ = ev->output.y - h_;
1467 move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_, 0.1,
1468 move_evas_map, edit_item_down_end_cb, wd);
1472 bar_item_move_end_cb(void *data, Evas_Object * obj)
1474 Widget_Data * wd = (Widget_Data *) data;
1477 Elm_Controlbar_Item * item;
1478 EINA_LIST_FOREACH(wd->items, l, item)
1480 if (item->base == obj)
1484 if (wd->animating < 0)
1486 printf("animation error\n");
1489 evas_object_data_set(obj, "animating", 0);
1493 bar_item_animation_end_check(void *data)
1497 Elm_Controlbar_Item * item;
1498 Widget_Data * wd = (Widget_Data *) data;
1500 return EXIT_FAILURE;
1501 EINA_LIST_FOREACH(wd->items, l, item)
1503 if (item->base == wd->moving_obj)
1508 printf("item is NULL\n");
1512 item->order = wd->empty_num;
1514 wd->moving_obj = NULL;
1516 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, bar_item_up_cb);
1517 evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb);
1518 return EXIT_SUCCESS;
1522 bar_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1524 Evas_Event_Mouse_Move * ev = event_info;
1526 Elm_Controlbar_Item * item, *it;
1527 Widget_Data * wd = (Widget_Data *) data;
1528 Evas_Coord x, y, w, h, x_, y_, w_, h_;
1531 if (wd->moving_obj == NULL)
1533 printf("%s : moving_obj is NULL\n", __func__);
1536 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1537 x = ev->cur.output.x - w / 2;
1538 set_evas_map(wd->moving_obj, x, y, w, h);
1539 EINA_LIST_FOREACH(wd->items, l, item)
1541 if (item->base == wd->moving_obj)
1546 if ((int)evas_object_data_get(item->base, "animating") == 1)
1548 evas_object_geometry_get(item->base, &x, &y, &w, &h);
1549 if (ev->cur.output.x > x && ev->cur.output.x < x + w && item->editable)
1556 evas_object_geometry_get(wd->moving_obj, &x_, &y_, &w_, &h_);
1557 evas_object_move(wd->moving_obj, x, y);
1558 tmp = wd->empty_num;
1559 wd->empty_num = item->order;
1561 elm_table_unpack(wd->box, item->base);
1562 elm_table_unpack(wd->box, wd->moving_obj);
1563 elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
1564 elm_table_pack(wd->box, wd->moving_obj, wd->empty_num - 1, 0, 1, 1);
1566 evas_object_data_set(item->base, "animating", (void *)1);
1567 move_object_with_animation(item->base, x, y, w, h, x_, y_, w_, h_,
1568 0.25, move_evas_map, bar_item_move_end_cb, wd);
1574 bar_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1576 Evas_Event_Mouse_Up * ev = event_info;
1577 Evas_Coord tx, x, y, w, h;
1578 Widget_Data * wd = (Widget_Data *) data;
1579 evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
1580 tx = ev->output.x - w / 2;
1581 move_object_with_animation(wd->moving_obj, tx, y, w, h, x, y, w, h, 0.25,
1582 move_evas_map, NULL, NULL);
1583 ecore_timer_add(0.1, bar_item_animation_end_check, wd);
1588 bar_item_down_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info)
1590 Widget_Data * wd = (Widget_Data *) data;
1592 Elm_Controlbar_Item * item;
1595 EINA_LIST_FOREACH(wd->items, l, item)
1597 if (item->base == obj)
1604 if (!item->editable)
1607 wd->moving_obj = obj;
1608 wd->empty_num = item->order;
1609 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, bar_item_up_cb, (void *)wd);
1610 evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb, (void *)wd);
1618 static Elm_Controlbar_Item *
1619 create_tab_item(Evas_Object * obj, const char *icon_path, const char *label,
1622 Elm_Controlbar_Item * it;
1626 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1629 wd = elm_widget_data_get(obj);
1632 fprintf(stderr, "Cannot get smart data\n");
1635 it = ELM_NEW(Elm_Controlbar_Item);
1639 it->label = eina_stringshare_add(label);
1640 it->icon_path = icon_path;
1641 it->selected = EINA_FALSE;
1642 it->editable = EINA_TRUE;
1647 it->base = create_item_layout(wd->edje, it);
1648 evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
1649 bar_item_down_cb, wd);
1650 //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm",
1651 // clicked_box_cb, wd);
1652 object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
1653 evas_object_show(it->base);
1654 it->edit_item = create_item_layout(wd->edje, it);
1655 evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN,
1656 edit_item_down_cb, wd);
1657 evas_object_show(it->edit_item);
1662 static Elm_Controlbar_Item *
1663 create_tool_item(Evas_Object * obj, const char *icon_path, const char *label,
1664 void (*func) (const void *data, Evas_Object * obj,
1665 void *event_info), const void *data)
1667 Elm_Controlbar_Item * it;
1671 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1674 wd = elm_widget_data_get(obj);
1677 fprintf(stderr, "Cannot get smart data\n");
1680 it = ELM_NEW(Elm_Controlbar_Item);
1684 it->label = eina_stringshare_add(label);
1685 it->icon_path = icon_path;
1686 it->selected = EINA_FALSE;
1687 it->editable = EINA_TRUE;
1692 it->style = TOOLBAR;
1693 it->base = create_item_layout(wd->edje, it);
1694 evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
1695 bar_item_down_cb, wd);
1696 //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm",
1697 // clicked_box_cb, wd);
1698 object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
1699 evas_object_show(it->base);
1700 it->edit_item = create_item_layout(wd->edje, it);
1701 evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN,
1702 edit_item_down_cb, wd);
1703 evas_object_show(it->edit_item);
1707 static Elm_Controlbar_Item *
1708 create_object_item(Evas_Object * obj, Evas_Object * obj_item, const int sel)
1710 Elm_Controlbar_Item * it;
1714 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1717 wd = elm_widget_data_get(obj);
1720 fprintf(stderr, "Cannot get smart data\n");
1723 it = ELM_NEW(Elm_Controlbar_Item);
1730 it->base = obj_item;
1735 set_items_position(Evas_Object * obj, Elm_Controlbar_Item * it,
1736 Elm_Controlbar_Item * mit, Eina_Bool bar)
1741 Elm_Controlbar_Item * item;
1744 int check = EINA_FALSE;
1752 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
1755 wd = elm_widget_data_get(obj);
1758 fprintf(stderr, "Cannot get smart data\n");
1762 EINA_LIST_FOREACH(wd->items, l, item)
1764 if (item == mit && item->order > 0)
1768 it->order = mit->order;
1772 if(item->order > 0){
1773 // printf("%s +_+_+_+_+_+ %d \n", item->label, item->order);
1774 elm_table_unpack(wd->box, item->base);
1775 item->order += it->sel;
1776 elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1);
1778 if (item->style != OBJECT && it->style != OBJECT)
1780 // printf("%s +_+_+_+_+_+ edit :: %d\n", item->label, i);
1781 elm_table_unpack(wd->edit_table, item->edit_item);
1782 elm_table_pack(wd->edit_table, item->edit_item,
1783 i % EDIT_ROW_NUM, i / EDIT_ROW_NUM, 1, 1);
1786 if (item->style != OBJECT)
1788 if(item->order > 0) order += item->sel;
1799 if(bar) elm_table_pack(wd->box, it->base, it->order - 1, 0, it->sel, 1);
1800 else evas_object_hide(it->base);
1801 if (it->style != OBJECT)
1802 elm_table_pack(wd->edit_table, it->edit_item, (edit - 1) % EDIT_ROW_NUM,
1803 (edit - 1) / EDIT_ROW_NUM, 1, 1);
1806 static Elm_Controlbar_Item *
1807 create_more_item(Widget_Data *wd)
1809 Elm_Controlbar_Item * it;
1811 it = ELM_NEW(Elm_Controlbar_Item);
1814 it->obj = wd->object;
1815 it->label = eina_stringshare_add("more");
1816 it->icon_path = CONTROLBAR_SYSTEM_ICON_MORE;
1817 it->selected = EINA_FALSE;
1822 it->base = create_item_layout(wd->edje, it);
1823 evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
1824 bar_item_down_cb, wd);
1825 object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
1826 evas_object_show(it->base);
1827 it->edit_item = create_item_layout(wd->edje, it);
1828 evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN,
1829 edit_item_down_cb, wd);
1830 evas_object_show(it->edit_item);
1832 set_items_position(it->obj, it, NULL, EINA_TRUE);
1834 wd->items = eina_list_append(wd->items, it);
1838 elm_controlbar_item_editable_set(it, EINA_FALSE);
1840 wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb);
1843 ///////////////////////////////////////////////////////////////////
1847 ////////////////////////////////////////////////////////////////////
1850 * Add a new controlbar object
1852 * @param parent The parent object
1853 * @return The new object or NULL if it cannot be created
1855 * @ingroup Controlbar
1857 EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent)
1859 Evas_Object * obj = NULL;
1860 Evas_Object * bg = NULL;
1861 Widget_Data * wd = NULL;
1862 Evas_Coord x, y, w, h;
1863 Evas_Object * r_button;
1864 wd = ELM_NEW(Widget_Data);
1865 wd->evas = evas_object_evas_get(parent);
1866 if (wd->evas == NULL)
1868 obj = elm_widget_add(wd->evas);
1871 elm_widget_type_set(obj, "controlbar");
1872 elm_widget_sub_object_add(parent, obj);
1873 elm_widget_data_set(obj, wd);
1874 elm_widget_del_hook_set(obj, _del_hook);
1875 elm_widget_theme_hook_set(obj, _theme_hook);
1878 wd->parent = parent;
1879 evas_object_geometry_get(parent, &x, &y, &w, &h);
1885 wd->mode = ELM_CONTROLBAR_MODE_DEFAULT;
1888 wd->edit_mode = EINA_FALSE;
1889 wd->init_animation = EINA_FALSE;
1890 wd->selected_animation = EINA_FALSE;
1891 wd->view = elm_layout_add(wd->parent); //edje_object_add(wd->evas);
1892 elm_layout_theme_set(wd->view, "controlbar", "view", "default");
1893 //_elm_theme_object_set(obj, wd->view, "controlbar", "view", "default");
1894 if (wd->view == NULL)
1896 printf("Cannot load bg edj\n");
1899 evas_object_show(wd->view);
1902 wd->edit_box = edje_object_add(wd->evas);
1903 _elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box",
1905 if (wd->edit_box == NULL)
1907 printf("Cannot load bg edj\n");
1910 evas_object_show(wd->edit_box);
1912 //instead of navigationbar
1913 /* r_button = elm_button_add(wd->edit_box);
1914 elm_button_label_set(r_button, "Done");
1915 evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd);
1916 edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", r_button);
1918 // navigationbar will contribution. but not yet
1919 wd->navigation = elm_navigationbar_add(wd->edit_box);
1920 r_button = elm_button_add(wd->navigation);
1921 elm_button_label_set(r_button, "Done");
1922 evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd);
1923 elm_navigationbar_push(wd->navigation, "Configure", NULL, r_button, NULL, NULL);
1924 edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", wd->navigation);
1926 wd->edit_table = elm_table_add(wd->edit_box);
1927 elm_table_homogenous_set(wd->edit_table, EINA_TRUE);
1928 edje_object_part_swallow(wd->edit_box, "elm.swallow.table", wd->edit_table);
1930 /* load background edj */
1931 wd->edje = edje_object_add(wd->evas);
1932 _elm_theme_object_set(obj, wd->edje, "controlbar", "base", "default");
1933 if (wd->edje == NULL)
1935 printf("Cannot load bg edj\n");
1938 evas_object_show(wd->edje);
1941 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_RESIZE,
1942 _controlbar_object_resize, obj);
1943 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_MOVE,
1944 _controlbar_object_move, obj);
1945 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_SHOW,
1946 _controlbar_object_show, obj);
1947 evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_HIDE,
1948 _controlbar_object_hide, obj);
1949 bg = (Evas_Object *)edje_object_part_object_get(wd->edje, "bg_image");
1950 evas_object_event_callback_add(bg, EVAS_CALLBACK_MOVE, _controlbar_object_move, obj);
1951 evas_object_event_callback_add(bg, EVAS_CALLBACK_RESIZE, _controlbar_object_resize, obj);
1953 wd->selected_box = edje_object_add(wd->evas);
1954 _elm_theme_object_set(obj, wd->selected_box, "controlbar", "item_bg", "default");
1955 evas_object_hide(wd->selected_box);
1958 wd->box = elm_table_add(wd->edje);
1959 elm_table_homogenous_set(wd->box, EINA_TRUE);
1960 evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND,
1962 evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
1963 // edje_object_part_swallow(wd->edje, "elm.swallow.items", wd->box);
1964 elm_widget_sub_object_add(obj, wd->box);
1965 evas_object_show(wd->box);
1967 wd->event_box = evas_object_rectangle_add(wd->evas);
1968 evas_object_color_set(wd->event_box, 255, 255, 255, 0);
1969 evas_object_repeat_events_set(wd->event_box, EINA_TRUE);
1970 evas_object_show(wd->event_box);
1973 // evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
1974 evas_object_smart_member_add(wd->view, obj);
1975 evas_object_smart_member_add(wd->edit_box, obj);
1976 elm_widget_resize_object_set(obj, wd->edje);
1977 evas_object_smart_member_add(wd->selected_box, obj);
1978 evas_object_smart_member_add(wd->box, obj);
1979 evas_object_smart_member_add(wd->event_box, obj);
1987 * Append new tab item
1989 * @param obj The controlbar object
1990 * @param icon_path The icon path of item
1991 * @param label The label of item
1992 * @param view The view of item
1993 * @return The item of controlbar
1995 * @ingroup Controlbar
1997 EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj,
2004 Elm_Controlbar_Item * it;
2005 Elm_Controlbar_Item * lit;
2007 it = create_tab_item(obj, icon_path, label, view);
2010 wd = elm_widget_data_get(obj);
2011 if(check_bar_item_number(wd) >= 5){
2012 if(!wd->more_item) {
2013 lit = elm_controlbar_last_item_get(obj);
2014 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2015 create_more_item(wd);
2017 set_items_position(obj, it, NULL, EINA_FALSE);
2020 set_items_position(obj, it, NULL, EINA_TRUE);
2022 if(wd->init_animation) evas_object_hide(it->base);
2023 wd->items = eina_list_append(wd->items, it);
2031 * Prepend new tab item
2033 * @param obj The controlbar object
2034 * @param icon_path The icon path of item
2035 * @param label The label of item
2036 * @param view The view of item
2037 * @return The item of controlbar
2039 * @ingroup Controlbar
2041 EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_prepend(Evas_Object *
2051 Elm_Controlbar_Item * it;
2052 Elm_Controlbar_Item * lit;
2053 Elm_Controlbar_Item * item;
2054 it = create_tab_item(obj, icon_path, label, view);
2057 wd = elm_widget_data_get(obj);
2058 item = eina_list_data_get(wd->items);
2059 if(check_bar_item_number(wd) >= 5){
2060 if(!wd->more_item) {
2061 lit = elm_controlbar_last_item_get(obj);
2062 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2063 create_more_item(wd);
2065 lit = elm_controlbar_item_prev(wd->more_item);
2066 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2067 set_items_position(obj, it, item, EINA_TRUE);
2070 set_items_position(obj, it, item, EINA_TRUE);
2072 wd->items = eina_list_prepend(wd->items, it);
2080 * Insert new tab item before given item
2082 * @param obj The controlbar object
2083 * @param before The given item
2084 * @param icon_path The icon path of item
2085 * @param label The label of item
2086 * @param view The view of item
2087 * @return The item of controlbar
2089 * @ingroup Controlbar
2091 EAPI Elm_Controlbar_Item *
2092 elm_controlbar_tab_item_insert_before(Evas_Object * obj,
2093 Elm_Controlbar_Item * before,
2094 const char *icon_path,
2095 const char *label, Evas_Object * view)
2098 Elm_Controlbar_Item * it;
2099 Elm_Controlbar_Item * lit;
2102 it = create_tab_item(obj, icon_path, label, view);
2105 wd = elm_widget_data_get(obj);
2106 if(check_bar_item_number(wd) >= 5){
2109 lit = elm_controlbar_last_item_get(obj);
2110 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2111 create_more_item(wd);
2113 if(before->order > 0)
2115 lit = elm_controlbar_item_prev(wd->more_item);
2116 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2117 set_items_position(obj, it, before, EINA_TRUE);
2121 set_items_position(obj, it, before, EINA_FALSE);
2125 set_items_position(obj, it, before, EINA_TRUE);
2127 wd->items = eina_list_prepend_relative(wd->items, it, before);
2135 * Insert new tab item after given item
2137 * @param obj The controlbar object
2138 * @param after The given item
2139 * @param icon_path The icon path of item
2140 * @param label The label of item
2141 * @param view The view of item
2142 * @return The item of controlbar
2144 * @ingroup Controlbar
2146 EAPI Elm_Controlbar_Item *
2147 elm_controlbar_tab_item_insert_after(Evas_Object * obj,
2148 Elm_Controlbar_Item * after,
2149 const char *icon_path, const char *label,
2153 Elm_Controlbar_Item * it;
2154 Elm_Controlbar_Item * lit;
2155 Elm_Controlbar_Item * item;
2158 it = create_tab_item(obj, icon_path, label, view);
2161 wd = elm_widget_data_get(obj);
2162 item = elm_controlbar_item_next(after);
2163 if(check_bar_item_number(wd) >= 5){
2166 lit = elm_controlbar_last_item_get(obj);
2167 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2168 create_more_item(wd);
2172 lit = elm_controlbar_item_prev(wd->more_item);
2173 elm_controlbar_item_visible_set(lit, EINA_FALSE);
2174 set_items_position(obj, it, item, EINA_TRUE);
2178 set_items_position(obj, it, item, EINA_FALSE);
2182 set_items_position(obj, it, item, EINA_TRUE);
2184 wd->items = eina_list_append_relative(wd->items, it, after);
2192 * Append new tool item
2194 * @param obj The controlbar object
2195 * @param icon_path The icon path of item
2196 * @param label The label of item
2197 * @param func Callback function of item
2198 * @param data The data of callback function
2199 * @return The item of controlbar
2201 * @ingroup Controlbar
2203 EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_append(Evas_Object *
2218 Elm_Controlbar_Item * it;
2220 it = create_tool_item(obj, icon_path, label, func, data);
2223 wd = elm_widget_data_get(obj);
2224 set_items_position(obj, it, NULL, EINA_TRUE);
2225 wd->items = eina_list_append(wd->items, it);
2231 * Prepend new tool item
2233 * @param obj The controlbar object
2234 * @param icon_path The icon path of item
2235 * @param label The label of item
2236 * @param func Callback function of item
2237 * @param data The data of callback function
2238 * @return The item of controlbar
2240 * @ingroup Controlbar
2242 EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_prepend(Evas_Object *
2259 Elm_Controlbar_Item * it;
2260 Elm_Controlbar_Item * item;
2261 it = create_tool_item(obj, icon_path, label, func, data);
2264 wd = elm_widget_data_get(obj);
2265 item = eina_list_data_get(wd->items);
2266 set_items_position(obj, it, item, EINA_TRUE);
2267 wd->items = eina_list_prepend(wd->items, it);
2273 * Insert new tool item before given item
2275 * @param obj The controlbar object
2276 * @param before The given item
2277 * @param icon_path The icon path of item
2278 * @param label The label of item
2279 * @param func Callback function of item
2280 * @param data The data of callback function
2281 * @return The item of controlbar
2283 * @ingroup Controlbar
2285 EAPI Elm_Controlbar_Item *
2286 elm_controlbar_tool_item_insert_before(Evas_Object * obj,
2287 Elm_Controlbar_Item * before,
2288 const char *icon_path,
2290 void (*func) (const void *data,
2296 Elm_Controlbar_Item * it;
2299 it = create_tool_item(obj, icon_path, label, func, data);
2302 wd = elm_widget_data_get(obj);
2303 set_items_position(obj, it, before, EINA_TRUE);
2304 wd->items = eina_list_prepend_relative(wd->items, it, before);
2310 * Insert new tool item after given item
2312 * @param obj The controlbar object
2313 * @param after The given item
2314 * @param icon_path The icon path of item
2315 * @param label The label of item
2316 * @param func Callback function of item
2317 * @param data The data of callback function
2318 * @return The item of controlbar
2320 * @ingroup Controlbar
2322 EAPI Elm_Controlbar_Item *
2323 elm_controlbar_tool_item_insert_after(Evas_Object * obj,
2324 Elm_Controlbar_Item * after,
2325 const char *icon_path,
2327 void (*func) (const void *data,
2333 Elm_Controlbar_Item * it;
2334 Elm_Controlbar_Item * item;
2337 it = create_tool_item(obj, icon_path, label, func, data);
2340 wd = elm_widget_data_get(obj);
2341 item = elm_controlbar_item_next(after);
2342 set_items_position(obj, it, item, EINA_TRUE);
2343 wd->items = eina_list_append_relative(wd->items, it, after);
2349 * Append new object item
2351 * @param obj The controlbar object
2352 * @param obj_item The object of item
2353 * @param sel The number of sel occupied
2354 * @return The item of controlbar
2356 * @ingroup Controlbar
2358 EAPI Elm_Controlbar_Item * elm_controlbar_object_item_append(Evas_Object *
2365 Elm_Controlbar_Item * it;
2366 it = create_object_item(obj, obj_item, sel);
2369 wd = elm_widget_data_get(obj);
2370 set_items_position(obj, it, NULL, EINA_TRUE);
2371 wd->items = eina_list_append(wd->items, it);
2377 * Prepend new object item
2379 * @param obj The controlbar object
2380 * @param obj_item The object of item
2381 * @param sel The number of sel occupied
2382 * @return The item of controlbar
2384 * @ingroup Controlbar
2386 EAPI Elm_Controlbar_Item * elm_controlbar_object_item_prepend(Evas_Object *
2393 Elm_Controlbar_Item * it;
2394 Elm_Controlbar_Item * item;
2395 it = create_object_item(obj, obj_item, sel);
2398 wd = elm_widget_data_get(obj);
2399 item = eina_list_data_get(wd->items);
2400 set_items_position(obj, it, item, EINA_TRUE);
2401 wd->items = eina_list_prepend(wd->items, it);
2407 * Insert new object item before given item
2409 * @param obj The controlbar object
2410 * @param before The given item
2411 * @param obj_item The object of item
2412 * @param sel The number of sel occupied
2413 * @return The item of controlbar
2415 * @ingroup Controlbar
2417 EAPI Elm_Controlbar_Item *
2418 elm_controlbar_object_item_insert_before(Evas_Object * obj,
2419 Elm_Controlbar_Item * before,
2420 Evas_Object * obj_item, const int sel)
2423 Elm_Controlbar_Item * it;
2426 it = create_object_item(obj, obj_item, sel);
2429 wd = elm_widget_data_get(obj);
2430 set_items_position(obj, it, before, EINA_TRUE);
2431 wd->items = eina_list_prepend_relative(wd->items, it, before);
2437 * Insert new object item after given item
2439 * @param obj The controlbar object
2440 * @param after The given item
2441 * @param obj_item The object of item
2442 * @param sel The number of sel occupied
2443 * @return The item of controlbar
2445 * @ingroup Controlbar
2447 EAPI Elm_Controlbar_Item *
2448 elm_controlbar_object_item_insert_after(Evas_Object * obj,
2449 Elm_Controlbar_Item * after,
2450 Evas_Object * obj_item, const int sel)
2453 Elm_Controlbar_Item * it;
2454 Elm_Controlbar_Item * item;
2457 it = create_object_item(obj, obj_item, sel);
2460 wd = elm_widget_data_get(obj);
2461 item = elm_controlbar_item_next(after);
2462 set_items_position(obj, it, item, EINA_TRUE);
2463 wd->items = eina_list_append_relative(wd->items, it, after);
2469 * Delete item from controlbar
2471 * @param it The item of controlbar
2473 * @ingroup Controlbar
2476 elm_controlbar_item_del(Elm_Controlbar_Item * it)
2482 Elm_Controlbar_Item * item;
2490 if (it->obj == NULL)
2492 printf("Invalid argument: controlbar object is NULL\n");
2495 wd = elm_widget_data_get(it->obj);
2498 printf("Cannot get smart data\n");
2505 elm_table_unpack(wd->box, it->base);
2507 EINA_LIST_FOREACH(wd->items, l, item)
2511 if (item->order > it->order)
2513 elm_table_unpack(wd->box, item->base);
2515 elm_table_pack(wd->box, item->base, item->order - 1, 0,
2528 if (it->edit_item != NULL)
2530 elm_table_unpack(wd->edit_table, it->edit_item);
2531 EINA_LIST_FOREACH(wd->items, l, item)
2535 if (item->edit_item != NULL)
2537 elm_table_unpack(wd->edit_table, item->edit_item);
2538 elm_table_pack(wd->edit_table, item->edit_item,
2539 (i - 1) % 4, (i - 1) / 4, 1, 1);
2542 if (it == item && item->style != OBJECT)
2547 if (item->style != OBJECT)
2552 // delete item in list
2554 eina_stringshare_del(it->label);
2556 evas_object_del(it->icon);
2559 if (it->style != OBJECT)
2560 evas_object_del(it->base);
2563 evas_object_hide(it->base);
2567 //edje_object_part_unswallow(wd->view, it->view);
2568 if(it->selected) elm_layout_content_unset(wd->view, "elm.swallow.view");
2569 evas_object_hide(it->view);
2572 evas_object_del(it->edit_item);
2573 wd->items = eina_list_remove(wd->items, it);
2574 wd->num = wd->num - 1;
2579 * Select item in controlbar
2581 * @param it The item of controlbar
2583 * @ingroup Controlbar
2586 elm_controlbar_item_select(Elm_Controlbar_Item * it)
2588 if (it->obj == NULL)
2590 Widget_Data * wd = elm_widget_data_get(it->obj);
2600 * Get the icon of item
2602 * @param it The item of controlbar
2603 * @return The icon object
2605 * @ingroup Controlbar
2607 EAPI Evas_Object * elm_controlbar_item_icon_get(Elm_Controlbar_Item * it)
2613 * Get the label of item
2615 * @param it The item of controlbar
2616 * @return The label of item
2618 * @ingroup Controlbar
2621 elm_controlbar_item_label_get(Elm_Controlbar_Item * it)
2627 * Set the label of item
2629 * @param it The item of controlbar
2630 * @param label The label of item
2632 * @ingroup Controlbar
2635 elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label)
2639 edje_object_part_text_set(it->base, "elm.text", label);
2643 * Get the selected item.
2645 * @param obj The controlbar object
2646 * @return The item of controlbar
2648 * @ingroup Controlbar
2650 EAPI Elm_Controlbar_Item * elm_controlbar_selected_item_get(Evas_Object *
2655 Elm_Controlbar_Item * item;
2658 Widget_Data * wd = elm_widget_data_get(obj);
2659 if (!wd || !wd->items)
2661 EINA_LIST_FOREACH(wd->items, l, item)
2670 * Get the first item.
2672 * @param obj The controlbar object
2673 * @return The item of controlbar
2675 * @ingroup Controlbar
2677 EAPI Elm_Controlbar_Item * elm_controlbar_first_item_get(Evas_Object * obj)
2681 Widget_Data * wd = elm_widget_data_get(obj);
2682 if (!wd || !wd->items)
2684 return eina_list_data_get(wd->items);
2688 * Get the last item.
2690 * @param obj The controlbar object
2691 * @return The item of controlbar
2693 * @ingroup Controlbar
2695 EAPI Elm_Controlbar_Item * elm_controlbar_last_item_get(Evas_Object * obj)
2699 Widget_Data * wd = elm_widget_data_get(obj);
2700 if (!wd || !wd->items)
2702 return eina_list_data_get(eina_list_last(wd->items));
2708 * @param obj The controlbar object
2709 * @return The list of the items
2711 * @ingroup Controlbar
2713 EAPI Eina_List * elm_controlbar_items_get(Evas_Object * obj)
2717 Widget_Data * wd = elm_widget_data_get(obj);
2718 if (!wd || !wd->items)
2724 * Get the previous item.
2726 * @param it The item of controlbar
2727 * @return The previous item of the parameter item
2729 * @ingroup Controlbar
2731 EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item *
2736 Elm_Controlbar_Item * item;
2737 if (it->obj == NULL)
2739 Widget_Data * wd = elm_widget_data_get(it->obj);
2740 if (!wd || !wd->items)
2742 EINA_LIST_FOREACH(wd->items, l, item)
2746 l = eina_list_prev(l);
2749 return eina_list_data_get(l);
2756 * Get the next item.
2758 * @param obj The controlbar object
2759 * @return The next item of the parameter item
2761 * @ingroup Controlbar
2763 EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item *
2768 Elm_Controlbar_Item * item;
2769 if (it->obj == NULL)
2771 Widget_Data * wd = elm_widget_data_get(it->obj);
2772 if (!wd || !wd->items)
2774 EINA_LIST_FOREACH(wd->items, l, item)
2778 l = eina_list_next(l);
2781 return eina_list_data_get(l);
2790 * @param The controlbar object
2792 * @ingroup Controlbar
2795 elm_controlbar_edit_start(Evas_Object * obj)
2797 printf("\n==================================\n");
2798 printf("%s\n", __func__);
2799 printf("==================================\n");
2800 printf("This API is just for test.\n");
2801 printf("Please don't use it!!\n");
2802 printf("Thank you.\n");
2803 printf("==================================\n");
2808 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
2811 wd = elm_widget_data_get(obj);
2814 fprintf(stderr, "Cannot get smart data\n");
2817 edje_object_signal_emit(wd->edit_box, "elm,state,show,edit_box", "elm");
2818 wd->edit_mode = EINA_TRUE;
2824 * @param it The item of controlbar
2825 * @param bar true or false
2827 * @ingroup Controlbar
2830 elm_controlbar_item_visible_set(Elm_Controlbar_Item * it, Eina_Bool bar)
2832 Eina_Bool check = EINA_TRUE;
2833 if (it->obj == NULL)
2835 Widget_Data * wd = elm_widget_data_get(it->obj);
2836 if (!wd || !wd->items)
2844 item_insert_in_bar(it, 0);
2848 item_delete_in_bar(it);
2850 wd->items = eina_list_sort(wd->items, eina_list_count(wd->items), sort_cb);
2851 _sizing_eval(it->obj);
2857 * @param it The item of controlbar
2858 * @param bar true or false
2860 * @ingroup Controlbar
2863 elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable)
2865 Evas_Object * color;
2868 it->editable = editable;
2870 (Evas_Object *) edje_object_part_object_get(_EDJ(it->edit_item),
2871 "elm.edit.item.color");
2873 evas_object_color_get(color, &r, &g, &b, &a);
2874 evas_object_color_set(it->edit_item, r, g, b, a);
2878 * Set the default view
2880 * @param obj The controlbar object
2881 * @param view The default view
2883 * @ingroup Controlbar
2886 elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view)
2888 printf("\n==================================\n");
2889 printf("%s\n", __func__);
2890 printf("==================================\n");
2891 printf("This API is just for test.\n");
2892 printf("Please don't use it!!\n");
2893 printf("Thank you.\n");
2894 printf("==================================\n");
2899 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
2902 wd = elm_widget_data_get(obj);
2905 fprintf(stderr, "Cannot get smart data\n");
2908 wd->view_content = view;
2909 //edje_object_part_swallow(wd->view, "elm.swallow.view", wd->view_content);
2910 elm_layout_content_set(wd->view, "elm.swallow.view", wd->view_content);
2914 * Set the view of the item
2916 * @param it The item of controlbar
2917 * @param view The view for the item
2919 * @ingroup Controlbar
2922 elm_controlbar_item_view_set(Elm_Controlbar_Item *it, Evas_Object * view)
2928 * Set the mode of the controlbar
2930 * @param obj The object of the controlbar
2931 * @param mode The mode of the controlbar
2933 * @ingroup Controlbar
2936 elm_controlbar_mode_set(Evas_Object *obj, int mode)
2942 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
2945 wd = elm_widget_data_get(obj);
2948 fprintf(stderr, "Cannot get smart data\n");
2952 if(wd->mode == mode) return;
2956 case ELM_CONTROLBAR_MODE_DEFAULT:
2957 edje_object_signal_emit(wd->edje, "elm,state,default", "elm");
2959 case ELM_CONTROLBAR_MODE_LARGE:
2960 edje_object_signal_emit(wd->edje, "elm,state,large", "elm");
2962 case ELM_CONTROLBAR_MODE_SMALL:
2963 edje_object_signal_emit(wd->edje, "elm,state,small", "elm");
2971 init_animation(void *data)
2974 Elm_Controlbar_Item * item;
2975 Widget_Data * wd = (Widget_Data *)data;
2977 wd->visible_items = eina_list_free(wd->visible_items);
2978 EINA_LIST_FOREACH(wd->items, l, item)
2982 wd->visible_items = eina_list_append(wd->visible_items, item->base);
2987 wd->ani_func(wd->ani_data, wd->object, wd->visible_items);
2989 return EXIT_SUCCESS;
2994 * Set the animation of the controlbar
2996 * @param obj The object of the controlbar
2997 * @param mode The mode of the controlbar
2999 * @ingroup Controlbar
3002 elm_controlbar_animation_set(Evas_Object *obj, void (*func) (const void *data, Evas_Object *obj, void *event_info), const void *data)
3004 printf("\n==================================\n");
3005 printf("%s\n", __func__);
3006 printf("==================================\n");
3007 printf("This API is just for test.\n");
3008 printf("Please don't use it!!\n");
3009 printf("Thank you.\n");
3010 printf("==================================\n");
3015 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
3018 wd = elm_widget_data_get(obj);
3021 fprintf(stderr, "Cannot get smart data\n");
3027 wd->init_animation = EINA_TRUE;
3029 wd->ani_func = func;
3030 wd->ani_data = data;
3032 ecore_idler_add(init_animation, wd);
3037 * Set the animation of the controlbar
3039 * @param obj The object of the controlbar
3040 * @param mode The mode of the controlbar
3042 * @ingroup Controlbar
3045 elm_controlbar_item_animation_set(Evas_Object *obj, Eina_Bool auto_animation, Eina_Bool selected_animation)
3047 printf("\n==================================\n");
3048 printf("%s\n", __func__);
3049 printf("==================================\n");
3050 printf("This API is just for test.\n");
3051 printf("Please don't use it!!\n");
3052 printf("Thank you.\n");
3053 printf("==================================\n");
3058 fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
3061 wd = elm_widget_data_get(obj);
3064 fprintf(stderr, "Cannot get smart data\n");
3068 if(auto_animation && !wd->effect_timer)
3070 wd->effect_timer = ecore_timer_add(1, item_animation_effect, wd);
3074 if(wd->effect_timer) ecore_timer_del(wd->effect_timer);
3075 wd->effect_timer = NULL;
3078 wd->selected_animation = selected_animation;