#include <Elementary.h>
static Evas_Object *inwin = NULL;
static const char *styles[] = {
"default",
"minimal",
"minimal_vertical"
};
static int current_style = 0;
static void
_inwin_hide(void *data, Evas_Object *obj, void *event)
{
if (inwin)
{
evas_object_hide(inwin);
return;
}
elm_object_text_set(obj, "No inwin!");
}
static void
_inwin_destroy(void *data, Evas_Object *obj, void *event)
{
if (inwin)
{
evas_object_del(inwin);
inwin = NULL;
return;
}
elm_object_text_set(obj, "No inwin!");
}
static void
_btn_click_cb(void *data, Evas_Object *obj, void *event)
{
Evas_Object *o, *parent;
if (inwin)
{
return;
}
evas_object_show(inwin);
current_style = (current_style + 1) % 3;
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
elm_object_text_set(o, "Click on the first button to hide the Inwin.<ps>"
"Second to destroy it<ps>");
evas_object_show(o);
elm_object_text_set(o, "Hide");
evas_object_show(o);
evas_object_smart_callback_add(o, "clicked", _inwin_hide, NULL);
elm_object_text_set(o, "Destroy");
evas_object_show(o);
evas_object_smart_callback_add(o, "clicked", _inwin_destroy, NULL);
}
static void
_win_del_cb(void *data, Evas_Object *obj, void *event)
{
if (inwin)
{
evas_object_del(inwin);
inwin = NULL;
evas_object_show(hover);
return;
}
evas_object_del(obj);
}
static Eina_Bool
_screenshot_hack_cb(void *data)
{
_btn_click_cb(NULL, data, NULL);
return EINA_FALSE;
}
EAPI_MAIN int
elm_main(int argc, char *argv[])
{
Evas_Object *win, *box, *o;
evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(box);
elm_object_text_set(o, "Inwin!");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, 0.0, 0.0);
elm_box_pack_end(box, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "clicked", _btn_click_cb, NULL);
ecore_timer_add(0.1, _screenshot_hack_cb, o);
evas_object_resize(win, 400, 400);
evas_object_show(win);
return 0;
}