This example doesn't present any other feature that is not already present in the other examples, but visually shows the difference between using the default list options (first list of the example), setting the horizontal mode to ELM_LIST_LIMIT (second list), enabling compress mode (third list) and using height_for_width option (fourth list).
The full code for this example is listed below:
#include <Elementary.h>
#define N_ITEMS 30
static char *
{
char buf[256];
int i = (int)(uintptr_t)data;
if (!strcmp(part, "elm.text"))
snprintf(buf, sizeof(buf), "Item # %i", i);
else
{
int n;
snprintf(buf, sizeof(buf), "created at %s", ctime(&t));
n = strlen(buf);
buf[n - 1] = '\0';
}
return strdup(buf);
}
{
if (!strcmp(part, "elm.swallow.icon"))
return ic;
}
static void
_item_sel_cb(
void *data,
Evas_Object *obj,
void *event_info)
{
printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n",
data, obj, event_info);
}
{
elm_box_pack_end(box, list);
return list;
}
static void
{
unsigned int i;
for (i = 0; i < N_ITEMS; i++)
{
elm_genlist_item_append(list, _itc,
(void *)(uintptr_t)i, NULL,
_item_sel_cb, NULL);
}
}
EAPI_MAIN int
{
if (!_itc)
{
}
list = _genlist_add(box);
_genlist_fill(list);
list = _genlist_add(box);
_genlist_fill(list);
list = _genlist_add(box);
_genlist_fill(list);
evas_object_resize(win, 800, 320);
return 0;
}
And the screenshot of the running example:
quit when the application's last window is closed
Definition: elm_general.h:248
double ecore_time_unix_get(void)
Retrieves the current UNIX time as a floating point value in seconds.
Definition: ecore_time.c:52
EAPI Evas_Object * elm_box_add(Evas_Object *parent)
Add a new box to the parent.
Definition: elm_box.c:366
#define EINA_UNUSED
Definition: eina_types.h:321
Simple item.
Definition: elm_general.h:349
Evas_Object * elm_genlist_add(Evas_Object *parent)
Add a new genlist widget to the given parent Elementary (container) object.
Definition: elm_genlist.c:5967
#define EVAS_HINT_EXPAND
Use with evas_object_size_hint_weight_set(), evas_object_size_hint_weight_get(), evas_object_size_hin...
Definition: Evas_Common.h:292
Elm_Gen_Item_Class_Functions func
Set of callbacks.
Definition: elm_gen.h:126
Efl_Canvas_Object Evas_Object
Definition: Evas_Common.h:180
Elm_Gen_Item_Content_Get_Cb content_get
Content fetching class function for genlist/gengrid item classes.
Definition: elm_gen.h:100
Evas_Object * elm_icon_add(Evas_Object *parent)
Add a new icon object to the parent.
Definition: elm_icon.c:606
void elm_run(void)
Run Elementary's main loop.
Definition: elm_main.c:1384
#define ELM_MAIN()
macro to be used after the elm_main() function
Definition: elm_general.h:528
Sets a minimum size hint on the list object, so that containers may respect it (and resize itself to ...
Definition: elm_general.h:443
Evas_Object * elm_win_util_standard_add(const char *name, const char *title)
Adds a window object with standard setup.
Definition: efl_ui_win.c:9199
Elm_Gen_Item_State_Get_Cb state_get
State fetching class function for genlist/gengrid item classes.
Definition: elm_gen.h:101
void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1853
#define EVAS_HINT_FILL
Use with evas_object_size_hint_align_set(), evas_object_size_hint_align_get(), evas_object_size_hint_...
Definition: Evas_Common.h:293
#define EINA_TRUE
Definition: eina_types.h:508
Eina_Bool elm_policy_set(unsigned int policy, int value)
Set a new policy's value (for a given policy group/identifier).
Definition: elm_main.c:1407
const char * item_style
Name of the visual style to use for this item.
Definition: elm_gen.h:118
The list won't set any of its size hints to inform how a possible container should resize it.
Definition: elm_general.h:432
Gengrid or Genlist item class definition.
Definition: elm_gen.h:108
void elm_win_resize_object_add(Eo *obj, Evas_Object *subobj)
Add subobj as a resize object of window obj.
Definition: efl_ui_win.c:8899
Elm_Gen_Item_Text_Get_Cb text_get
Text fetching class function for genlist/gengrid item classes.
Definition: elm_gen.h:99
void elm_win_autodel_set(Eo *obj, Eina_Bool autodel)
Set the window's autodel state.
Definition: efl_ui_win.c:6145
Eina_Bool elm_icon_standard_set(Evas_Object *obj, const char *name)
Set the icon by icon standards names.
Definition: elm_icon.c:878
Elm_Genlist_Item_Class * elm_genlist_item_class_new(void)
Create a new genlist item class in a given genlist widget.
Definition: elm_genlist.c:8357
under which circumstances the application should quit automatically.
Definition: elm_general.h:227
Elm_Gen_Item_Del_Cb del
Deletion class function for genlist/gengrid item classes.
Definition: elm_gen.h:102