Added get functions in elm_genlist and added external Genlist support. By Fidencio

Author:    Fabiano Fidêncio <fidencio at profusion.mobi>

SVN revision: 47784
This commit is contained in:
Tiago Rezende Campos Falcao 2010-04-06 14:01:04 +00:00
parent 07702cd2f3
commit ffaa68c266
11 changed files with 690 additions and 32 deletions

View File

@ -16,6 +16,7 @@ ico_button.png \
ico_check.png \
ico_clock.png \
ico_fileselector.png \
ico_genlist.png \
ico_hoversel.png \
ico_map.png \
ico_notepad.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

View File

@ -17,6 +17,7 @@ ICON("button")
ICON("check")
ICON("clock")
ICON("fileselector")
ICON("genlist")
ICON("hoversel")
ICON("map")
ICON("notepad")

View File

@ -33,6 +33,7 @@ elm_button.c \
elm_check.c \
elm_clock.c \
elm_fileselector.c \
elm_genlist.c \
elm_hoversel.c \
elm_map.c \
elm_notepad.c \

View File

@ -0,0 +1,430 @@
#include <assert.h>
#include "private.h"
typedef struct _Elm_Params_Genlist
{
const char *policy_h, *policy_v;
const char *horizontal_mode;
Eina_Bool multi:1;
Eina_Bool multi_exists:1;
Eina_Bool always_select:1;
Eina_Bool always_select_exists:1;
Eina_Bool no_select:1;
Eina_Bool no_select_exists:1;
Eina_Bool compress:1;
Eina_Bool compress_exists:1;
Eina_Bool homogeneous:1;
Eina_Bool homogeneous_exists:1;
Eina_Bool h_bounce:1;
Eina_Bool h_bounce_exists:1;
Eina_Bool v_bounce:1;
Eina_Bool v_bounce_exists:1;
} Elm_Params_Genlist;
static const char* list_horizontal_mode_choices[] = {"compress", "scroll", "limit"};
static Elm_List_Mode
_list_horizontal_mode_setting_get(const char *horizontal_mode_str)
{
unsigned int i;
assert(sizeof(list_horizontal_mode_choices)/sizeof(list_horizontal_mode_choices[0]) == ELM_LIST_LAST);
for (i = 0; i < sizeof(list_horizontal_mode_choices); i++)
{
if (!strcmp(horizontal_mode_str, list_horizontal_mode_choices[i]))
return i;
}
return ELM_LIST_LAST;
}
static const char* scroller_policy_choices[] = {"auto", "on", "off"};
static Elm_Scroller_Policy
_scroller_policy_choices_setting_get(const char *scroller_policy_str)
{
unsigned int i;
assert(sizeof(scroller_policy_choices)/sizeof(scroller_policy_choices[0]) == ELM_SCROLLER_POLICY_LAST);
for (i = 0; i < sizeof(scroller_policy_choices); i++)
{
if (!strcmp(scroller_policy_str, scroller_policy_choices[i]))
return i;
}
return ELM_SCROLLER_POLICY_LAST;
}
static void
external_genlist_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
{
const Elm_Params_Genlist *p;
if (to_params) p = to_params;
else if (from_params) p = from_params;
else return;
if (p->horizontal_mode)
{
Elm_List_Mode set = _list_horizontal_mode_setting_get(p->horizontal_mode);
if (set == ELM_LIST_LAST) return;
elm_genlist_horizontal_mode_set(obj, set);
}
if ((p->policy_h) && (p->policy_v))
{
Elm_Scroller_Policy policy_h, policy_v;
policy_h = _scroller_policy_choices_setting_get(p->policy_h);
policy_v = _scroller_policy_choices_setting_get(p->policy_v);
if ((policy_h == ELM_SCROLLER_POLICY_LAST) || (policy_v == ELM_SCROLLER_POLICY_LAST)) return;
elm_genlist_scroller_policy_set(obj, policy_h, policy_v);
}
else if((p->policy_h) || (p->policy_v))
{
Elm_Scroller_Policy policy_h, policy_v;
elm_genlist_scroller_policy_get(obj, &policy_h, &policy_v);
if (p->policy_h)
policy_h = _scroller_policy_choices_setting_get(p->policy_h);
else
policy_v = _scroller_policy_choices_setting_get(p->policy_v);
if ((policy_h == ELM_SCROLLER_POLICY_LAST) || (policy_v == ELM_SCROLLER_POLICY_LAST)) return;
elm_genlist_scroller_policy_set(obj, policy_h, policy_v);
}
if (p->multi_exists)
elm_genlist_multi_select_set(obj, p->multi);
if (p->always_select_exists)
elm_genlist_always_select_mode_set(obj, p->always_select);
if (p->no_select_exists)
elm_genlist_no_select_mode_set(obj, p->no_select);
if (p->compress_exists)
elm_genlist_compress_mode_set(obj, p->compress);
if (p->homogeneous_exists)
elm_genlist_homogeneous_set(obj, p->homogeneous);
if ((p->h_bounce_exists) && (p->v_bounce_exists))
elm_genlist_bounce_set(obj, p->h_bounce, p->v_bounce);
else if ((p->h_bounce_exists) || (p->v_bounce_exists))
{
Eina_Bool h_bounce, v_bounce;
elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
if (p->h_bounce_exists)
elm_genlist_bounce_set(obj, p->h_bounce, v_bounce);
else
elm_genlist_bounce_set(obj, h_bounce, p->v_bounce);
}
}
static Eina_Bool
external_genlist_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
{
if (!strcmp(param->name, "horizontal mode"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
Elm_List_Mode set = _list_horizontal_mode_setting_get(param->s);
if (set == ELM_LIST_LAST) return EINA_FALSE;
elm_genlist_horizontal_mode_set(obj, set);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "policy horizontal"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
Elm_Scroller_Policy policy_h, policy_v;
elm_genlist_scroller_policy_get(obj, &policy_h, &policy_v);
policy_h = _scroller_policy_choices_setting_get(param->s);
if (policy_h == ELM_SCROLLER_POLICY_LAST) return EINA_FALSE;
elm_genlist_scroller_policy_set(obj, policy_h, policy_v);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "policy vertical"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
Elm_Scroller_Policy policy_h, policy_v;
elm_genlist_scroller_policy_get(obj, &policy_h, &policy_v);
policy_v = _scroller_policy_choices_setting_get(param->s);
if (policy_v == ELM_SCROLLER_POLICY_LAST) return EINA_FALSE;
elm_genlist_scroller_policy_set(obj, policy_h, policy_v);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "multi select"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
elm_genlist_multi_select_set(obj, param->i);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "always select"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
elm_genlist_always_select_mode_set(obj, param->i);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "no select"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
elm_genlist_no_select_mode_set(obj, param->i);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "compress"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
elm_genlist_compress_mode_set(obj, param->i);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "homogeneous"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
elm_genlist_homogeneous_set(obj, param->i);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "height bounce"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
Eina_Bool h_bounce, v_bounce;
elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
elm_genlist_bounce_set(obj, param->i, v_bounce);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "width bounce"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
Eina_Bool h_bounce, v_bounce;
elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
elm_genlist_bounce_set(obj, h_bounce, param->i);
return EINA_TRUE;
}
}
ERR("unknown parameter '%s' of type '%s'",
param->name, edje_external_param_type_str(param->type));
return EINA_FALSE;
}
static Eina_Bool
external_genlist_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
{
if (!strcmp(param->name, "horizontal mode"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
Elm_List_Mode list_horizontal_mode_set = elm_genlist_horizontal_mode_get(obj);
if (list_horizontal_mode_set == ELM_LIST_LAST)
return EINA_FALSE;
param->s = list_horizontal_mode_choices[list_horizontal_mode_set];
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "scroll horizontal"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
Elm_Scroller_Policy policy_h, policy_v;
elm_genlist_scroller_policy_get(obj, &policy_h, &policy_v);
if (policy_h == ELM_SCROLLER_POLICY_LAST)
return EINA_FALSE;
param->s = scroller_policy_choices[policy_h];
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "scroll vertical"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
Elm_Scroller_Policy policy_h, policy_v;
elm_genlist_scroller_policy_get(obj, &policy_h, &policy_v);
if (policy_v == ELM_SCROLLER_POLICY_LAST)
return EINA_FALSE;
param->s = scroller_policy_choices[policy_v];
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "multi select"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
param->i = elm_genlist_multi_select_get(obj);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "always select"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
param->i = elm_genlist_always_select_mode_get(obj);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "no select"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
param->i = elm_genlist_no_select_mode_get(obj);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "compress"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
param->i = elm_genlist_compress_mode_get(obj);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "homogeneous"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
param->i = elm_genlist_homogeneous_get(obj);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "height bounce"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
Eina_Bool h_bounce, v_bounce;
elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
param->i = h_bounce;
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "width bounce"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
Eina_Bool h_bounce, v_bounce;
elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
param->i = v_bounce;
return EINA_TRUE;
}
}
ERR("unknown parameter '%s' of type '%s'",
param->name, edje_external_param_type_str(param->type));
return EINA_FALSE;
}
static void *
external_genlist_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
{
Elm_Params_Genlist *mem;
Edje_External_Param *param;
const Eina_List *l;
mem = calloc(1, sizeof(Elm_Params_Genlist));
if (!mem)
return NULL;
EINA_LIST_FOREACH(params, l, param)
{
if (!strcmp(param->name, "horizontal mode"))
mem->horizontal_mode = eina_stringshare_add(param->s);
else if (!strcmp(param->name, "scroll horizontal"))
mem->policy_h = eina_stringshare_add(param->s);
else if (!strcmp(param->name, "scroll vertical"))
mem->policy_v = eina_stringshare_add(param->s);
else if (!strcmp(param->name, "multi select"))
{
mem->multi = !!param->i;
mem->multi_exists = EINA_TRUE;
}
else if (!strcmp(param->name, "always select"))
{
mem->always_select = !!param->i;
mem->always_select_exists = EINA_TRUE;
}
else if (!strcmp(param->name, "no select"))
{
mem->no_select = !!param->i;
mem->no_select_exists = EINA_TRUE;
}
else if (!strcmp(param->name, "compress"))
{
mem->compress = !!param->i;
mem->compress_exists = EINA_TRUE;
}
else if (!strcmp(param->name, "homogeneous"))
{
mem->homogeneous = !!param->i;
mem->homogeneous_exists = EINA_TRUE;
}
else if (!strcmp(param->name, "height bounce"))
{
mem->h_bounce = !!param->i;
mem->h_bounce_exists = EINA_TRUE;
}
else if (!strcmp(param->name, "width bounce"))
{
mem->v_bounce = !!param->i;
mem->v_bounce_exists = EINA_TRUE;
}
}
return mem;
}
static void
external_genlist_params_free(void *params)
{
Elm_Params_Genlist *mem = params;
if (mem->horizontal_mode)
eina_stringshare_del(mem->horizontal_mode);
if (mem->policy_h)
eina_stringshare_del(mem->policy_h);
if (mem->policy_v)
eina_stringshare_del(mem->policy_v);
free(mem);
}
static Edje_External_Param_Info external_genlist_params[] = {
EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("horizontal mode", "scroll", list_horizontal_mode_choices),
EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("scroll horizontal", "auto", scroller_policy_choices),
EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("scroll vertical", "auto", scroller_policy_choices),
EDJE_EXTERNAL_PARAM_INFO_BOOL("multi select"),
EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"),
EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"),
EDJE_EXTERNAL_PARAM_INFO_BOOL("compress"),
EDJE_EXTERNAL_PARAM_INFO_BOOL("homogeneous"),
EDJE_EXTERNAL_PARAM_INFO_BOOL("height bounce"),
EDJE_EXTERNAL_PARAM_INFO_BOOL("width bounce"),
EDJE_EXTERNAL_PARAM_INFO_SENTINEL
};
DEFINE_EXTERNAL_ICON_ADD(genlist, "genlist");
DEFINE_EXTERNAL_TYPE_SIMPLE(genlist, "Generic List");

View File

@ -5,6 +5,7 @@ DEFINE_TYPE(button)
DEFINE_TYPE(check)
DEFINE_TYPE(clock)
DEFINE_TYPE(fileselector)
DEFINE_TYPE(genlist)
DEFINE_TYPE(hoversel)
DEFINE_TYPE(map)
DEFINE_TYPE(notepad)

View File

@ -417,9 +417,10 @@ extern "C" {
typedef enum _Elm_Scroller_Policy
{
ELM_SCROLLER_POLICY_AUTO,
ELM_SCROLLER_POLICY_ON,
ELM_SCROLLER_POLICY_OFF
ELM_SCROLLER_POLICY_AUTO = 0,
ELM_SCROLLER_POLICY_ON,
ELM_SCROLLER_POLICY_OFF,
ELM_SCROLLER_POLICY_LAST
}
Elm_Scroller_Policy;
@ -429,6 +430,7 @@ extern "C" {
EAPI void elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h);
EAPI void elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
EAPI void elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
EAPI void elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
EAPI void elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
EAPI void elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
EAPI void elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
@ -817,9 +819,10 @@ extern "C" {
typedef enum _Elm_List_Mode
{
ELM_LIST_COMPRESS,
ELM_LIST_COMPRESS = 0,
ELM_LIST_SCROLL,
ELM_LIST_LIMIT
ELM_LIST_LIMIT,
ELM_LIST_LAST
} Elm_List_Mode;
typedef struct _Elm_List_Item Elm_List_Item;
EAPI Evas_Object *elm_list_add(Evas_Object *parent);
@ -919,15 +922,25 @@ extern "C" {
EAPI Evas_Object *elm_genlist_add(Evas_Object *parent);
EAPI void elm_genlist_clear(Evas_Object *obj);
// TODO: add getters for all functions below:
EAPI void elm_genlist_multi_select_set(Evas_Object *obj, Eina_Bool multi);
EAPI Eina_Bool elm_genlist_multi_select_get(const Evas_Object *obj);
EAPI void elm_genlist_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode);
EAPI Elm_List_Mode elm_genlist_horizontal_mode_get(const Evas_Object *obj);
EAPI void elm_genlist_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
EAPI Eina_Bool elm_genlist_always_select_mode_get(const Evas_Object *obj);
EAPI void elm_genlist_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select);
EAPI Eina_Bool elm_genlist_no_select_mode_get(const Evas_Object *obj);
EAPI void elm_genlist_compress_mode_set(Evas_Object *obj, Eina_Bool compress);
EAPI Eina_Bool elm_genlist_compress_mode_get(const Evas_Object *obj);
EAPI void elm_genlist_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
EAPI void elm_genlist_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
EAPI void elm_genlist_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous);
EAPI Eina_Bool elm_genlist_homogeneous_get(const Evas_Object *obj);
EAPI void elm_genlist_block_count_set(Evas_Object *obj, int n);
EAPI int elm_genlist_block_count_get(const Evas_Object *obj);
EAPI void elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
EAPI void elm_genlist_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
/* operations to add items */
EAPI Elm_Genlist_Item *elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags, Evas_Smart_Cb func, const void *func_data);
EAPI Elm_Genlist_Item *elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags, Evas_Smart_Cb func, const void *func_data);

View File

@ -1995,7 +1995,7 @@ elm_genlist_clear(Evas_Object *obj)
/**
* Enable or disable multi-select in the genlist
*
* This enables (1) or disableds (0) multi-select in the list. This allows
* This enables (EINA_TRUE) or disableds (EINA_FALSE) multi-select in the list. This allows
* more than 1 item to be selected.
*
* @param obj The genlist object
@ -2012,6 +2012,25 @@ elm_genlist_multi_select_set(Evas_Object *obj, Eina_Bool multi)
wd->multi = multi;
}
/**
* Gets if multi-select in genlist is enable or disable
*
* @param obj The genlist object
* @return Multi-select enable/disable
* (EINA_TRUE = enabled/EINA_FALSE = disabled)
*
* @ingroup Genlist
*/
EAPI Eina_Bool
elm_genlist_multi_select_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->multi;
}
/**
* Get the selectd item in the genlist
*
@ -2750,24 +2769,6 @@ elm_genlist_item_del(Elm_Genlist_Item *it)
_item_del(it);
}
/**
* Get the data item from the genlist item
*
* This returns the data value passed on the elm_genlist_item_append() and
* related item addition calls.
*
* @param it The item
* @return The data pointer provided when created
*
* @ingroup Genlist
*/
EAPI const void *
elm_genlist_item_data_get(const Elm_Genlist_Item *it)
{
if (!it) return NULL;
return it->data;
}
/**
* Set the data item from the genlist item
*
@ -2789,6 +2790,24 @@ elm_genlist_item_data_set(Elm_Genlist_Item *it, const void *data)
elm_genlist_item_update(it);
}
/**
* Get the data item from the genlist item
*
* This returns the data value passed on the elm_genlist_item_append() and
* related item addition calls.
*
* @param it The item
* @return The data pointer provided when created
*
* @ingroup Genlist
*/
EAPI const void *
elm_genlist_item_data_get(const Elm_Genlist_Item *it)
{
if (!it) return NULL;
return it->data;
}
/**
* Get the real evas object of the genlist item
*
@ -2863,6 +2882,24 @@ elm_genlist_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode)
elm_scroller_content_min_limit(wd->scr, 0, 0);
}
/**
* Gets the horizontal stretching mode
*
* @param obj The genlist object
* @return The mode to use
* (ELM_LIST_LIMIT, ELM_LIST_SCROLL)
*
* @ingroup Genlist
*/
EAPI Elm_List_Mode
elm_genlist_horizontal_mode_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_SCROLL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return ELM_LIST_SCROLL;
return wd->mode;
}
/**
* Set the always select mode.
*
@ -2872,7 +2909,8 @@ elm_genlist_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode)
* selected, every click will make the selected callbacks be called.
*
* @param obj The genlist object
* @param always_select The always select mode (1 on, 2 off)
* @param always_select The always select mode
* (EINA_TRUE = on, EINA_FALSE = off)
*
* @ingroup Genlist
*/
@ -2885,6 +2923,24 @@ elm_genlist_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select)
wd->always_select = always_select;
}
/**
* Get the always select mode.
*
* @param obj The genlist object
* @return The always select mode
* (EINA_TRUE = on, EINA_FALSE = off)
*
* @ingroup Genlist
*/
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;
}
/**
* Set no select mode
*
@ -2892,7 +2948,8 @@ elm_genlist_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select)
* neither appear selected nor call selected callback functions.
*
* @param obj The genlist object
* @param no_select The no select mode (1 on, 2 off)
* @param no_select The no select mode
* (EINA_TRUE = on, EINA_FALSE = off)
*
* @ingroup Genlist
*/
@ -2905,6 +2962,24 @@ elm_genlist_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select)
wd->no_select = no_select;
}
/**
* Gets no select mode
*
* @param obj The genlist object
* @return The no select mode
* (EINA_TRUE = on, EINA_FALSE = off)
*
* @ingroup Genlist
*/
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;
}
/**
* Set compress mode
*
@ -2912,7 +2987,8 @@ elm_genlist_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select)
* to fit the genlist scrollable viewport width.
*
* @param obj The genlist object
* @param no_select The compress mode (1 on, 2 off)
* @param no_select The compress mode
* (EINA_TRUE = on, EINA_FALSE = off)
*
* @ingroup Genlist
*/
@ -2925,6 +3001,24 @@ elm_genlist_compress_mode_set(Evas_Object *obj, Eina_Bool compress)
wd->compress = compress;
}
/**
* Get the compress mode
*
* @param obj The genlist object
* @return The compress mode
* (EINA_TRUE = on, EINA_FALSE = off)
*
* @ingroup Genlist
*/
EAPI Eina_Bool
elm_genlist_compress_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->compress;
}
/**
* Set bounce mode
*
@ -2946,6 +3040,24 @@ elm_genlist_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
}
/**
* Get the bounce mode
*
* @param obj The genlist object
* @param h_bounce Allow bounce horizontally
* @param v_bounce Allow bounce vertically
*
* @ingroup Genlist
*/
EAPI void
elm_genlist_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_smart_scroller_bounce_allow_get(obj, h_bounce, v_bounce);
}
/**
* Set homogenous mode
*
@ -2954,6 +3066,7 @@ elm_genlist_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
*
* @param obj The genlist object
* @param homogeneous Assume the items within the genlist are of the same height and width
* (EINA_TRUE = on, EINA_FALSE = off)
*
* @ingroup Genlist
*/
@ -2963,10 +3076,28 @@ elm_genlist_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous)
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (homogeneous) elm_genlist_compress_mode_set(obj, 1);
if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
wd->homogeneous = homogeneous;
}
/**
* Get the homogenous mode
*
* @param obj The genlist object
* @return Assume the items within the genlist are of the same height and width
* (EINA_TRUE = on, EINA_FALSE = off)
*
* @ingroup Genlist
*/
EAPI Eina_Bool
elm_genlist_homogeneous_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->homogeneous;
}
/**
* Set the maximum number of items within an item block
*
@ -2986,4 +3117,63 @@ elm_genlist_block_count_set(Evas_Object *obj, int n)
wd->max_items_per_block = n;
}
/**
* Get the maximum number of items within an item block
*
* @param obj The genlist object
* @return Maximum number of items within an item block
*
* @ingroup Genlist
*/
EAPI int
elm_genlist_block_count_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return wd->max_items_per_block;
}
/**
* Set the scrollbar policy
*
* This sets the scrollbar visibility policy for the given scroller.
* ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it
* is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns
* it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off.
* This applies respectively for the horizontal and vertical scrollbars.
*
* @param obj The genlist object
* @param policy_h Horizontal scrollbar policy
* @param policy_v Vertical scrollbar policy
*
* @ingroup List
*/
EAPI void
elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->scr)
elm_scroller_policy_set(wd->scr, policy_h, policy_v);
}
/**
* Get the scrollbar policy
*
* @param obj The genlist object
* @param policy_h Horizontal scrollbar policy
* @param policy_v Vertical scrollbar policy
*
* @ingroup List
*/
EAPI void
elm_genlist_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->scr)
elm_scroller_policy_get(wd->scr, policy_h, policy_v);
}

View File

@ -475,6 +475,19 @@ elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scro
elm_smart_scroller_policy_set(wd->scr, map[policy_h], map[policy_v]);
}
EAPI void
elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
if (!wd) return;
if (wd->scr)
elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
*policy_h = (Elm_Scroller_Policy) s_policy_h;
*policy_v = (Elm_Scroller_Policy) s_policy_v;
}
/**
* Get the currently visible content region
*

View File

@ -954,6 +954,14 @@ elm_smart_scroller_bounce_allow_set(Evas_Object *obj, Eina_Bool horiz, Eina_Bool
sd->bounce_vert = vert;
}
void
elm_smart_scroller_bounce_allow_get(const Evas_Object *obj, Eina_Bool *horiz, Eina_Bool *vert)
{
API_ENTRY return;
*horiz = sd->bounce_horiz;
*vert = sd->bounce_vert;
}
void
elm_smart_scroller_paging_set(Evas_Object *obj, double pagerel_h, double pagerel_v, Evas_Coord pagesize_h, Evas_Coord pagesize_v)
{

View File

@ -1,8 +1,8 @@
typedef enum _Elm_Smart_Scroller_Policy
{
ELM_SMART_SCROLLER_POLICY_AUTO,
ELM_SMART_SCROLLER_POLICY_ON,
ELM_SMART_SCROLLER_POLICY_OFF
ELM_SMART_SCROLLER_POLICY_ON,
ELM_SMART_SCROLLER_POLICY_OFF
}
Elm_Smart_Scroller_Policy;
@ -27,6 +27,6 @@ void elm_smart_scroller_theme_set (Evas_Object *obj, const char *c
void elm_smart_scroller_hold_set (Evas_Object *obj, Eina_Bool hold);
void elm_smart_scroller_freeze_set (Evas_Object *obj, Eina_Bool freeze);
void elm_smart_scroller_bounce_allow_set (Evas_Object *obj, Eina_Bool horiz, Eina_Bool vert);
void elm_smart_scroller_bounce_allow_get (const Evas_Object *obj, Eina_Bool *horiz, Eina_Bool *vert);
void elm_smart_scroller_paging_set (Evas_Object *obj, double pagerel_h, double pagerel_v, Evas_Coord pagesize_h, Evas_Coord pagesize_v);
void elm_smart_scroller_region_bring_in (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);