Mobile native Wearable native

EFL UTIL: Adjusting the Notification Window Level

This tutorial demonstrates how you can adjust the level of a notification window using the EFL UTIL API.

Warm-up

Become familiar with the EFL UTIL, Elementary, and Evas API basics by learning about:

Initializing EFL Utility

To use the EFL UTIL API, the following header file has to be included:

#include <efl_util.h>

If the window type is not notification type, the efl_util_set_notification_window_level() function returns an error.

Creating a Notification Window and Setting a Notification Window Level

To create a notification window and set the window level, use the efl_util_set_notification_window_level() function:

#include <Elementary.h>
#include <efl_util.h>
#include <dlog.h>

void create_win() 
{
   Evas_Object *eo;
   efl_util_error_e error;
   char *name = "Notification window";
   
   // Create notification window
   eo = elm_win_add(NULL, name, ELM_WIN_NOTIFICATION);
   if (!eo) return;
   
   // Set notification level
   error = efl_util_set_notification_window_level
           (eo, EFL_UTIL_NOTIFICATION_LEVEL_1);
   if (error != EFL_UTIL_ERROR_NONE)
   {
      // Do error handling
   }
}

Getting the Notification Window Level

To get the notification window level, use the efl_util_get_notification_window_level() function:

void create_win() 
{
   Evas_Object *eo;
   efl_util_error_e error;
   efl_util_notification_level_e notification_level;
   char *name = "Notification window";
   
   // Create notification window
   eo = elm_win_add(NULL, name, ELM_WIN_NOTIFICATION);
   if (!eo) return;
   
   // Get notification level
   error = efl_util_get_notification_window_level
           (eo, &notification_level);
   if (error == EFL_UTIL_ERROR_NONE) 
   {
      switch (notification_level) 
      {
         case EFL_UTIL_NOTIFICATION_LEVEL_1:
            // Do something for notification level 1
            break;
         case EFL_UTIL_NOTIFICATION_LEVEL_2:
            // Do something for notification level 2
            break;
      }
   }
}
Go to top