lib/elementary/efl_ui_grid_static.eo \
lib/elementary/efl_ui_text_interactive.eo \
lib/elementary/efl_ui_text.eo \
+ lib/elementary/efl_ui_popup.eo \
lib/elementary/efl_ui_text_editable.eo \
lib/elementary/efl_ui_text_async.eo \
lib/elementary/efl_ui_textpath.eo \
lib/elementary/elm_widget_hoversel.h \
lib/elementary/elm_widget_icon.h \
lib/elementary/efl_ui_widget_image.h \
+ lib/elementary/efl_ui_popup_private.h \
lib/elementary/elm_widget_index.h \
lib/elementary/elm_widget_inwin.h \
lib/elementary/elm_widget_label.h \
lib/elementary/efl_ui_box_stack.c \
lib/elementary/efl_ui_box_layout.c \
lib/elementary/efl_ui_box_private.h \
+ lib/elementary/efl_ui_popup.c \
lib/elementary/efl_ui_grid.c \
lib/elementary/efl_ui_grid_static.c \
lib/elementary/efl_ui_grid_private.h \
void test_datetime(void *data, Evas_Object *obj, void *event_info);
void test_ui_clock(void *data, Evas_Object *obj, void *event_info);
void test_popup(void *data, Evas_Object *obj, void *event_info);
+void test_efl_ui_popup(void *data, Evas_Object *obj, void *event_info);
void test_dayselector(void *data, Evas_Object *obj, void *event_info);
void test_image(void *data, Evas_Object *obj, void *event_info);
void test_image_scale_type(void *data, Evas_Object *obj, void *event_info);
ADD_TEST(NULL, "Popups", "Tooltip 3", test_tooltip3);
ADD_TEST(NULL, "Popups", "Tooltip 4", test_tooltip4);
ADD_TEST(NULL, "Popups", "Popup", test_popup);
+ ADD_TEST(NULL, "Popups", "Efl UI Popup", test_efl_ui_popup);
//------------------------------//
ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar);
evas_object_resize(win, 480, 400);
evas_object_show(win);
}
+
+void
+test_efl_ui_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win;
+
+ win = elm_win_util_standard_add("Efl UI Popup", "Efl UI Popup");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+
+ Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_CLASS, win);
+
+ evas_object_move(efl_ui_popup, 80, 80);
+ evas_object_resize(efl_ui_popup, 160, 160);
+ evas_object_show(efl_ui_popup);
+
+ int x, y, w, h;
+ evas_object_geometry_get(efl_ui_popup, &x, &y, &w, &h);
+ printf("efl_ui_popup: %d %d %d %d\n", x, y, w, h);
+
+ Evas_Object *btn = elm_button_add(efl_ui_popup);
+ elm_object_text_set(btn, "Efl.Ui.Popup content");
+ evas_object_show(btn);
+
+ efl_content_set(efl_ui_popup, btn);
+}
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#define EFL_UI_POPUP_PROTECTED
+
+#include <Elementary.h>
+
+#include "elm_priv.h"
+#include "efl_ui_popup_private.h"
+
+#define MY_CLASS EFL_UI_POPUP_CLASS
+#define MY_CLASS_NAME "Efl.Ui.Popup"
+#define MY_CLASS_NAME_LEGACY "elm_popup"
+
+EOLIAN static void
+_efl_ui_popup_efl_gfx_position_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eina_Position2D pos)
+{
+ efl_gfx_position_set(efl_super(obj, MY_CLASS), pos);
+}
+
+static void
+_parent_geom_cb(void *data, const Efl_Event *ev)
+{
+ Evas_Object *event_bg = data;
+ Evas_Coord x, y, w, h;
+ evas_object_geometry_get(ev->object, &x, &y, &w, &h);
+
+ if (efl_isa(ev->object, EFL_UI_WIN_CLASS))
+ {
+ x = 0;
+ y = 0;
+ }
+
+ evas_object_move(event_bg, x, y);
+ evas_object_resize(event_bg, w, h);
+}
+
+EOLIAN static void
+_efl_ui_popup_elm_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Evas_Object *parent EINA_UNUSED)
+{
+ Evas_Coord x, y, w, h;
+ pd->win_parent = efl_provider_find(obj, EFL_UI_WIN_CLASS);
+ if (!pd->win_parent)
+ {
+ ERR("Cannot find window parent");
+ return;
+ }
+
+ evas_object_geometry_get(pd->win_parent, &x, &y, &w, &h);
+ evas_object_move(pd->event_bg, x, y);
+ evas_object_resize(pd->event_bg, w, h);
+
+ efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, pd->event_bg);
+ efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, pd->event_bg);
+}
+
+EOLIAN static Eina_Bool
+_efl_ui_popup_efl_container_content_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Evas_Object *content)
+{
+ return efl_content_set(efl_part(obj, "elm.swallow.content"), content);
+}
+
+EOLIAN static Evas_Object*
+_efl_ui_popup_efl_container_content_get(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
+{
+ return efl_content_get(efl_part(obj, "elm.swallow.content"));
+}
+
+EOLIAN static Evas_Object*
+_efl_ui_popup_efl_container_content_unset(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
+{
+ return efl_content_unset(efl_part(obj, "elm.swallow.content"));
+}
+
+EOLIAN static Efl_Canvas_Object *
+_efl_ui_popup_parent_window_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd)
+{
+ return pd->win_parent;
+}
+
+EOLIAN static void
+_efl_ui_popup_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Popup_Data *pd)
+{
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+ efl_canvas_group_add(efl_super(obj, MY_CLASS));
+ elm_widget_sub_object_parent_add(obj);
+
+ elm_widget_can_focus_set(obj, EINA_TRUE);
+ elm_layout_theme_set(obj, "popup", "base", "view");
+
+ pd->event_bg = edje_object_add(evas_object_evas_get(obj));
+ elm_widget_theme_object_set(obj, pd->event_bg, "popup", "base", "event_bg");
+ evas_object_smart_member_add(pd->event_bg, obj);
+ evas_object_stack_below(pd->event_bg, wd->resize_obj);
+}
+
+EOLIAN static void
+_efl_ui_popup_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Popup_Data *pd)
+{
+ ELM_SAFE_FREE(pd->event_bg, evas_object_del);
+ efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, pd->event_bg);
+ efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, pd->event_bg);
+
+ efl_canvas_group_del(efl_super(obj, MY_CLASS));
+}
+
+EOLIAN static void
+_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
+{
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+ Evas_Coord minw = -1, minh = -1;
+
+ elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+ edje_object_size_min_restricted_calc
+ (wd->resize_obj, &minw, &minh, minw, minh);
+ evas_object_size_hint_min_set(obj, minw, minh);
+}
+
+EOLIAN static void
+_efl_ui_popup_class_constructor(Efl_Class *klass)
+{
+ evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
+}
+
+/* Internal EO APIs and hidden overrides */
+
+#define EFL_UI_POPUP_EXTRA_OPS \
+ EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_popup), \
+ ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup)
+
+#include "efl_ui_popup.eo.c"