ctxpopup: add auto hide feature more, and add example for rotate callback since Tizen 3.0 41/102241/4
authorJinYong Park <j4939.park@samsung.com>
Mon, 5 Dec 2016 08:30:49 +0000 (17:30 +0900)
committerJinYong Park <j4939.park@samsung.com>
Mon, 5 Dec 2016 09:57:10 +0000 (18:57 +0900)
PS3: [LB] Reviewed
PS4: remove white space

Change-Id: Ib6ac989db5fac02fee05473387ed2d810633bafe
Signed-off-by: Jinyong Park <j4939.park@samsung.com>
org.tizen.guides/html/native/ui/efl/component_ctxpopup_mn.htm

index 9086372..1bb52c8 100644 (file)
@@ -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)
+{
+&nbsp;&nbsp;&nbsp;&nbsp;evas_object_del(obj);
+}
+
+static void
 _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
 {
 &nbsp;&nbsp;&nbsp;&nbsp;Evas_Object *nf = data;
@@ -114,6 +120,9 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
 &nbsp;&nbsp;&nbsp;&nbsp;elm_ctxpopup_item_append(ctxpopup, &quot;Item 3&quot;, NULL, ctxpopup_item_select_cb, NULL);
 &nbsp;&nbsp;&nbsp;&nbsp;elm_ctxpopup_item_append(ctxpopup, &quot;Item 4&quot;, NULL, ctxpopup_item_select_cb, NULL);
 
+&nbsp;&nbsp;&nbsp;&nbsp;eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL);
+&nbsp;&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ctxpopup, &quot;dismissed&quot;, _ctxpopup_dismissed_cb, NULL);
+
 &nbsp;&nbsp;&nbsp;&nbsp;evas_object_geometry_get(obj, &amp;x, &amp;y, &amp;w, &amp;h);
 &nbsp;&nbsp;&nbsp;&nbsp;evas_object_move(ctxpopup, x + (w / 2), y + (h / 2));
 &nbsp;&nbsp;&nbsp;&nbsp;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);
 </pre>
 </li>
+
 <li>Disable auto hiding.
 <p>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 <span style="font-family: Courier New,Courier,monospace">elm_ctxpopup_auto_hide_disabled_set()</span> function with <span style="font-family: Courier New,Courier,monospace">EINA_TRUE</span>:</p>
 <pre class="prettyprint">
 elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE);
 </pre>
 </li>
+<li>Set auto hide when rotating the display (since Tizen 3.0).
+<p>The ctxpopup is closed when you touch outside of the ctxpopup component, or rotate the display.</p>
+<p>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.</p>
+<p>The following example shows how to set the ctxpopup component position when rotating the display:</p>
+<pre class="prettyprint">
+/* Ctxpopup position is determined with the button&#39;s position */
+
+Evas_Object *win;
+Evas_Object *button;
+Evas_Object *ctxpopup;
+
+ctxpopup = elm_ctxpopup_add(win);
+
+elm_object_signal_callback_add(ctxpopup, &quot;elm,state,orient,*&quot;, &quot;elm&quot;, _ctxpopup_orient_changed_cb, button);
+
+move_ctxpopup(ctxpopup, button);
+
+static void
+move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *obj)
+{
+&nbsp;&nbsp;&nbsp;&nbsp;/* 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)
+{
+&nbsp;&nbsp;&nbsp;&nbsp;/*
+&nbsp;&nbsp;&nbsp;&nbsp;   The ctxpopup component emits one of the following signals:
+&nbsp;&nbsp;&nbsp;&nbsp;   &quot;elm,state,orient,0&quot;, &quot;elm,state,orient,90&quot;, &quot;elm,state,orient,180&quot;, &quot;elm,state,orient,270&quot;
+&nbsp;&nbsp;&nbsp;&nbsp;*/
+
+&nbsp;&nbsp;&nbsp;&nbsp;move_ctxpopup(obj, data);
+}
+</pre>
+</li>
 <li>
 <p>Set the priority of the direction where the ctxpopup appears from with the <span style="font-family: Courier New,Courier,monospace">elm_ctxpopup_direction_priority_set()</span> function:</p>
 
@@ -160,6 +205,7 @@ elm_ctxpopup_dismiss(ctxpopup);
 </li>
 </ul>
 
+
 <h2 id="items">Items</h2>
 
 <p>The ctxpopup can contain a small number of items. Each item can have a label, an icon, or both.</p>