forked from enlightenment/efl
Fix some bugs in Genlist/Photocam. By Fidencio
Author: Fabiano Fidêncio <fidencio at profusion.mobi> SVN revision: 47823
This commit is contained in:
parent
ad9e7cb93b
commit
58ffdf8254
|
@ -4,7 +4,6 @@
|
|||
|
||||
typedef struct _Elm_Params_Genlist
|
||||
{
|
||||
const char *policy_h, *policy_v;
|
||||
const char *horizontal_mode;
|
||||
Eina_Bool multi:1;
|
||||
Eina_Bool multi_exists:1;
|
||||
|
@ -22,14 +21,14 @@ typedef struct _Elm_Params_Genlist
|
|||
Eina_Bool v_bounce_exists:1;
|
||||
} Elm_Params_Genlist;
|
||||
|
||||
static const char* list_horizontal_mode_choices[] = {"compress", "scroll", "limit"};
|
||||
static const char* list_horizontal_mode_choices[] = {"compress", "scroll", "limit", NULL};
|
||||
|
||||
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);
|
||||
assert(sizeof(list_horizontal_mode_choices)/sizeof(list_horizontal_mode_choices[0]) == ELM_LIST_LAST + 1);
|
||||
|
||||
for (i = 0; i < sizeof(list_horizontal_mode_choices); i++)
|
||||
{
|
||||
|
@ -39,23 +38,6 @@ _list_horizontal_mode_setting_get(const char *horizontal_mode_str)
|
|||
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__)
|
||||
{
|
||||
|
@ -72,29 +54,6 @@ external_genlist_state_set(void *data __UNUSED__, Evas_Object *obj, const void *
|
|||
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)
|
||||
|
@ -133,32 +92,6 @@ external_genlist_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_E
|
|||
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);
|
||||
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, "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);
|
||||
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)
|
||||
|
@ -242,35 +175,6 @@ external_genlist_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_E
|
|||
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)
|
||||
|
@ -353,10 +257,6 @@ external_genlist_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__
|
|||
{
|
||||
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;
|
||||
|
@ -404,18 +304,12 @@ external_genlist_params_free(void *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"),
|
||||
|
|
|
@ -12,14 +12,14 @@ typedef struct _Elm_Params_Photocam
|
|||
Eina_Bool zoom_exists:1;
|
||||
} Elm_Params_Photocam;
|
||||
|
||||
static const char* choices[] = {"manual", "auto fit", "auto fill"};
|
||||
static const char* choices[] = {"manual", "auto fit", "auto fill", NULL};
|
||||
|
||||
static Elm_Photocam_Zoom_Mode
|
||||
_zoom_mode_setting_get(const char *zoom_mode_str)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
assert(sizeof(choices)/sizeof(choices[0]) == ELM_PHOTOCAM_ZOOM_MODE_LAST);
|
||||
assert(sizeof(choices)/sizeof(choices[0]) == ELM_PHOTOCAM_ZOOM_MODE_LAST + 1);
|
||||
|
||||
for (i = 0; i < sizeof(choices); i++)
|
||||
{
|
||||
|
|
|
@ -939,8 +939,6 @@ extern "C" {
|
|||
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);
|
||||
|
|
|
@ -2887,16 +2887,16 @@ elm_genlist_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode)
|
|||
*
|
||||
* @param obj The genlist object
|
||||
* @return The mode to use
|
||||
* (ELM_LIST_LIMIT, ELM_LIST_SCROLL)
|
||||
* (ELM_LIST_LIMIT, ELM_LIST_SCROLL, ELM_LIST_LIMIT)
|
||||
*
|
||||
* @ingroup Genlist
|
||||
*/
|
||||
EAPI Elm_List_Mode
|
||||
elm_genlist_horizontal_mode_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_SCROLL;
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return ELM_LIST_SCROLL;
|
||||
if (!wd) return ELM_LIST_LAST;
|
||||
return wd->mode;
|
||||
}
|
||||
|
||||
|
@ -3133,47 +3133,3 @@ elm_genlist_block_count_get(const Evas_Object *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);
|
||||
}
|
||||
|
|
|
@ -1389,9 +1389,9 @@ elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode)
|
|||
EAPI Elm_Photocam_Zoom_Mode
|
||||
elm_photocam_zoom_mode_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) ELM_PHOTOCAM_ZOOM_MODE_MANUAL;
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) ELM_PHOTOCAM_ZOOM_MODE_LAST;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return ELM_PHOTOCAM_ZOOM_MODE_MANUAL;
|
||||
if (!wd) return ELM_PHOTOCAM_ZOOM_MODE_LAST;
|
||||
return wd->mode;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue