From: JinYong Park Date: Mon, 5 Dec 2016 08:30:49 +0000 (+0900) Subject: ctxpopup: add auto hide feature more, and add example for rotate callback since Tizen 3.0 X-Git-Tag: tizen_3.0/branch_out/20161207~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fbf1018cd3e401fedfee5370613eefbd0e77707;p=sdk%2Fonline-doc.git ctxpopup: add auto hide feature more, and add example for rotate callback since Tizen 3.0 PS3: [LB] Reviewed PS4: remove white space Change-Id: Ib6ac989db5fac02fee05473387ed2d810633bafe Signed-off-by: Jinyong Park --- diff --git a/org.tizen.guides/html/native/ui/efl/component_ctxpopup_mn.htm b/org.tizen.guides/html/native/ui/efl/component_ctxpopup_mn.htm index 9086372..1bb52c8 100644 --- a/org.tizen.guides/html/native/ui/efl/component_ctxpopup_mn.htm +++ b/org.tizen.guides/html/native/ui/efl/component_ctxpopup_mn.htm @@ -102,6 +102,12 @@ elm_box_pack_end(box, btn); evas_object_show(btn); static void +_ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) +{ +    evas_object_del(obj); +} + +static void _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) {     Evas_Object *nf = data; @@ -114,6 +120,9 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)     elm_ctxpopup_item_append(ctxpopup, "Item 3", NULL, ctxpopup_item_select_cb, NULL);     elm_ctxpopup_item_append(ctxpopup, "Item 4", NULL, ctxpopup_item_select_cb, NULL); +    eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL); +    evas_object_smart_callback_add(ctxpopup, "dismissed", _ctxpopup_dismissed_cb, NULL); +     evas_object_geometry_get(obj, &x, &y, &w, &h);     evas_object_move(ctxpopup, x + (w / 2), y + (h / 2));     evas_object_show(ctxpopup); @@ -138,12 +147,48 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE); +
  • Disable auto hiding.

    The ctxpopup can be hidden automatically when its parent is resized. The auto hide functionality is enabled by default. You can disable auto hiding by calling the elm_ctxpopup_auto_hide_disabled_set() function with EINA_TRUE:

     elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE);
     
  • +
  • Set auto hide when rotating the display (since Tizen 3.0). +

    The ctxpopup is closed when you touch outside of the ctxpopup component, or rotate the display.

    +

    Since Tizen 3.0, the auto hide feature is disabled when rotating a display. When the display is rotated, the ctxpopup component position must be reset.

    +

    The following example shows how to set the ctxpopup component position when rotating the display:

    +
    +/* Ctxpopup position is determined with the button's position */
    +
    +Evas_Object *win;
    +Evas_Object *button;
    +Evas_Object *ctxpopup;
    +
    +ctxpopup = elm_ctxpopup_add(win);
    +
    +elm_object_signal_callback_add(ctxpopup, "elm,state,orient,*", "elm", _ctxpopup_orient_changed_cb, button);
    +
    +move_ctxpopup(ctxpopup, button);
    +
    +static void
    +move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *obj)
    +{
    +    /* Move the ctxpopup component to the button component */
    +}
    +
    +static void
    +_ctxpopup_orient_changed_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
    +{
    +    /*
    +       The ctxpopup component emits one of the following signals:
    +       "elm,state,orient,0", "elm,state,orient,90", "elm,state,orient,180", "elm,state,orient,270"
    +    */
    +
    +    move_ctxpopup(obj, data);
    +}
    +
    +
  • Set the priority of the direction where the ctxpopup appears from with the elm_ctxpopup_direction_priority_set() function:

    @@ -160,6 +205,7 @@ elm_ctxpopup_dismiss(ctxpopup);
  • +

    Items

    The ctxpopup can contain a small number of items. Each item can have a label, an icon, or both.