efl_ui_popup: Rename bg_set with backwall_set

Since "background" is used as a basic part property, "backwall" is used
to indicate the area behind efl_ui_popup.
This commit is contained in:
Jaehyun Cho 2017-10-30 20:34:42 +09:00
parent f82779efc2
commit 91df6723c9
5 changed files with 50 additions and 50 deletions

View File

@ -626,7 +626,7 @@ group { "elm/popup/base/alert";
}
}
group { "elm/popup/base/event_bg";
group { "elm/popup/base/backwall";
parts {
rect { "base";
desc { "default";

View File

@ -16,7 +16,7 @@ typedef struct
} efl_ui_popup_data;
static void
_bg_clicked(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
_backwall_clicked(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
printf("Popup's background is clicked.\n");
}
@ -55,7 +55,7 @@ _create_popup(efl_ui_popup_data *p_data)
Eo *efl_ui_popup = efl_add(EFL_UI_POPUP_CLASS, p_data->win);
efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_EVENT_BG_CLICKED, _bg_clicked, NULL);
efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_EVENT_BACKWALL_CLICKED, _backwall_clicked, NULL);
efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_EVENT_TIMEOUT, _timeout_cb, p_data);
efl_gfx_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
@ -75,7 +75,7 @@ _create_cb(void *data, const Efl_Event *ev EINA_UNUSED)
}
static void
_bg_cb(void *data EINA_UNUSED, const Efl_Event *ev)
_backwall_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
static int k = 0;
efl_ui_popup_data *p_data = data;
@ -84,13 +84,13 @@ _bg_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_bg_set(p_data->efl_ui_popup, buf, NULL);
efl_text_set(ev->object, "Bg UnSet");
efl_ui_popup_backwall_set(p_data->efl_ui_popup, buf, NULL);
efl_text_set(ev->object, "Backwall UnSet");
}
else
{
efl_ui_popup_bg_set(p_data->efl_ui_popup, NULL, NULL);
efl_text_set(ev->object, "Bg Set");
efl_ui_popup_backwall_set(p_data->efl_ui_popup, 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_bg_repeat_events_get(p_data->efl_ui_popup))
if (!efl_ui_popup_backwall_repeat_events_get(p_data->efl_ui_popup))
{
efl_ui_popup_bg_repeat_events_set(p_data->efl_ui_popup, EINA_TRUE);
efl_ui_popup_backwall_repeat_events_set(p_data->efl_ui_popup, EINA_TRUE);
efl_text_set(ev->object, "Repeat Event UnSet");
}
else
{
efl_ui_popup_bg_repeat_events_set(p_data->efl_ui_popup, EINA_FALSE);
efl_ui_popup_backwall_repeat_events_set(p_data->efl_ui_popup, EINA_FALSE);
efl_text_set(ev->object, "Repeat Event Set");
}
}
@ -265,11 +265,11 @@ test_ui_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
efl_gfx_size_set(dummy_btn, EINA_SIZE2D(150, 50));
efl_event_callback_add(dummy_btn, EFL_UI_EVENT_CLICKED, _dummy_cb, p_data);
Eo *bg_btn = efl_add(EFL_UI_BUTTON_CLASS, panel_win);
efl_gfx_position_set(bg_btn, EINA_POSITION2D(0, 100));
efl_gfx_size_set(bg_btn, EINA_SIZE2D(150, 50));
efl_text_set(bg_btn, "Bg Set");
efl_event_callback_add(bg_btn, EFL_UI_EVENT_CLICKED, _bg_cb, p_data);
Eo *backwall_btn = efl_add(EFL_UI_BUTTON_CLASS, panel_win);
efl_gfx_position_set(backwall_btn, EINA_POSITION2D(0, 100));
efl_gfx_size_set(backwall_btn, EINA_SIZE2D(150, 50));
efl_text_set(backwall_btn, "Backwall Set");
efl_event_callback_add(backwall_btn, EFL_UI_EVENT_CLICKED, _backwall_cb, p_data);
Eo *timeout_btn = efl_add(EFL_UI_BUTTON_CLASS, panel_win);
efl_text_set(timeout_btn, "Timeout 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_bg_repeat_events_set(efl_ui_popup, EINA_TRUE);
efl_ui_popup_backwall_repeat_events_set(efl_ui_popup, 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,

View File

@ -13,13 +13,13 @@
#define MY_CLASS_NAME "Efl.Ui.Popup"
static void
_bg_clicked_cb(void *data,
Eo *o EINA_UNUSED,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
_backwall_clicked_cb(void *data,
Eo *o EINA_UNUSED,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
Eo *obj = data;
efl_event_callback_call(obj, EFL_UI_POPUP_EVENT_BG_CLICKED, NULL);
efl_event_callback_call(obj, EFL_UI_POPUP_EVENT_BACKWALL_CLICKED, NULL);
}
EOLIAN static void
@ -36,8 +36,8 @@ _calc_align(Eo *obj)
Eina_Rect p_geom = efl_gfx_geometry_get(pd->win_parent);
efl_gfx_position_set(pd->event_bg, EINA_POSITION2D(0, 0));
efl_gfx_size_set(pd->event_bg, EINA_SIZE2D(p_geom.w, p_geom.h));
efl_gfx_position_set(pd->backwall, EINA_POSITION2D(0, 0));
efl_gfx_size_set(pd->backwall, EINA_SIZE2D(p_geom.w, p_geom.h));
Eina_Rect o_geom = efl_gfx_geometry_get(obj);
@ -89,8 +89,8 @@ _efl_ui_popup_elm_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_U
Eina_Rect p_geom = efl_gfx_geometry_get(pd->win_parent);
efl_gfx_position_set(pd->event_bg, EINA_POSITION2D(p_geom.x, p_geom.y));
efl_gfx_size_set(pd->event_bg, EINA_SIZE2D(p_geom.w, p_geom.h));
efl_gfx_position_set(pd->backwall, EINA_POSITION2D(p_geom.x, p_geom.y));
efl_gfx_size_set(pd->backwall, EINA_SIZE2D(p_geom.w, p_geom.h));
efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, obj);
efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, obj);
@ -202,13 +202,13 @@ _efl_ui_popup_efl_object_constructor(Eo *obj, Efl_Ui_Popup_Data *pd)
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);
pd->backwall = edje_object_add(evas_object_evas_get(obj));
elm_widget_theme_object_set(obj, pd->backwall, "popup", "base", "backwall");
evas_object_smart_member_add(pd->backwall, obj);
evas_object_stack_below(pd->backwall, wd->resize_obj);
edje_object_signal_callback_add(pd->event_bg, "elm,action,clicked", "*",
_bg_clicked_cb, obj);
edje_object_signal_callback_add(pd->backwall, "elm,action,clicked", "*",
_backwall_clicked_cb, obj);
pd->align = EFL_UI_POPUP_ALIGN_CENTER;
@ -218,7 +218,7 @@ _efl_ui_popup_efl_object_constructor(Eo *obj, Efl_Ui_Popup_Data *pd)
EOLIAN static void
_efl_ui_popup_efl_object_destructor(Eo *obj, Efl_Ui_Popup_Data *pd)
{
ELM_SAFE_DEL(pd->event_bg);
ELM_SAFE_DEL(pd->backwall);
efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb,
obj);
@ -250,12 +250,12 @@ _efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
}
EOLIAN static void
_efl_ui_popup_bg_set(Eo *obj, Efl_Ui_Popup_Data *pd, const char* file, const char* group)
_efl_ui_popup_backwall_set(Eo *obj, Efl_Ui_Popup_Data *pd, const char* file, const char* group)
{
Eo *prev_obj = edje_object_part_swallow_get(pd->event_bg, "elm.swallow.image");
Eo *prev_obj = edje_object_part_swallow_get(pd->backwall, "elm.swallow.image");
if (prev_obj)
{
edje_object_part_unswallow(pd->event_bg, prev_obj);
edje_object_part_unswallow(pd->backwall, prev_obj);
efl_del(prev_obj);
}
@ -263,26 +263,26 @@ _efl_ui_popup_bg_set(Eo *obj, Efl_Ui_Popup_Data *pd, const char* file, const cha
Eina_Bool ret = elm_image_file_set(image, file, group);
if (!ret)
{
edje_object_signal_emit(pd->event_bg, "elm,state,image,hidden", "elm");
edje_object_signal_emit(pd->backwall, "elm,state,image,hidden", "elm");
efl_del(image);
return;
}
edje_object_part_swallow(pd->event_bg, "elm.swallow.image", image);
edje_object_signal_emit(pd->event_bg, "elm,state,image,visible", "elm");
edje_object_part_swallow(pd->backwall, "elm.swallow.image", image);
edje_object_signal_emit(pd->backwall, "elm,state,image,visible", "elm");
}
EOLIAN static void
_efl_ui_popup_bg_repeat_events_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd, Eina_Bool repeat)
_efl_ui_popup_backwall_repeat_events_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd, Eina_Bool repeat)
{
pd->bg_repeat_events = repeat;
pd->backwall_repeat_events = repeat;
efl_canvas_object_repeat_events_set(pd->event_bg, repeat);
efl_canvas_object_repeat_events_set(pd->backwall, repeat);
}
EOLIAN static Eina_Bool
_efl_ui_popup_bg_repeat_events_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd)
_efl_ui_popup_backwall_repeat_events_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd)
{
return pd->bg_repeat_events;
return pd->backwall_repeat_events;
}
/* Internal EO APIs and hidden overrides */

View File

@ -10,14 +10,14 @@ enum Efl.Ui.Popup.Align {
class Efl.Ui.Popup(Efl.Ui.Layout)
{
methods {
bg_set {
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 bg_repeat_events {
@property backwall_repeat_events {
set {
[[Sets whether events should be passed to by a click outside.
@ -25,7 +25,7 @@ class Efl.Ui.Popup(Efl.Ui.Layout)
]]
}
get {
[[Returns value indicating whether bg repeat events is enabled or not.]]
[[Returns value indicating whether backwall repeat events is enabled or not.]]
}
values {
repeat: bool; [[If $true, events are passed to lower objects.]]
@ -66,7 +66,7 @@ class Efl.Ui.Popup(Efl.Ui.Layout)
Efl.Container.content_unset;
}
events {
bg,clicked; [[This is called whenever the user click background of popup.]]
backwall,clicked; [[This is called whenever the user clicks back wall of popup.]]
timeout; [[This is called when popup times out.]]
}
}

View File

@ -5,11 +5,11 @@ typedef struct _Efl_Ui_Popup_Data Efl_Ui_Popup_Data;
struct _Efl_Ui_Popup_Data
{
Eo *win_parent;
Eo *event_bg;
Eo *backwall;
Efl_Ui_Popup_Align align;
Ecore_Timer *timer;
double timeout;
Eina_Bool bg_repeat_events : 1;
Eina_Bool backwall_repeat_events : 1;
};
#endif