data.item: "texts" "elm.text";
data.item: "contents" "elm.swallow.icon elm.swallow.end";
data.item: "treesize" "20";
+ data.item: "flips" "elm.text.flip";
// data.item: "states" "";
images {
image: "bt_sm_base1.png" COMP;
offset: -1 -5;
}
}
+ description { state: "flip_enabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
}
part { name: "elm.swallow.end";
clip_to: "disclip";
offset: -5 -5;
}
}
+ description { state: "flip_enabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
}
part { name: "elm.text";
clip_to: "disclip";
color: 224 224 224 255;
color3: 0 0 0 64;
}
+ description { state: "flip_enabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part { name: "elm.text.flip";
+ clip_to: "disclip";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ visible: 0;
+ rel1.to_y: "elm.text";
+ rel2.to_y: "elm.text";
+ }
+ description { state: "flip_enabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
}
part { name: "fg1";
clip_to: "disclip";
target: "reorder_bg";
transition: DECELERATE 0.5;
}
+ program { name: "flip_enabled";
+ signal: "elm,state,flip,enabled";
+ source: "elm";
+ action: STATE_SET "flip_enabled" 0.0;
+ target: "elm.text";
+ target: "elm.text.flip";
+ target: "elm.swallow.icon";
+ target: "elm.swallow.end";
+ }
+ program { name: "flip_disabled";
+ signal: "elm,state,flip,disabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.text";
+ target: "elm.text.flip";
+ target: "elm.swallow.icon";
+ target: "elm.swallow.end";
+ }
}
}
group { name: "elm/genlist/item/group_index/default";
inherit: "default" 0.0;
align: 0.0 0.5;
}
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
}
part { name: "elm.padding.icon1.right";
type: RECT;
to_x: "elm.padding.icon2.left";
}
}
+ description { state: "flipped" 0.0;
+ inherit: "default" 0.0;
+ rel1.to_x: "elm.padding.left";
+ rel2 {
+ relative: 1.3 1.0;
+ to_x: "elm.padding.right";
+ }
+ }
}
part { name: "elm.padding.icon2.left";
type: RECT;
inherit: "default" 0.0;
align: 1.0 0.5;
}
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
}
part { name: "disclip";
type: RECT;
target: "elm.edit.icon.1";
target: "elm.edit.icon.2";
}
+ program {
+ name: "enable_flip_mode";
+ signal: "elm,state,flip,enabled";
+ source: "elm";
+ action: STATE_SET "disabled" 0.0;
+ target: "elm.edit.icon.1";
+ target: "elm.edit.icon.2";
+ after: "enable_flip_mode_next";
+ }
+ program {
+ name: "enable_flip_mode_next";
+ action: STATE_SET "flipped" 0.0;
+ transition: DECELERATE 0.5;
+ target: "elm.swallow.edit.content";
+ }
+ program {
+ name: "disable_flip_mode";
+ signal: "elm,state,flip,disabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ transition: DECELERATE 0.5;
+ target: "elm.swallow.edit.content";
+ target: "elm.edit.icon.1";
+ target: "elm.edit.icon.2";
+ }
}
}
void test_genlist13(void *data, Evas_Object *obj, void *event_info);
void test_genlist14(void *data, Evas_Object *obj, void *event_info);
void test_genlist15(void *data, Evas_Object *obj, void *event_info);
+void test_genlist16(void *data, Evas_Object *obj, void *event_info);
void test_gesture_layer(void *data, Evas_Object *obj, void *event_info);
void test_gesture_layer2(void *data, Evas_Object *obj, void *event_info);
void test_gesture_layer3(void *data, Evas_Object *obj, void *event_info);
ADD_TEST(NULL, "Lists", "Genlist Tree, Insert Sorted", test_genlist13);
ADD_TEST(NULL, "Lists", "Genlist Tree, Insert Relative", test_genlist14);
ADD_TEST(NULL, "Lists", "Genlist Edit Mode", test_genlist15);
+ ADD_TEST(NULL, "Lists", "Genlist Flip Mode", test_genlist16);
ADD_TEST(NULL, "Lists", "GenGrid", test_gengrid);
ADD_TEST(NULL, "Lists", "GenGrid 2", test_gengrid2);
ADD_TEST(NULL, "Lists", "GenGrid Group", test_gengrid3);
evas_object_resize(win, 520, 520);
evas_object_show(win);
}
+
+static void _flip_icon_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ const Testitem *tit = data;
+
+ if (elm_genlist_item_flip_get(tit->item))
+ elm_genlist_item_flip_set(tit->item, EINA_FALSE);
+ else
+ elm_genlist_item_flip_set(tit->item, EINA_TRUE);
+}
+
+char *gl16_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
+{
+ const Testitem *tit = data;
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Item #%i", tit->mode);
+ return strdup(buf);
+}
+
+Evas_Object *gl16_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ Testitem *tit = data;
+ char buf[PATH_MAX];
+
+ if (!strcmp(part, "elm.text.flip"))
+ {
+ Evas_Object *btn = elm_button_add(obj);
+ elm_object_text_set(btn, "flipped content placement");
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
+ evas_object_smart_callback_add(btn, "clicked", _flip_icon_clicked_cb, (void *)tit);
+ evas_object_show(btn);
+ return btn;
+ }
+ else if (!strcmp(part, "elm.edit.icon.1"))
+ {
+ Evas_Object *icn = elm_icon_add(obj);
+ snprintf(buf, sizeof(buf), "%s/images/icon_04.png", PACKAGE_DATA_DIR);
+ elm_icon_file_set(icn, buf, NULL);
+ evas_object_propagate_events_set(icn, EINA_FALSE);
+ evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ return icn;
+ }
+ else if (!strcmp(part, "elm.edit.icon.2"))
+ {
+ Evas_Object *icn = elm_icon_add(obj);
+ snprintf(buf, sizeof(buf), "%s/images/icon_09.png", PACKAGE_DATA_DIR);
+ elm_icon_file_set(icn, buf, NULL);
+ evas_object_propagate_events_set(icn, EINA_FALSE);
+ evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ evas_object_smart_callback_add(icn, "clicked", _flip_icon_clicked_cb, (void *)tit);
+ return icn;
+ }
+ else return NULL;
+}
+
+void
+test_genlist16(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Evas_Object *win, *bx, *gl;
+ int i;
+ static Testitem tit[100];
+
+ win = elm_win_util_standard_add("genlist-flip-mode", "Genlist Flip Mode");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ gl = elm_genlist_add(win);
+ evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(gl);
+
+ elm_genlist_edit_mode_set(gl, EINA_TRUE);
+ elm_genlist_always_select_mode_set(gl, EINA_TRUE);
+
+ itc15 = elm_genlist_item_class_new();
+ itc15->item_style = "default";
+ itc15->func.text_get = gl16_text_get;
+ itc15->func.content_get = gl16_content_get;
+ itc15->func.state_get = gl_state_get;
+ itc15->func.del = NULL;
+ itc15->edit_item_style = "edit";
+
+ for (i = 0; i < 100; i++)
+ {
+ tit[i].mode = i;
+ tit[i].item = elm_genlist_item_append(gl, itc15,
+ &(tit[i])/* item data */,
+ NULL/* parent */,
+ ELM_GENLIST_ITEM_NONE/* flags */,
+ gl_sel/* func */,
+ (void *)(long)&(tit[i])/* func data */);
+ }
+ elm_genlist_item_class_free(itc15);
+ elm_box_pack_end(bx, gl);
+ evas_object_show(bx);
+
+ evas_object_resize(win, 520, 520);
+ evas_object_show(win);
+}
#endif
Eina_Bool group : 1;
Eina_Bool reorder : 1;
Eina_Bool mode_set : 1; /* item uses style mode for highlight/select */
+ Eina_Bool flipped : 1; /* a flag that shows the flip status of the item. */
};
typedef struct _Pan Pan;
if (!it->wd->on_hold)
{
it->wd->on_hold = EINA_TRUE;
- if (!it->wd->wasselected)
+ if ((!it->wd->wasselected) && (!it->flipped))
{
_item_unhighlight(it);
_item_unselect(it);
if (it->wd->longpressed)
{
it->wd->longpressed = EINA_FALSE;
- if (!it->wd->wasselected)
+ if ((!it->wd->wasselected) && (!it->flipped))
{
_item_unhighlight(it);
_item_unselect(it);
if ((itc->tree == tree) &&
(itc->compress == it->wd->compress) &&
(((!it->itc->item_style) && (!itc->item_style)) ||
- (it->itc->item_style && itc->item_style &&
+ (it->itc->item_style && itc->item_style &&
(!strcmp(it->itc->item_style, itc->item_style)))))
{
it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
}
}
+static Eina_List *
+_item_flips_realize(Elm_Gen_Item *it,
+ Evas_Object *target,
+ Eina_List **source)
+{
+ Eina_List *res = NULL;
+
+ if (it->itc->func.content_get)
+ {
+ const Eina_List *l;
+ const char *key;
+ Evas_Object *ic = NULL;
+
+ *source = elm_widget_stringlist_get(edje_object_data_get(target, "flips"));
+
+ EINA_LIST_FOREACH(*source, l, key)
+ {
+ if (it->itc->func.content_get)
+ ic = it->itc->func.content_get
+ ((void *)it->base.data, WIDGET(it), key);
+ if (ic)
+ {
+ res = eina_list_append(res, ic);
+ edje_object_part_swallow(target, key, ic);
+ evas_object_show(ic);
+ elm_widget_sub_object_add(WIDGET(it), ic);
+ if (elm_widget_item_disabled_get(it))
+ elm_widget_disabled_set(ic, EINA_TRUE);
+ }
+ }
+ }
+
+ return res;
+}
+
static void
_item_realize(Elm_Gen_Item *it,
int in,
_item_text_realize(it, VIEW(it), &it->texts, NULL);
it->content_objs = _item_content_realize(it, VIEW(it), &it->contents, NULL);
_item_state_realize(it, VIEW(it), &it->states, NULL);
+ if (it->flipped)
+ {
+ edje_object_signal_emit(VIEW(it), "elm,state,flip,enabled", "elm");
+ it->content_objs = _item_flips_realize(it, VIEW(it), &it->contents);
+ }
if (!it->item->mincalcd)
{
_multi_move, it);
_item_text_realize(it, it->edit_obj, &it->item->edit_texts, NULL);
+ if (it->flipped) edje_object_signal_emit(it->edit_obj, "elm,state,flip,enabled", "elm");
it->item->edit_content_objs =
_item_content_realize(it, it->edit_obj, &it->item->edit_contents, NULL);
_item_state_realize(it, it->edit_obj, &it->item->edit_states, NULL);
elm_widget_stringlist_free(it->item->edit_states);
it->item->edit_states = NULL;
EINA_LIST_FREE(it->item->edit_content_objs, icon)
- evas_object_del(icon);
+ evas_object_del(icon);
edje_object_message_signal_process(it->edit_obj);
evas_object_event_callback_del_full(it->edit_obj, EVAS_CALLBACK_MOUSE_DOWN,
}
}
+void _flip_job(void *data)
+{
+ Elm_Gen_Item *it = (Elm_Gen_Item *) data;
+ _elm_genlist_item_unrealize(it, EINA_FALSE);
+ if (it->selected) _item_unselect(it);
+ it->flipped = EINA_TRUE;
+ it->item->nocache = EINA_TRUE;
+}
+
+EAPI void
+elm_genlist_item_flip_set(Elm_Object_Item *it,
+ Eina_Bool flip)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ flip = !!flip;
+ if (_it->flipped == flip) return;
+
+ if (flip)
+ {
+ ecore_job_add(_flip_job, _it);
+ if (_it->wd->calc_job) ecore_job_del(_it->wd->calc_job);
+ _it->wd->calc_job = ecore_job_add(_calc_job, _it->wd);
+ }
+ else
+ {
+ _it->flipped = flip;
+ _it->item->nocache = EINA_TRUE;
+ _item_cache_zero(_it->wd);
+ elm_genlist_item_update(it);
+ }
+}
+
+EAPI Eina_Bool
+elm_genlist_item_flip_get(const Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ return _it->flipped;
+}
+
/* for gengrid as of now */
void
_elm_genlist_page_relative_set(Evas_Object *obj,
EAPI Eina_Bool elm_genlist_edit_mode_get(const Evas_Object *obj);
/**
+ * Set the flip state of a given genlist item.
+ *
+ * @param it The genlist item object
+ * @param flip The flip mode
+ * (EINA_TRUE = on, EINA_FALSE = off)
+ *
+ * This function sets the flip state of a given genlist item.
+ * Flip mode overrides current item object.
+ * It can be used for on-the-fly item replace.
+ *
+ * @see elm_genlist_item_flip_get()
+ *
+ * @ingroup Genlist
+ */
+
+EAPI void elm_genlist_item_flip_set(Elm_Object_Item *it, Eina_Bool flip);
+
+/**
+ * Get the flip state of a given genlist item.
+ *
+ * @param it The genlist item object
+ *
+ * This function returns the flip state of a given genlist item.
+ * If the parameter is invalid, it returns EINA_FALSE.
+ *
+ * @see elm_genlist_item_flip_set()
+ *
+ * @ingroup Genlist
+ */
+
+EAPI Eina_Bool elm_genlist_item_flip_get(const Elm_Object_Item *it);
+
+/**
* @}
*/