Dear all

I added two apis for item selecting mode.
It almost same with elm_genlist_select_mode.


+EAPI void
+elm_genlist_item_select_mode_set(Elm_Object_Item *it,
+                                 Elm_Object_Select_Mode_Type mode)
+EAPI Elm_Object_Select_Mode_Type
+elm_genlist_item_select_mode_get(const Elm_Object_Item *it)

And display_only apis is unfied with item_select_mode.

+EINA_DEPRECATED EAPI void
elm_genlist_item_display_only_set(Elm_Object_Item *it, Eina_Bool
display_only);
+EINA_DEPRECATED EAPI Eina_Bool
elm_genlist_item_display_only_get(const Elm_Object_Item *it);

Thanks.
Index: elementary/src/lib/elm_genlist.c
===================================================================
--- elementary/src/lib/elm_genlist.c    (리비전 68973)
+++ elementary/src/lib/elm_genlist.c    (작업 사본)
@@ -692,7 +692,8 @@ _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) ||
+       (it->select_mode == ELM_OBJECT_DISPLAY_ONLY_SELECT))
      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");
@@ -991,7 +992,7 @@ _mouse_move(void        *data,
           }
         return;
      }
-   if (!it->display_only)
+   if (it->select_mode != ELM_OBJECT_DISPLAY_ONLY_SELECT)
      elm_coords_finger_size_adjust(1, &minw, 1, &minh);
    evas_object_geometry_get(obj, &x, &y, NULL, NULL);
    x = ev->cur.canvas.x - x;
@@ -1057,7 +1058,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_DISPLAY_ONLY_SELECT))
      return ECORE_CALLBACK_CANCEL;
    it->wd->longpressed = EINA_TRUE;
    evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
@@ -1096,7 +1098,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_DISPLAY_ONLY_SELECT) ||
+       elm_widget_item_disabled_get(it)) return;
    it->wd->swipe = EINA_FALSE;
    for (i = 0; i < it->wd->movements; i++)
      {
@@ -1304,7 +1307,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_DISPLAY_ONLY_SELECT))
        {
           evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
           evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
@@ -1413,7 +1417,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_DISPLAY_ONLY_SELECT))
      return;
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
    if (it->wd->multi)
@@ -2105,12 +2110,12 @@ _item_realize(Elm_Gen_Item *it,
           {
              Evas_Coord mw = -1, mh = -1;
 
-             if (!it->display_only)
+             if (it->select_mode != ELM_OBJECT_DISPLAY_ONLY_SELECT)
                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->select_mode != ELM_OBJECT_DISPLAY_ONLY_SELECT)
                elm_coords_finger_size_adjust(1, &mw, 1, &mh);
              it->item->w = it->item->minw = mw;
              it->item->h = it->item->minh = mh;
@@ -4804,30 +4809,33 @@ elm_genlist_item_expanded_depth_get(const Elm_Obje
    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_select_mode_set(it, ELM_OBJECT_DISPLAY_ONLY_SELECT);
+   else
+     {
+        Elm_Object_Select_Mode_Type oldmode = 
elm_genlist_item_select_mode_get(it);
+        if (oldmode == ELM_OBJECT_DISPLAY_ONLY_SELECT)
+          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_DISPLAY_ONLY_SELECT)
+     return EINA_TRUE;
+   return EINA_FALSE;
 }
 
 static Eina_Bool _elm_genlist_item_compute_coordinates(
@@ -5760,6 +5768,38 @@ elm_genlist_highlight_mode_get(const Evas_Object *
    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;
+
+   if (_it->select_mode == ELM_OBJECT_DISPLAY_ONLY_SELECT)
+     {
+        _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 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;
+}
+
 /* for gengrid as of now */
 void
 _elm_genlist_page_relative_set(Evas_Object *obj,
Index: elementary/src/lib/elm_genlist.h
===================================================================
--- elementary/src/lib/elm_genlist.h    (리비전 68973)
+++ elementary/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
@@ -1571,41 +1571,6 @@ EAPI Eina_Bool                     elm_genlist_ite
 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
@@ -1928,5 +1893,49 @@ EAPI Eina_Bool
 elm_genlist_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.
+ * - ELM_OBJECT_DISPLAY_ONLY_SELECT : This will apply no-finger-size rule with
+ *      with ELM_OBJECT_NO_SELECT. No-finger-size rule makes an item can be
+ *      smaller than lower limit. In some touch or small screen devices,
+ *      clickable objects should be bigger than human touch point device
+ *      (your finger). So it is enabled, the item can be smaller than
+ *      predefined finger-size value. And the item will be updated.
+ *
+ * @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);
+
+/**
  * @}
  */
Index: elementary/src/lib/elm_general.h
===================================================================
--- elementary/src/lib/elm_general.h    (리비전 68973)
+++ elementary/src/lib/elm_general.h    (작업 사본)
@@ -99,6 +99,7 @@ typedef enum
    ELM_OBJECT_NORMAL_SELECT = 0, /**< default select mode */
    ELM_OBJECT_ALWAYS_SELECT, /**< always select mode */
    ELM_OBJECT_NO_SELECT, /**< no select mode */
+   ELM_OBJECT_DISPLAY_ONLY_SELECT, /**< no select mode with no finger size 
rule*/
 
    ELM_OBJECT_SELECT_MODE_MAX
 } Elm_Object_Select_Mode_Type;
Index: elementary/src/lib/elm_gen_common.h
===================================================================
--- elementary/src/lib/elm_gen_common.h (리비전 68973)
+++ elementary/src/lib/elm_gen_common.h (작업 사본)
@@ -51,6 +51,7 @@ 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;
Index: elementary/src/lib/elm_gengrid.h
===================================================================
--- elementary/src/lib/elm_gengrid.h    (리비전 68973)
+++ elementary/src/lib/elm_gengrid.h    (작업 사본)
@@ -1,5 +1,3 @@
-// XXX: elm_gengrid - make sure api's match 1:1 with genlist api's
-// for eventual move to back-end of gengrid == genlist (in grid mode)
 /**
  * @defgroup Gengrid Gengrid (Generic grid)
  *
@@ -131,8 +129,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.
Index: elementary/src/lib/elm_deprecated.h
===================================================================
--- elementary/src/lib/elm_deprecated.h (리비전 68973)
+++ elementary/src/lib/elm_deprecated.h (작업 사본)
@@ -6116,5 +6116,38 @@ EINA_DEPRECATED EAPI void
 EINA_DEPRECATED EAPI Eina_Bool                    
elm_list_always_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()
+ *
+ * @deprecated elm_genlist_item_display_only_set()
+ */
+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()
+ *
+ * @deprecated elm_genlist_item_display_only_get()
+ */
+EINA_DEPRECATED EAPI Eina_Bool                     
elm_genlist_item_display_only_get(const Elm_Object_Item *it);
+
+/**
  * @}
  */
Index: elementary/src/bin/test_genlist.c
===================================================================
--- elementary/src/bin/test_genlist.c   (리비전 68973)
+++ elementary/src/bin/test_genlist.c   (작업 사본)
@@ -1574,7 +1574,7 @@ test_genlist8(void *data __UNUSED__, Evas_Object *
                                                  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_select_mode_set(git, 
ELM_OBJECT_DISPLAY_ONLY_SELECT);
           }
         else if (git)
           {
@@ -1703,7 +1703,8 @@ test_genlist9(void *data __UNUSED__, Evas_Object *
    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_select_mode_set(git, ELM_OBJECT_DISPLAY_ONLY_SELECT);
+
    elm_genlist_item_append(gl, itc1,
                            (void *)1/* item data */, git/* parent */, 
ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
                            NULL/* func data */);
@@ -1716,7 +1717,8 @@ test_genlist9(void *data __UNUSED__, Evas_Object *
    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_select_mode_set(git, ELM_OBJECT_DISPLAY_ONLY_SELECT);
+
    elm_genlist_item_append(gl, itc1,
                            (void *)5/* item data */, git/* parent */, 
ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
                            NULL/* func data */);
Index: elementary/src/examples/genlist_example_04.c
===================================================================
--- elementary/src/examples/genlist_example_04.c        (리비전 68973)
+++ elementary/src/examples/genlist_example_04.c        (작업 사본)
@@ -322,7 +322,7 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED
                                                  (void *)(long)nitems++, NULL,
                                                  ELM_GENLIST_ITEM_GROUP,
                                                  _item_sel_cb, NULL);
-             elm_genlist_item_display_only_set(glg, EINA_TRUE);
+             elm_genlist_item_select_mode_set(git, 
ELM_OBJECT_DISPLAY_ONLY_SELECT);
           }
         else
           {
------------------------------------------------------------------------------
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

Reply via email to