Mobile native

Minicontrol: Creating a Minicontrol

This tutorial demonstrates how you can create minicontrols on the quick panel or the lock screen, and hide a minicontrol viewer.

This feature is supported in mobile applications only.

Warm-up

Become familiar with the Minicontrol API basics by learning about:

Creating a Minicontrol on the Quick Panel

To create a minicontrol of your application:

  1. To use the functions and data types of the Minicontrol API, include the <minicontrol_provider.h> header file in your application:

    #include <minicontrol_provider.h>
    
  2. To create a minicontrol, use the minicontrol_create_window() function:

    Evas_Object *win;
    
    win = minicontrol_create_window("mini-sample", MINICONTROL_TARGET_VIEWER_QUICK_PANEL, NULL);
    evas_object_resize(win, 480, 140);
    evas_object_show(win);
    

    To create a minicontrol on the quick panel, the target_viewer parameter must be set to MINICONTROL_TARGET_VIEWER_QUICK_PANEL.

  3. Add a text label on the minicontrol using the elm_label_add() function:
    label = elm_label_add(win);
    elm_object_text_set(label, "mini-sample");
    evas_object_resize(label, 480, 140);
    evas_object_show(label);
    

Hiding the Quick Panel

To hide the quick panel:

  1. Add a button on the minicontrol:

    button = elm_button_add(win);
    elm_object_text_set(button, "Click to hide.");
    evas_object_move(button, 0, 50);
    evas_object_resize(button, 200, 50);
    evas_object_show(button);
    
  2. Add an event handler callback function:

    evas_object_smart_callback_add(button, "clicked", _button_clicked_cb, win);
    
  3. Define the callback function for hiding the quick panel:

    static void 
    _button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
    {
       Evas_Object *win = data;
       minicontrol_send_event(win, MINICONTROL_PROVIDER_EVENT_REQUEST_HIDE, NULL);
    }
    

Figure: Minicontrol button for hiding the quick panel

Minicontrol button for hiding the quick panel

Go to top