Dear all.
I made a patch about genlist_item_display_only_set()
This api consist of setting finger size flag and making item no select mode.
So I split with two apis.
+EAPI void
+elm_genlist_item_select_mode_set(Elm_Object_Item *it,
+ Elm_Object_Select_Mode_Type mode);
+EAPI void
+elm_genlist_item_no_finger_size_calc_set(Elm_Object_Item *it,
Eina_Bool no_finger_size);
Also two getting apis is added
+EAPI Eina_Bool
+elm_genlist_item_no_finger_size_calc_get(const Elm_Object_Item *it);
+EAPI Elm_Object_Select_Mode_Type
+elm_genlist_item_select_mode_get(const Elm_Object_Item *it);
After applied this patch, users can selectively applying finger size
and item select.
Such as
- elm_genlist_item_display_only_set(git, EINA_TRUE);
+ elm_genlist_item_no_finger_size_calc_set(git, EINA_TRUE);
+ elm_genlist_item_select_mode_set(git, ELM_OBJECT_NO_SELECT);
Thanks
From 250410d0d8c92773eefb7350d0f570da64c34893 Mon Sep 17 00:00:00 2001
From: Hyoyoung Chang <hyoyoung.ch...@samsung.com>
Date: Wed, 7 Mar 2012 15:33:17 +0900
Subject: [PATCH] [genlist] add item finger size calc and item select mode api
---
src/bin/test_genlist.c | 11 +++-
src/lib/elm_deprecated.h | 33 +++++++++++++
src/lib/elm_gen_common.h | 2 +
src/lib/elm_gengrid.h | 5 +-
src/lib/elm_genlist.c | 104 +++++++++++++++++++++++++++++++----------
src/lib/elm_genlist.h | 116 ++++++++++++++++++++++++++++++----------------
6 files changed, 202 insertions(+), 69 deletions(-)
diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c
index 0cf9e61..b571eb8 100644
--- a/src/bin/test_genlist.c
+++ b/src/bin/test_genlist.c
@@ -1573,7 +1573,8 @@ test_genlist8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
ELM_GENLIST_ITEM_GROUP,
gl_sel/* func */,
(void *)(long)(i * 10)/* func data */);
- elm_genlist_item_display_only_set(git, EINA_TRUE);
+ elm_genlist_item_no_finger_size_calc_set(git, EINA_TRUE);
+ elm_genlist_item_select_mode_set(git, ELM_OBJECT_NO_SELECT);
}
else if (git)
{
@@ -1702,7 +1703,9 @@ test_genlist9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
git = elm_genlist_item_append(gl, &itc_group,
(void *)0/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_display_only_set(git, EINA_TRUE);
+ elm_genlist_item_no_finger_size_calc_set(git, EINA_TRUE);
+ elm_genlist_item_select_mode_set(git, ELM_OBJECT_NO_SELECT);
+
elm_genlist_item_append(gl, itc1,
(void *)1/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
NULL/* func data */);
@@ -1715,7 +1718,9 @@ test_genlist9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
git = elm_genlist_item_append(gl, &itc_group,
(void *)4/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_display_only_set(git, EINA_TRUE);
+ elm_genlist_item_no_finger_size_calc_set(git, EINA_TRUE);
+ elm_genlist_item_select_mode_set(git, ELM_OBJECT_NO_SELECT);
+
elm_genlist_item_append(gl, itc1,
(void *)5/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
NULL/* func data */);
diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h
index d20217d..4caf06f 100644
--- a/src/lib/elm_deprecated.h
+++ b/src/lib/elm_deprecated.h
@@ -5231,5 +5231,38 @@ EINA_DEPRECATED EAPI void elm_toolbar_no_select_mode_set
EINA_DEPRECATED EAPI Eina_Bool elm_toolbar_no_select_mode_get(const Evas_Object *obj);
/**
+ * Sets the display only state of an item.
+ *
+ * @param it The item
+ * @param display_only @c EINA_TRUE if the item is display only, @c
+ * EINA_FALSE otherwise.
+ *
+ * A display only item cannot be selected or unselected. It is for
+ * display only and not selecting or otherwise clicking, dragging
+ * etc. by the user, thus finger size rules will not be applied to
+ * this item.
+ *
+ * It's good to set group index items to display only state.
+ *
+ * @see elm_genlist_item_display_only_get()
+ *
+ * @ingroup Genlist
+ */
+EINA_DEPRECATED EAPI void elm_genlist_item_display_only_set(Elm_Object_Item *it, Eina_Bool display_only);
+
+/**
+ * Get the display only state of an item
+ *
+ * @param it The item
+ * @return @c EINA_TRUE if the item is display only, @c
+ * EINA_FALSE otherwise.
+ *
+ * @see elm_genlist_item_display_only_set()
+ *
+ * @ingroup Genlist
+ */
+EINA_DEPRECATED EAPI Eina_Bool elm_genlist_item_display_only_get(const Elm_Object_Item *it);
+
+/**
* @}
*/
diff --git a/src/lib/elm_gen_common.h b/src/lib/elm_gen_common.h
index ebee81e..6243889 100644
--- a/src/lib/elm_gen_common.h
+++ b/src/lib/elm_gen_common.h
@@ -59,10 +59,12 @@ struct Elm_Gen_Item
Ecore_Cb unsel_cb, unhighlight_cb, unrealize_cb;
int position;
+ Elm_Object_Select_Mode_Type select_mode;
Eina_Bool position_update : 1;
Eina_Bool want_unrealize : 1;
Eina_Bool display_only : 1;
+ Eina_Bool no_finger_size : 1;
Eina_Bool realized : 1;
Eina_Bool selected : 1;
Eina_Bool highlighted : 1;
diff --git a/src/lib/elm_gengrid.h b/src/lib/elm_gengrid.h
index ce59260..c269182 100644
--- a/src/lib/elm_gengrid.h
+++ b/src/lib/elm_gengrid.h
@@ -131,8 +131,9 @@
* Grid cells will only have their selection smart callbacks called
* when firstly getting selected. Any further clicks will do
* nothing, unless you enable the "always select mode", with
- * elm_gengrid_always_select_mode_set(), thus making every click to
- * issue selection callbacks. elm_gengrid_no_select_mode_set() will
+ * elm_gengrid_select_mode_set() as ELM_OBJECT_ALWAYS_SELECT,
+ * thus making every click to issue selection callbacks.
+ * elm_gengrid_select_mode_set() as ELM_OBJECT_NO_SELECT will
* turn off the ability to select items entirely in the widget and
* they will neither appear selected nor call the selection smart
* callbacks.
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index d56c6db..918d1cc 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -683,7 +683,7 @@ _item_highlight(Elm_Gen_Item *it)
(it->wd->no_highlight) ||
(it->generation < it->wd->generation) ||
(it->highlighted) || elm_widget_item_disabled_get(it) ||
- (it->display_only) || (it->item->mode_view))
+ (it->select_mode == ELM_OBJECT_NO_SELECT) || (it->item->mode_view))
return;
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,selected", "elm");
@@ -969,7 +969,7 @@ _mouse_move(void *data,
}
return;
}
- if (!it->display_only)
+ if (!it->no_finger_size)
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
x = ev->cur.canvas.x - x;
@@ -1035,7 +1035,8 @@ _long_press(void *data)
Eina_List *list, *l;
it->long_timer = NULL;
- if (elm_widget_item_disabled_get(it) || (it->dragging) || (it->display_only))
+ if (elm_widget_item_disabled_get(it) || (it->dragging) ||
+ (it->select_mode == ELM_OBJECT_NO_SELECT))
return ECORE_CALLBACK_CANCEL;
it->wd->longpressed = EINA_TRUE;
evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
@@ -1074,7 +1075,8 @@ _swipe(Elm_Gen_Item *it)
int i, sum = 0;
if (!it) return;
- if ((it->display_only) || elm_widget_item_disabled_get(it)) return;
+ if ((it->select_mode == ELM_OBJECT_NO_SELECT) ||
+ elm_widget_item_disabled_get(it)) return;
it->wd->swipe = EINA_FALSE;
for (i = 0; i < it->wd->movements; i++)
{
@@ -1282,7 +1284,8 @@ _mouse_down(void *data,
it->wd->wasselected = it->selected;
_item_highlight(it);
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
- if ((!elm_widget_item_disabled_get(it)) && (!it->display_only))
+ if ((!elm_widget_item_disabled_get(it)) &&
+ (it->select_mode != ELM_OBJECT_NO_SELECT))
{
evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
@@ -1391,7 +1394,8 @@ _mouse_up(void *data,
_item_block_unrealize(it->item->block);
}
}
- if (elm_widget_item_disabled_get(it) || (dragged) || (it->display_only))
+ if (elm_widget_item_disabled_get(it) || (dragged) ||
+ (it->select_mode == ELM_OBJECT_NO_SELECT))
return;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
if (it->wd->multi)
@@ -2083,12 +2087,12 @@ _item_realize(Elm_Gen_Item *it,
{
Evas_Coord mw = -1, mh = -1;
- if (!it->display_only)
+ if (!it->no_finger_size)
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
mh);
- if (!it->display_only)
+ if (!it->no_finger_size)
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
it->item->w = it->item->minw = mw;
it->item->h = it->item->minh = mh;
@@ -3476,7 +3480,8 @@ _item_select(Elm_Gen_Item *it)
it->selected = EINA_TRUE;
it->wd->selected = eina_list_append(it->wd->selected, it);
}
- else if (it->wd->select_mode == ELM_OBJECT_ALWAYS_SELECT) return;
+ else if ((it->wd->select_mode == ELM_OBJECT_ALWAYS_SELECT) ||
+ (it->select_mode == ELM_OBJECT_ALWAYS_SELECT)) return;
evas_object_ref(WIDGET(it));
it->walking++;
@@ -4695,30 +4700,32 @@ elm_genlist_item_expanded_depth_get(const Elm_Object_Item *it)
return ((Elm_Gen_Item *)it)->item->expanded_depth;
}
-EAPI void
+EINA_DEPRECATED EAPI void
elm_genlist_item_display_only_set(Elm_Object_Item *it,
Eina_Bool display_only)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
- display_only = !!display_only;
- if (_it->display_only == display_only) return;
- if (_it->generation < _it->wd->generation) return;
- _it->display_only = display_only;
- _it->item->mincalcd = EINA_FALSE;
- _it->item->updateme = EINA_TRUE;
- if (_it->item->block) _it->item->block->updateme = EINA_TRUE;
- if (_it->wd->update_job) ecore_job_del(_it->wd->update_job);
- _it->wd->update_job = ecore_job_add(_update_job, _it->wd);
+ if (display_only)
+ {
+ elm_genlist_item_no_finger_size_calc_set(it, EINA_TRUE);
+ elm_genlist_item_select_mode_set(it, ELM_OBJECT_NO_SELECT);
+ }
+ else
+ {
+ elm_genlist_item_no_finger_size_calc_set(it, EINA_FALSE);
+ elm_genlist_item_select_mode_set(it, ELM_OBJECT_NORMAL_SELECT);
+ }
}
-EAPI Eina_Bool
+EINA_DEPRECATED EAPI Eina_Bool
elm_genlist_item_display_only_get(const Elm_Object_Item *it)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
- Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
- if (_it->generation < _it->wd->generation) return EINA_FALSE;
- return _it->display_only;
+ Elm_Object_Select_Mode_Type oldmode = elm_genlist_item_select_mode_get(it);
+ if (oldmode == ELM_OBJECT_NO_SELECT)
+ return EINA_TRUE;
+ else
+ return EINA_FALSE;
}
EAPI void
@@ -5730,6 +5737,55 @@ elm_genlist_no_highlight_mode_get(const Evas_Object *obj)
return wd->no_highlight;
}
+EAPI void
+elm_genlist_item_select_mode_set(Elm_Object_Item *it,
+ Elm_Object_Select_Mode_Type mode)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (!_it) return;
+ if (_it->generation < _it->wd->generation) return;
+ if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
+ return;
+ if (_it->select_mode != mode)
+ _it->select_mode = mode;
+}
+
+EAPI Elm_Object_Select_Mode_Type
+elm_genlist_item_select_mode_get(const Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ELM_OBJECT_SELECT_MODE_MAX);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (!_it) return ELM_OBJECT_SELECT_MODE_MAX;
+ return _it->select_mode;
+}
+
+EAPI void
+elm_genlist_item_no_finger_size_calc_set(Elm_Object_Item *it,
+ Eina_Bool no_finger_size)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ no_finger_size = !!no_finger_size;
+ if (_it->no_finger_size == no_finger_size) return;
+ if (_it->generation < _it->wd->generation) return;
+ _it->no_finger_size = no_finger_size;
+ _it->item->mincalcd = EINA_FALSE;
+ _it->item->updateme = EINA_TRUE;
+ if (_it->item->block) _it->item->block->updateme = EINA_TRUE;
+ if (_it->wd->update_job) ecore_job_del(_it->wd->update_job);
+ _it->wd->update_job = ecore_job_add(_update_job, _it->wd);
+
+}
+
+EAPI Eina_Bool
+elm_genlist_item_no_finger_size_calc_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->no_finger_size;
+}
+
/* for gengrid as of now */
void
_elm_genlist_page_relative_set(Evas_Object *obj,
diff --git a/src/lib/elm_genlist.h b/src/lib/elm_genlist.h
index d05b7b0..a8f09c7 100644
--- a/src/lib/elm_genlist.h
+++ b/src/lib/elm_genlist.h
@@ -193,11 +193,11 @@
*
* Items will only call their selection func and callback when first becoming
* selected. Any further clicks will do nothing, unless you enable always
- * select with elm_genlist_always_select_mode_set(). This means even if
- * selected, every click will make the selected callbacks be called.
- * elm_genlist_no_select_mode_set() will turn off the ability to select
- * items entirely and they will neither appear selected nor call selected
- * callback functions.
+ * select with elm_genlist_select_mode_set() as ELM_OBJECT_ALWAYS_SELECT.
+ * This means even if selected, every click will make the selected callbacks
+ * be called.elm_genlist_select_mode_set() as ELM_OBJECT_NO_SELECT will
+ * turn off the ability to select items entirely and they will neither
+ * appear selected nor call selected callback functions.
*
* Remember that you can create new styles and add your own theme augmentation
* per application with elm_theme_extension_add(). If you absolutely must
@@ -1624,41 +1624,6 @@ EAPI Eina_Bool elm_genlist_item_expanded_get(const Elm_Objec
EAPI int elm_genlist_item_expanded_depth_get(const Elm_Object_Item *it);
/**
- * Sets the display only state of an item.
- *
- * @param it The item
- * @param display_only @c EINA_TRUE if the item is display only, @c
- * EINA_FALSE otherwise.
- *
- * A display only item cannot be selected or unselected. It is for
- * display only and not selecting or otherwise clicking, dragging
- * etc. by the user, thus finger size rules will not be applied to
- * this item.
- *
- * It's good to set group index items to display only state.
- *
- * @see elm_genlist_item_display_only_get()
- *
- * @ingroup Genlist
- */
-//XXX: elm_genlist_item_no_select_mode_set()?
-EAPI void elm_genlist_item_display_only_set(Elm_Object_Item *it, Eina_Bool display_only);
-
-/**
- * Get the display only state of an item
- *
- * @param it The item
- * @return @c EINA_TRUE if the item is display only, @c
- * EINA_FALSE otherwise.
- *
- * @see elm_genlist_item_display_only_set()
- *
- * @ingroup Genlist
- */
-//XXX: elm_genlist_item_no_select_mode_get()?
-EAPI Eina_Bool elm_genlist_item_display_only_get(const Elm_Object_Item *it);
-
-/**
* Unset all contents fetched by the item class
*
* @param it The item
@@ -1959,5 +1924,76 @@ EAPI Eina_Bool
elm_genlist_no_highlight_mode_get(const Evas_Object *obj);
/**
+ * Set the genlist item's select mode.
+ *
+ * @param it The genlist item object
+ * @param mode The select mode
+ *
+ * elm_genlist_select_mode_set() changes item's select mode.
+ * - ELM_OBJECT_NORMAL_SELECT : The item will only call their selection func and
+ * callback when first becoming selected. Any further clicks will
+ * do nothing, unless you set always select mode.
+ * - ELM_OBJECT_ALWAYS_SELECT : This means that, even if selected,
+ * every click will make the selected callbacks be called.
+ * - ELM_OBJECT_NO_SELECT : This will turn off the ability to select the item
+ * entirely and they will neither appear selected nor call selected
+ * callback functions.
+ *
+ * @see elm_genlist_item_select_mode_get()
+ *
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_item_select_mode_set(Elm_Object_Item *it,
+ Elm_Object_Select_Mode_Type mode);
+
+/**
+ * Get the genlist item's select mode.
+ *
+ * @param it The genlist item object
+ * @return The select mode
+ * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX)
+ *
+ * @see elm_genlist_item_select_mode_set()
+ *
+ * @ingroup Genlist
+ */
+EAPI Elm_Object_Select_Mode_Type
+elm_genlist_item_select_mode_get(const Elm_Object_Item *it);
+
+/**
+ * Set whether the genlist item's should be finger size calculated.
+ *
+ * @param it The genlist item object.
+ * @param no_finger_size @c EINA_TRUE to disable finger size calculating
+ * or @c EINA_FALSE to enable it.
+ *
+ * This fuction can turn off the finger size calculating when item creation
+ * and other item operation. Finger size rule is enabled by default.
+ * That means no_finger_size is set as EINA_FALSE by default.
+ * If finger size setting value is changed, the item will be updated.
+ *
+ * @see elm_genlist_no_finger_size_calc_get().
+ *
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_item_no_finger_size_calc_set(Elm_Object_Item *it, Eina_Bool no_finger_size);
+
+/**
+ * Get whether the genlist item's should be finger size calculated.
+ *
+ * @param it The genlist item object.
+ * @return @c EINA_TRUE means item doesn't calculate finger size @c EINA_FALSE indicates
+ * it can. If @p obj is @c NULL, @c EINA_FALSE is returned.
+ *
+ * @see elm_genlist_no_finger_size_calc_set() for details.
+ *
+ * @ingroup Genlist
+ */
+EAPI Eina_Bool
+elm_genlist_item_no_finger_size_calc_get(const Elm_Object_Item *it);
+
+/**
* @}
*/
--
1.7.5.4
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel