Mobile native

Hoversel

This feature is supported in mobile applications only.

The hoversel component is a button that pops up a list of items (automatically choosing the direction to display).

The hoversel component inherits from the button component, which means that all button functions can be used on the hoversel component.

For more information, see the Hoversel API.

Figure: Hoversel component

Hoversel component

Figure: Hoversel hierarchy

Hoversel hierarchy

Adding a Hoversel Component

To create a hoversel component, use the elm_hoversel_add() function. When activated, the component automatically chooses the direction in which to display itself in its parent object's view.

Evas_Object *hoversel, *parent;

// Create a hoversel
hoversel = elm_hoversel_add(parent);

Configuring the Hoversel

To configure the hoversel:

  • In Tizen 2.4, the horizontal mode is not provided for hoversel. When the hoversel is added, it must be set to the vertical mode with the elm_hoversel_horizontal_set() function:

    elm_hoversel_horizontal_set(hoversel, EINA_FALSE);
    
  • The hoversel creates a hover component and puts a list of items in the hover when it is activated. The hover parent can be set by using the elm_hoversel_hover_parent_set() function, and it determines the area where the item list can be shown. The hover parent does not need to be the same as the hoversel parent.

    Evas_Object *hoversel, *parent, *win;
    hoversel = elm_hoversel_add(parent);
    
    elm_hoversel_hover_parent_set(hoversel, win);
    
  • The hoversel can be activated by a click or calling the elm_hoversel_hover_begin() function. To deactivate, click an item, click outside the item list, or call the elm_hoversel_hover_end() function.

    elm_hoversel_hover_begin(hoversel);
    elm_hoversel_hover_end(hoversel);
    
  • You can retrieve the activation state of the hoversel (as a Boolean value) using the elm_hoversel_expanded_get() function:

    Eina_Bool expanded;
    expanded = elm_hoversel_expanded_get(hoversel);
    

Managing the Hoversel Items

The hoversel component can contain items that have a label. Even though parameters for an icon are defined in the elm_hoversel_item_add() function, the hoversel item icon is not supported in Tizen 2.4.

To manage items:

  1. To add an item with a "test" label and the _hoversel_item_cb clicked callback, use the elm_hoversel_item_add() function. The clicked signal is related to an individual item, not the entire hoversel.
    Elm_Object_Item *it;
    
    it = elm_hoversel_item_add(hoversel, // Hoversel object
                               "test", // Item label
                               NULL, // Icon file
                               ELM_ICON_NONE, // icon type
                               _hoversel_item_cb, // Clicked callback for the item
                               NULL); // Callback data
    
  2. Retrieve the handles for the added items with the elm_hoversel_items_get() function. It returns a list of Elm_Object_Item items.

    Eina_List *items;
    items = elm_hoversel_items_get(hoversel);
    
  3. To change the item label, use the elm_object_item_part_text_set() function. The following example shows how to change the item label to "New Label".

    Elm_Object_Item *it = elm_hoversel_item_add(hoversel, "test", NULL, ELM_ICON_NONE, NULL, NULL);
    elm_object_item_part_text_set(it, "default", "New label");
    
  4. All items can be deleted together with the elm_hoversel_clear() function:

    elm_hoversel_clear(hoversel);
    

Using the Hoversel Callbacks

The hoversel component emits the following signals:

  • clicked: When the hoversel is clicked.
  • selected: When a hoversel item is selected.
  • dismissed: When the hover is dismissed (by selecting an item or clicking the hover).
  • expanded: When the hoversel is activated by clicking the hoversel or by a function.
  • language,changed: When the program language is changed.

For example, when the hoversel is deactivated by selecting an item or clicking the hover, the hover becomes dismissed and the hoversel emits the dismissed signal. You can register a callback to this signal. The event_info parameter is NULL.

{
   evas_object_smart_callback_add(hoversel, "dismissed", dismissed_cb, data);
}

// Callback function for the "dismissed" signal
// This callback is called when the hoversel is dismissed
void 
dismissed_cb(void *data, Evas_Object *obj, void *event_info)
{
   dlog_print(DLOG_INFO, LOG_TAG, "Hoversel dismissed\n");
}
Note
Except as noted, this content is licensed under LGPLv2.1+.
Go to top