Win
This feature is supported in mobile applications only.
The window component is the root UI component that is often used in an application. It allows the developer create content in it, and it is handled by the window manager.
The window component is created with the elm_win_add() or elm_win_util_standard_add() function. The content can be added in the window with the elm_win_resize_object_add() function so that a window resize also resizes the content inside.
For more information, see the Win API.
Figure: Win hierarchy
Adding a Window Component
To add a window component:
-
Create a new window and change the title:
Evas_Object *window; // Create a window window = elm_win_add(NULL, "main", ELM_WIN_BASIC); // Change the window title elm_win_title_set(window, "Example Window");
The first element of the elm_win_add() function is the parent window. For example, for a dialog you want to have the main window as the parent. In this example it is NULL, meaning there is no parent. main is the name of the window used by the window manager for identifying the window uniquely amongst all the windows within this application (and all instances of the application). The type is a basic window (the final parameter).
-
Create a new window with a title and a background. This API is a shortcut of the previous one. It also creates a standard background to the window with elm_bg_add(). The window created is of the type ELM_WIN_BASIC.
Evas_Object *window; // Create a standard window window = elm_win_util_standard_add("main", "Example Window");
Closing a Window
When the window is closed outside of the program control, a delete,request signal is emitted to indicate that this event occurred.
When the autodel parameter is set, the window is automatically destroyed after the signal is emitted. If autodel is EINA_FALSE, the window is not destroyed and the program does so when required. The default is EINA_FALSE, where the window is not destroyed automatically.
The autodel is set using the following call:
elm_win_autodel_set(window, EINA_TRUE);
To close the window, use the evas_object_del() function. The window is destroyed and the signal delete,request is sent.
Using the Window Callbacks
The window component emits the following signals:
- focus,in: The window received focus.
- focus,out: The window lost focus.
- moved: The window that holds the canvas is moved.
- withdrawn: The window is managed normally but is removed from the view.
- iconified: The window is minimized (for example, into an icon or a taskbar).
- normal: The window is in the normal state (not withdrawn or iconified).
- stick: The window shows on all desktops.
- unstick: The window shows only on one desktop.
- fullscreen: The window is fullscreen.
- unfullscreen: The window stops being fullscreen.
- maximized: The window is maximized.
- unmaximized: The window is diminished.
- wm,rotation,changed: The rotation of the window is changed by the Windows Manager.
- ioerr: A low-level I/O error occurred in the display system.
With all these signals, event_info is NULL.
The following example registers a callback function called on the fullscreen signal.
{ evas_object_smart_callback_add(window, "fullscreen", fullscreen_cb, data); } // Callback function for the "fullscreen" signal // This callback is called when the window becomes fullscreen void fullscreen_cb(void *data, Evas_Object *obj, void *event_info) { dlog_print(DLOG_INFO, LOG_TAG, "Window fullscreen\n"); }
Note |
---|
Except as noted, this content is licensed under LGPLv2.1+. |