From 7a2364d7bdf85d2c0487643f5bfa9834a22d4de6 Mon Sep 17 00:00:00 2001 From: "Myoungwoon Roy, Kim" Date: Wed, 6 Sep 2017 13:21:21 +0900 Subject: [PATCH] Add a guideline for EVAS_EVENT_FLAG_ON_HOLD 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 --- .../html/native/ui/efl/event_types_n.htm | 27 +++++++++++++++++++++- .../html/native/ui/efl/multipoint_touch_n.htm | 26 +++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/org.tizen.guides/html/native/ui/efl/event_types_n.htm b/org.tizen.guides/html/native/ui/efl/event_types_n.htm index 2a82c4c..df221c4 100644 --- a/org.tizen.guides/html/native/ui/efl/event_types_n.htm +++ b/org.tizen.guides/html/native/ui/efl/event_types_n.htm @@ -361,7 +361,6 @@ void -

Evas Object Events

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.

@@ -512,6 +511,32 @@ void +

The following example shows a scenario with an image and an EVAS_CALLBACK_MOUSE_UP 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 EVAS_EVENT_FLAG_ON_HOLD event flag to check whether the event is usable: if the EVAS_EVENT_FLAG_ON_HOLD event flag is set, the event is on hold and must not be used to perform any actions.

+ +
+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 & 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);
+}
+
+

Evas Smart Object Events

Evas smart object events are the most widely-used type of events in graphical applications, since they are used for signals, such as "clicked", "clicked,double" (double-click), and "pressed". They are identified by strings, and each smart object is able to define its own events (although the names follow conventions).

diff --git a/org.tizen.guides/html/native/ui/efl/multipoint_touch_n.htm b/org.tizen.guides/html/native/ui/efl/multipoint_touch_n.htm index 29f36d7..4b0c728 100644 --- a/org.tizen.guides/html/native/ui/efl/multipoint_touch_n.htm +++ b/org.tizen.guides/html/native/ui/efl/multipoint_touch_n.htm @@ -294,6 +294,32 @@ create_main_view(appdata_s *ad)
  • EVAS_CALLBACK_MULTI_MOVE: Object receives the multi-mouse/touch move event.
  • +

    The following example shows a scenario with an image and an EVAS_CALLBACK_MOUSE_UP 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 EVAS_EVENT_FLAG_ON_HOLD event flag to check whether the event is usable: if the EVAS_EVENT_FLAG_ON_HOLD event flag is set, the event is on hold and must not be used to perform any actions.

    + +
    +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 & 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);
    +}
    +
    + -- 2.7.4