Index
This feature is supported in wearable applications only.
An index component gives you an index for fast access to whichever group of other UI items you have. The index component is by default hidden, but it appears when the user clicks over its reserved area in the canvas. In the default theme, it is a one finger wide area on the right side of the index component's container. Generally, an index is used together with lists, generic lists, or generic grids.
For more information, see the Index API.
Figure: Index component
Figure: Index hierarchy
Adding an Index Component
To create a new index component, use the elm_index_add() function:
Evas_Object *index, *parent; index = elm_index_add(parent);
Adding Items
To add items:
-
Add the list item object at the letter A, calling the it_select_cb() smart callback when this item is selected:
Elm_Object_Item *list_item1, *list_item2; elm_index_item_append(index, "A", it_select_cb, list_item1);
-
Add item objects, calling the it_select_cb() smart callback when the item is selected:
Elm_Object_Item *it[5]; for (i = 0; i < 5; ++i) { it[i] = elm_index_item_append(index, NULL, it_select_cb, (void *) i); }
-
Define the smart callback:
// Callback function called when the list_item1 object is selected void it_select_cb(void *data, Evas_Object *obj, void *event_info) { dlog_print(DLOG_INFO, LOG_TAG, "Item1 selected\n"); }
In the previous case, the indexes are appended to the existing ones. It is also possible to prepend index items with the elm_index_item_prepend() function.
Using Index Callbacks
The index component emits the following signals:
- changed: The selected index item changes. event_info is the selected item's data pointer.
- delay,changed: The selected index item changes, but after a small idling period. event_info is the selected item's data pointer.
- selected: The mouse button is released and an item is selected. event_info is the selected item's data pointer.
- level,up: The user moves a finger from the first level to the second level.
- level,down: The user moves a finger from the second level to the first level.
When the user selects an item in the index, the selected signal is emitted.
Implement the associated callback to do the appropriate action (to show a given area or child object depending on the index item selected, for example):
static void _index_selected_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item *lit = event_info; // Code that does the desired action }
Register the callback to the selected signal:
evas_object_smart_callback_add(index, "selected", _index_selected_cb, NULL);
Note |
---|
Except as noted, this content is licensed under LGPLv2.1+. |