Mobile native

[UI Sample] EcoreEvent Sample Overview

The EcoreEvent sample demonstrates how to create an event handler using EFL Ecore event functions. In addition, it supports signals, such as ECORE_EVENT_SIGNAL_EXIT, ECORE_EVENT_SIGNAL_POWER, and ECORE_EVENT_SIGNAL_REALTIME.

The sample uses Ecore event functions, such as ecore_event_handler_add() for adding an event handler. The event handler calls the given callback function.

Implementation

The create_base_gui() function creates the window that does not do anything in this sample application. However, it contains an event function and you can see it working when a given signal is triggered.

static Eina_Bool
_quitter(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event EINA_UNUSED)
{
   dlog_print(DLOG_INFO, "USR_TAG", "Leaving already?");

   return ECORE_CALLBACK_DONE;
}

static void
create_base_gui(appdata_s *ad)
{
   // Window
   ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
   elm_win_autodel_set(ad->win, EINA_TRUE);

   if (elm_win_wm_rotation_supported_get(ad->win)) 
   {
      int rots[4] = { 0, 90, 180, 270 };
      elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
   }

   evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
   eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);

   // Conformant
   ad->conform = elm_conformant_add(ad->win);
   elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
   elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
   evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(ad->win, ad->conform);
   evas_object_show(ad->conform);

   // Event
   ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _quitter, NULL);

   // Show the window after the base GUI is set up
   evas_object_show(ad->win);
}
Go to top