aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/bin/elementary/test_ui_popup.c12
-rw-r--r--src/lib/elementary/efl_ui_popup.c107
-rw-r--r--src/lib/elementary/efl_ui_popup.eo25
-rw-r--r--src/lib/elementary/efl_ui_popup_part.eo11
-rw-r--r--src/lib/elementary/efl_ui_popup_private.h1
6 files changed, 106 insertions, 51 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 39b04c0cc8..752cad7f88 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -32,6 +32,7 @@ elm_public_eolian_files = \
lib/elementary/efl_ui_text_interactive.eo \
lib/elementary/efl_ui_text.eo \
lib/elementary/efl_ui_popup.eo \
+ lib/elementary/efl_ui_popup_part.eo \
lib/elementary/efl_ui_popup_alert.eo \
lib/elementary/efl_ui_popup_alert_part.eo \
lib/elementary/efl_ui_popup_alert_scroll.eo \
diff --git a/src/bin/elementary/test_ui_popup.c b/src/bin/elementary/test_ui_popup.c
index b39113f23d..770ff93f7c 100644
--- a/src/bin/elementary/test_ui_popup.c
+++ b/src/bin/elementary/test_ui_popup.c
@@ -84,12 +84,12 @@ _backwall_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
- efl_ui_popup_backwall_set(p_data->efl_ui_popup, buf, NULL);
+ efl_file_set(efl_part(p_data->efl_ui_popup, "backwall"), buf, NULL);
efl_text_set(ev->object, "Backwall UnSet");
}
else
{
- efl_ui_popup_backwall_set(p_data->efl_ui_popup, NULL, NULL);
+ efl_file_set(efl_part(p_data->efl_ui_popup, "backwall"), NULL, NULL);
efl_text_set(ev->object, "Backwall Set");
}
k = !k;
@@ -100,14 +100,14 @@ _repeat_event_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
efl_ui_popup_data *p_data = data;
if (!p_data->efl_ui_popup) return;
- if (!efl_ui_popup_backwall_repeat_events_get(p_data->efl_ui_popup))
+ if (!efl_canvas_object_repeat_events_get(efl_part(p_data->efl_ui_popup, "backwall")))
{
- efl_ui_popup_backwall_repeat_events_set(p_data->efl_ui_popup, EINA_TRUE);
+ efl_canvas_object_repeat_events_set(efl_part(p_data->efl_ui_popup, "backwall"), EINA_TRUE);
efl_text_set(ev->object, "Repeat Event UnSet");
}
else
{
- efl_ui_popup_backwall_repeat_events_set(p_data->efl_ui_popup, EINA_FALSE);
+ efl_canvas_object_repeat_events_set(efl_part(p_data->efl_ui_popup, "backwall"), EINA_FALSE);
efl_text_set(ev->object, "Repeat Event Set");
}
}
@@ -453,7 +453,7 @@ test_ui_popup_anchor(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
Eo *efl_ui_popup = efl_add(EFL_UI_POPUP_ANCHOR_CLASS, win);
- efl_ui_popup_backwall_repeat_events_set(efl_ui_popup, EINA_TRUE);
+ efl_canvas_object_repeat_events_set(efl_part(efl_ui_popup, "backwall"), EINA_TRUE);
//Default align priority order is top, left, right, bottom, center.
efl_ui_popup_anchor_align_priority_set(efl_ui_popup, EFL_UI_POPUP_ALIGN_TOP,
diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c
index 92eed8df8b..114daa09c6 100644
--- a/src/lib/elementary/efl_ui_popup.c
+++ b/src/lib/elementary/efl_ui_popup.c
@@ -8,6 +8,8 @@
#include "elm_priv.h"
#include "efl_ui_popup_private.h"
+#include "efl_ui_popup_part.eo.h"
+#include "elm_part_helper.h"
#define MY_CLASS EFL_UI_POPUP_CLASS
#define MY_CLASS_NAME "Efl.Ui.Popup"
@@ -249,42 +251,101 @@ _efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
_calc_align(obj);
}
-EOLIAN static void
-_efl_ui_popup_backwall_set(Eo *obj, Efl_Ui_Popup_Data *pd, const char* file, const char* group)
+static Eina_Bool
+_efl_ui_popup_content_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, const char *part, Eo *content)
{
- Eo *prev_obj = edje_object_part_swallow_get(pd->backwall, "elm.swallow.image");
- if (prev_obj)
- {
- edje_object_part_unswallow(pd->backwall, prev_obj);
- efl_del(prev_obj);
- }
+ return efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
+}
- Eo *image = elm_image_add(obj);
- Eina_Bool ret = elm_image_file_set(image, file, group);
- if (!ret)
- {
- edje_object_signal_emit(pd->backwall, "elm,state,image,hidden", "elm");
- efl_del(image);
- return;
- }
- edje_object_part_swallow(pd->backwall, "elm.swallow.image", image);
- edje_object_signal_emit(pd->backwall, "elm,state,image,visible", "elm");
+Eo *
+_efl_ui_popup_content_get(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, const char *part)
+{
+ return efl_content_get(efl_part(efl_super(obj, MY_CLASS), part));
+}
+
+static Eo *
+_efl_ui_popup_content_unset(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, const char *part)
+{
+ return efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part));
+}
+
+/* Efl.Part begin */
+
+ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_popup, EFL_UI_POPUP, Efl_Ui_Popup_Data)
+ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_popup, EFL_UI_POPUP, Efl_Ui_Popup_Data)
+ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_popup, EFL_UI_POPUP, Efl_Ui_Popup_Data)
+
+EOLIAN static Eo *
+_efl_ui_popup_efl_part_part(const Eo *obj, Efl_Ui_Popup_Data *_pd EINA_UNUSED, const char *part)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
+
+ if (eina_streq(part, "backwall"))
+ return ELM_PART_IMPLEMENT(EFL_UI_POPUP_PART_CLASS, obj, part);
+
+ return efl_part(efl_super(obj, MY_CLASS), part);
}
EOLIAN static void
-_efl_ui_popup_backwall_repeat_events_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd, Eina_Bool repeat)
+_efl_ui_popup_part_efl_canvas_object_repeat_events_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool repeat)
+{
+ Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
+ Efl_Ui_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_POPUP_CLASS);
+
+ if (eina_streq(pd->part, "backwall"))
+ efl_canvas_object_repeat_events_set(sd->backwall, repeat);
+ else
+ efl_canvas_object_repeat_events_set(efl_part(efl_super(pd->obj, MY_CLASS), pd->part), repeat);
+}
+
+EOLIAN static Eina_Bool
+_efl_ui_popup_part_efl_canvas_object_repeat_events_get(Eo *obj, void *_pd EINA_UNUSED)
{
- pd->backwall_repeat_events = repeat;
+ Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
+ Efl_Ui_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_POPUP_CLASS);
+
+ if (eina_streq(pd->part, "backwall"))
+ return efl_canvas_object_repeat_events_get(sd->backwall);
- efl_canvas_object_repeat_events_set(pd->backwall, repeat);
+ return efl_canvas_object_repeat_events_get(efl_part(efl_super(pd->obj, MY_CLASS), pd->part));
}
EOLIAN static Eina_Bool
-_efl_ui_popup_backwall_repeat_events_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd)
+_efl_ui_popup_part_efl_file_file_set(Eo *obj, void *_pd EINA_UNUSED, const char *file, const char *group)
{
- return pd->backwall_repeat_events;
+ Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
+ Efl_Ui_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_POPUP_CLASS);
+
+ if (eina_streq(pd->part, "backwall"))
+ {
+ Eo *prev_obj = edje_object_part_swallow_get(sd->backwall, "elm.swallow.image");
+ if (prev_obj)
+ {
+ edje_object_part_unswallow(sd->backwall, prev_obj);
+ efl_del(prev_obj);
+ }
+
+ Eo *image = elm_image_add(pd->obj);
+ Eina_Bool ret = elm_image_file_set(image, file, group);
+ if (!ret)
+ {
+ edje_object_signal_emit(sd->backwall, "elm,state,image,hidden", "elm");
+ efl_del(image);
+ return EINA_FALSE;
+ }
+ edje_object_part_swallow(sd->backwall, "elm.swallow.image", image);
+ edje_object_signal_emit(sd->backwall, "elm,state,image,visible", "elm");
+
+ return EINA_TRUE;
+ }
+
+ return efl_file_set(efl_part(efl_super(pd->obj, MY_CLASS), pd->part), file, group);
}
+#include "efl_ui_popup_part.eo.c"
+
+/* Efl.Part end */
+
/* Internal EO APIs and hidden overrides */
#define EFL_UI_POPUP_EXTRA_OPS \
diff --git a/src/lib/elementary/efl_ui_popup.eo b/src/lib/elementary/efl_ui_popup.eo
index 09871c407f..48407fff7e 100644
--- a/src/lib/elementary/efl_ui_popup.eo
+++ b/src/lib/elementary/efl_ui_popup.eo
@@ -10,27 +10,6 @@ enum Efl.Ui.Popup.Align {
class Efl.Ui.Popup(Efl.Ui.Layout)
{
methods {
- backwall_set {
- params {
- @in file: string; [[The image file path.]]
- @in group: string; [[The image key in $file (if its an Eet one), or
- $null, otherwise.]]
- }
- }
- @property backwall_repeat_events {
- set {
- [[Sets whether events should be passed to by a click outside.
-
- Note: The default value is $false.
- ]]
- }
- get {
- [[Returns value indicating whether backwall repeat events is enabled or not.]]
- }
- values {
- repeat: bool; [[If $true, events are passed to lower objects.]]
- }
- }
@property align {
set {
[[ Set the popup alignment.]]
@@ -56,6 +35,9 @@ class Efl.Ui.Popup(Efl.Ui.Layout)
}
}
}
+ parts {
+ backwall: Efl.Ui.Popup.Part; [[A backwall behind the popup.]]
+ }
implements {
Efl.Object.constructor;
Efl.Object.destructor;
@@ -64,6 +46,7 @@ class Efl.Ui.Popup(Efl.Ui.Layout)
Elm.Widget.widget_parent { set; }
Efl.Container.content { get; set; }
Efl.Container.content_unset;
+ Efl.Part.part;
}
events {
backwall,clicked; [[This is called whenever the user clicks back wall of popup.]]
diff --git a/src/lib/elementary/efl_ui_popup_part.eo b/src/lib/elementary/efl_ui_popup_part.eo
new file mode 100644
index 0000000000..8df70e0c50
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_part.eo
@@ -0,0 +1,11 @@
+class Efl.Ui.Popup.Part (Efl.Ui.Layout.Part_Content, Efl.Canvas.Object, Efl.File)
+{
+ [[Efl UI Popup internal part class]]
+ data: null;
+ implements {
+ Efl.Container.content { get; set; }
+ Efl.Container.content_unset;
+ Efl.Canvas.Object.repeat_events { set; get; }
+ Efl.File.file { set; }
+ }
+}
diff --git a/src/lib/elementary/efl_ui_popup_private.h b/src/lib/elementary/efl_ui_popup_private.h
index 6a1f48b44d..a62a654046 100644
--- a/src/lib/elementary/efl_ui_popup_private.h
+++ b/src/lib/elementary/efl_ui_popup_private.h
@@ -9,7 +9,6 @@ struct _Efl_Ui_Popup_Data
Efl_Ui_Popup_Align align;
Ecore_Timer *timer;
double timeout;
- Eina_Bool backwall_repeat_events : 1;
};
#endif