forked from enlightenment/efl
From: Hyoyoung Chang <hyoyoung@gmail.com>
Subject: [E-devel] [patch] elm_gen{list, grid} - add elm_genlist_select_mode_set As discussed in irc, I made a patch about unifying always_select_mode_set and no_select_mode_set. I'm introducing two apis in genlist (also in gengrid) +EAPI void +elm_genlist_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode_Type mode) +EAPI Elm_Object_Select_Mode_Type +elm_genlist_select_mode_get(const Evas_Object *obj); And added a enum in elm_general.h +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_SELECT_MODE_MAX +} Elm_Object_Select_Mode_Type; After this is commited, i'll send a patch about examples and edje_external. SVN revision: 68937
This commit is contained in:
parent
f545d9ace9
commit
d1ab1c10e3
|
@ -42,7 +42,7 @@ set_api_state(api_data *api)
|
|||
break;
|
||||
|
||||
case GRID_NO_SELECT_MODE: /* 2 */
|
||||
elm_gengrid_no_select_mode_set(grid, EINA_TRUE);
|
||||
elm_gengrid_select_mode_set(grid, ELM_OBJECT_NO_SELECT);
|
||||
break;
|
||||
|
||||
case GRID_NO_BOUNCE: /* 3 */
|
||||
|
|
|
@ -42,12 +42,12 @@ set_api_state(api_data *api)
|
|||
break;
|
||||
|
||||
case NO_SELECT_MODE_SET: /* 1 */
|
||||
elm_genlist_no_select_mode_set(gl, EINA_TRUE);
|
||||
elm_genlist_select_mode_set(gl, ELM_OBJECT_NO_SELECT);
|
||||
elm_genlist_mode_set(gl, ELM_LIST_SCROLL); /* Back to default */
|
||||
break;
|
||||
|
||||
case COMPRESS_MODE_SET: /* 2 */
|
||||
elm_genlist_no_select_mode_set(gl, EINA_FALSE); /* Back to default */
|
||||
elm_genlist_select_mode_set(gl, ELM_OBJECT_NORMAL_SELECT);
|
||||
elm_genlist_compress_mode_set(gl, EINA_TRUE);
|
||||
break;
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ test_genlist5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
|
|||
evas_object_show(bx);
|
||||
|
||||
gl = elm_genlist_add(win);
|
||||
elm_genlist_always_select_mode_set(gl, 1);
|
||||
elm_genlist_select_mode_set(gl, ELM_OBJECT_ALWAYS_SELECT);
|
||||
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);
|
||||
|
@ -2401,14 +2401,14 @@ static void
|
|||
gl15_edit_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
elm_genlist_edit_mode_set(data, EINA_TRUE);
|
||||
elm_genlist_always_select_mode_set(data, EINA_TRUE);
|
||||
elm_genlist_select_mode_set(data, ELM_OBJECT_ALWAYS_SELECT);
|
||||
}
|
||||
|
||||
static void
|
||||
gl15_normal_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
elm_genlist_edit_mode_set(data, EINA_FALSE);
|
||||
elm_genlist_always_select_mode_set(data, EINA_FALSE);
|
||||
elm_genlist_select_mode_set(data, ELM_OBJECT_NORMAL_SELECT);
|
||||
}
|
||||
|
||||
void gl15_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
|
||||
|
@ -2564,7 +2564,7 @@ test_genlist16(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
|
|||
|
||||
/* note: flip mode can be used with/without edit mode */
|
||||
elm_genlist_edit_mode_set(gl, EINA_TRUE);
|
||||
elm_genlist_always_select_mode_set(gl, EINA_TRUE);
|
||||
elm_genlist_select_mode_set(gl, ELM_OBJECT_ALWAYS_SELECT);
|
||||
|
||||
itc15 = elm_genlist_item_class_new();
|
||||
itc15->item_style = "default";
|
||||
|
|
|
@ -6019,17 +6019,135 @@ EINA_DEPRECATED EAPI void elm_genlist_item_middle_show(
|
|||
EINA_DEPRECATED EAPI void elm_diskselector_round_set(Evas_Object *obj, Eina_Bool round);
|
||||
|
||||
/**
|
||||
* Get a value whether round mode is enabled or not.
|
||||
* Set the always select mode.
|
||||
*
|
||||
* @see elm_diskselector_round_enabled_set() for details.
|
||||
* @param obj The genlist object
|
||||
* @param always_select The always select mode (@c EINA_TRUE = on, @c
|
||||
* EINA_FALSE = off). Default is @c EINA_FALSE.
|
||||
*
|
||||
* @param obj The diskselector object.
|
||||
* @return @c EINA_TRUE means round mode is enabled. @c EINA_FALSE indicates
|
||||
* it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned.
|
||||
* 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 that, even if selected, every click will make the selected
|
||||
* callbacks be called.
|
||||
*
|
||||
* @deprecated elm_diskselector_round_enabled_get()
|
||||
* @see elm_genlist_always_select_mode_get()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
EINA_DEPRECATED EAPI Eina_Bool elm_diskselector_round_get(const Evas_Object *obj);
|
||||
EINA_DEPRECATED EAPI void elm_genlist_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
|
||||
|
||||
|
||||
/**
|
||||
* Get the always select mode.
|
||||
*
|
||||
* @param obj The genlist object
|
||||
* @return The always select mode
|
||||
* (@c EINA_TRUE = on, @c EINA_FALSE = off)
|
||||
*
|
||||
* @see elm_genlist_always_select_mode_set()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
EINA_DEPRECATED EAPI Eina_Bool elm_genlist_always_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Enable/disable the no select mode.
|
||||
*
|
||||
* @param obj The genlist object
|
||||
* @param no_select The no select mode
|
||||
* (EINA_TRUE = on, EINA_FALSE = off)
|
||||
*
|
||||
* This will turn off the ability to select items entirely and they
|
||||
* will neither appear selected nor call selected callback functions.
|
||||
*
|
||||
* @see elm_genlist_no_select_mode_get()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
EINA_DEPRECATED EAPI void elm_genlist_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select);
|
||||
|
||||
/**
|
||||
* Gets whether the no select mode is enabled.
|
||||
*
|
||||
* @param obj The genlist object
|
||||
* @return The no select mode
|
||||
* (@c EINA_TRUE = on, @c EINA_FALSE = off)
|
||||
*
|
||||
* @see elm_genlist_no_select_mode_set()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
EINA_DEPRECATED EAPI Eina_Bool elm_genlist_no_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Set whether items on a given gengrid widget are to get their
|
||||
* selection callbacks issued for @b every subsequent selection
|
||||
* click on them or just for the first click.
|
||||
*
|
||||
* @param obj The gengrid object
|
||||
* @param always_select @c EINA_TRUE to make items "always
|
||||
* selected", @c EINA_FALSE, otherwise
|
||||
*
|
||||
* By default, grid items will only call their selection callback
|
||||
* function when firstly getting selected, any subsequent further
|
||||
* clicks will do nothing. With this call, you make those
|
||||
* subsequent clicks also to issue the selection callbacks.
|
||||
*
|
||||
* @note <b>Double clicks</b> will @b always be reported on items.
|
||||
*
|
||||
* @see elm_gengrid_always_select_mode_get()
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
EINA_DEPRECATED EAPI void elm_gengrid_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
|
||||
|
||||
/**
|
||||
* Get whether items on a given gengrid widget have their selection
|
||||
* callbacks issued for @b every subsequent selection click on them
|
||||
* or just for the first click.
|
||||
*
|
||||
* @param obj The gengrid object.
|
||||
* @return @c EINA_TRUE if the gengrid items are "always selected",
|
||||
* @c EINA_FALSE, otherwise
|
||||
*
|
||||
* @see elm_gengrid_always_select_mode_set() for more details
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
EINA_DEPRECATED EAPI Eina_Bool elm_gengrid_always_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Set whether items on a given gengrid widget can be selected or not.
|
||||
*
|
||||
* @param obj The gengrid object
|
||||
* @param no_select @c EINA_TRUE to make items selectable,
|
||||
* @c EINA_FALSE otherwise
|
||||
*
|
||||
* This will make items in @p obj selectable or not. In the latter
|
||||
* case, any user interaction on the gengrid items will neither make
|
||||
* them appear selected nor them call their selection callback
|
||||
* functions.
|
||||
*
|
||||
* @see elm_gengrid_no_select_mode_get()
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
EINA_DEPRECATED EAPI void elm_gengrid_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select);
|
||||
|
||||
/**
|
||||
* Get whether items on a given gengrid widget can be selected or
|
||||
* not.
|
||||
*
|
||||
* @param obj The gengrid object
|
||||
* @return @c EINA_TRUE, if items are selectable, @c EINA_FALSE
|
||||
* otherwise
|
||||
*
|
||||
* @see elm_gengrid_no_select_mode_set() for more details
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
EINA_DEPRECATED EAPI Eina_Bool elm_gengrid_no_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Get the side labels max length.
|
||||
|
|
|
@ -93,12 +93,11 @@ struct _Widget_Data
|
|||
int minw, minh;
|
||||
unsigned int item_count;
|
||||
Evas_Coord pan_x, pan_y;
|
||||
Elm_Object_Select_Mode_Type select_mode;
|
||||
Eina_Bool reorder_mode : 1; /**< a flag for reorder mode enable/disable */
|
||||
Eina_Bool on_hold : 1;
|
||||
Eina_Bool multi : 1; /**< a flag for item multi selection */
|
||||
Eina_Bool no_select : 1;
|
||||
Eina_Bool wasselected : 1;
|
||||
Eina_Bool always_select : 1;
|
||||
Eina_Bool clear_me : 1; /**< a flag whether genlist is marked as to be cleared or not. if this flag is true, genlist clear was already deferred. */
|
||||
Eina_Bool h_bounce : 1;
|
||||
Eina_Bool v_bounce : 1;
|
||||
|
|
|
@ -94,6 +94,15 @@ typedef enum
|
|||
ELM_FOCUS_NEXT
|
||||
} Elm_Focus_Direction;
|
||||
|
||||
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_SELECT_MODE_MAX
|
||||
} Elm_Object_Select_Mode_Type;
|
||||
|
||||
/**
|
||||
* @typedef Elm_Object_Item
|
||||
* An Elementary Object item handle.
|
||||
|
|
|
@ -59,9 +59,7 @@ struct _Widget_Data
|
|||
Eina_Bool reorder_mode : 1;
|
||||
Eina_Bool on_hold : 1;
|
||||
Eina_Bool multi : 1;
|
||||
Eina_Bool no_select : 1;
|
||||
Eina_Bool wasselected : 1;
|
||||
Eina_Bool always_select : 1;
|
||||
Eina_Bool clear_me : 1;
|
||||
Eina_Bool h_bounce : 1;
|
||||
Eina_Bool v_bounce : 1;
|
||||
|
@ -918,7 +916,7 @@ _mouse_up(void *data,
|
|||
static void
|
||||
_item_highlight(Elm_Gen_Item *it)
|
||||
{
|
||||
if ((it->wd->no_select) || (it->generation < it->wd->generation) || (it->highlighted)) return;
|
||||
if ((it->wd->select_mode == ELM_OBJECT_NO_SELECT) || (it->generation < it->wd->generation) || (it->highlighted)) return;
|
||||
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
||||
it->highlighted = EINA_TRUE;
|
||||
}
|
||||
|
@ -2576,30 +2574,52 @@ elm_gengrid_reorder_mode_get(const Evas_Object *obj)
|
|||
return wd->reorder_mode;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
EINA_DEPRECATED EAPI void
|
||||
elm_gengrid_always_select_mode_set(Evas_Object *obj,
|
||||
Eina_Bool always_select)
|
||||
{
|
||||
elm_genlist_always_select_mode_set(obj, always_select);
|
||||
if (always_select)
|
||||
elm_genlist_select_mode_set(obj, ELM_OBJECT_ALWAYS_SELECT);
|
||||
else
|
||||
{
|
||||
Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
|
||||
if (oldmode == ELM_OBJECT_ALWAYS_SELECT)
|
||||
elm_genlist_select_mode_set(obj, ELM_OBJECT_NORMAL_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
EINA_DEPRECATED EAPI Eina_Bool
|
||||
elm_gengrid_always_select_mode_get(const Evas_Object *obj)
|
||||
{
|
||||
return elm_genlist_always_select_mode_get(obj);
|
||||
Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
|
||||
if (oldmode == ELM_OBJECT_ALWAYS_SELECT)
|
||||
return EINA_TRUE;
|
||||
else
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
EINA_DEPRECATED EAPI void
|
||||
elm_gengrid_no_select_mode_set(Evas_Object *obj,
|
||||
Eina_Bool no_select)
|
||||
{
|
||||
elm_genlist_no_select_mode_set(obj, no_select);
|
||||
if (no_select)
|
||||
elm_genlist_select_mode_set(obj, ELM_OBJECT_NO_SELECT);
|
||||
else
|
||||
{
|
||||
Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
|
||||
if (oldmode == ELM_OBJECT_NO_SELECT)
|
||||
elm_genlist_select_mode_set(obj, ELM_OBJECT_NORMAL_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
EINA_DEPRECATED EAPI Eina_Bool
|
||||
elm_gengrid_no_select_mode_get(const Evas_Object *obj)
|
||||
{
|
||||
return elm_genlist_no_select_mode_get(obj);
|
||||
Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
|
||||
if (oldmode == ELM_OBJECT_NO_SELECT)
|
||||
return EINA_TRUE;
|
||||
else
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -2816,3 +2836,14 @@ elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_gengrid_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode_Type mode)
|
||||
{
|
||||
elm_genlist_select_mode_set(obj, mode);
|
||||
}
|
||||
|
||||
EAPI Elm_Object_Select_Mode_Type
|
||||
elm_gengrid_select_mode_get(const Evas_Object *obj)
|
||||
{
|
||||
return elm_genlist_select_mode_get(obj);
|
||||
}
|
||||
|
|
|
@ -356,79 +356,6 @@ EAPI void elm_gengrid_horizontal_set(Evas_Object *obj,
|
|||
*/
|
||||
EAPI Eina_Bool elm_gengrid_horizontal_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Set whether items on a given gengrid widget are to get their
|
||||
* selection callbacks issued for @b every subsequent selection
|
||||
* click on them or just for the first click.
|
||||
*
|
||||
* @param obj The gengrid object
|
||||
* @param always_select @c EINA_TRUE to make items "always
|
||||
* selected", @c EINA_FALSE, otherwise
|
||||
*
|
||||
* By default, grid items will only call their selection callback
|
||||
* function when firstly getting selected, any subsequent further
|
||||
* clicks will do nothing. With this call, you make those
|
||||
* subsequent clicks also to issue the selection callbacks.
|
||||
*
|
||||
* @note <b>Double clicks</b> will @b always be reported on items.
|
||||
*
|
||||
* @see elm_gengrid_always_select_mode_get()
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
//XXX: How about elm_gengrid_select_mode_set() ?
|
||||
EAPI void elm_gengrid_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
|
||||
|
||||
/**
|
||||
* Get whether items on a given gengrid widget have their selection
|
||||
* callbacks issued for @b every subsequent selection click on them
|
||||
* or just for the first click.
|
||||
*
|
||||
* @param obj The gengrid object.
|
||||
* @return @c EINA_TRUE if the gengrid items are "always selected",
|
||||
* @c EINA_FALSE, otherwise
|
||||
*
|
||||
* @see elm_gengrid_always_select_mode_set() for more details
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
//XXX: How about elm_gengrid_select_mode_get() ?
|
||||
EAPI Eina_Bool elm_gengrid_always_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Set whether items on a given gengrid widget can be selected or not.
|
||||
*
|
||||
* @param obj The gengrid object
|
||||
* @param no_select @c EINA_TRUE to make items selectable,
|
||||
* @c EINA_FALSE otherwise
|
||||
*
|
||||
* This will make items in @p obj selectable or not. In the latter
|
||||
* case, any user interaction on the gengrid items will neither make
|
||||
* them appear selected nor them call their selection callback
|
||||
* functions.
|
||||
*
|
||||
* @see elm_gengrid_no_select_mode_get()
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
//XXX: elm_gengrid_always_select_mode_set and elm_gengrid_no_select_mode_set API could be merged to elm_genlist_select_mode_set()
|
||||
EAPI void elm_gengrid_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select);
|
||||
|
||||
/**
|
||||
* Get whether items on a given gengrid widget can be selected or
|
||||
* not.
|
||||
*
|
||||
* @param obj The gengrid object
|
||||
* @return @c EINA_TRUE, if items are selectable, @c EINA_FALSE
|
||||
* otherwise
|
||||
*
|
||||
* @see elm_gengrid_no_select_mode_set() for more details
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
//XXX: elm_gengrid_always_select_mode_get and elm_gengrid_no_select_mode_get API could be merged to elm_genlist_select_mode_get()
|
||||
EAPI Eina_Bool elm_gengrid_no_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Enable or disable bouncing effect for a given gengrid widget
|
||||
*
|
||||
|
@ -1489,6 +1416,43 @@ EAPI void elm_gengrid_filled_set(Evas_Object *obj, Eina
|
|||
//XXX: Does this API working well?
|
||||
EAPI Eina_Bool elm_gengrid_filled_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Set the gengrid select mode.
|
||||
*
|
||||
* @param obj The gengrid object
|
||||
* @param mode The select mode
|
||||
*
|
||||
* elm_gengrid_select_mode_set() changes item select mode in the gengrid widget.
|
||||
* - ELM_OBJECT_NORMAL_SELECT : Items 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 items
|
||||
* entirely and they will neither appear selected nor call selected
|
||||
* callback functions.
|
||||
*
|
||||
* @see elm_gengrid_select_mode_get()
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
EAPI void
|
||||
elm_gengrid_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode_Type mode);
|
||||
|
||||
/**
|
||||
* Get the gengrid select mode.
|
||||
*
|
||||
* @param obj The gengrid object
|
||||
* @return The select mode
|
||||
* (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX)
|
||||
*
|
||||
* @see elm_gengrid_select_mode_set()
|
||||
*
|
||||
* @ingroup Gengrid
|
||||
*/
|
||||
EAPI Elm_Object_Select_Mode_Type
|
||||
elm_gengrid_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -688,7 +688,8 @@ static void
|
|||
_item_highlight(Elm_Gen_Item *it)
|
||||
{
|
||||
const char *selectraise;
|
||||
if ((it->wd->no_select) || (it->generation < it->wd->generation) ||
|
||||
if ((it->wd->select_mode == ELM_OBJECT_NO_SELECT) ||
|
||||
(it->generation < it->wd->generation) ||
|
||||
(it->highlighted) || elm_widget_item_disabled_get(it) ||
|
||||
(it->display_only) || (it->item->mode_view))
|
||||
return;
|
||||
|
@ -3503,13 +3504,15 @@ elm_genlist_add(Evas_Object *parent)
|
|||
void
|
||||
_item_select(Elm_Gen_Item *it)
|
||||
{
|
||||
if ((it->wd->no_select) || (it->generation < it->wd->generation) || (it->mode_set)) return;
|
||||
if ((it->generation < it->wd->generation) || (it->mode_set) ||
|
||||
(it->wd->select_mode == ELM_OBJECT_NO_SELECT))
|
||||
return;
|
||||
if (!it->selected)
|
||||
{
|
||||
it->selected = EINA_TRUE;
|
||||
it->wd->selected = eina_list_append(it->wd->selected, it);
|
||||
}
|
||||
else if (!it->wd->always_select) return;
|
||||
else if (it->wd->select_mode == ELM_OBJECT_ALWAYS_SELECT) return;
|
||||
|
||||
evas_object_ref(WIDGET(it));
|
||||
it->walking++;
|
||||
|
@ -5247,42 +5250,64 @@ elm_genlist_mode_get(const Evas_Object *obj)
|
|||
return wd->mode;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
EINA_DEPRECATED EAPI void
|
||||
elm_genlist_always_select_mode_set(Evas_Object *obj,
|
||||
Eina_Bool always_select)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
wd->always_select = !!always_select;
|
||||
if (always_select)
|
||||
elm_genlist_select_mode_set(obj, ELM_OBJECT_ALWAYS_SELECT);
|
||||
else
|
||||
{
|
||||
Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
|
||||
if (oldmode == ELM_OBJECT_ALWAYS_SELECT)
|
||||
elm_genlist_select_mode_set(obj, ELM_OBJECT_NORMAL_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
EINA_DEPRECATED EAPI Eina_Bool
|
||||
elm_genlist_always_select_mode_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return EINA_FALSE;
|
||||
return wd->always_select;
|
||||
Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
|
||||
if (oldmode == ELM_OBJECT_ALWAYS_SELECT)
|
||||
return EINA_TRUE;
|
||||
else
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
EINA_DEPRECATED EAPI void
|
||||
elm_genlist_no_select_mode_set(Evas_Object *obj,
|
||||
Eina_Bool no_select)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
wd->no_select = !!no_select;
|
||||
if (no_select)
|
||||
elm_genlist_select_mode_set(obj, ELM_OBJECT_NO_SELECT);
|
||||
else
|
||||
{
|
||||
Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
|
||||
if (oldmode == ELM_OBJECT_NO_SELECT)
|
||||
elm_genlist_select_mode_set(obj, ELM_OBJECT_NORMAL_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
EINA_DEPRECATED EAPI Eina_Bool
|
||||
elm_genlist_no_select_mode_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return EINA_FALSE;
|
||||
return wd->no_select;
|
||||
Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
|
||||
if (oldmode == ELM_OBJECT_NO_SELECT)
|
||||
return EINA_TRUE;
|
||||
else
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -5695,6 +5720,27 @@ elm_genlist_item_flip_get(const Elm_Object_Item *it)
|
|||
return _it->flipped;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_genlist_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode_Type mode)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
|
||||
return;
|
||||
if (wd->select_mode != mode)
|
||||
wd->select_mode = mode;
|
||||
}
|
||||
|
||||
EAPI Elm_Object_Select_Mode_Type
|
||||
elm_genlist_select_mode_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) ELM_OBJECT_SELECT_MODE_MAX;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return ELM_OBJECT_SELECT_MODE_MAX;
|
||||
return wd->select_mode;
|
||||
}
|
||||
|
||||
/* for gengrid as of now */
|
||||
void
|
||||
_elm_genlist_page_relative_set(Evas_Object *obj,
|
||||
|
|
|
@ -391,7 +391,7 @@ typedef enum
|
|||
/**
|
||||
* @see Elm_Gen_Item_Class
|
||||
*/
|
||||
typedef Elm_Gen_Item_Class Elm_Genlist_Item_Class;
|
||||
typedef Elm_Gen_Item_Class Elm_Genlist_Item_Class;
|
||||
|
||||
/**
|
||||
* @see Elm_Gen_Item_Text_Get_Cb
|
||||
|
@ -506,71 +506,6 @@ EAPI void elm_genlist_mode_set(Evas_Object *obj, Elm_Li
|
|||
*/
|
||||
EAPI Elm_List_Mode elm_genlist_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Set the always select mode.
|
||||
*
|
||||
* @param obj The genlist object
|
||||
* @param always_select The always select mode (@c EINA_TRUE = on, @c
|
||||
* EINA_FALSE = off). Default is @c EINA_FALSE.
|
||||
*
|
||||
* 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 that, even if selected, every click will make the selected
|
||||
* callbacks be called.
|
||||
*
|
||||
* @see elm_genlist_always_select_mode_get()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
//XXX: How about elm_genlist_select_mode_set() ?
|
||||
EAPI void elm_genlist_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
|
||||
|
||||
/**
|
||||
* Get the always select mode.
|
||||
*
|
||||
* @param obj The genlist object
|
||||
* @return The always select mode
|
||||
* (@c EINA_TRUE = on, @c EINA_FALSE = off)
|
||||
*
|
||||
* @see elm_genlist_always_select_mode_set()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
//XXX: How about elm_genlist_select_mode_get() ?
|
||||
EAPI Eina_Bool elm_genlist_always_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Enable/disable the no select mode.
|
||||
*
|
||||
* @param obj The genlist object
|
||||
* @param no_select The no select mode
|
||||
* (EINA_TRUE = on, EINA_FALSE = off)
|
||||
*
|
||||
* This will turn off the ability to select items entirely and they
|
||||
* will neither appear selected nor call selected callback functions.
|
||||
*
|
||||
* @see elm_genlist_no_select_mode_get()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
//XXX: elm_genlist_always_select_mode_set and elm_genlist_no_select_mode_set API could be merged to elm_genlist_select_mode_set()
|
||||
EAPI void elm_genlist_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select);
|
||||
|
||||
/**
|
||||
* Gets whether the no select mode is enabled.
|
||||
*
|
||||
* @param obj The genlist object
|
||||
* @return The no select mode
|
||||
* (@c EINA_TRUE = on, @c EINA_FALSE = off)
|
||||
*
|
||||
* @see elm_genlist_no_select_mode_set()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
//XXX: elm_genlist_always_select_mode_get and elm_genlist_no_select_mode_get API could be merged to elm_genlist_select_mode_get()
|
||||
EAPI Eina_Bool elm_genlist_no_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Enable/disable horizontal and vertical bouncing effect.
|
||||
*
|
||||
|
@ -1907,6 +1842,43 @@ EAPI void elm_genlist_tree_effect_enabled_set(Evas_Object *obj, Ei
|
|||
*/
|
||||
EAPI Eina_Bool elm_genlist_tree_effect_enabled_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Set the genlist select mode.
|
||||
*
|
||||
* @param obj The genlist object
|
||||
* @param mode The select mode
|
||||
*
|
||||
* elm_genlist_select_mode_set() changes item select mode in the genlist widget.
|
||||
* - ELM_OBJECT_NORMAL_SELECT : Items 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 items
|
||||
* entirely and they will neither appear selected nor call selected
|
||||
* callback functions.
|
||||
*
|
||||
* @see elm_genlist_select_mode_get()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
EAPI void
|
||||
elm_genlist_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode_Type mode);
|
||||
|
||||
/**
|
||||
* Get the genlist select mode.
|
||||
*
|
||||
* @param obj The genlist object
|
||||
* @return The select mode
|
||||
* (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX)
|
||||
*
|
||||
* @see elm_genlist_select_mode_set()
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
EAPI Elm_Object_Select_Mode_Type
|
||||
elm_genlist_select_mode_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue