genlist, gengrid: Add ELM_OBJECT_MULTIPLE_SELECT_MODE_WITH_CONTROL

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
This commit is contained in:
Ryuan Choi 2013-11-02 20:50:59 +09:00 committed by Carsten Haitzler (Rasterman)
parent 6027ce9bad
commit 5836a25bc8
7 changed files with 22 additions and 2 deletions

View File

@ -1735,3 +1735,9 @@
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.

View 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:

View 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;

View 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)
{

View 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
*/

View 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)
{

View 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
*/