static Evas_Object *_action_button_unset(Evas_Object *obj, unsigned int idx);
static void _button_remove(Evas_Object *obj, Evas_Object *content,
Eina_Bool delete);
+static void _popup_show(void *data, Evas *e, Evas_Object *obj,
+ void *event_info);
static const char SIG_BLOCK_CLICKED[] = "block,clicked";
static const char SIG_TIMEOUT[] = "timeout";
static const Evas_Smart_Cb_Description _signals[] = {
evas_object_smart_callback_del(wd->notify, "timeout", _timeout);
evas_object_event_callback_del(wd->notify, EVAS_CALLBACK_RESIZE,
_notify_resize);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _popup_show);
wd->button_count = 0;
for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++)
if (wd->buttons[i])
if (!wd) return;
elm_layout_theme_set(wd->base, "popup", "base", elm_widget_style_get(obj));
- elm_widget_scale_set(wd->base, elm_widget_scale_get(obj) *
- _elm_config->scale);
_elm_widget_mirrored_reload(obj);
_mirrored_set(obj, elm_widget_mirrored_get(obj));
if (wd->button_count)
if (!wd) return;
if (wd->title_icon == icon) return;
title_visibility_old = (wd->title_text) || (wd->title_icon);
- if (wd->title_icon)
- {
- evas_object_del(wd->title_icon);
- wd->title_icon = NULL;
- }
+ if (wd->title_icon) evas_object_del(wd->title_icon);
+
wd->title_icon = icon;
title_visibility_current = (wd->title_text) || (wd->title_icon);
elm_object_part_content_set(wd->base, "elm.swallow.title.icon",
wd->content_area);
elm_object_part_content_set(wd->content_area, "elm.swallow.content",
content);
+ evas_object_show(content);
}
_sizing_eval(obj);
}
elm_object_part_content_unset(wd->action_area, buf);
elm_object_part_content_set(wd->action_area, buf,
wd->buttons[i]->btn);
+ evas_object_show(wd->buttons[i]->btn);
wd->buttons[i]->delete_me = EINA_TRUE;
}
if (!wd->button_count)
{
_layout_set(obj);
+ elm_object_part_content_unset(wd->base, "elm.swallow.action_area");
+ evas_object_hide(wd->action_area);
edje_object_message_signal_process(elm_layout_edje_get(wd->base));
}
else
{
Action_Area_Data *adata;
char buf[128];
- unsigned int index = idx - 1, i = 0, position = 0;
+ unsigned int num = idx - 1, i = 0, position = 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (index >= ELM_POPUP_ACTION_BUTTON_MAX) return;
- if (wd->buttons[index])
- _button_remove(obj, wd->buttons[index]->btn, EINA_TRUE);
+ if (num >= ELM_POPUP_ACTION_BUTTON_MAX) return;
+ if (wd->buttons[num])
+ _button_remove(obj, wd->buttons[num]->btn, EINA_TRUE);
if (btn)
{
wd->button_count++;
adata = ELM_NEW(Action_Area_Data);
adata->obj = obj;
adata->btn = btn;
- wd->buttons[index] = adata;
+ wd->buttons[num] = adata;
/* Adding delete_me state inside action data as unset calls _sub_del
too and before setting a new content, the previous one needs to
be unset in order to avoid unwanted deletion. This way rearrangement
elm_object_part_content_unset(wd->action_area, buf);
elm_object_part_content_set(wd->action_area, buf,
wd->buttons[i]->btn);
+ evas_object_show(wd->buttons[i]->btn);
/* Setting delete_me to TRUE in order to let _sub_del handle it
if deleted externally and update the buttons array after freeing
action data allocated earlier.
}
elm_object_part_content_set(wd->base, "elm.swallow.action_area",
wd->action_area);
+ evas_object_show(wd->action_area);
if (wd->button_count == 1)
_layout_set(obj);
edje_object_message_signal_process(wd->base);
static Evas_Object *
_action_button_get(Evas_Object *obj, unsigned int idx)
{
- unsigned int index = idx - 1;
+ unsigned int num = idx - 1;
Evas_Object *button = NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd || !wd->button_count) return NULL;
- if (wd->buttons[index])
- button = wd->buttons[index]->btn;
+ if (wd->buttons[num])
+ button = wd->buttons[num]->btn;
return button;
}
static Evas_Object *
_action_button_unset(Evas_Object *obj, unsigned int idx)
{
- unsigned int index = idx -1;
+ unsigned int num = idx -1;
Evas_Object *button = NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
- if ((!wd->button_count) || (index >= ELM_POPUP_ACTION_BUTTON_MAX))
+ if ((!wd->button_count) || (num >= ELM_POPUP_ACTION_BUTTON_MAX))
return NULL;
- if (wd->buttons[index])
+ if (wd->buttons[num])
{
- button = wd->buttons[index]->btn;
+ button = wd->buttons[num]->btn;
_button_remove(obj, button, EINA_FALSE);
}
return button;
}
static Eina_Bool
-_focus_next_hook(const Evas_Object *obj __UNUSED__,
- Elm_Focus_Direction dir __UNUSED__,
- Evas_Object **next __UNUSED__)
+_focus_next_hook(const Evas_Object *obj,
+ Elm_Focus_Direction dir,
+ Evas_Object **next)
{
- //TODO: Implement Focus chanin Handling in Popup for action area buttons
- return EINA_FALSE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ if (!wd)
+ return EINA_FALSE;
+ return elm_widget_focus_next_get(wd->notify, dir, next);
}
+
static void
_item_text_set(Elm_Popup_Content_Item *item, const char *label)
{
if (item->icon == icon) return;
if (item->icon)
{
- elm_widget_sub_object_del(WIDGET(item), item->icon);
evas_object_data_del(item->icon, "_popup_content_item");
evas_object_del(item->icon);
}
edje_object_signal_emit(VIEW(item), emission, source);
}
+static void
+_popup_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
+ void *event_info __UNUSED__)
+{
+ Widget_Data *wd;
+
+ wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ evas_object_show(wd->notify);
+}
+
EAPI Evas_Object *
elm_popup_add(Evas_Object *parent)
{
elm_widget_content_set_hook_set(obj, _content_set_hook);
elm_widget_content_get_hook_set(obj, _content_get_hook);
elm_widget_content_unset_hook_set(obj,_content_unset_hook);
+ elm_widget_can_focus_set(obj, EINA_FALSE);
elm_widget_focus_next_hook_set(obj, _focus_next_hook);
evas_object_smart_callbacks_descriptions_set(obj, _signals);
wd->notify = elm_notify_add(obj);
- elm_widget_resize_object_set(obj, wd->notify);
elm_notify_parent_set(wd->notify, parent);
elm_notify_orient_set(wd->notify, ELM_NOTIFY_ORIENT_CENTER);
elm_notify_allow_events_set(wd->notify, EINA_FALSE);
evas_object_event_callback_add(wd->notify, EVAS_CALLBACK_RESIZE,
_notify_resize, obj);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _popup_show,
+ NULL);
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESTACK, _restack, NULL);
wd->base = elm_layout_add(obj);
evas_object_size_hint_weight_set(wd->base, EVAS_HINT_EXPAND,
}
EAPI Elm_Wrap_Type
-elm_popup_content_text_wrap_type_get(Evas_Object *obj)
+elm_popup_content_text_wrap_type_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) ELM_WRAP_LAST;
Widget_Data *wd = elm_widget_data_get(obj);
}
EAPI Elm_Popup_Orient
-elm_popup_orient_get(Evas_Object *obj)
+elm_popup_orient_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) -1;
Widget_Data *wd = elm_widget_data_get(obj);
}
EAPI double
-elm_popup_timeout_get(Evas_Object *obj)
+elm_popup_timeout_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) 0.0;
Widget_Data *wd = elm_widget_data_get(obj);
}
EAPI Eina_Bool
-elm_popup_allow_events_get(Evas_Object *obj)
+elm_popup_allow_events_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);