The window widget is the root widget 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 widget is created with elm_win_add() or
elm_win_util_standard_add()
. Content can be added in the window with
elm_win_resize_object_add()
so that a window resize also resizes the content
inside.
Create a new window and change the title.
Evas_Object *window; // Creating a window window = elm_win_add(NULL, "main", ELM_WIN_BASIC); // Change window title elm_win_title_set(window, "Example Window");
The first element of elm_win_add()
is the parent window. For example, for a
dialog you want to have the main window as the parent. Here, 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; // Creating a standard window window = elm_win_util_standard_add("main", "Example Window");
When the user closes the window outside of the program control, a âdelete,requestâ signal is emitted to indicate that this event occurred. The developer can take any action, for example, destroy the window object.
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
API. The window is destroyed and
the signal âdelete,requestâ is sent.
The window widget emits the following signals:
âdelete,requestâ
: the user requested to close the window. See elm_win_autodel_set()
and elm_win_autohide_set().âfocus,inâ
: window got focus (deprecated. use âfocusedâ instead.)âfocus,outâ
: window lost focus (deprecated. use âunfocusedâ instead.)âmovedâ
: window that holds the canvas was movedâwithdrawnâ
: window is still managed normally but removed from viewâiconifiedâ
: window is minimized (perhaps into an icon or taskbar)ânormalâ
: window is in a normal state (not withdrawn or iconified)âstickâ
: window has become sticky (shows on all desktops)âunstickâ
: window has stopped being stickyâfullscreenâ
: window has become fullscreenâunfullscreenâ
: window has stopped being fullscreenâmaximizedâ
: window has been maximizedâunmaximizedâ
: window has stopped being maximizedâioerrâ
: there has been a low-level I/O error with the display systemâindicator,prop,changedâ
: an indicator's property has been changedârotation,changedâ
: window rotation has been changedâprofile,changedâ
: profile of the window has been changedâfocusedâ
: When the win has received focus. (since 1.8)âunfocusedâ
: When the win has lost focus. (since 1.8)âtheme,changedâ
: The theme was changed. (since 1.13)With all these signals, event_info is NULL.
This is an example to register 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 static void _fullscreen_cb(void *data, Evas_Object *obj, void *event_info) { printf("Window fullscreen\n"); }