evas_object_move(data, 0, 0);
}
+static void
+_timeout_set_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ efl_ui_popup_timeout_set(data, 3);
+ printf("timemout is set to 3 seconds\n");
+}
+
void
test_efl_ui_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_CLASS, win);
evas_object_smart_callback_add(efl_ui_popup, "bg,clicked", _bg_clicked, NULL);
-
evas_object_resize(efl_ui_popup, 160, 160);
evas_object_show(efl_ui_popup);
evas_object_show(position_btn);
evas_object_smart_callback_add(position_btn, "clicked", _position_set_cb, efl_ui_popup);
+ Evas_Object *timeout_btn;
+ timeout_btn = elm_button_add(win);
+ elm_object_text_set(timeout_btn, "Timeout Set");
+ evas_object_move(timeout_btn, 0, 400);
+ evas_object_resize(timeout_btn, 100, 50);
+ evas_object_show(timeout_btn);
+ evas_object_smart_callback_add(timeout_btn, "clicked", _timeout_set_cb, efl_ui_popup);
+
efl_content_set(efl_ui_popup, btn);
}
return pd->align;
}
+static Eina_Bool
+_timer_cb(void *data)
+{
+ Evas_Object *popup = data;
+ evas_object_del(popup);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_timer_del(Efl_Ui_Popup_Data *pd)
+{
+ if (pd->timer)
+ {
+ ecore_timer_del(pd->timer);
+ pd->timer = NULL;
+ }
+}
+
+static void
+_timer_init(Eo *obj, Efl_Ui_Popup_Data *pd)
+{
+ if (pd->timeout > 0.0)
+ pd->timer = ecore_timer_add(pd->timeout, _timer_cb, obj);
+}
+
+EOLIAN static void
+_efl_ui_popup_efl_gfx_visible_set(Eo *obj, Efl_Ui_Popup_Data *pd, Eina_Bool v)
+{
+ if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, v))
+ return;
+
+ efl_gfx_visible_set(efl_super(obj, MY_CLASS), v);
+
+ if (v)
+ {
+ _timer_del(pd);
+ _timer_init(obj, pd);
+ }
+}
+
+EOLIAN static void
+_efl_ui_popup_timeout_set(Eo *obj, Efl_Ui_Popup_Data *pd, double time)
+{
+ if (time < 0.0)
+ time = 0.0;
+
+ pd->timeout = time;
+
+ _timer_del(pd);
+
+ if (efl_gfx_visible_get(obj))
+ _timer_init(obj, pd);
+}
+
+EOLIAN static double
+_efl_ui_popup_timeout_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd)
+{
+ return pd->timeout;
+}
+
EOLIAN static void
_efl_ui_popup_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Popup_Data *pd)
{
type: Efl.Ui.Popup.Align;
}
}
+ @property timeout {
+ set {
+ [[ Set the timeout seconds.
+ After timeout seconds, popup will be deleted automatically.
+ ]]
+ }
+ get {
+ [[ Get the currently set timeout seconds.]]
+ }
+ values {
+ time: double;
+ }
+ }
}
implements {
class.constructor;
Efl.Gfx.position { set; }
+ Efl.Gfx.visible { set; }
Elm.Widget.widget_parent { set; }
Efl.Container.content { get; set; }
Efl.Container.content_unset;