genlist, gengrid: Add ELM_OBJECT_MULTIPLE_SELECT_MODE_WITH_CONTROL
authorRyuan Choi <ryuan.choi@gmail.com>
Sat, 2 Nov 2013 11:50:59 +0000 (20:50 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sat, 2 Nov 2013 11:53:43 +0000 (20:53 +0900)
Summary:
Some applications like file viewer allow multiple selection only with
Control key was pressed.

Reviewers: seoz, raster

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D251

Conflicts:
ChangeLog
NEWS

legacy/elementary/ChangeLog
legacy/elementary/NEWS
legacy/elementary/src/lib/elm_general.h
legacy/elementary/src/lib/elm_gengrid.c
legacy/elementary/src/lib/elm_gengrid_legacy.h
legacy/elementary/src/lib/elm_genlist.c
legacy/elementary/src/lib/elm_genlist_legacy.h

index 0060f0a..66e4536 100644 (file)
 2013-10-30  Shilpa Onkar Singh
 
         * slider: Added elm_slider_step_get(), elm_slider_step_set().
+
+2013-10-02  Ryuan Choi (ryuan)
+
+        * genlist , gengrid: Add ELM_OBJECT_MULTIPLE_SELECT_MODE_WITH_CONTROL.
+        It disallow multiple selection when clicked without control pressed although
+        multiple selection is enabled.
index 9342851..4ba58bf 100644 (file)
@@ -101,6 +101,7 @@ Additions:
    * Add support for "clicked" callback on Return/space/KP_Enter key press for image.
    * Add "virtualkeypad,size,changed" callback on virtualkeypad min size change for conformant.
    * Add elm_slider_step_get(), elm_slider_step_set() for slider.
+   * Add ELM_OBJECT_MULTIPLE_SELECT_MODE_WITH_CONTROL select mode for genlist/gengrid.
 
 Improvements:
 
index 2ad5d2d..9f5e140 100644 (file)
@@ -126,6 +126,7 @@ typedef enum
    ELM_OBJECT_SELECT_MODE_ALWAYS, /**< always select mode */
    ELM_OBJECT_SELECT_MODE_NONE, /**< no select mode */
    ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY, /**< no select mode with no finger size rule*/
+   ELM_OBJECT_MULTIPLE_SELECT_MODE_WITH_CONTROL, /**< disallow mutiple selection when clicked without control key pressed */
    ELM_OBJECT_SELECT_MODE_MAX
 } Elm_Object_Select_Mode;
 
index b315bf5..883d4fb 100644 (file)
@@ -596,7 +596,9 @@ _item_mouse_up_cb(void *data,
           _elm_gengrid_item_unrealize(it, EINA_FALSE);
      }
    if (elm_widget_item_disabled_get(it) || (dragged)) return;
-   if (sd->multi)
+   if (sd->multi &&
+       ((sd->select_mode != ELM_OBJECT_MULTIPLE_SELECT_MODE_WITH_CONTROL) ||
+        (evas_key_modifier_is_set(ev->modifiers, "Control"))))
      {
         if (!it->selected)
           {
index f55edc0..0f09c70 100644 (file)
@@ -799,8 +799,12 @@ EAPI Eina_Bool                     elm_gengrid_filled_get(const Evas_Object *obj
  * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items
  *      entirely and they will neither appear selected nor call selected
  *      callback functions.
+ * - ELM_OBJECT_MULTIPLE_SELECT_MODE_WITH_CONTROL : Only one item will be selected
+ *      although multi-selection is enabled, if clicked without pressing control
+ *      key. This mode is only available with multi-selection.
  *
  * @see elm_gengrid_select_mode_get()
+ * @see elm_gengrid_multi_select_set()
  *
  * @ingroup Gengrid
  */
index ff3c8b0..cdb27be 100644 (file)
@@ -4220,7 +4220,9 @@ _item_mouse_up_cb(void *data,
      return;
 
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
-   if (sd->multi)
+   if (sd->multi &&
+       ((sd->select_mode != ELM_OBJECT_MULTIPLE_SELECT_MODE_WITH_CONTROL) ||
+        (evas_key_modifier_is_set(ev->modifiers, "Control"))))
      {
         if (!it->selected)
           {
index 3332d32..d1a02fc 100644 (file)
@@ -575,8 +575,12 @@ EAPI Eina_Bool          elm_genlist_tree_effect_enabled_get(const Evas_Object *o
  * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items
  *      entirely and they will neither appear selected nor call selected
  *      callback functions.
+ * - ELM_OBJECT_MULTIPLE_SELECT_MODE_WITH_CONTROL : Only one item will be selected
+ *      although multi-selection is enabled, if clicked without pressing control
+ *      key. This mode is only available with multi-selection.
  *
  * @see elm_genlist_select_mode_get()
+ * @see elm_genlist_multi_select_set()
  *
  * @ingroup Genlist
  */