#define MY_CLASS_NAME "Elm_Popup"
#define MY_CLASS_NAME_LEGACY "elm_popup"
+/* TIZEN_ONLY(20161109): check theme compatibility more precise
+ Naming rules of some parts in theme is changed in Tizen 3.0,
+ so popup must check theme compatibility more precise.
+
+ - notify style changes
+ Tizen 2.4 : "popup" -> Tizen 3.0 : "popup/default"
+ Tizen 2.4 : "toast" -> Tizen 3.0 : "popup/toast"
+
+ - content area & action area changes
+ Tizen 2.4 : "default" -> Tizen 3.0 : "popup/default"
+ Tizen 2.4 : "toast" -> Tizen 3.0 : "popup/toast"
+
+ For some third party app which customize 2.4 popup theme,
+ popup must check 4 styles according to the below style priority.
+ */
+#define STYLE_PRIORITY_COUNT 4
+/* END */
+
static void _button_remove(Evas_Object *, int, Eina_Bool);
static const char ACCESS_TITLE_PART[] = "access.title";
static const char SIG_ITEM_FOCUSED[] = "item,focused";
static const char SIG_ITEM_UNFOCUSED[] = "item,unfocused";
+/* TIZEN_ONLY(20161109): check theme compatibility more precise */
+static const char STYLE_PRIORITY[4][15] = { "%s", "popup/%s", "default", "popup/default" };
+/* END */
+
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
{SIG_BLOCK_CLICKED, ""},
{SIG_TIMEOUT, ""},
static void _hide_effect_finished_cb(void *data, const Efl_Event *event);
+/* TIZEN_ONLY(20161109): add internal style set function */
+static Efl_Ui_Theme_Apply _notify_style_set(Evas_Object *obj, const char *style);
+/* END */
+
static const Elm_Action key_actions[] = {
{"escape", _key_action_escape},
{NULL, NULL}
Elm_Popup_Item_Data *it;
Eina_List *elist;
char buf[1024], style[1024];
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise */
+ int i;
+ /* END */
_mirrored_set(obj, efl_ui_mirrored_get(obj));
snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(obj));
- /* TIZEN_ONLY(20160318): Support legacy group and swallow part names
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
elm_widget_style_set(sd->notify, style);
*/
{
- Eina_Bool ret;
+ Efl_Ui_Theme_Apply ret;
const char *obj_style = elm_widget_style_get(obj);
if (obj_style && !strcmp(obj_style, "default"))
- ret = elm_widget_style_set(sd->notify, "popup");
+ ret = _notify_style_set(sd->notify, "popup");
else
- ret = elm_widget_style_set(sd->notify, obj_style);
+ ret = _notify_style_set(sd->notify, obj_style);
- if (!ret)
- elm_widget_style_set(sd->notify, style);
+ if (ret != EFL_UI_THEME_APPLY_SUCCESS)
+ if (_notify_style_set(sd->notify, style) != EFL_UI_THEME_APPLY_SUCCESS)
+ if (_notify_style_set(sd->notify, "popup") != EFL_UI_THEME_APPLY_SUCCESS)
+ _notify_style_set(sd->notify, "popup/default");
}
/* END */
if (sd->action_area)
{
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
snprintf(buf, sizeof(buf), "buttons%i", sd->last_button_number);
- /* TIZEN_ONLY(20160328): Support legacy groups
if (!elm_layout_theme_set(sd->action_area, "popup", buf, style))
CRI("Failed to set layout!");
*/
- if (!(elm_layout_theme_set(sd->action_area, "popup", buf, elm_widget_style_get(obj)) ||
- elm_layout_theme_set(sd->action_area, "popup", buf, style)))
+ snprintf(buf, sizeof(buf), "buttons%i", sd->last_button_number);
+ for (i = 0; i < STYLE_PRIORITY_COUNT; i++)
+ {
+ snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj));
+ if (efl_ui_layout_theme_set(sd->action_area, "popup", buf, style) == EFL_UI_THEME_APPLY_SUCCESS)
+ break;
+ }
+ if (i == STYLE_PRIORITY_COUNT)
CRI("Failed to set layout!");
/* END */
}
- /* TIZEN_ONLY(20160328): Support legacy groups
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
if (!elm_layout_theme_set(sd->content_area, "popup", "content", style))
CRI("Failed to set layout!");
*/
- if (!(elm_layout_theme_set(sd->content_area, "popup", "content", elm_widget_style_get(obj)) ||
- elm_layout_theme_set(sd->content_area, "popup", "content", style)))
+ for (i = 0; i < STYLE_PRIORITY_COUNT; i++)
+ {
+ snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj));
+ if (efl_ui_layout_theme_set(sd->content_area, "popup", "content", style) == EFL_UI_THEME_APPLY_SUCCESS)
+ break;
+ }
+ if (i == STYLE_PRIORITY_COUNT)
CRI("Failed to set layout!");
+ snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(obj));
/* END */
if (sd->text_content_obj)
- elm_object_style_set(sd->text_content_obj, style);
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
+ elm_object_style_set(sd->text_content_obj, style);
+ */
+ if (elm_widget_style_set(sd->text_content_obj, style) != EFL_UI_THEME_APPLY_SUCCESS)
+ elm_widget_style_set(sd->text_content_obj, "popup/default");
+ /* END */
else if (sd->items)
{
EINA_LIST_FOREACH(sd->items, elist, it)
}
else
{
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
char style[1024];
snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(obj));
snprintf(buf, sizeof(buf), "buttons%i", sd->last_button_number);
- /* TIZEN_ONLY(20160328): Support legacy groups
if (!elm_layout_theme_set(sd->action_area, "popup", buf, style))
CRI("Failed to set layout!");
*/
- if (!(elm_layout_theme_set(sd->action_area, "popup", buf, elm_widget_style_get(obj)) ||
- elm_layout_theme_set(sd->action_area, "popup", buf, style)))
+ char style[1024];
+
+ snprintf(buf, sizeof(buf), "buttons%i", sd->last_button_number);
+ for (i = 0 ; i < STYLE_PRIORITY_COUNT; i++)
+ {
+ snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj));
+ if (efl_ui_layout_theme_set(sd->action_area, "popup", buf, style) == EFL_UI_THEME_APPLY_SUCCESS)
+ break;
+ }
+ if (i == STYLE_PRIORITY_COUNT)
CRI("Failed to set layout!");
/* END */
}
sd->text_content_obj = elm_label_add(sd->content_area);
snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(obj));
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
elm_object_style_set(sd->text_content_obj, style);
+ */
+ if (elm_widget_style_set(sd->text_content_obj, style) != EFL_UI_THEME_APPLY_SUCCESS)
+ elm_widget_style_set(sd->text_content_obj, "popup/default");
+ /* END */
evas_object_event_callback_add
(sd->text_content_obj, EVAS_CALLBACK_DEL, _on_text_content_del, obj);
_visuals_set(obj);
}
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
snprintf(buf, sizeof(buf), "buttons%i", sd->last_button_number);
snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(obj));
- /* TIZEN_ONLY(20160328): Support legacy groups
if (!elm_layout_theme_set(sd->action_area, "popup", buf, style))
CRI("Failed to set layout!");
*/
- if (!(elm_layout_theme_set(sd->action_area, "popup", buf, elm_widget_style_get(obj)) ||
- elm_layout_theme_set(sd->action_area, "popup", buf, style)))
+ snprintf(buf, sizeof(buf), "buttons%i", sd->last_button_number);
+ for (i = 0; i < STYLE_PRIORITY_COUNT; i++)
+ {
+ snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj));
+ if (efl_ui_layout_theme_set(sd->action_area, "popup", buf, style) == EFL_UI_THEME_APPLY_SUCCESS)
+ break;
+ }
+ if (i == STYLE_PRIORITY_COUNT)
CRI("Failed to set layout!");
/* END */
- /* TIZEN_ONLY(20160318): Support legacy group and swallow part names
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
snprintf(buf, sizeof(buf), "elm.swallow.content.button%i", idx + 1);
+ */
evas_object_show(sd->buttons[idx]->btn);
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
elm_object_part_content_set
(sd->action_area, buf, sd->buttons[idx]->btn);
*/
_elm_popup_efl_canvas_group_group_add(Eo *obj, Elm_Popup_Data *priv)
{
char style[1024];
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise */
+ int i;
+ /* END */
efl_canvas_group_add(efl_super(obj, MY_CLASS));
elm_widget_sub_object_parent_add(obj);
snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(obj));
priv->notify = elm_notify_add(obj);
- /* TIZEN_ONLY(20160328): Support legacy groups
+
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise */
+ elm_notify_align_set(priv->notify,
+ _elm_config->popup_horizontal_align,
+ _elm_config->popup_vertical_align);
+ /* END */
+
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
elm_object_style_set(priv->notify, style);
*/
{
- Eina_Bool ret;
+ Efl_Ui_Theme_Apply ret;
const char *obj_style = elm_widget_style_get(obj);
if (obj_style && !strcmp(obj_style, "default"))
- ret = elm_widget_style_set(priv->notify, "popup");
+ ret = _notify_style_set(priv->notify, "popup");
else
- ret = elm_widget_style_set(priv->notify, obj_style);
+ ret = _notify_style_set(priv->notify, obj_style);
- if (!ret)
- elm_widget_style_set(priv->notify, style);
+ if (ret != EFL_UI_THEME_APPLY_SUCCESS)
+ if (_notify_style_set(priv->notify, style) != EFL_UI_THEME_APPLY_SUCCESS)
+ if (_notify_style_set(priv->notify, "popup") != EFL_UI_THEME_APPLY_SUCCESS)
+ _notify_style_set(priv->notify, "popup/default");
}
/* END */
_on_obj_size_hints_changed, NULL);
/* END */
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
elm_notify_align_set(priv->notify,
_elm_config->popup_horizontal_align,
_elm_config->popup_vertical_align);
+ */
elm_notify_allow_events_set(priv->notify, EINA_FALSE);
evas_object_size_hint_weight_set
(priv->notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
(priv->main_layout, "elm,state,action_area,hidden", "elm", _layout_change_cb, NULL);
priv->content_area = elm_layout_add(priv->main_layout);
- /* TIZEN_ONLY(20160328): Support legacy groups
+ /* TIZEN_ONLY(20161109): check theme compatibility more precise
if (!elm_layout_theme_set(priv->content_area, "popup", "content", style))
CRI("Failed to set layout!");
else
(priv->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_size_hints_changed_cb, priv->main_layout);
*/
- if (!(elm_layout_theme_set(priv->content_area, "popup", "content", elm_widget_style_get(obj)) ||
- elm_layout_theme_set(priv->content_area, "popup", "content", style)))
+ for (i = 0 ; i < STYLE_PRIORITY_COUNT; i++)
+ {
+ snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj));
+ if (efl_ui_layout_theme_set(priv->content_area, "popup", "content", style) == EFL_UI_THEME_APPLY_SUCCESS)
+ break;
+ }
+ if (i == STYLE_PRIORITY_COUNT)
CRI("Failed to set layout!");
else
evas_object_event_callback_add
(priv->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _size_hints_changed_cb, priv->main_layout);
+ _size_hints_changed_cb, obj);
/* END */
priv->content_text_wrap_type = ELM_WRAP_MIXED;
}
//
+/* TIZEN_ONLY(20161109): check theme compatibility more precise
+ add internal style set function */
+static Efl_Ui_Theme_Apply
+_notify_style_set(Evas_Object *obj, const char *style)
+{
+ Efl_Ui_Theme_Apply ret = EFL_UI_THEME_APPLY_SUCCESS;
+
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
+
+ if (eina_stringshare_replace(&wd->style, style))
+ {
+ const Eina_List *l;
+ Elm_Tooltip *tt;
+ Elm_Cursor *cur;
+
+ if (wd->hover_obj) ret &= elm_widget_theme(wd->hover_obj);
+
+ EINA_LIST_FOREACH(wd->tooltips, l, tt)
+ elm_tooltip_theme(tt);
+ EINA_LIST_FOREACH(wd->cursors, l, cur)
+ elm_cursor_theme(cur);
+
+ ret &= elm_obj_widget_theme_apply(obj);
+ }
+
+ return ret;
+}
+/* END */
+
/* Standard widget overrides */
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_popup, Elm_Popup_Data)