Add a guideline for EVAS_EVENT_FLAG_ON_HOLD 00/147900/5
authorMyoungwoon Roy, Kim <myoungwoon.kim@samsung.com>
Wed, 6 Sep 2017 04:21:21 +0000 (13:21 +0900)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Thu, 7 Sep 2017 07:29:36 +0000 (10:29 +0300)
Summary: Add a guideline how to use EVAS_EVENT_FLAG_ON_HOLD event flag

PS4: Reviewed.
PS5: Reviewed the other code snippet as well

Change-Id: I871a641ca311fd085c70f472895f745efee0cc38

org.tizen.guides/html/native/ui/efl/event_types_n.htm
org.tizen.guides/html/native/ui/efl/multipoint_touch_n.htm

index 2a82c4c..df221c4 100644 (file)
@@ -361,7 +361,6 @@ void
   </tbody>
 </table>
 
-
 <h2 id="evas_object" name="evas_object">Evas Object Events</h2>
 
 <p>Each Evas object on a specific Evas canvas can be manipulated independently. Each object can send events, which you can handle by registering callback functions for them. The events all relate to single objects, not the whole canvas.</p>
@@ -512,6 +511,32 @@ void
    </tbody>
 </table>
 
+<p>The following example shows a scenario with an image and an <code>EVAS_CALLBACK_MOUSE_UP</code> event callback, where the callback is used to print out the location where a touch up event occurs over the image. The callback uses the <code>EVAS_EVENT_FLAG_ON_HOLD</code> event flag to check whether the event is usable: if the <code>EVAS_EVENT_FLAG_ON_HOLD</code> event flag is set, the event is on hold and must not be used to perform any actions.</p>
+
+<pre class="prettyprint">
+static void
+_mouse_up(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED,
+          void *event_info)
+{
+    Evas_Event_Mouse_Up *ev = event_info;
+
+    if (ev->button != 1) return;
+    if (ev->event_flags &amp; EVAS_EVENT_FLAG_ON_HOLD) return;
+
+    printf("MOUSE: up @ %4i %4i\n", ev->canvas.x, ev->canvas.y);
+}
+
+static void
+_add_mouse_up(Evas_Object *window)
+{
+    Evas_Object *image;
+
+    image = elm_image_add(win);
+    evas_object_event_callback_add(image, EVAS_CALLBACK_MOUSE_UP, _mouse_up, NULL);
+    evas_object_show(image);
+}
+</pre>
+
 <h2 id="evas_smart_object" name="evas_smart_object">Evas Smart Object Events</h2>
 
 <p>Evas smart object events are the most widely-used type of events in graphical applications, since they are used for signals, such as <code>"clicked"</code>, <code>"clicked,double"</code> (double-click), and <code>"pressed"</code>. They are identified by strings, and each smart object is able to define its own events (although the names follow conventions).</p>
index 29f36d7..4b0c728 100644 (file)
@@ -294,6 +294,32 @@ create_main_view(appdata_s *ad)
 <li><code>EVAS_CALLBACK_MULTI_MOVE</code>: Object receives the multi-mouse/touch move event.</li>
 </ul>
 
+<p>The following example shows a scenario with an image and an <code>EVAS_CALLBACK_MOUSE_UP</code> event callback, where the callback is used to print out the location where a touch up event occurs over the image. The callback uses the <code>EVAS_EVENT_FLAG_ON_HOLD</code> event flag to check whether the event is usable: if the <code>EVAS_EVENT_FLAG_ON_HOLD</code> event flag is set, the event is on hold and must not be used to perform any actions.</p>
+
+<pre class="prettyprint">
+static void
+_mouse_up(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED,
+          void *event_info)
+{
+    Evas_Event_Mouse_Up *ev = event_info;
+
+    if (ev->button != 1) return;
+    if (ev->event_flags &amp; EVAS_EVENT_FLAG_ON_HOLD) return;
+
+    printf("MOUSE: up @ %4i %4i\n", ev->canvas.x, ev->canvas.y);
+}
+
+static void
+_add_mouse_up(Evas_Object *window)
+{
+    Evas_Object *image;
+
+    image = elm_image_add(win);
+    evas_object_event_callback_add(image, EVAS_CALLBACK_MOUSE_UP, _mouse_up, NULL);
+    evas_object_show(image);
+}
+</pre>
+
 <script type="text/javascript" src="../../../scripts/jquery.zclip.min.js"></script>
 <script type="text/javascript" src="../../../scripts/showhide.js"></script>