ui: Fix close callbacks for the UI reference examples

This commit is contained in:
Andy Williams 2017-12-13 12:53:11 +00:00
parent af48dd8fba
commit eabdff1f27
3 changed files with 36 additions and 2 deletions

View File

@ -21,6 +21,13 @@
* TODO - still ELM Table
*/
// quit the app, called if the user clicks the Quit button or the window is deleted
static void
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
efl_exit(0);
}
// Load a simple grid layout into the window
static Efl_Ui_Grid *
_ui_grid_setup(Efl_Ui_Win *win)
@ -99,7 +106,9 @@ _ui_panes_setup(Efl_Ui_Win *win)
efl_add(EFL_UI_BUTTON_CLASS, win,
efl_text_set(efl_added, "Quit"),
efl_content_set(efl_part(horiz_split, "second"), efl_added));
efl_content_set(efl_part(horiz_split, "second"), efl_added),
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
_gui_quit_cb, efl_added));
}
EAPI_MAIN void
@ -114,6 +123,9 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
// _ui_panes_setup(win);
_ui_boxes_setup(win);
// when the user clicks "close" on a window there is a request to delete
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);
efl_gfx_size_set(win, EINA_SIZE2D(350, 250));
}

View File

@ -15,6 +15,13 @@
* and the last has a min size. Try resizing the window to see how this changes.
*/
// quit the app, called if the window is deleted
static void
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
efl_exit(0);
}
EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
@ -25,6 +32,9 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
efl_text_set(efl_added, "Size Control"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
// when the user clicks "close" on a window there is a request to delete
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);
box = efl_add(EFL_UI_BOX_CLASS, win,
efl_content_set(win, efl_added));

View File

@ -21,6 +21,13 @@
*/
#define _TEXT_DOMAIN "example_translation"
// quit the app, called if the user clicks the Quit button or the window is deleted
static void
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
efl_exit(0);
}
EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
@ -32,6 +39,9 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
_TEXT_DOMAIN),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
// when the user clicks "close" on a window there is a request to delete
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);
box = efl_add(EFL_UI_BOX_CLASS, win,
efl_content_set(win, efl_added));
@ -46,7 +56,9 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
efl_add(EFL_UI_BUTTON_CLASS, win,
efl_ui_translatable_text_set(efl_added, "Quit", _TEXT_DOMAIN),
efl_pack_end(box, efl_added),
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(100, 100)));
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(100, 100)),
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
_gui_quit_cb, efl_added));
efl_gfx_size_set(win, EINA_SIZE2D(320, 320));
}