Panel
This feature is supported in mobile applications only.
The panel component is an animated object that can contain subobjects. It can be expanded or contracted by clicking on the button on its edge.
Panel inherits from layout component, so the layout API can be used on this UI component.
Figure: Panel hierarchy
Adding a Panel Component
The following example shows how to add a panel and set its orientation to the left.
Evas_Object *panel, *parent; panel = elm_panel_add(parent); elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT);
Using the Panel
The panel can be manually hidden.
elm_panel_hidden_set(pan, EINA_TRUE);
The panel can be toggled if you do not know the hidden state of the UI component.
elm_panel_toggle(pan);
The panel can be set scrollable.
elm_panel_scrollable_set(pan, EINA_TRUE);
Creating a Drawer
Tizen SDK has implemented a layout theme to add a drawer in the application. This example shows how to add a new Elementary layout object and set the theme of this layout to the drawer.
Evas_Object *layout; // Create a new layout object layout = elm_layout_add(parent); // Set the "drawer" group theme and "panel" style to it elm_layout_theme_set(layout,"layout", "drawer", "panel"); // Show the new layout evas_object_show(layout);
Once the panel object is created, it can be swallowed in the new layout.
elm_object_part_content_set(layout, "elm.swallow.left", pan);
You can set content to the elm.swallow.bg and elm.swallow.content parts of the layout.
// Panel Background (Dimmed Area) Evas_Object *bg = create_bg(layout); elm_object_part_content_set(layout, "elm.swallow.bg", bg); // Add content to the drawer Evas_Object *content; elm_object_part_content_set(layout, "elm.swallow.content", content);
Using Panel Callbacks
You can register a callback on the scroll signal, when the user scrolls the panel. The event_info parameter is of the type Elm_Panel_Scroll_Info.
{ evas_object_smart_callback_add(pan, "scroll", scroll_cb, data); } // Callback function for the "scroll" signal // This callback is called when the user scrolls the panel void scroll_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Panel_Scroll_Info *scrollinfo = event_info; dlog_print(DLOG_INFO, LOG_TAG, "The panel was scrolled.\n"); }