Evas_Object * box;
Evas_Object * event_box;
- //Evas_Object *center_box;
- Evas_Object * rect;
Evas_Object * moving_obj;
Elm_Controlbar_Item * moving_item;
+ Elm_Controlbar_Item * pre_item;
+ Elm_Controlbar_Item * cur_item;
Evas_Coord x, y, w, h;
Eina_Bool edit_mode;
+ int mode;
int empty_num;
int num;
Eina_List * items;
Evas_Coord th;
unsigned int start_time;
double time;
- void (*func) (void *data, Evas_Object * obj);
+ int (*func) (void *data, Evas_Object * obj);
void *data;
Ecore_Animator * timer;
};
wd->event_box = NULL;
}
EINA_LIST_FREE(wd->items, item)
- {
- eina_stringshare_del(item->label);
- if (item->icon)
- evas_object_del(item->icon);
- if (item->base)
- evas_object_del(item->base);
- if (item->edit_item)
- evas_object_del(item->edit_item);
- free(item);
- item = NULL;
- }
+ {
+ eina_stringshare_del(item->label);
+ if (item->icon)
+ evas_object_del(item->icon);
+ if (item->base)
+ evas_object_del(item->base);
+ if (item->edit_item)
+ evas_object_del(item->edit_item);
+ free(item);
+ item = NULL;
+ }
free(wd);
wd = NULL;
}
_elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box",
elm_widget_style_get(obj));
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->style != OBJECT)
- {
- elm_layout_theme_set(item->base, "controlbar", "item",
- elm_widget_style_get(obj));
- object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
- elm_layout_theme_set(item->edit_item, "controlbar", "item",
- elm_widget_style_get(obj));
- if (!item->editable)
- {
- color =
- (Evas_Object *)
- edje_object_part_object_get(_EDJ(item->edit_item),
- "elm.edit.item.color");
- if (color)
- evas_object_color_get(color, &r, &g, &b, &a);
- evas_object_color_set(item->edit_item, r, g, b, a);
- }
- if (item->label)
- {
- edje_object_part_text_set(_EDJ(item->base), "elm.text",
- item->label);
- edje_object_part_text_set(_EDJ(item->edit_item), "elm.text",
- item->label);
- }
- if (item->label && item->icon)
- {
- edje_object_signal_emit(_EDJ(item->base),
- "elm,state,icon_text", "elm");
- edje_object_signal_emit(_EDJ(item->edit_item),
- "elm,state,icon_text", "elm");
- }
- if (item->selected)
- {
- selected_box(item);
- }
- }
- }
+ {
+ if (item->style != OBJECT)
+ {
+ elm_layout_theme_set(item->base, "controlbar", "item",
+ elm_widget_style_get(obj));
+ object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
+ elm_layout_theme_set(item->edit_item, "controlbar", "item",
+ elm_widget_style_get(obj));
+ if (!item->editable)
+ {
+ color =
+ (Evas_Object *)
+ edje_object_part_object_get(_EDJ(item->edit_item),
+ "elm.edit.item.color");
+ if (color)
+ evas_object_color_get(color, &r, &g, &b, &a);
+ evas_object_color_set(item->edit_item, r, g, b, a);
+ }
+ if (item->label)
+ {
+ edje_object_part_text_set(_EDJ(item->base), "elm.text",
+ item->label);
+ edje_object_part_text_set(_EDJ(item->edit_item), "elm.text",
+ item->label);
+ }
+ if (item->label && item->icon)
+ {
+ edje_object_signal_emit(_EDJ(item->base),
+ "elm,state,icon_text", "elm");
+ edje_object_signal_emit(_EDJ(item->edit_item),
+ "elm,state,icon_text", "elm");
+ }
+ if (item->selected)
+ {
+ selected_box(item);
+ }
+ }
+ }
}
static void
set_evas_map(Evas_Object * obj, Evas_Coord x, Evas_Coord y, Evas_Coord w,
Evas_Coord h)
{
- if (!obj) return;
-
+ if (obj == NULL)
+ {
+ return;
+ }
Evas_Map * map = evas_map_new(4);
- if (!map) return;
-
+ if (map == NULL)
+ return;
evas_map_smooth_set(map, EINA_TRUE);
evas_map_util_points_populate_from_object_full(map, obj, 0);
evas_object_map_enable_set(obj, EINA_TRUE);
return EXIT_FAILURE;
}
+
+static int
+move_evas_object(void *data)
+{
+ double t;
+
+ int dx, dy, dw, dh;
+
+ int px, py, pw, ph;
+
+ int x, y, w, h;
+
+ Animation_Data * ad = (Animation_Data *) data;
+ t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
+ dx = ad->tx - ad->fx;
+ dy = ad->ty - ad->fy;
+ dw = ad->tw - ad->fw;
+ dh = ad->th - ad->fh;
+ if (t <= ad->time)
+ {
+ x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
+ y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
+ w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
+ h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
+ }
+ else
+ {
+ x = dx;
+ y = dy;
+ w = dw;
+ h = dh;
+ }
+ px = ad->fx + x;
+ py = ad->fy + y;
+ pw = ad->fw + w;
+ ph = ad->fh + h;
+ if (x == dx && y == dy && w == dw && h == dh)
+ {
+ ecore_animator_del(ad->timer);
+ ad->timer = NULL;
+ evas_object_move(ad->obj, px, py);
+ evas_object_resize(ad->obj, pw, ph);
+ if (ad->func != NULL)
+ ad->func(ad->data, ad->obj);
+ }
+ else
+ {
+ evas_object_move(ad->obj, px, py);
+ evas_object_resize(ad->obj, pw, ph);
+ }
+ return EXIT_FAILURE;
+}
+
+static int
+move_fade_out_object(void *data)
+{
+ double t;
+
+ int dx, dy, dw, dh, da;
+
+ int px, py, pw, ph, pa;
+
+ int x, y, w, h, a;
+
+ int r, g, b;
+
+ Animation_Data * ad = (Animation_Data *) data;
+ t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
+ dx = ad->tx - ad->fx;
+ dy = ad->ty - ad->fy;
+ dw = ad->tw - ad->fw;
+ dh = ad->th - ad->fh;
+ da = 255;
+ if (t <= ad->time)
+ {
+ x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
+ y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
+ w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
+ h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
+ a = (1 * sin((t / ad->time) * (M_PI / 2)) * da);
+ }
+ else
+ {
+ x = dx;
+ y = dy;
+ w = dw;
+ h = dh;
+ a = da;
+ }
+ px = ad->fx + x;
+ py = ad->fy + y;
+ pw = ad->fw + w;
+ ph = ad->fh + h;
+ pa = 255 - a;
+ if (x == dx && y == dy && w == dw && h == dh)
+ {
+ ecore_animator_del(ad->timer);
+ ad->timer = NULL;
+ evas_object_move(ad->obj, px, py);
+ //evas_object_resize(ad->obj, 480, 600);
+ evas_object_resize(ad->obj, pw, ph);
+ evas_object_color_get(ad->obj, &r, &g, &b, &a);
+ evas_object_color_set(ad->obj, r, g, b, pa);
+ evas_object_show(ad->obj);
+ if (ad->func != NULL)
+ ad->func(ad->data, ad->obj);
+ }
+ else
+ {
+ evas_object_move(ad->obj, px, py);
+ //evas_object_resize(ad->obj, 480, 600);
+ evas_object_resize(ad->obj, pw, ph);
+ evas_object_color_get(ad->obj, &r, &g, &b, &a);
+ evas_object_color_set(ad->obj, r, g, b, pa);
+ evas_object_show(ad->obj);
+ }
+ return EXIT_FAILURE;
+}
+
+static int
+move_fade_in_object(void *data)
+{
+ double t;
+
+ int dx, dy, dw, dh, da;
+
+ int px, py, pw, ph, pa;
+
+ int x, y, w, h, a;
+
+ int r, g, b;
+
+ Animation_Data * ad = (Animation_Data *) data;
+ t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000;
+ dx = ad->tx - ad->fx;
+ dy = ad->ty - ad->fy;
+ dw = ad->tw - ad->fw;
+ dh = ad->th - ad->fh;
+ da = 255;
+ if (t <= ad->time)
+ {
+ x = (1 * sin((t / ad->time) * (M_PI / 2)) * dx);
+ y = (1 * sin((t / ad->time) * (M_PI / 2)) * dy);
+ w = (1 * sin((t / ad->time) * (M_PI / 2)) * dw);
+ h = (1 * sin((t / ad->time) * (M_PI / 2)) * dh);
+ a = (1 * sin((t / ad->time) * (M_PI / 2)) * da);
+ }
+ else
+ {
+ x = dx;
+ y = dy;
+ w = dw;
+ h = dh;
+ a = da;
+ }
+ px = ad->fx + x;
+ py = ad->fy + y;
+ pw = ad->fw + w;
+ ph = ad->fh + h;
+ pa = a;
+ if (x == dx && y == dy && w == dw && h == dh)
+ {
+ ecore_animator_del(ad->timer);
+ ad->timer = NULL;
+ evas_object_move(ad->obj, px, py);
+ //evas_object_resize(ad->obj, 480, 600);
+ evas_object_resize(ad->obj, pw, ph);
+ evas_object_color_get(ad->obj, &r, &g, &b, &a);
+ evas_object_color_set(ad->obj, r, g, b, pa);
+ evas_object_show(ad->obj);
+ if (ad->func != NULL)
+ ad->func(ad->data, ad->obj);
+ }
+ else
+ {
+ evas_object_move(ad->obj, px, py);
+ //evas_object_resize(ad->obj, 480, 600);
+ evas_object_resize(ad->obj, pw, ph);
+ evas_object_color_get(ad->obj, &r, &g, &b, &a);
+ evas_object_color_set(ad->obj, r, g, b, pa);
+ evas_object_show(ad->obj);
+ }
+ return EXIT_FAILURE;
+}
+
static void
move_object_with_animation(Evas_Object * obj, Evas_Coord x, Evas_Coord y,
Evas_Coord w, Evas_Coord h, Evas_Coord x_,
Evas_Coord y_, Evas_Coord w_, Evas_Coord h_,
- double time, void (*func) (void *data,
- Evas_Object * obj),
- void *data)
+ double time, int (*mv_func) (void *data),
+ void (*func) (void *data,
+ Evas_Object * obj), void *data)
{
Animation_Data * ad = (Animation_Data *) malloc(sizeof(Animation_Data));
ad->obj = obj;
ad->time = time;
ad->func = func;
ad->data = data;
- ad->timer = ecore_animator_add(move_evas_map, ad);
+ ad->timer = ecore_animator_add(mv_func, ad);
}
/////////////////////////////////////////////////////////////
int check = 0;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->order == order && item != it)
- check = 1;
- }
+ {
+ if (item->order == order && item != it)
+ check = 1;
+ }
if (check)
{
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->order > 0)
- elm_table_unpack(wd->box, item->base);
- }
+ {
+ if (item->order > 0)
+ elm_table_unpack(wd->box, item->base);
+ }
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->order > 0)
- {
- if (item->order >= order)
- item->order += 1;
- elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
- evas_object_show(item->base);
- }
- }
+ {
+ if (item->order > 0)
+ {
+ if (item->order >= order)
+ item->order += 1;
+ elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
+ evas_object_show(item->base);
+ }
+ }
}
it->order = order;
elm_table_pack(wd->box, it->base, order - 1, 0, 1, 1);
int i = 0;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item == it)
- {
- i = it->order;
- it->order = 0;
- elm_table_unpack(wd->box, it->base);
- evas_object_hide(it->base);
- }
- }
+ {
+ if (item == it)
+ {
+ i = it->order;
+ it->order = 0;
+ elm_table_unpack(wd->box, it->base);
+ evas_object_hide(it->base);
+ }
+ }
if (i)
{
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->order > i)
- {
- item->order--;
- elm_table_unpack(wd->box, item->base);
- elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
- }
- }
+ {
+ if (item->order > i)
+ {
+ item->order--;
+ elm_table_unpack(wd->box, item->base);
+ elm_table_pack(wd->box, item->base, item->order - 1, 0, 1, 1);
+ }
+ }
}
}
evas_object_geometry_get(it2->base, &x_, &y_, &w_, &h_);
wd->animating++;
move_object_with_animation(it1->base, x, y, w, h, x_, y_, w_, h_, 0.25,
- item_exchange_animation_cb, wd);
+ move_evas_map, item_exchange_animation_cb, wd);
wd->animating++;
move_object_with_animation(it2->base, x_, y_, w_, h_, x, y, w, h, 0.25,
- item_exchange_animation_cb, wd);
+ move_evas_map, item_exchange_animation_cb, wd);
elm_table_unpack(wd->box, it1->base);
elm_table_unpack(wd->box, it2->base);
order = it1->order;
evas_object_geometry_get(it->edit_item, &x_, &y_, &w_, &h_);
wd->animating++;
move_object_with_animation(it->base, x, y, w, h, x_, y_, w_, h_, 0.25,
- item_change_animation_cb, wd);
+ move_evas_map, item_change_animation_cb, wd);
evas_object_geometry_get(wd->moving_item->base, &x, &y, &w, &h);
set_evas_map(wd->moving_item->base, x, y, w, h);
}
static void
object_color_set(Evas_Object *ly, const char *color_part, const char *obj_part)
{
- Evas_Object *color;
- int r, g, b, a;
+ Evas_Object *color;
+ int r, g, b, a;
- color =
- (Evas_Object *) edje_object_part_object_get(_EDJ(ly), color_part);
- if (color)
- evas_object_color_get(color, &r, &g, &b, &a);
- color =
- edje_object_part_swallow_get(_EDJ(ly), obj_part);
- evas_object_color_set(color, r, g, b, a);
+ color =
+ (Evas_Object *) edje_object_part_object_get(_EDJ(ly), color_part);
+ if (color)
+ evas_object_color_get(color, &r, &g, &b, &a);
+ color =
+ edje_object_part_swallow_get(_EDJ(ly), obj_part);
+ evas_object_color_set(color, r, g, b, a);
}
-static void
-selected_box(Elm_Controlbar_Item * it)
+static void
+_end_selected_box(void *data, Evas_Object *obj)
{
- Widget_Data * wd = elm_widget_data_get(it->obj);
+ Widget_Data * wd = (Widget_Data *)data;
- if(it->style == TABBAR)
- {
- it->selected = EINA_TRUE;
- evas_object_smart_callback_call(it->obj, "view,change,before", it);
- object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon");
- edje_object_signal_emit(_EDJ(it->base), "elm,state,selected",
- "elm");
- edje_object_part_swallow(wd->view, "elm.swallow.view",
- it->view);
- evas_object_show(it->view);
+ edje_object_signal_emit(_EDJ(wd->pre_item->base), "elm,state,unselected", "elm");
+ edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,state,selected", "elm");
- }
- else if(it->style == TOOLBAR)
+ wd->animating--;
+ if (wd->animating < 0)
{
- if (it->func)
- it->func(it->data, it->obj, it);
+ printf("animation error\n");
+ wd->animating = 0;
}
+}
- evas_object_smart_callback_call(it->obj, "clicked", it);
+static void
+move_selected_box(Widget_Data *wd, Elm_Controlbar_Item * fit, Elm_Controlbar_Item * tit)
+{
+ Evas_Coord fx, fy, fw, fh, tx, ty, tw, th;
+ Evas_Object *from, *to;
+
+ from = (Evas_Object *)edje_object_part_object_get(_EDJ(fit->base), "bg_img");
+ evas_object_geometry_get(from, &fx, &fy, &fw, &fh);
+
+ to = (Evas_Object *)edje_object_part_object_get(_EDJ(tit->base), "bg_img");
+ evas_object_geometry_get(to, &tx, &ty, &tw, &th);
+
+ edje_object_signal_emit(_EDJ(wd->pre_item->base), "elm,state,unselected", "elm");
+ edje_object_signal_emit(_EDJ(wd->cur_item->base), "elm,state,selected", "elm");
+ printf("layer from : %d to : %d \n", evas_object_layer_get(fit->base),evas_object_layer_get(tit->base));
+
+ Evas_Object *icon = (Evas_Object *)edje_object_part_object_get(_EDJ(tit->base), "elm.swallow.icon");
+ //evas_object_stack_below(from, icon);
+ //evas_object_raise(from);
+ evas_object_layer_set(fit->base, 123);
+ wd->animating++;
+ move_object_with_animation(to, fx, fy, fw, fh, tx, ty, tw, th,
+ 0.6, move_evas_object, _end_selected_box, wd);
}
static void
-clicked_box_cb(void *data, Evas_Object * obj, const char *emission,
- const char *source)
+end_selected_box(void *data, Evas_Object *obj)
{
- Widget_Data * wd = (Widget_Data *) data;
+ Widget_Data * wd = (Widget_Data *)data;
+
+ printf("end selected box\n");
+ wd->pre_item->selected = EINA_FALSE;
+ edje_object_part_unswallow(wd->view, wd->pre_item->view);
+ evas_object_hide(wd->pre_item->view);
+
+ edje_object_part_swallow(wd->view, "elm.swallow.view", obj);
+ evas_object_show(obj);
+}
+
+static void
+selected_box(Elm_Controlbar_Item * it)
+{
+ Widget_Data * wd = elm_widget_data_get(it->obj);
const Eina_List *l;
+ Elm_Controlbar_Item * item, *fit = NULL;
+ Evas_Coord x, y, w, h;
- Elm_Controlbar_Item * item;
- if (wd == NULL)
- return;
- if (wd->edit_mode)
- return;
- EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->style == TABBAR)
- {
- object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
- edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm");
- edje_object_signal_emit(_EDJ(item->base), "elm,state,text_unselected", "elm");
- }
- if (_EDJ(item->base) == obj)
- {
- selected_box(item);
- }
- else
- {
- item->selected = EINA_FALSE;
- edje_object_part_unswallow(wd->view, item->view);
- evas_object_hide(item->view);
- }
- }
+ if(wd->animating) return;
+
+ wd->cur_item = it;
+
+ if(it->style == TABBAR){
+
+ EINA_LIST_FOREACH(wd->items, l, item){
+ if(item->selected) {
+ fit = item;
+ wd->pre_item = fit;
+ }
+ item->selected = EINA_FALSE;
+ edje_object_part_unswallow(wd->view, item->view);
+ evas_object_hide(item->view);
+ }
+ it->selected = EINA_TRUE;
+ evas_object_smart_callback_call(it->obj, "view,change,before", it);
+ object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon");
+
+ if(fit != NULL && fit != it)
+ move_selected_box(wd, fit, it);
+ else
+ edje_object_signal_emit(_EDJ(it->base), "elm,state,selected", "elm");
+
+
+ if(fit != NULL && fit != it){
+ evas_object_geometry_get(fit->view, &x, &y, &w, &h);
+// move_object_with_animation(fit->view, x, y, w, h, x, y, w, h, 0.5, move_fade_out_object, NULL, NULL);
+// if(fit->order > it->order)
+// move_object_with_animation(it->view, x+20, y, w, h, x, y, w, h, 0.5, move_fade_in_object, NULL, NULL);
+// else
+// move_object_with_animation(it->view, x-20, y, w, h, x, y, w, h, 0.5, move_fade_in_object, NULL, NULL);
+
+
+ //fit->selected = EINA_FALSE;
+ //edje_object_part_unswallow(wd->view, fit->view);
+ //evas_object_hide(fit->view);
+
+
+ }
+ edje_object_part_swallow(wd->view, "elm.swallow.view", it->view);
+ evas_object_show(it->view);
+
+ }else if(it->style == TOOLBAR){
+ if (it->func)
+ it->func(it->data, it->obj, it);
+ }
+
+ evas_object_smart_callback_call(it->obj, "clicked", it);
}
-static int
-unfocused_box_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+static void
+unpressed_box_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
Widget_Data * wd = (Widget_Data *) data;
const Eina_List *l;
+ Evas_Event_Mouse_Up * ev = event_info;
+ Evas_Coord x, y, w, h;
Elm_Controlbar_Item * item;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->style == TABBAR)
- {
- if(item->selected){
- object_color_set(item->base, "elm.tabbar.selected.color", "elm.swallow.icon");
- edje_object_signal_emit(_EDJ(item->base), "elm,state,selected", "elm");
- }
- else
- {
- object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
- edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm");
- }
- }
- else if (item->style == TOOLBAR)
- {
- object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
- edje_object_signal_emit(_EDJ(item->base), "elm,state,text_unselected", "elm");
+ {
+ evas_object_geometry_get(item->base, &x, &y, &w, &h);
+ if(ev->output.x > x && ev->output.x < x+w && ev->output.y > y && ev->output.y < y+h){
+ selected_box(item);
+ }else{
+ if (item->style == TABBAR)
+ {
+ if(item->selected){
+ object_color_set(item->base, "elm.tabbar.selected.color", "elm.swallow.icon");
+ edje_object_signal_emit(_EDJ(item->base), "elm,state,selected", "elm");
+ }
+ else
+ {
+ object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
+ edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm");
+ }
+ }
+ else if (item->style == TOOLBAR)
+ {
+ object_color_set(item->base, "elm.tabbar.default.color", "elm.swallow.icon");
+ edje_object_signal_emit(_EDJ(item->base), "elm,state,text_unselected", "elm");
+ }
}
- }
- evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unfocused_box_cb);
+ }
+ evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb);
- return EXIT_SUCCESS;
+ return;
}
static int
int check = 0;
const Eina_List *l;
Elm_Controlbar_Item * item;
+
+ if(wd->animating) return;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (it == item)
- {
- if (it->style == TABBAR)
- {
- object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon");
- edje_object_signal_emit(_EDJ(it->base), "elm,state,pressed",
- "elm");
- }
- else if (it->style == TOOLBAR)
- {
- object_color_set(it->base, "elm.toolbar.pressed.color", "elm.swallow.icon");
- edje_object_signal_emit(_EDJ(it->base), "elm,state,text_selected",
- "elm");
- }
- evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unfocused_box_cb, (void *)wd);
-
- check = EINA_TRUE;
- }
- }
+ {
+ if (it == item)
+ {
+ if (it->style == TABBAR)
+ {
+
+ object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon");
+ edje_object_signal_emit(_EDJ(it->base), "elm,state,pressed",
+ "elm");
+ }
+ else if (it->style == TOOLBAR)
+ {
+
+ object_color_set(it->base, "elm.toolbar.pressed.color", "elm.swallow.icon");
+ edje_object_signal_emit(_EDJ(it->base), "elm,state,text_selected",
+ "elm");
+ }
+ evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, unpressed_box_cb, (void *)wd);
+
+ check = EINA_TRUE;
+ }
+ }
if (!check)
return EXIT_FAILURE;
Evas_Coord x, y, w, h;
Widget_Data * wd = (Widget_Data *) data;
if (wd->animating)
- return EXIT_FAILURE;
+ return;
evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
w *= 2.0;
h *= 2.0;
set_evas_map(wd->moving_obj, x, y, w, h);
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (wd->moving_item->edit_item == item->edit_item || item->style == OBJECT)
- continue;
- evas_object_geometry_get(item->base, &x, &y, &w, &h);
- if (ev->cur.output.x > x && ev->cur.output.x < x + w && ev->cur.output.y > y && ev->cur.output.y < y + h
- && item->editable)
- {
- edje_object_signal_emit(_EDJ(item->base), "elm,state,show,glow",
- "elm");
- }
- else
- {
- edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
- "elm");
- }
- }
- return EXIT_SUCCESS;
+ {
+ if (wd->moving_item->edit_item == item->edit_item || item->style == OBJECT)
+ continue;
+ evas_object_geometry_get(item->base, &x, &y, &w, &h);
+ if (ev->cur.output.x > x && ev->cur.output.x < x + w && ev->cur.output.y > y && ev->cur.output.y < y + h
+ && item->editable)
+ {
+ edje_object_signal_emit(_EDJ(item->base), "elm,state,show,glow",
+ "elm");
+ }
+ else
+ {
+ edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
+ "elm");
+ }
+ }
+ return;
}
static void
Widget_Data * wd = (Widget_Data *) data;
if (wd->moving_obj)
if ((int)evas_object_data_get(wd->moving_obj, "returning") == 1)
- return EXIT_FAILURE;
+ return;
evas_object_color_set(wd->moving_item->edit_item, 255, 255, 255, 255);
- // check which change or not
- EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (wd->moving_item->edit_item == item->edit_item)
- continue;
- if (item->order <= 0)
- continue;
- evas_object_geometry_get(item->base, &x, &y, &w, &h);
- if (ev->output.x > x && ev->output.x < x + w && ev->output.y > y && ev->output.y < y + h
- && item->style != OBJECT && item->editable)
- {
- edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
- "elm");
- break;
- }
- }
+ // check which change or not
+ EINA_LIST_FOREACH(wd->items, l, item)
+ {
+ if (wd->moving_item->edit_item == item->edit_item)
+ continue;
+ if (item->order <= 0)
+ continue;
+ evas_object_geometry_get(item->base, &x, &y, &w, &h);
+ if (ev->output.x > x && ev->output.x < x + w && ev->output.y > y && ev->output.y < y + h
+ && item->style != OBJECT && item->editable)
+ {
+ edje_object_signal_emit(_EDJ(item->base), "elm,state,hide,glow",
+ "elm");
+ break;
+ }
+ }
if (item != NULL)
{
if (wd->moving_item->order > 0)
{
item_change_in_bar(item);
}
- evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb);
- evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb);
+ evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb);
+ evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb);
}
else
{
-
- // return moving object to original location
- evas_object_geometry_get(wd->moving_item->edit_item, &x_, &y_, &w_,
- &h_);
+
+ // return moving object to original location
+ evas_object_geometry_get(wd->moving_item->edit_item, &x_, &y_, &w_,
+ &h_);
evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
w *= 2.0;
h *= 2.0;
evas_object_data_set(wd->moving_obj, "returning", (void *)1);
wd->animating++;
move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_,
- 0.25, edit_item_return_cb, wd);
+ 0.25, move_evas_map, edit_item_return_cb, wd);
}
- return EXIT_SUCCESS;
+ return;
}
static void
if (wd->animating)
return;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->edit_item == obj)
- break;
- }
+ {
+ if (item->edit_item == obj)
+ break;
+ }
if (item == NULL)
- return;
+ return;
if (!item->editable)
- return;
-
+ return;
+
evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb, (void *)wd);
evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, edit_item_move_cb, (void *)wd);
color =
(Evas_Object *)
edje_object_part_object_get(_EDJ(wd->moving_item->edit_item),
- "elm.edit.item.color");
+ "elm.edit.item.color");
if (color)
- evas_object_color_get(color, &r, &g, &b, &a);
+ evas_object_color_get(color, &r, &g, &b, &a);
evas_object_color_set(item->edit_item, r, g, b, a);
if (wd->moving_obj)
- evas_object_del(wd->moving_obj);
+ evas_object_del(wd->moving_obj);
wd->moving_obj = NULL;
wd->moving_obj = create_item_layout(obj, item);
evas_object_geometry_get(obj, &x, &y, &w, &h);
y_ = ev->output.y - h_;
wd->animating++;
move_object_with_animation(wd->moving_obj, x, y, w, h, x_, y_, w_, h_, 0.1,
- edit_item_down_end_cb, wd);
+ move_evas_map, edit_item_down_end_cb, wd);
}
static void
Elm_Controlbar_Item * item;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->base == obj)
- break;
- }
+ {
+ if (item->base == obj)
+ break;
+ }
wd->animating--;
if (wd->animating < 0)
{
Elm_Controlbar_Item * item;
Widget_Data * wd = (Widget_Data *) data;
if (wd->animating)
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->base == wd->moving_obj)
- break;
- }
+ {
+ if (item->base == wd->moving_obj)
+ break;
+ }
if (item == NULL)
{
printf("item is NULL\n");
if (wd->moving_obj == NULL)
{
printf("%s : moving_obj is NULL\n", __func__);
- return EXIT_FAILURE;
+ return;
}
evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
x = ev->cur.output.x - w / 2;
set_evas_map(wd->moving_obj, x, y, w, h);
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->base == wd->moving_obj)
- {
- it = item;
- continue;
- }
- if ((int)evas_object_data_get(item->base, "animating") == 1)
- continue;
- evas_object_geometry_get(item->base, &x, &y, &w, &h);
- if (ev->cur.output.x > x && ev->cur.output.x < x + w && item->editable)
- {
- break;
- }
- }
+ {
+ if (item->base == wd->moving_obj)
+ {
+ it = item;
+ continue;
+ }
+ if ((int)evas_object_data_get(item->base, "animating") == 1)
+ continue;
+ evas_object_geometry_get(item->base, &x, &y, &w, &h);
+ if (ev->cur.output.x > x && ev->cur.output.x < x + w && item->editable)
+ {
+ break;
+ }
+ }
if (item)
{
evas_object_geometry_get(wd->moving_obj, &x_, &y_, &w_, &h_);
wd->animating++;
evas_object_data_set(item->base, "animating", (void *)1);
move_object_with_animation(item->base, x, y, w, h, x_, y_, w_, h_,
- 0.25, bar_item_move_end_cb, wd);
+ 0.25, move_evas_map, bar_item_move_end_cb, wd);
}
- return EXIT_SUCCESS;
+ return;
}
static void
evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h);
tx = ev->output.x - w / 2;
move_object_with_animation(wd->moving_obj, tx, y, w, h, x, y, w, h, 0.25,
- NULL, NULL);
+ move_evas_map, NULL, NULL);
ecore_timer_add(0.1, bar_item_animation_end_check, wd);
- return EXIT_SUCCESS;
+ return;
}
static void
if (wd->animating)
return;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (item->base == obj)
- break;
- }
+ {
+ if (item->base == obj)
+ break;
+ }
if (item == NULL)
- return;
+ return;
if (wd->edit_mode)
{
if (!item->editable)
- return;
+ return;
wd->moving_obj = obj;
wd->empty_num = item->order;
evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_UP, bar_item_up_cb, (void *)wd);
- evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb, (void *)wd);
+ evas_object_event_callback_add(wd->event_box, EVAS_CALLBACK_MOUSE_MOVE, bar_item_move_cb, (void *)wd);
}
else
{
it->base = create_item_layout(wd->edje, it);
evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
bar_item_down_cb, wd);
- edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm",
- clicked_box_cb, wd);
+ //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm",
+ // clicked_box_cb, wd);
object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
evas_object_show(it->base);
it->edit_item = create_item_layout(wd->edje, it);
evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN,
edit_item_down_cb, wd);
evas_object_show(it->edit_item);
+
return it;
}
it->base = create_item_layout(wd->edje, it);
evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
bar_item_down_cb, wd);
- edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm",
- clicked_box_cb, wd);
+ //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm",
+ // clicked_box_cb, wd);
object_color_set(it->base, "elm.tabbar.default.color", "elm.swallow.icon");
evas_object_show(it->base);
it->edit_item = create_item_layout(wd->edje, it);
*
* @ingroup Controlbar
*/
-EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent)
+ EAPI Evas_Object * elm_controlbar_add(Evas_Object * parent)
{
Evas_Object * obj = NULL;
Widget_Data * wd = NULL;
wd->y = y;
wd->w = w;
wd->h = h;
+ wd->mode = ELM_CONTROLBAR_MODE_DEFAULT;
wd->num = 0;
wd->animating = 0;
wd->edit_mode = EINA_FALSE;
return NULL;
}
evas_object_show(wd->view);
-
- // edit box
- wd->edit_box = edje_object_add(wd->evas);
+
+ // edit box
+ wd->edit_box = edje_object_add(wd->evas);
_elm_theme_object_set(obj, wd->edit_box, "controlbar", "edit_box",
- "default");
+ "default");
if (wd->edit_box == NULL)
{
printf("Cannot load bg edj\n");
evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd);
edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", r_button);
*/
- // navigationbar will contribution. but not yet
- wd->navigation = elm_navigationbar_add(wd->edit_box);
- r_button = elm_button_add(wd->navigation);
- elm_button_label_set(r_button, "Done");
- evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd);
- elm_navigationbar_push(wd->navigation, "Configure", NULL, r_button, NULL, NULL);
- edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", wd->navigation);
-
- wd->edit_table = elm_table_add(wd->edit_box);
+ // navigationbar will contribution. but not yet
+ wd->navigation = elm_navigationbar_add(wd->edit_box);
+ r_button = elm_button_add(wd->navigation);
+ elm_button_label_set(r_button, "Done");
+ evas_object_smart_callback_add(r_button, "clicked", done_button_cb, wd);
+ elm_navigationbar_push(wd->navigation, "Configure", NULL, r_button, NULL, NULL);
+ edje_object_part_swallow(wd->edit_box, "elm.swallow.navigation", wd->navigation);
+
+ wd->edit_table = elm_table_add(wd->edit_box);
elm_table_homogenous_set(wd->edit_table, EINA_TRUE);
edje_object_part_swallow(wd->edit_box, "elm.swallow.table", wd->edit_table);
-
- /* load background edj */
- wd->edje = edje_object_add(wd->evas);
-
- // snprintf(buf, sizeof(buf), "bg_portrait_%d", wd->view_slot_num);
- _elm_theme_object_set(obj, wd->edje, "controlbar", "base", "default");
+
+ /* load background edj */
+ wd->edje = edje_object_add(wd->evas);
+
+// snprintf(buf, sizeof(buf), "bg_portrait_%d", wd->view_slot_num);
+ _elm_theme_object_set(obj, wd->edje, "controlbar", "base", "default");
if (wd->edje == NULL)
{
printf("Cannot load bg edj\n");
return NULL;
}
evas_object_show(wd->edje);
-
- // initialization
+
+ // initialization
evas_object_event_callback_add(wd->edje, EVAS_CALLBACK_RESIZE,
_controlbar_object_resize, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE,
_controlbar_object_hide, obj);
- // items container
+ // items container
wd->box = elm_table_add(wd->edje);
elm_table_homogenous_set(wd->box, EINA_TRUE);
evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
+ EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
edje_object_part_swallow(wd->edje, "elm.swallow.items", wd->box);
elm_widget_sub_object_add(obj, wd->box);
-
- //FIXME
- // evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
+
+ //FIXME
+ // evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
evas_object_smart_member_add(wd->view, obj);
evas_object_smart_member_add(wd->edit_box, obj);
elm_widget_resize_object_set(obj, wd->edje);
-
- // initialization
+
+ // initialization
_sizing_eval(obj);
return obj;
}
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj,
+ EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_append(Evas_Object * obj,
const char
*icon_path,
const char *label,
Widget_Data * wd;
it = create_tab_item(obj, icon_path, label, view);
if (it == NULL)
- return NULL;
+ return NULL;
wd = elm_widget_data_get(obj);
set_items_position(obj, it, NULL);
wd->items = eina_list_append(wd->items, it);
if (wd->num == 1)
- selected_box(it);
+ selected_box(it);
_sizing_eval(obj);
return it;
}
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_prepend(Evas_Object *
+ EAPI Elm_Controlbar_Item * elm_controlbar_tab_item_prepend(Evas_Object *
obj,
const char
*icon_path,
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item *
+ EAPI Elm_Controlbar_Item *
elm_controlbar_tab_item_insert_before(Evas_Object * obj,
Elm_Controlbar_Item * before,
const char *icon_path,
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item *
+ EAPI Elm_Controlbar_Item *
elm_controlbar_tab_item_insert_after(Evas_Object * obj,
Elm_Controlbar_Item * after,
const char *icon_path, const char *label,
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_append(Evas_Object *
+ EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_append(Evas_Object *
obj,
const char
*icon_path,
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_prepend(Evas_Object *
+ EAPI Elm_Controlbar_Item * elm_controlbar_tool_item_prepend(Evas_Object *
obj,
const char
*icon_path,
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item *
+ EAPI Elm_Controlbar_Item *
elm_controlbar_tool_item_insert_before(Evas_Object * obj,
Elm_Controlbar_Item * before,
const char *icon_path,
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item *
+ EAPI Elm_Controlbar_Item *
elm_controlbar_tool_item_insert_after(Evas_Object * obj,
Elm_Controlbar_Item * after,
const char *icon_path,
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_object_item_append(Evas_Object *
+ EAPI Elm_Controlbar_Item * elm_controlbar_object_item_append(Evas_Object *
obj,
Evas_Object *
obj_item,
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item *
+ EAPI Elm_Controlbar_Item *
elm_controlbar_object_item_insert_before(Evas_Object * obj,
Elm_Controlbar_Item * before,
Evas_Object * obj_item, const int sel)
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item *
+ EAPI Elm_Controlbar_Item *
elm_controlbar_object_item_insert_after(Evas_Object * obj,
Elm_Controlbar_Item * after,
Evas_Object * obj_item, const int sel)
* @ingroup Controlbar
*/
-EAPI void
+ EAPI void
elm_controlbar_item_del(Elm_Controlbar_Item * it)
{
Evas_Object * obj;
return;
}
- // delete base item
- if (it->order > 0)
+ // delete base item
+ if (it->order > 0)
{
elm_table_unpack(wd->box, it->base);
sel = it->sel;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (it != item)
- {
- if (item->order > it->order)
- {
- elm_table_unpack(wd->box, item->base);
- item->order -= sel;
- elm_table_pack(wd->box, item->base, item->order - 1, 0,
- item->sel, 1);
- }
- }
- if (it == item)
- {
- check = 1;
- }
- }
+ {
+ if (it != item)
+ {
+ if (item->order > it->order)
+ {
+ elm_table_unpack(wd->box, item->base);
+ item->order -= sel;
+ elm_table_pack(wd->box, item->base, item->order - 1, 0,
+ item->sel, 1);
+ }
+ }
+ if (it == item)
+ {
+ check = 1;
+ }
+ }
}
-
- // delete edit item
- check = 0;
+
+ // delete edit item
+ check = 0;
if (it->edit_item != NULL)
{
elm_table_unpack(wd->edit_table, it->edit_item);
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (check)
- {
- if (item->edit_item != NULL)
- {
- elm_table_unpack(wd->edit_table, item->edit_item);
- elm_table_pack(wd->edit_table, item->edit_item,
- (i - 1) % 4, (i - 1) / 4, 1, 1);
- }
- }
- if (it == item && item->style != OBJECT)
- {
- check = 1;
- i--;
- }
- if (item->style != OBJECT)
- i++;
- }
+ {
+ if (check)
+ {
+ if (item->edit_item != NULL)
+ {
+ elm_table_unpack(wd->edit_table, item->edit_item);
+ elm_table_pack(wd->edit_table, item->edit_item,
+ (i - 1) % 4, (i - 1) / 4, 1, 1);
+ }
+ }
+ if (it == item && item->style != OBJECT)
+ {
+ check = 1;
+ i--;
+ }
+ if (item->style != OBJECT)
+ i++;
+ }
}
-
- // delete item in list
- if (it->label)
- eina_stringshare_del(it->label);
+
+ // delete item in list
+ if (it->label)
+ eina_stringshare_del(it->label);
if (it->icon)
- evas_object_del(it->icon);
+ evas_object_del(it->icon);
if (it->base)
{
if (it->style != OBJECT)
- evas_object_del(it->base);
-
+ evas_object_del(it->base);
+
else
- evas_object_hide(it->base);
+ evas_object_hide(it->base);
}
if (it->view)
{
evas_object_hide(it->view);
}
if (it->edit_item)
- evas_object_del(it->edit_item);
+ evas_object_del(it->edit_item);
wd->items = eina_list_remove(wd->items, it);
wd->num = wd->num - 1;
_sizing_eval(obj);
* @ingroup Controlbar
*/
-EAPI void
+ EAPI void
elm_controlbar_item_select(Elm_Controlbar_Item * it)
{
if (it->obj == NULL)
*
* @ingroup Controlbar
*/
-EAPI Evas_Object * elm_controlbar_item_icon_get(Elm_Controlbar_Item * it)
+ EAPI Evas_Object * elm_controlbar_item_icon_get(Elm_Controlbar_Item * it)
{
return it->icon;
}
*
* @ingroup Controlbar
*/
-EAPI void
+ EAPI void
elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label)
{
if (!it->base)
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_selected_item_get(Evas_Object *
+ EAPI Elm_Controlbar_Item * elm_controlbar_selected_item_get(Evas_Object *
obj)
{
const Eina_List *l;
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_first_item_get(Evas_Object * obj)
+ EAPI Elm_Controlbar_Item * elm_controlbar_first_item_get(Evas_Object * obj)
{
if (obj == NULL)
return NULL;
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_last_item_get(Evas_Object * obj)
+ EAPI Elm_Controlbar_Item * elm_controlbar_last_item_get(Evas_Object * obj)
{
if (obj == NULL)
return NULL;
*
* @ingroup Controlbar
*/
-EAPI Eina_List * elm_controlbar_items_get(Evas_Object * obj)
+ EAPI Eina_List * elm_controlbar_items_get(Evas_Object * obj)
{
if (obj == NULL)
return NULL;
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item *
+ EAPI Elm_Controlbar_Item * elm_controlbar_item_prev(Elm_Controlbar_Item *
it)
{
const Eina_List *l;
return NULL;
Widget_Data * wd = elm_widget_data_get(it->obj);
if (!wd || !wd->items)
- return NULL;
+ return NULL;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (it == item)
- {
- l = eina_list_prev(l);
- if (!l)
- return NULL;
- return eina_list_data_get(l);
- }
- }
+ {
+ if (it == item)
+ {
+ l = eina_list_prev(l);
+ if (!l)
+ return NULL;
+ return eina_list_data_get(l);
+ }
+ }
return NULL;
}
*
* @ingroup Controlbar
*/
-EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item *
+ EAPI Elm_Controlbar_Item * elm_controlbar_item_next(Elm_Controlbar_Item *
it)
{
const Eina_List *l;
return NULL;
Widget_Data * wd = elm_widget_data_get(it->obj);
if (!wd || !wd->items)
- return NULL;
+ return NULL;
EINA_LIST_FOREACH(wd->items, l, item)
- {
- if (it == item)
- {
- l = eina_list_next(l);
- if (!l)
- return NULL;
- return eina_list_data_get(l);
- }
- }
+ {
+ if (it == item)
+ {
+ l = eina_list_next(l);
+ if (!l)
+ return NULL;
+ return eina_list_data_get(l);
+ }
+ }
return NULL;
}
* @ingroup Controlbar
*/
-EAPI void
+ EAPI void
elm_controlbar_edit_start(Evas_Object * obj)
{
Widget_Data * wd;
*
* @ingroup Controlbar
*/
-EAPI void
+ EAPI void
elm_controlbar_item_visible_set(Elm_Controlbar_Item * it, Eina_Bool bar)
{
Eina_Bool check = EINA_TRUE;
if (it->order <= 0)
- check = EINA_FALSE;
+ check = EINA_FALSE;
if (check == bar)
- return;
+ return;
if (bar)
{
item_insert_in_bar(it, 0);
*
* @ingroup Controlbar
*/
-EAPI void
+ EAPI void
elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable)
{
Evas_Object * color;
*
* @ingroup Controlbar
*/
-EAPI void
+ EAPI void
elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view)
{
Widget_Data * wd;
edje_object_part_swallow(wd->view, "elm.swallow.view", wd->view_content);
}
-
/**
* Set the view of the item
*
*
* @ingroup Controlbar
*/
-EAPI void
+ EAPI void
elm_controlbar_item_view_set(Elm_Controlbar_Item *it, Evas_Object * view)
{
- it->view = view;
+ it->view = view;
+}
+
+/**
+ * Set the mode of the controlbar
+ *
+ * @param obj The object of the controlbar
+ * @param mode The mode of the controlbar
+ *
+ * @ingroup Controlbar
+ */
+ EAPI void
+elm_controlbar_mode_set(Evas_Object *obj, int mode)
+{
+ Widget_Data * wd;
+ if (obj == NULL)
+ {
+ fprintf(stderr, "Invalid argument: controlbar object is NULL\n");
+ return;
+ }
+ wd = elm_widget_data_get(obj);
+ if (wd == NULL)
+ {
+ fprintf(stderr, "Cannot get smart data\n");
+ return;
+ }
+
+ if(wd->mode == mode) return;
+
+ switch(mode){
+ case ELM_CONTROLBAR_MODE_DEFAULT:
+ edje_object_signal_emit(wd->edje, "elm,state,default", "elm");
+ break;
+ case ELM_CONTROLBAR_MODE_LARGE:
+ edje_object_signal_emit(wd->edje, "elm,state,large", "elm");
+ break;
+ case ELM_CONTROLBAR_MODE_SMALL:
+ edje_object_signal_emit(wd->edje, "elm,state,small", "elm");
+ break;
+ default:
+ break;
+ }
}
+
typedef struct _Widget_Data Widget_Data;
-typedef enum
-{ BOTTOM_ARROW, RIGHT_ARROW, LEFT_ARROW, TOP_ARROW,
- NONE_ARROW } Arrow_Direction;
+
struct _Ctxpopup_Item
{
Evas_Object *base;
const char *label;
Evas_Object *content;
- void (*func) (void *data, Evas_Object *obj, void *event_info);
+ void (*func) ( void *data, Evas_Object *obj, void *event_info);
const void *data;
Eina_Bool disabled:1;
Eina_Bool separator:1;
Eina_List *items;
double align_x, align_y;
int btn_cnt;
+ Elm_Ctxpopup_Arrow arrow_priority[4];
Eina_Bool scroller_disabled:1;
Eina_Bool horizontal:1;
- Eina_Bool arrow_disabled:1;
+ Eina_Bool arrow_disabled:1;
Eina_Bool visible:1;
Eina_Bool screen_dimmed_disabled:1;
-
};
static const char *widtype = NULL;
static void _ctxpopup_item_select(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _separator_obj_add(Evas_Object *obj);
static void _separator_obj_del(Widget_Data *wd, Elm_Ctxpopup_Item *remove_item);
-static Arrow_Direction _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect);
+static Elm_Ctxpopup_Arrow _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect);
static void _arrow_obj_add(Evas_Object *obj, const char *group_name);
-static void _update_arrow_obj(Evas_Object *obj, Arrow_Direction arrow_dir);
-static void _shift_base_by_arrow(Evas_Object *arrow, Arrow_Direction arrow_dir, Evas_Coord_Rectangle *rect);
+static void _update_arrow_obj(Evas_Object *obj, Elm_Ctxpopup_Arrow arrow_dir);
+static void _shift_base_by_arrow(Evas_Object *arrow, Elm_Ctxpopup_Arrow arrow_dir, Evas_Coord_Rectangle *rect);
static void _btn_layout_create(Evas_Object *obj);
static void _btn_clicked(void *data, Evas_Object *obj, void *event_info);
} \
}while(0)
-static Arrow_Direction
+static Elm_Ctxpopup_Arrow
_calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
{
Widget_Data *wd;
Evas_Coord parent_x, parent_y, parent_w, parent_h;
Evas_Coord box_w, box_h;
Evas_Coord base_w = 0, base_h = 0;
- Arrow_Direction arrow_dir;
+ Elm_Ctxpopup_Arrow arrow;
Evas_Coord x1, x2, y1, y2;
int idx;
Evas_Coord finger_size;
wd = elm_widget_data_get(obj);
- if ((!wd) || (!rect))
- return NONE_ARROW;
+ if ((!wd) || (!rect)) {
+ return ELM_CTXPOPUP_ARROW_DOWN;
+ }
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
evas_object_geometry_get(wd->parent, &parent_x, &parent_y, &parent_w,
base_h += box_h ;
edje_object_size_max_get(wd->base, &max_width_size, &max_height_size);
+ max_width_size *= elm_scale_get();
+ max_height_size *= elm_scale_get();
if (base_h > max_height_size)
base_h = max_height_size;
finger_size = elm_finger_size_get();
- if((base_h == 0) || (base_w == 0))
- return NONE_ARROW;
+ if((base_h == 0) || (base_w == 0)) {
+ return ELM_CTXPOPUP_ARROW_DOWN;
+ }
if (!wd->arrow_disabled)
{
evas_object_resize( wd->arrow, arrow_w, arrow_h );
}
- //Phase 1: Define x, y Segments and find invalidated direction.
- //Left
- x1 = x - base_w;
- if ((x1 - arrow_w - finger_size) < parent_x)
- {
- x1 = parent_x;
- available_direction[RIGHT_ARROW] = 0;
- }
-
- //Right
- x2 = x + base_w;
- if (x2 + arrow_w + finger_size > WORLD_PARENT_W)
- {
- x2 = WORLD_PARENT_W - base_w;
- available_direction[LEFT_ARROW] = 0;
- }
-
- //Top
- y1 = y - base_h;
- if (y1 - arrow_h - finger_size < parent_y)
- {
- y1 = parent_y;
- available_direction[BOTTOM_ARROW] = 0;
- }
- //Bottom
- y2 = y + base_h;
- if (y2 + arrow_h + finger_size > WORLD_PARENT_H)
- {
- y2 = WORLD_PARENT_H - base_h;
- available_direction[TOP_ARROW] = 0;
- }
-
-//ADDITIONAL OPTION: Phase 2: Determine Direction Priority ?
+ //Define x, y Segments and find invalidated direction.
+ //After that, adjust base geometry.
+ for (idx = 0; idx < 4; ++idx)
+ {
+ switch (wd->arrow_priority[idx])
+ {
+ case ELM_CTXPOPUP_ARROW_DOWN:
+ y1 = y - base_h;
+ if (y1 - arrow_h - finger_size > parent_y) continue;
+ y1 = parent_y;
+ available_direction[idx] = 0;
+ break;
+ case ELM_CTXPOPUP_ARROW_RIGHT:
+ x1 = x - base_w;
+ if ((x1 - arrow_w - finger_size) > parent_x) continue;
+ x1 = parent_x;
+ available_direction[idx] = 0;
+ break;
+ case ELM_CTXPOPUP_ARROW_LEFT:
+ x2 = x + base_w;
+ if (x2 + arrow_w + finger_size < WORLD_PARENT_W) continue;
+ x2 = WORLD_PARENT_W - base_w;
+ available_direction[idx] = 0;
+ break;
+ case ELM_CTXPOPUP_ARROW_UP:
+ y2 = y + base_h;
+ if (y2 + arrow_h + finger_size < WORLD_PARENT_H) continue;
+ y2 = WORLD_PARENT_H - base_h;
+ available_direction[idx] = 0;
+ break;
+ default:
+ break;
+ }
+ }
-//Phase 3: adjust base geometry.
for (idx = 0; idx < 4; ++idx)
{
if (available_direction[idx] == 0)
continue;
//Find the Nearest point to center of box.
- switch (idx)
+ switch (wd->arrow_priority[idx])
{
- case BOTTOM_ARROW:
+ case ELM_CTXPOPUP_ARROW_DOWN:
ADJUST_POS_X(x);
y -= (base_h + finger_size);
- arrow_dir = BOTTOM_ARROW;
+ arrow = ELM_CTXPOPUP_ARROW_DOWN;
break;
- case RIGHT_ARROW:
+ case ELM_CTXPOPUP_ARROW_RIGHT:
ADJUST_POS_Y(y);
x -= (base_w + finger_size);
- arrow_dir = RIGHT_ARROW;
+ arrow = ELM_CTXPOPUP_ARROW_RIGHT;
break;
- case LEFT_ARROW:
+ case ELM_CTXPOPUP_ARROW_LEFT:
ADJUST_POS_Y(y);
x += finger_size;
- arrow_dir = LEFT_ARROW;
+ arrow = ELM_CTXPOPUP_ARROW_LEFT;
break;
- case TOP_ARROW:
+ case ELM_CTXPOPUP_ARROW_UP:
ADJUST_POS_X(x);
y += finger_size;
- arrow_dir = TOP_ARROW;
+ arrow = ELM_CTXPOPUP_ARROW_UP;
break;
default:
- fprintf(stderr, "Not Enough space to show contextual popup!! \n");
+ break;
}
- break;
+ break;
}
rect->x = x;
rect->y = y;
rect->w = base_w;
rect->h = base_h;
- return arrow_dir;
+ return arrow;
}
static void
-_update_arrow_obj(Evas_Object *obj, Arrow_Direction arrow_dir)
+_update_arrow_obj(Evas_Object *obj, Elm_Ctxpopup_Arrow arrow_dir)
{
Evas_Coord x, y;
Evas_Coord arrow_x, arrow_y, arrow_w, arrow_h;
switch (arrow_dir)
{
- case LEFT_ARROW:
+ case ELM_CTXPOPUP_ARROW_LEFT:
{
edje_object_signal_emit(wd->arrow, "elm,state,left", "elm");
arrow_y = (y - (arrow_h*0.5));
arrow_x = (x + elm_finger_size_get());
break;
}
- case RIGHT_ARROW:
+ case ELM_CTXPOPUP_ARROW_RIGHT:
{
edje_object_signal_emit(wd->arrow, "elm,state,right", "elm");
arrow_y = (y - (arrow_h*0.5));
arrow_x = (x - elm_finger_size_get() - arrow_w);
break;
}
- case TOP_ARROW:
+ case ELM_CTXPOPUP_ARROW_UP:
{
edje_object_signal_emit(wd->arrow, "elm,state,top", "elm");
arrow_x = (x - (arrow_w*0.5));
arrow_y = (y + elm_finger_size_get());
break;
}
- case BOTTOM_ARROW:
+ case ELM_CTXPOPUP_ARROW_DOWN:
{
edje_object_signal_emit(wd->arrow, "elm,state,bottom", "elm");
arrow_x = (x - (arrow_w*0.5));
Eina_List *elist;
Elm_Ctxpopup_Item *item;
Evas_Coord_Rectangle rect = {0,0,1,1};
- Evas_Coord x, y, w, h;
- Arrow_Direction arrow_dir;
+ Evas_Coord y, w, h;
+ Elm_Ctxpopup_Arrow arrow;
wd = (Widget_Data *) elm_widget_data_get(obj);
- char buf[256];
if ((!wd) || (!wd->parent))
return;
_item_sizing_eval(item);
}
- //button layout
- sprintf(buf, "actionbtn%d", wd->btn_cnt);
- edje_object_part_geometry_get( wd->btn_layout, buf, 0, 0, &w, &h );
- evas_object_size_hint_min_set( wd->btn_layout, w, h );
-
//base
- arrow_dir = _calc_base_geometry(obj, &rect);
+ arrow = _calc_base_geometry(obj, &rect);
- if((!wd->arrow_disabled) && (arrow_dir!=NONE_ARROW))
+ if(!wd->arrow_disabled)
{
- _update_arrow_obj(obj, arrow_dir);
- _shift_base_by_arrow(wd->arrow, arrow_dir, &rect);
+ _update_arrow_obj(obj, arrow);
+ _shift_base_by_arrow(wd->arrow, arrow, &rect);
}
evas_object_resize(wd->base, rect.w, rect.h);
edje_object_part_geometry_get(wd->base, "ctxpopup_list", NULL, &y, NULL, &h );
evas_object_resize(wd->scroller, w, h+(y*2));
evas_object_move(wd->scroller, rect.x, rect.y);
-
-
}
static void
-_shift_base_by_arrow(Evas_Object *arrow, Arrow_Direction arrow_dir,
+_shift_base_by_arrow(Evas_Object *arrow, Elm_Ctxpopup_Arrow arrow_dir,
Evas_Coord_Rectangle *rect)
{
Evas_Coord arrow_w, arrow_h;
switch (arrow_dir)
{
- case LEFT_ARROW:
+ case ELM_CTXPOPUP_ARROW_LEFT:
rect->x += arrow_w;
break;
- case RIGHT_ARROW:
+ case ELM_CTXPOPUP_ARROW_RIGHT:
rect->x -= arrow_w;
break;
- case TOP_ARROW:
+ case ELM_CTXPOPUP_ARROW_UP:
rect->y += arrow_h;
break;
- case BOTTOM_ARROW:
+ case ELM_CTXPOPUP_ARROW_DOWN:
rect->y -= arrow_h;
break;
- case NONE_ARROW:
- break;
+ default:
+ break;
}
}
static void
_parent_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = (Widget_Data *) data;
+ Evas_Coord x, y;
+ Widget_Data *wd = (Widget_Data *) elm_widget_data_get(data);
if (!wd) return;
- Evas_Coord x, y;
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
evas_object_move(wd->bg, x, y);
_sizing_eval(data);
static void
_parent_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = (Widget_Data *) data;
+ Evas_Coord w, h;
+ Widget_Data *wd = (Widget_Data *) elm_widget_data_get(data);
if (!wd) return;
- Evas_Coord w, h;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
evas_object_resize(wd->bg, w, h);
_sizing_eval(data);
elm_widget_theme_hook_set(obj, _theme_hook);
wd->parent = parent;
- wd->align_x = 0.5;
- wd->align_y = 0.5;
//Background
wd->bg = edje_object_add(e);
_elm_theme_object_set(obj, wd->arrow, "ctxpopup", "arrow",
elm_widget_style_get(obj));
+ wd->arrow_priority[0] = ELM_CTXPOPUP_ARROW_DOWN;
+ wd->arrow_priority[1] = ELM_CTXPOPUP_ARROW_RIGHT;
+ wd->arrow_priority[2] = ELM_CTXPOPUP_ARROW_LEFT;
+ wd->arrow_priority[3] = ELM_CTXPOPUP_ARROW_UP;
+
evas_object_event_callback_add(parent, EVAS_CALLBACK_MOVE, _parent_move, obj);
- evas_object_event_callback_add(parent, EVAS_CALLBACK_RESIZE, _parent_resize,
+ evas_object_event_callback_add(parent, EVAS_CALLBACK_RESIZE, _parent_resize,
obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _ctxpopup_show, wd);
evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _ctxpopup_hide, wd);
wd->screen_dimmed_disabled = disabled;
}
+/**
+ * Append additional button in ctxpoppup bottom layout.
+ * @param obj Ctxpopup object
+ * @param label Button label
+ * @param func Button clicked event callback function
+ * @param data Button clicked event callback function data
+ *
+ * @ingroup Ctxpopup
+ */
EAPI void
elm_ctxpopup_button_append(Evas_Object *obj, const char *label, Evas_Smart_Cb func, const void *data)
{
evas_object_smart_callback_add(btn, "clicked", func, data);
sprintf(buf, "actionbtn%d", wd->btn_cnt);
edje_object_part_swallow(wd->btn_layout, buf, btn);
+
+ //button layout
+ sprintf(buf, "actionbtn%d", wd->btn_cnt);
+ edje_object_part_geometry_get( wd->btn_layout, buf, 0, 0, &w, &h );
+ evas_object_size_hint_min_set( wd->btn_layout, w, h );
}
if(wd->visible)
}
-
-/*
+/**
+ * Sets the size align control hint for the items
+ *
+ * Please refer the evas_object_size_hint_align_set function
+ *
+ * @param obj Ctxpopup object
+ * @param align_x Double (0.0..1.0 or -1.0) to use as align x hint
+ * @param align_y Double (0.0..1.0 or -1.0) to use as align y hint
+ *
+ * @ingroup Ctxpopup
+ */
EAPI void
elm_ctxpopup_align_set(Evas_Object *obj, double align_x, double align_y)
{
wd->align_y = align_y;
}
-
+/**
+ * Retrieves the size align control hint
+ *
+ * Please refer the evas_object_size_hint_align_get function
+ *
+ * @param obj Ctxpopup object
+ * @param align_x Pointer to a double in which to store the align x.
+ * @param align_y Pointer to a double in which to store the align y.
+ *
+ * @ingroup Ctxpopup
+ */
EAPI void
elm_ctxpopup_align_get(Evas_Object *obj, double *align_x, double *align_y)
{
if( align_y ) *align_y = wd->align_y;
}
-*/
+
+
+/**
+ * Set the priority of arrow direction
+ *
+ * This functions gives user to set the priority of ctxpopup box showing position.
+ *
+ * @param obj Ctxpopup object
+ * @param first 1st priority of arrow direction
+ * @param second 2nd priority of arrow direction
+ * @param third 3th priority of arrow direction
+ * @param fourth 4th priority of arrow direction
+ *
+ * @ingroup Ctxpopup
+ */
+EAPI void
+elm_ctxpopup_arrow_priority_set(Evas_Object *obj, Elm_Ctxpopup_Arrow first, Elm_Ctxpopup_Arrow second, Elm_Ctxpopup_Arrow third, Elm_Ctxpopup_Arrow fourth)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = (Widget_Data *) elm_widget_data_get(obj);
+ if(!wd) return;
+ wd->arrow_priority[0] = first;
+ wd->arrow_priority[1] = second;
+ wd->arrow_priority[2] = third;
+ wd->arrow_priority[3] = fourth;
+}
+
+
+
+