[elm] Genlist now a scrollable layout.

The ERRs thrown on the terminal while exiting some tests were already
there -- check that those decorate and stuff modes add lots of NULL
children on lists.

Genlist work exactly as before. All the bugs and feature were kept :)



SVN revision: 73941
This commit is contained in:
Gustavo Lima Chaves 2012-07-16 21:56:30 +00:00
parent 9199e0d974
commit 9cea522b88
7 changed files with 4699 additions and 4335 deletions

View File

@ -107,6 +107,7 @@ WGT_TREE = \
flipselector \
frame \
gengrid \
genlist \
gesture_layer \
glview \
grid \

View File

@ -52,17 +52,17 @@ set_api_state(api_data *api)
break;
case BOUNCE_SET: /* 3 */
elm_genlist_bounce_set(gl, EINA_FALSE, EINA_FALSE);
elm_scroller_bounce_set(gl, EINA_FALSE, EINA_FALSE);
break;
case HOMOGENEOUS_SET: /* 4 */
elm_genlist_bounce_set(gl, EINA_TRUE, EINA_TRUE); /* Back to default */
elm_scroller_bounce_set(gl, EINA_TRUE, EINA_TRUE); /* Back to default */
elm_genlist_homogeneous_set(gl, EINA_TRUE);
break;
case SCROLLER_POLICY_SET: /* 5 */
elm_genlist_homogeneous_set(gl, EINA_FALSE); /* Back to default */
elm_genlist_scroller_policy_set(gl, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
elm_scroller_policy_set(gl, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
break;
case TOOLTIP_TEXT_SET: /* 6 */

View File

@ -73,16 +73,16 @@ external_genlist_state_set(void *data __UNUSED__, Evas_Object *obj, const void *
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);
elm_scroller_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);
elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
if (p->h_bounce_exists)
elm_genlist_bounce_set(obj, p->h_bounce, v_bounce);
elm_scroller_bounce_set(obj, p->h_bounce, v_bounce);
else
elm_genlist_bounce_set(obj, h_bounce, p->v_bounce);
elm_scroller_bounce_set(obj, h_bounce, p->v_bounce);
}
}
@ -143,8 +143,8 @@ external_genlist_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_E
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);
elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
elm_scroller_bounce_set(obj, param->i, v_bounce);
return EINA_TRUE;
}
}
@ -153,8 +153,8 @@ external_genlist_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_E
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);
elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
elm_scroller_bounce_set(obj, h_bounce, param->i);
return EINA_TRUE;
}
}
@ -226,7 +226,7 @@ external_genlist_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_E
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
Eina_Bool h_bounce, v_bounce;
elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
param->i = h_bounce;
return EINA_TRUE;
}
@ -236,7 +236,7 @@ external_genlist_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_E
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
Eina_Bool h_bounce, v_bounce;
elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
param->i = v_bounce;
return EINA_TRUE;
}

View File

@ -132,7 +132,7 @@ elm_main(int argc, char **argv)
printf("default values:\n");
printf("always select: %d\n", always);
elm_genlist_bounce_get(list, &hbounce, &vbounce);
elm_scroller_bounce_get(list, &hbounce, &vbounce);
printf("bounce - horizontal: %d, vertical: %d\n", hbounce, vbounce);
printf("homogeneous: %d\n", elm_genlist_homogeneous_get(list));
printf("horizontal mode: %d\n", elm_genlist_mode_get(list));
@ -140,17 +140,17 @@ elm_main(int argc, char **argv)
elm_genlist_longpress_timeout_get(list));
printf("multi selection: %d\n", elm_genlist_multi_select_get(list));
printf("no selection mode: %d\n", no_sel);
elm_genlist_scroller_policy_get(list, &hp, &vp);
elm_scroller_policy_get(list, &hp, &vp);
printf("scroller policy - horizontal: %d, vertical: %d\n", hp, vp);
printf("block count: %d\n", elm_genlist_block_count_get(list));
printf("\n");
elm_genlist_bounce_set(list, EINA_FALSE, EINA_FALSE);
elm_scroller_bounce_set(list, EINA_FALSE, EINA_FALSE);
elm_genlist_homogeneous_set(list, EINA_FALSE);
elm_genlist_mode_set(list, ELM_LIST_LIMIT);
elm_genlist_multi_select_set(list, EINA_TRUE);
elm_genlist_select_mode_set(list, ELM_OBJECT_SELECT_MODE_DEFAULT);
elm_genlist_scroller_policy_set(list, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON);
elm_scroller_policy_set(list, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON);
elm_genlist_longpress_timeout_set(list, 0.5);
elm_genlist_block_count_set(list, 16);

View File

@ -10,9 +10,10 @@
#define SWIPE_MOVES 12
/* common item handles for genlist/gengrid */
typedef struct Elm_Gen_Item_Type Elm_Gen_Item_Type;
typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip;
typedef struct _Widget_Data Widget_Data;
struct Elm_Gen_Item_Tooltip
{
@ -28,8 +29,6 @@ struct Elm_Gen_Item
ELM_WIDGET_ITEM;
EINA_INLIST;
//FIXME: remove it
Widget_Data *wd;
Elm_Gen_Item_Type *item;
const Elm_Gen_Item_Class *itc;
Evas_Coord x, y, dx, dy;
@ -43,10 +42,10 @@ struct Elm_Gen_Item
const char *mouse_cursor;
struct
{
Evas_Smart_Cb func;
const void *data;
} func;
{
Evas_Smart_Cb func;
const void *data;
} func;
Elm_Gen_Item_Tooltip tooltip;
Ecore_Cb del_cb, sel_cb, highlight_cb;
@ -68,140 +67,4 @@ struct Elm_Gen_Item
Eina_Bool flipped : 1; /**< a flag that shows the flip status of the item. */
};
//FIXME: remove it
typedef struct _Pan Pan;
struct _Pan
{
Evas_Object_Smart_Clipped_Data __clipped_data;
Widget_Data *wd;
Ecore_Job *resize_job;
};
typedef enum
{
ELM_GENLIST_TREE_EFFECT_NONE = 0,
ELM_GENLIST_TREE_EFFECT_EXPAND = 1,
ELM_GENLIST_TREE_EFFECT_CONTRACT = 2
} Elm_Genlist_Item_Move_Effect_Mode;
struct _Widget_Data
{
Eina_Inlist_Sorted_State *state;
Evas_Object *obj; /**< the genlist object */
Evas_Object *scr; /**< a smart scroller object which is used internally in genlist */
Evas_Object *pan_smart; /**< "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
Eina_List *selected; /**< a list of selected items */
Eina_List *group_items; /**< a list of groups index items */
Eina_Inlist *items; /**< an inlist of all items */
Elm_Gen_Item *reorder_it; /**< item currently being repositioned */
Elm_Object_Item *last_selected_item;
Pan *pan; /**< pan_smart object's smart data */
Ecore_Job *calc_job;
int walking;
int item_width, item_height;
int group_item_width, group_item_height;
int minw, minh;
unsigned int item_count;
Evas_Coord pan_x, pan_y;
Elm_Object_Select_Mode 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 wasselected : 1;
Eina_Bool highlight : 1; /**< a flag for items can be highlighted or not. by default this flag is true. */
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;
Ecore_Cb del_cb, calc_cb, sizing_cb;
Ecore_Cb clear_cb;
////////////////////////////////////
Eina_Inlist *blocks; /**< an inlist of all blocks. a block consists of a certain number of items. maximum number of items in a block is 'max_items_per_block'. */
Evas_Coord reorder_old_pan_y, w, h, realminw, prev_viewport_w;
Ecore_Job *update_job;
Ecore_Idle_Enterer *queue_idle_enterer;
Ecore_Idler *must_recalc_idler;
Eina_List *queue;
Elm_Gen_Item *show_item, *anchor_item, *mode_item, *reorder_rel, *expanded_item;
Eina_Inlist *item_cache; /**< an inlist of edje object it cache. */
Evas_Coord anchor_y;
Evas_Coord reorder_start_y; /**< reorder it's initial y coordinate in the pan. */
Elm_List_Mode mode;
Ecore_Timer *multi_timer, *scr_hold_timer;
Ecore_Animator *reorder_move_animator;
const char *decorate_it_type;
double start_time;
Evas_Coord prev_x, prev_y, prev_mx, prev_my;
Evas_Coord cur_x, cur_y, cur_mx, cur_my;
Eina_Bool mouse_down : 1;
Eina_Bool multi_down : 1;
Eina_Bool multi_timeout : 1;
Eina_Bool multitouched : 1;
Eina_Bool longpressed : 1;
Eina_Bool bring_in : 1; /**< a flag to describe the scroll animation. (show, bring in) */
Eina_Bool height_for_width : 1;
Eina_Bool homogeneous : 1;
Eina_Bool swipe : 1;
Eina_Bool decorate_all_mode : 1;
Eina_Bool reorder_pan_move : 1;
Eina_Bool auto_scroll_enabled : 1;
Eina_Bool pan_changed : 1;
Eina_Bool requeued : 1; /**< this is set to EINA_TRUE when the item is re-queued. this happens when the item is un-queued but the rel item is still in the queue. this item will be processed later. */
Eina_Bool check_scroll : 1; /**< this flag means genlist is supposed to be scrolled. if this flag is set to EINA_TRUE, genlist checks whether it's ok to scroll genlist now or not. */
Eina_Bool tree_effect_enabled : 1; /**< tree effect */
struct
{
Evas_Coord x, y;
} history[SWIPE_MOVES];
int multi_device;
int item_cache_count;
int item_cache_max; /**< maximum number of cached items */
int movements;
int max_items_per_block; /**< maximum number of items per block */
double longpress_timeout; /**< longpress timeout. this value comes from _elm_config by default. this can be changed by elm_genlist_longpress_timeout_set() */
int generation; /**< a generation of genlist. when genlist is cleared, this value will be increased and a new generation will start */
Eina_Compare_Cb item_compare_cb;
Eina_Compare_Cb item_compare_data_cb;
Elm_Genlist_Item_Scrollto_Type scrollto_type; /**< a scrollto type which remembers where to scroll ex) in, top, middle */
Evas_Object *alpha_bg; /**< not to receive event when tree effect is not finished */
Eina_List *move_items; /**< items move for tree effect */
Elm_Gen_Item *expanded_next_item;
Ecore_Animator *tree_effect_animator; /**< tree effect animator */
Elm_Genlist_Item_Move_Effect_Mode move_effect_mode;
/* The stuff below directly come from gengrid without any thinking */
unsigned int nmax;
Evas_Coord reorder_item_x, reorder_item_y;
Evas_Coord old_pan_x, old_pan_y;
long items_lost;
double align_x, align_y;
Eina_Bool horizontal : 1;
Eina_Bool move_effect_enabled : 1;
Eina_Bool reorder_item_changed : 1;
Eina_Bool filled : 1;
};
Elm_Gen_Item *_elm_genlist_item_new(Widget_Data *wd, const Elm_Gen_Item_Class *itc, const void *data, Elm_Gen_Item *parent, Evas_Smart_Cb func, const void *func_data);
Evas_Object *_elm_genlist_item_widget_get(const Elm_Gen_Item *it);
void _elm_genlist_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel);
void _elm_genlist_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel);
void _elm_genlist_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize);
void _elm_genlist_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber);
void _elm_genlist_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber);
void _elm_genlist_page_show(const Evas_Object *obj, int h_pagenumber, int v_pagenumber);
void _elm_genlist_page_bring_in(const Evas_Object *obj, int h_pagenumber, int v_pagenumber);
void _elm_genlist_item_unrealize(Elm_Gen_Item *it, Eina_Bool calc);
void _elm_genlist_item_del_serious(Elm_Gen_Item *it);
void _elm_genlist_item_del_notserious(Elm_Gen_Item *it);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,9 @@
* @defgroup Genlist Genlist
* @ingroup Elementary
*
* @image html genlist_inheritance_tree.png
* @image latex genlist_inheritance_tree.eps
*
* @image html img/widget/genlist/preview-00.png
* @image latex img/widget/genlist/preview-00.eps
* @image html img/genlist.png
@ -18,6 +21,19 @@
* trying to be both expansive, powerful and efficient. First we will begin
* an overview on the theory behind genlist.
*
* This widget inherits from the @ref Layout one, so that all the
* functions acting on it also work for genlist objects.
*
* This widget implements the @b @ref elm-scrollable-interface
* interface, so that all (non-deprecated) functions for the base @ref
* Scroller widget also work for genlists.
*
* Some calls on the genlist's API are marked as @b deprecated, as
* they just wrap the scrollable widgets counterpart functions. Use
* the ones we point you to, for each case of deprecation here,
* instead -- eventually the deprecated ones will be discarded (next
* major release).
*
* @section Genlist_Item_Class Genlist item classes - creating items
*
* In order to have the ability to add and delete items on the fly, genlist
@ -26,7 +42,7 @@
* multiple different items with different classes, states and styles).
* Genlist will call the functions in this struct (methods) when an item is
* "realized" (i.e., created dynamically, while the user is scrolling the
* grid). All objects will simply be deleted when no longer needed with
* list). All objects will simply be deleted when no longer needed with
* evas_object_del(). The #Elm_Genlist_Item_Class structure contains the
* following members:
* - @c item_style - This is a constant string and simply defines the name
@ -243,7 +259,8 @@
*
* @section Genlist_Smart_Events Genlist smart events
*
* Signals that you can add callbacks for are:
* This widget emits the following signals, besides the ones sent from
* @ref Layout:
* - @c "activated" - The user has double-clicked or pressed
* (enter|return|spacebar) on an item. The @c event_info parameter is the
* item that was activated.
@ -334,8 +351,6 @@
* changed.
* - @c "tree,effect,finished" - This is called when a genlist tree effect is finished.
*
* Supported elm_object common APIs
* @li @ref elm_object_signal_emit()
*
* Supported elm_object_item common APIs
* @li @ref elm_object_item_part_content_get()
@ -556,12 +571,14 @@ EAPI Elm_List_Mode elm_genlist_mode_get(const Evas_Object *obj);
* This will enable or disable the scroller bouncing effect for the
* genlist. See elm_scroller_bounce_set() for details.
*
* @deprecated Use elm_scroller_bounce_set() instead.
*
* @see elm_scroller_bounce_set()
* @see elm_genlist_bounce_get()
*
* @ingroup Genlist
*/
EAPI void elm_genlist_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
EINA_DEPRECATED EAPI void elm_genlist_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
/**
* Get whether the horizontal and vertical bouncing effect is enabled.
@ -572,11 +589,14 @@ EAPI void elm_genlist_bounce_set(Evas_Object *obj, Eina
* @param v_bounce Pointer to a bool to receive if the bounce vertically
* option is set.
*
* @deprecated Use elm_scroller_bounce_get() instead.
*
* @see elm_scroller_bounce_get()
* @see elm_genlist_bounce_set()
*
* @ingroup Genlist
*/
EAPI void elm_genlist_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
EINA_DEPRECATED EAPI void elm_genlist_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
/**
* Append a new item in a given genlist widget.
@ -800,11 +820,13 @@ EAPI Elm_Object_Item *elm_genlist_last_item_get(const Evas_Object *o
* This applies respectively for the horizontal and vertical scrollbars.
* Default is #ELM_SCROLLER_POLICY_AUTO
*
* @see elm_genlist_scroller_policy_get()
* @deprecated Use elm_scroller_policy_set() instead.
*
* @see elm_scroller_policy_set()
*
* @ingroup Genlist
*/
EAPI void elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
EINA_DEPRECATED EAPI void elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
/**
* Get the scrollbar policy
@ -813,11 +835,13 @@ EAPI void elm_genlist_scroller_policy_set(Evas_Object *
* @param policy_h Pointer to store the horizontal scrollbar policy.
* @param policy_v Pointer to store the vertical scrollbar policy.
*
* @see elm_genlist_scroller_policy_set()
* @deprecated Use elm_scroller_policy_get() instead.
*
* @see elm_scroller_policy_get()
*
* @ingroup Genlist
*/
EAPI void elm_genlist_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
EINA_DEPRECATED EAPI void elm_genlist_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
/**
* Get the @b next item in a genlist widget's internal list of items,