forked from enlightenment/efl
efl_ui_widget: use elm_widget_element_update to set subobj edc
affected widget list: efl_ui_clock: test, ampm efl_ui_multibuttonentry: guidetext, label, closedbutton efl_ui_slider: popup(indicator) efl_ui_text: scroller, handler, magnifier, cursor, selection, anchor
This commit is contained in:
parent
dd4467505e
commit
f80ab519af
|
@ -517,6 +517,8 @@ _efl_ui_clock_elm_widget_theme_apply(Eo *obj, Efl_Ui_Clock_Data *sd)
|
|||
for (idx = 0; idx < EFL_UI_CLOCK_TYPE_COUNT; idx++)
|
||||
{
|
||||
field = sd->field_list + idx;
|
||||
// TODO: Different group name for each field_obj may be needed.
|
||||
elm_widget_element_update(obj, field->item_obj, PART_NAME_ARRAY[idx]);
|
||||
if (field->fmt_exist && field->visible)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_ENABLE_SIG_STR,
|
||||
|
|
|
@ -33,6 +33,15 @@ typedef struct _Format_Map Format_Map;
|
|||
#define EFL_UI_CLOCK_MAX_FORMAT_LEN 64
|
||||
#define EFL_UI_CLOCK_MAX_FIELD_FORMAT_LEN 3
|
||||
|
||||
const char *PART_NAME_ARRAY[EFL_UI_CLOCK_TYPE_COUNT] = { "text",
|
||||
"text",
|
||||
"text",
|
||||
"text",
|
||||
"text",
|
||||
"text",
|
||||
"text",
|
||||
"ampm"};
|
||||
|
||||
struct _Efl_Ui_Clock_Module_Data
|
||||
{
|
||||
Evas_Object *base;
|
||||
|
|
|
@ -2071,6 +2071,17 @@ EOLIAN static void _efl_ui_layout_class_constructor(Efl_Class *klass)
|
|||
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object*
|
||||
_efl_ui_layout_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Eo *eo;
|
||||
|
||||
eo = efl_finalize(efl_super(obj, MY_CLASS));
|
||||
efl_ui_widget_theme_apply(eo);
|
||||
|
||||
return eo;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_layout_efl_layout_signal_message_send(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED, int id, const Eina_Value msg)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,7 @@ class Efl.Ui.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File,
|
|||
implements {
|
||||
class.constructor;
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.finalize;
|
||||
Efl.File.file { get; set; }
|
||||
Efl.File.mmap { get; set; }
|
||||
Efl.Canvas.Group.group_calculate;
|
||||
|
|
|
@ -35,6 +35,11 @@ static const char SIG_UNFOCUSED[] = "unfocused";
|
|||
static const char SIG_EXPANDED[] = "expanded";
|
||||
static const char SIG_CONTRACTED[] = "contracted";
|
||||
static const char SIG_EXPAND_STATE_CHANGED[] = "expand,state,changed";
|
||||
|
||||
static const char PART_NAME_BUTTON[] = "btn";
|
||||
static const char PART_NAME_GUIDE_TEXT[] = "guidetext";
|
||||
static const char PART_NAME_LABEL[] = "label";
|
||||
static const char PART_NAME_CLOSED_BUTTON[] = "closedbutton";
|
||||
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
||||
{SIG_ITEM_SELECTED, ""},
|
||||
{SIG_ITEM_ADDED, ""},
|
||||
|
@ -117,20 +122,13 @@ _efl_ui_multibuttonentry_elm_widget_theme_apply(Eo *obj, Efl_Ui_Multibuttonentry
|
|||
{
|
||||
ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
|
||||
if (VIEW(item))
|
||||
if (!elm_layout_theme_set
|
||||
(VIEW(item), "multibuttonentry", "btn", elm_widget_style_get(obj)))
|
||||
if (!elm_widget_element_update(obj, VIEW(item), PART_NAME_BUTTON))
|
||||
CRI("Failed to set layout!");
|
||||
}
|
||||
|
||||
elm_widget_theme_object_set
|
||||
(obj, sd->label, "multibuttonentry", "label",
|
||||
elm_widget_style_get(obj));
|
||||
elm_widget_theme_object_set
|
||||
(obj, sd->end, "multibuttonentry", "closedbutton",
|
||||
elm_widget_style_get(obj));
|
||||
elm_widget_theme_object_set
|
||||
(obj,sd->guide_text, "multibuttonentry", "guidetext",
|
||||
elm_widget_style_get(obj));
|
||||
elm_widget_element_update(obj, sd->label, PART_NAME_LABEL);
|
||||
elm_widget_element_update(obj, sd->end, PART_NAME_CLOSED_BUTTON);
|
||||
elm_widget_element_update(obj, sd->guide_text, PART_NAME_GUIDE_TEXT);
|
||||
|
||||
elm_layout_sizing_eval(obj);
|
||||
|
||||
|
@ -764,8 +762,7 @@ _item_new(Efl_Ui_Multibuttonentry_Data *sd,
|
|||
|
||||
efl_access_type_set(VIEW(item), EFL_ACCESS_TYPE_DISABLED);
|
||||
|
||||
if (!elm_layout_theme_set
|
||||
(VIEW(item), "multibuttonentry", "btn", elm_widget_style_get(obj)))
|
||||
if (!elm_widget_element_update(obj, VIEW(item), PART_NAME_BUTTON))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
elm_object_part_text_set(VIEW(item), "elm.btn.text", str);
|
||||
|
@ -1246,8 +1243,7 @@ _guide_text_set(Evas_Object *obj,
|
|||
|
||||
if (sd->guide_text)
|
||||
{
|
||||
elm_widget_theme_object_set(obj, sd->guide_text, "multibuttonentry",
|
||||
"guidetext", elm_widget_style_get(obj));
|
||||
elm_widget_element_update(obj, sd->guide_text, PART_NAME_GUIDE_TEXT);
|
||||
evas_object_size_hint_weight_set
|
||||
(sd->guide_text, 0.0, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set
|
||||
|
@ -1447,9 +1443,7 @@ _view_init(Evas_Object *obj, Efl_Ui_Multibuttonentry_Data *sd)
|
|||
|
||||
sd->label = edje_object_add(evas_object_evas_get(obj));
|
||||
if (!sd->label) return;
|
||||
elm_widget_theme_object_set
|
||||
(obj, sd->label, "multibuttonentry", "label",
|
||||
elm_widget_style_get(obj));
|
||||
elm_widget_element_update(obj, sd->label, PART_NAME_LABEL);
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
|
@ -1477,9 +1471,7 @@ _view_init(Evas_Object *obj, Efl_Ui_Multibuttonentry_Data *sd)
|
|||
|
||||
sd->end = edje_object_add(evas_object_evas_get(obj));
|
||||
if (!sd->end) return;
|
||||
elm_widget_theme_object_set
|
||||
(obj, sd->end, "multibuttonentry", "closedbutton",
|
||||
elm_widget_style_get(obj));
|
||||
elm_widget_element_update(obj, sd->end, PART_NAME_CLOSED_BUTTON);
|
||||
|
||||
edje_object_size_min_calc(sd->end, &button_min_width, &button_min_height);
|
||||
elm_coords_finger_size_adjust(1, &button_min_width, 1, &button_min_height);
|
||||
|
|
|
@ -198,15 +198,77 @@ _efl_ui_progressbar_elm_widget_widget_sub_object_add(Eo *obj, Efl_Ui_Progressbar
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
//TODO: efl_ui_slider also use this.
|
||||
static const char *
|
||||
_theme_group_modify_pos_get(const char *cur_group, const char *search, size_t len, Eina_Bool is_legacy)
|
||||
{
|
||||
const char *pos = NULL;
|
||||
const char *temp_str = NULL;
|
||||
|
||||
if (is_legacy)
|
||||
return cur_group;
|
||||
|
||||
temp_str = cur_group + len - strlen(search);
|
||||
if (temp_str >= cur_group)
|
||||
{
|
||||
if (!strcmp(temp_str, search))
|
||||
pos = temp_str;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
static char *
|
||||
_efl_ui_progressbar_theme_group_get(Evas_Object *obj, Efl_Ui_Progressbar_Data *sd)
|
||||
{
|
||||
const char *pos = NULL;
|
||||
const char *cur_group = elm_widget_theme_element_get(obj);
|
||||
Eina_Strbuf *new_group = eina_strbuf_new();
|
||||
Eina_Bool is_legacy = elm_widget_is_legacy(obj);
|
||||
size_t len = 0;
|
||||
|
||||
if (cur_group)
|
||||
{
|
||||
len = strlen(cur_group);
|
||||
pos = _theme_group_modify_pos_get(cur_group, "horizontal", len, is_legacy);
|
||||
if (!pos)
|
||||
pos = _theme_group_modify_pos_get(cur_group, "vertical", len, is_legacy);
|
||||
|
||||
|
||||
// TODO: change separator when it is decided.
|
||||
// can skip when prev_group == cur_group
|
||||
if (!pos)
|
||||
{
|
||||
eina_strbuf_append(new_group, cur_group);
|
||||
eina_strbuf_append(new_group, "/");
|
||||
}
|
||||
else
|
||||
{
|
||||
eina_strbuf_append_length(new_group, cur_group, pos - cur_group);
|
||||
}
|
||||
}
|
||||
|
||||
if (_is_horizontal(sd->dir))
|
||||
eina_strbuf_append(new_group, "horizontal");
|
||||
else
|
||||
eina_strbuf_append(new_group, "vertical");
|
||||
|
||||
return eina_strbuf_release(new_group);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Ui_Theme_Apply
|
||||
_efl_ui_progressbar_elm_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *sd)
|
||||
{
|
||||
Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
|
||||
char *group;
|
||||
|
||||
if (_is_horizontal(sd->dir))
|
||||
elm_widget_theme_element_set(obj, "horizontal");
|
||||
else elm_widget_theme_element_set(obj, "vertical");
|
||||
group = _efl_ui_progressbar_theme_group_get(obj, sd);
|
||||
if (group)
|
||||
{
|
||||
elm_widget_theme_element_set(obj, group);
|
||||
free(group);
|
||||
}
|
||||
|
||||
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
||||
if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
|
||||
|
|
|
@ -39,6 +39,8 @@ static const char SIG_CHANGED[] = "changed";
|
|||
static const char SIG_DELAY_CHANGED[] = "delay,changed";
|
||||
static const char SIG_DRAG_START[] = "slider,drag,start";
|
||||
static const char SIG_DRAG_STOP[] = "slider,drag,stop";
|
||||
|
||||
static const char PART_NAME_POPUP[] = "popup";
|
||||
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
||||
{SIG_CHANGED, ""},
|
||||
{SIG_DELAY_CHANGED, ""},
|
||||
|
@ -647,6 +649,32 @@ _track2_resize_cb(void *data,
|
|||
evas_object_resize(sd->popup2, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
_popup_update(Evas_Object *obj, Efl_Ui_Slider_Data *sd, Evas_Object *popup)
|
||||
{
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
if (_is_horizontal(sd->dir))
|
||||
efl_ui_widget_theme_object_set(obj, popup, "slider", "horizontal/popup", elm_widget_style_get(obj));
|
||||
else
|
||||
efl_ui_widget_theme_object_set(obj, popup, "slider", "vertical/popup", elm_widget_style_get(obj));
|
||||
}
|
||||
else
|
||||
elm_widget_element_update(obj, popup, PART_NAME_POPUP);
|
||||
edje_object_scale_set(popup, efl_gfx_scale_get(obj) *
|
||||
elm_config_scale_get());
|
||||
|
||||
if (!_is_inverted(sd->dir))
|
||||
edje_object_signal_emit(popup, "elm,state,inverted,off", "elm");
|
||||
else
|
||||
edje_object_signal_emit(popup, "elm,state,inverted,on", "elm");
|
||||
|
||||
if (sd->indicator_show)
|
||||
edje_object_signal_emit(popup, "elm,state,val,show", "elm");
|
||||
else
|
||||
edje_object_signal_emit(popup, "elm,state,val,hide", "elm");
|
||||
}
|
||||
|
||||
static void
|
||||
_popup_add(Efl_Ui_Slider_Data *sd, Eo *obj, Evas_Object **popup,
|
||||
Evas_Object **track, Eina_Bool is_range)
|
||||
|
@ -662,17 +690,13 @@ _popup_add(Efl_Ui_Slider_Data *sd, Eo *obj, Evas_Object **popup,
|
|||
// XXX popup needs to adapt to theme etc.
|
||||
*popup = edje_object_add(evas_object_evas_get(obj));
|
||||
evas_object_smart_member_add(*popup, obj);
|
||||
if (_is_horizontal(sd->dir))
|
||||
efl_ui_widget_theme_object_set(obj, *popup, "slider", "horizontal/popup", elm_widget_style_get(obj));
|
||||
else
|
||||
efl_ui_widget_theme_object_set(obj, *popup, "slider", "vertical/popup", elm_widget_style_get(obj));
|
||||
edje_object_scale_set(*popup, efl_gfx_scale_get(obj) *
|
||||
elm_config_scale_get());
|
||||
edje_object_signal_callback_add(*popup, "popup,hide,done", "elm", // XXX: for compat
|
||||
_popup_hide_done, obj);
|
||||
edje_object_signal_callback_add(*popup, "elm,popup,hide,done", "elm",
|
||||
_popup_hide_done, obj);
|
||||
|
||||
_popup_update(obj, sd, *popup);
|
||||
|
||||
/* create a rectangle to track position+size of the dragable */
|
||||
*track = evas_object_rectangle_add(evas_object_evas_get(obj));
|
||||
evas_object_color_set(*track, 0, 0, 0, 0);
|
||||
|
@ -695,64 +719,82 @@ _popup_add(Efl_Ui_Slider_Data *sd, Eo *obj, Evas_Object **popup,
|
|||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
_theme_group_modify_pos_get(const char *cur_group, const char *search, size_t len, Eina_Bool is_legacy)
|
||||
{
|
||||
const char *pos = NULL;
|
||||
const char *temp_str = NULL;
|
||||
|
||||
if (is_legacy)
|
||||
return cur_group;
|
||||
|
||||
temp_str = cur_group + len - strlen(search);
|
||||
if (temp_str >= cur_group)
|
||||
{
|
||||
if (!strcmp(temp_str, search))
|
||||
pos = temp_str;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
static char *
|
||||
_efl_ui_slider_theme_group_get(Evas_Object *obj, Efl_Ui_Slider_Data *sd)
|
||||
{
|
||||
const char *pos = NULL;
|
||||
const char *cur_group = elm_widget_theme_element_get(obj);
|
||||
Eina_Strbuf *new_group = eina_strbuf_new();
|
||||
Eina_Bool is_legacy = elm_widget_is_legacy(obj);
|
||||
size_t len = 0;
|
||||
|
||||
if (cur_group)
|
||||
{
|
||||
len = strlen(cur_group);
|
||||
pos = _theme_group_modify_pos_get(cur_group, "horizontal", len, is_legacy);
|
||||
if (!pos)
|
||||
pos = _theme_group_modify_pos_get(cur_group, "vertical", len, is_legacy);
|
||||
|
||||
|
||||
// TODO: change separator when it is decided.
|
||||
// can skip when prev_group == cur_group
|
||||
if (!pos)
|
||||
{
|
||||
eina_strbuf_append(new_group, cur_group);
|
||||
eina_strbuf_append(new_group, "/");
|
||||
}
|
||||
else
|
||||
{
|
||||
eina_strbuf_append_length(new_group, cur_group, pos - cur_group);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_legacy && sd->intvl_enable)
|
||||
eina_strbuf_append(new_group, "range/");
|
||||
if (_is_horizontal(sd->dir))
|
||||
eina_strbuf_append(new_group, "horizontal");
|
||||
else
|
||||
eina_strbuf_append(new_group, "vertical");
|
||||
|
||||
return eina_strbuf_release(new_group);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Ui_Theme_Apply
|
||||
_efl_ui_slider_elm_widget_theme_apply(Eo *obj, Efl_Ui_Slider_Data *sd)
|
||||
{
|
||||
Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
|
||||
char *group;
|
||||
|
||||
if (_is_horizontal(sd->dir))
|
||||
group = _efl_ui_slider_theme_group_get(obj, sd);
|
||||
if (group)
|
||||
{
|
||||
if (!sd->intvl_enable)
|
||||
elm_widget_theme_element_set(obj, "horizontal");
|
||||
else
|
||||
elm_widget_theme_element_set(obj, "range/horizontal");
|
||||
if (sd->popup)
|
||||
efl_ui_widget_theme_object_set(obj, sd->popup,
|
||||
"slider", "horizontal/popup",
|
||||
elm_widget_style_get(obj));
|
||||
if (sd->popup2)
|
||||
efl_ui_widget_theme_object_set(obj, sd->popup2,
|
||||
"slider", "horizontal/popup",
|
||||
elm_widget_style_get(obj));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sd->intvl_enable)
|
||||
elm_widget_theme_element_set(obj, "vertical");
|
||||
else
|
||||
elm_widget_theme_element_set(obj, "range/vertical");
|
||||
|
||||
if (sd->popup)
|
||||
efl_ui_widget_theme_object_set(obj, sd->popup,
|
||||
"slider", "vertical/popup",
|
||||
elm_widget_style_get(obj));
|
||||
if (sd->popup2)
|
||||
efl_ui_widget_theme_object_set(obj, sd->popup2,
|
||||
"slider", "vertical/popup",
|
||||
elm_widget_style_get(obj));
|
||||
elm_widget_theme_element_set(obj, group);
|
||||
free(group);
|
||||
}
|
||||
|
||||
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
||||
if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
|
||||
|
||||
if (sd->popup)
|
||||
{
|
||||
edje_object_scale_set(sd->popup, efl_gfx_scale_get(obj) *
|
||||
elm_config_scale_get());
|
||||
if (sd->intvl_enable && sd->popup2)
|
||||
edje_object_scale_set(sd->popup2, efl_gfx_scale_get(obj) *
|
||||
elm_config_scale_get());
|
||||
else if (sd->intvl_enable && !sd->popup2)
|
||||
_popup_add(sd, obj, &sd->popup2, &sd->track2, EINA_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
_popup_add(sd, obj, &sd->popup, &sd->track, EINA_FALSE);
|
||||
if (sd->intvl_enable && !sd->popup2)
|
||||
_popup_add(sd, obj, &sd->popup2, &sd->track2, EINA_TRUE);
|
||||
}
|
||||
|
||||
if (_is_horizontal(sd->dir))
|
||||
evas_object_size_hint_min_set
|
||||
(sd->spacer, (double)sd->size * efl_gfx_scale_get(obj) *
|
||||
|
@ -768,27 +810,27 @@ _efl_ui_slider_elm_widget_theme_apply(Eo *obj, Efl_Ui_Slider_Data *sd)
|
|||
elm_layout_signal_emit(obj, "elm,slider,range,disable", "elm");
|
||||
|
||||
if (_is_inverted(sd->dir))
|
||||
{
|
||||
elm_layout_signal_emit(obj, "elm,state,inverted,on", "elm");
|
||||
if (sd->popup)
|
||||
edje_object_signal_emit(sd->popup, "elm,state,inverted,on", "elm");
|
||||
if (sd->popup2)
|
||||
edje_object_signal_emit(sd->popup2, "elm,state,inverted,on", "elm");
|
||||
}
|
||||
elm_layout_signal_emit(obj, "elm,state,inverted,on", "elm");
|
||||
else
|
||||
{
|
||||
elm_layout_signal_emit(obj, "elm,state,inverted,off", "elm");
|
||||
if (sd->popup)
|
||||
edje_object_signal_emit(sd->popup, "elm,state,inverted,off", "elm");
|
||||
}
|
||||
elm_layout_signal_emit(obj, "elm,state,inverted,off", "elm");
|
||||
|
||||
if (sd->indicator_show)
|
||||
elm_layout_signal_emit(obj, "elm,state,val,show", "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, "elm,state,val,hide", "elm");
|
||||
|
||||
|
||||
if (!sd->popup)
|
||||
_popup_add(sd, obj, &sd->popup, &sd->track, sd->intvl_enable);
|
||||
else
|
||||
_popup_update(obj, sd, sd->popup);
|
||||
|
||||
if (sd->intvl_enable)
|
||||
{
|
||||
elm_layout_signal_emit(obj, "elm,state,val,show", "elm");
|
||||
if (sd->popup)
|
||||
edje_object_signal_emit(sd->popup, "elm,state,val,show", "elm");
|
||||
if (sd->popup2)
|
||||
edje_object_signal_emit(sd->popup2, "elm,state,val,show", "elm");
|
||||
if (!sd->popup2)
|
||||
_popup_add(sd, obj, &sd->popup2, &sd->track2, EINA_TRUE);
|
||||
else
|
||||
_popup_update(obj, sd, sd->popup2);
|
||||
}
|
||||
|
||||
_min_max_set(obj);
|
||||
|
|
|
@ -107,6 +107,7 @@ _efl_ui_slider_interval_efl_object_finalize(Eo *obj, void *sd EINA_UNUSED)
|
|||
|
||||
pd->intvl_enable = EINA_TRUE;
|
||||
|
||||
elm_widget_theme_klass_set(obj, "slider_interval");
|
||||
efl_ui_widget_theme_apply(obj);
|
||||
|
||||
elm_layout_signal_emit(obj, "elm,slider,range,enable", "elm");
|
||||
|
|
|
@ -256,7 +256,15 @@ struct _Mod_Api
|
|||
void (*obj_longpress)(Evas_Object *obj);
|
||||
};
|
||||
|
||||
static void _create_selection_handlers(Evas_Object *obj, Efl_Ui_Text_Data *sd, const char *file);
|
||||
static const char PART_NAME_SCROLLER[] = "scroller";
|
||||
static const char PART_NAME_HANDLER_START[] = "handler/start";
|
||||
static const char PART_NAME_HANDLER_END[] = "handler/end";
|
||||
static const char PART_NAME_MAGNIFIER[] = "magnifier";
|
||||
static const char PART_NAME_CURSOR[] = "cursor";
|
||||
static const char PART_NAME_SELECTION[] = "selection";
|
||||
static const char PART_NAME_ANCHOR[] = "anchor";
|
||||
|
||||
static void _create_selection_handlers(Evas_Object *obj, Efl_Ui_Text_Data *sd);
|
||||
static void _magnifier_move(void *data);
|
||||
static void _update_decorations(Eo *obj);
|
||||
static void _create_text_cursors(Eo *obj, Efl_Ui_Text_Data *sd);
|
||||
|
@ -270,7 +278,7 @@ static void _efl_ui_text_anchor_hover_parent_set(Eo *obj, Efl_Ui_Text_Data *sd,
|
|||
static const char* _efl_ui_text_selection_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd);
|
||||
static void _edje_signal_emit(Efl_Ui_Text_Data *obj, const char *sig, const char *src);
|
||||
static void _decoration_defer_all(Eo *obj);
|
||||
static inline Eo * _decoration_create(Efl_Ui_Text_Data *sd, const char *file, const char *source, Eina_Bool above);
|
||||
static inline Eo * _decoration_create(Eo *obj, Efl_Ui_Text_Data *sd, const char *source, Eina_Bool above);
|
||||
static void _decoration_defer(Eo *obj);
|
||||
static void _anchors_clear_all(Evas_Object *o EINA_UNUSED, Efl_Ui_Text_Data *sd);
|
||||
static void _unused_item_objs_free(Efl_Ui_Text_Data *sd);
|
||||
|
@ -573,11 +581,7 @@ _update_selection_handler(Eo *obj)
|
|||
efl_ui_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end);
|
||||
|
||||
if (!sd->start_handler)
|
||||
{
|
||||
const char *file;
|
||||
efl_file_get(sd->entry_edje, &file, NULL);
|
||||
_create_selection_handlers(obj, sd, file);
|
||||
}
|
||||
_create_selection_handlers(obj, sd);
|
||||
|
||||
rect = _viewport_region_get(obj);
|
||||
|
||||
|
@ -896,7 +900,6 @@ EOLIAN static Efl_Ui_Theme_Apply
|
|||
_efl_ui_text_elm_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd)
|
||||
{
|
||||
const char *str;
|
||||
const char *style = elm_widget_style_get(obj);
|
||||
Efl_Ui_Theme_Apply theme_apply;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
||||
|
@ -917,8 +920,8 @@ _efl_ui_text_elm_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd)
|
|||
|
||||
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
||||
|
||||
elm_widget_theme_object_set
|
||||
(obj, sd->entry_edje, "text", _efl_ui_text_theme_group_get(obj), style);
|
||||
elm_widget_element_update(obj, sd->entry_edje,
|
||||
_efl_ui_text_theme_group_get(obj));
|
||||
|
||||
if (elm_widget_disabled_get(obj))
|
||||
edje_object_signal_emit(sd->entry_edje, "elm,state,disabled", "elm");
|
||||
|
@ -964,16 +967,10 @@ _efl_ui_text_elm_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd)
|
|||
|
||||
if (sd->scroll)
|
||||
{
|
||||
Efl_Ui_Theme_Apply ok = EFL_UI_THEME_APPLY_FAILED;
|
||||
|
||||
elm_interface_scrollable_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
||||
|
||||
if (sd->single_line)
|
||||
ok = elm_widget_theme_object_set
|
||||
(obj, sd->scr_edje, "scroller", "entry_single", style);
|
||||
if (!ok)
|
||||
elm_widget_theme_object_set
|
||||
(obj, sd->scr_edje, "scroller", "entry", style);
|
||||
elm_widget_element_update(obj, sd->scr_edje, PART_NAME_SCROLLER);
|
||||
|
||||
_efl_ui_text_background_switch(sd->entry_edje, sd->scr_edje);
|
||||
|
||||
|
@ -993,10 +990,8 @@ _efl_ui_text_elm_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd)
|
|||
|
||||
if (sd->start_handler)
|
||||
{
|
||||
elm_widget_theme_object_set(obj, sd->start_handler,
|
||||
"text", "handler/start", style);
|
||||
elm_widget_theme_object_set(obj, sd->end_handler,
|
||||
"text", "handler/end", style);
|
||||
elm_widget_element_update(obj, sd->start_handler, PART_NAME_HANDLER_START);
|
||||
elm_widget_element_update(obj, sd->end_handler, PART_NAME_HANDLER_END);
|
||||
}
|
||||
|
||||
sd->changed = EINA_TRUE;
|
||||
|
@ -1740,7 +1735,7 @@ _magnifier_create(void *data)
|
|||
|
||||
//Bg
|
||||
sd->mgf_bg = edje_object_add(e);
|
||||
elm_widget_theme_object_set(data, sd->mgf_bg, "text", "magnifier", "default");
|
||||
elm_widget_element_update(data, sd->mgf_bg, PART_NAME_MAGNIFIER);
|
||||
evas_object_show(sd->mgf_bg);
|
||||
|
||||
//Proxy
|
||||
|
@ -3014,7 +3009,12 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv)
|
|||
_dnd_pos_cb, NULL,
|
||||
_dnd_drop_cb, NULL);
|
||||
|
||||
if (!elm_layout_theme_set(obj, "text", "base", elm_widget_style_get(obj)))
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "text");
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
_efl_ui_text_theme_group_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
edje_object_part_swallow(priv->entry_edje, "elm.text", text_obj);
|
||||
|
@ -3171,12 +3171,11 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv)
|
|||
}
|
||||
|
||||
static void
|
||||
_create_selection_handlers(Evas_Object *obj, Efl_Ui_Text_Data *sd,
|
||||
const char *file)
|
||||
_create_selection_handlers(Evas_Object *obj, Efl_Ui_Text_Data *sd)
|
||||
{
|
||||
Evas_Object *handle;
|
||||
|
||||
handle = _decoration_create(sd, file, "text/handler/start", EINA_TRUE);
|
||||
handle = _decoration_create(obj, sd, PART_NAME_HANDLER_START, EINA_TRUE);
|
||||
evas_object_pass_events_set(handle, EINA_FALSE);
|
||||
sd->start_handler = handle;
|
||||
evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
|
@ -3187,7 +3186,7 @@ _create_selection_handlers(Evas_Object *obj, Efl_Ui_Text_Data *sd,
|
|||
_start_handler_mouse_up_cb, obj);
|
||||
evas_object_show(handle);
|
||||
|
||||
handle = _decoration_create(sd, file, "text/handler/end", EINA_TRUE);
|
||||
handle = _decoration_create(obj, sd, PART_NAME_HANDLER_END, EINA_TRUE);
|
||||
evas_object_pass_events_set(handle, EINA_FALSE);
|
||||
sd->end_handler = handle;
|
||||
evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
|
@ -3740,9 +3739,7 @@ _efl_ui_text_scrollable_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool scroll)
|
|||
{
|
||||
sd->scr_edje = edje_object_add(evas_object_evas_get(obj));
|
||||
|
||||
elm_widget_theme_object_set
|
||||
(obj, sd->scr_edje, "scroller", "entry",
|
||||
elm_widget_style_get(obj));
|
||||
elm_widget_element_update(obj, sd->scr_edje, PART_NAME_SCROLLER);
|
||||
|
||||
evas_object_size_hint_weight_set
|
||||
(sd->scr_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
|
@ -4626,12 +4623,12 @@ _edje_signal_emit(Efl_Ui_Text_Data *sd, const char *sig, const char *src)
|
|||
}
|
||||
|
||||
static inline Eo *
|
||||
_decoration_create(Efl_Ui_Text_Data *sd, const char *file,
|
||||
const char *source, Eina_Bool above)
|
||||
_decoration_create(Eo *obj, Efl_Ui_Text_Data *sd,
|
||||
const char *group_name, Eina_Bool above)
|
||||
{
|
||||
Eo *ret = efl_add(EFL_CANVAS_LAYOUT_CLASS, sd->entry_edje);
|
||||
Eo *text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text");
|
||||
edje_object_file_set(ret, file, source);
|
||||
elm_widget_element_update(obj, ret, group_name);
|
||||
evas_object_smart_member_add(ret, sd->entry_edje);
|
||||
if (above)
|
||||
{
|
||||
|
@ -4653,10 +4650,8 @@ _decoration_create(Efl_Ui_Text_Data *sd, const char *file,
|
|||
static void
|
||||
_create_text_cursors(Eo *obj, Efl_Ui_Text_Data *sd)
|
||||
{
|
||||
const char *file;
|
||||
efl_file_get(sd->entry_edje, &file, NULL);
|
||||
sd->cursor = _decoration_create(sd, file, "elm/entry/cursor/default", EINA_TRUE);
|
||||
sd->cursor_bidi = _decoration_create(sd, file, "elm/entry/cursor/default", EINA_TRUE);
|
||||
sd->cursor = _decoration_create(obj, sd, PART_NAME_CURSOR, EINA_TRUE);
|
||||
sd->cursor_bidi = _decoration_create(obj, sd, PART_NAME_CURSOR, EINA_TRUE);
|
||||
|
||||
if (!efl_ui_text_interactive_editable_get(obj))
|
||||
{
|
||||
|
@ -4745,7 +4740,6 @@ _update_text_selection(Eo *obj, Eo *text_obj)
|
|||
Eina_Iterator *range;
|
||||
Efl_Ui_Text_Rectangle *rect;
|
||||
Eina_Rectangle *r;
|
||||
const char *file;
|
||||
|
||||
EFL_UI_TEXT_DATA_GET(obj, sd);
|
||||
|
||||
|
@ -4754,8 +4748,6 @@ _update_text_selection(Eo *obj, Eo *text_obj)
|
|||
|
||||
_decoration_calc_offset(sd, &x, &y);
|
||||
|
||||
efl_file_get(sd->entry_edje, &file, NULL);
|
||||
|
||||
efl_ui_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end);
|
||||
|
||||
range = efl_canvas_text_range_simple_geometry_get(text_obj,
|
||||
|
@ -4770,7 +4762,7 @@ _update_text_selection(Eo *obj, Eo *text_obj)
|
|||
rect = calloc(1, sizeof(Efl_Ui_Text_Rectangle));
|
||||
sd->sel = eina_list_append(sd->sel, rect);
|
||||
|
||||
rect->obj_bg = _decoration_create(sd, file, "elm/entry/selection/default", EINA_FALSE);
|
||||
rect->obj_bg = _decoration_create(obj, sd, PART_NAME_SELECTION, EINA_FALSE);
|
||||
evas_object_show(rect->obj_bg);
|
||||
}
|
||||
else
|
||||
|
@ -5084,13 +5076,10 @@ _anchors_update(Eo *o, Efl_Ui_Text_Data *sd)
|
|||
Evas_Object *smart, *clip;
|
||||
Efl_Ui_Text_Rectangle *rect;
|
||||
Anchor *an;
|
||||
const char *file;
|
||||
Eo *sw;
|
||||
|
||||
sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text");
|
||||
|
||||
efl_file_get(sd->entry_edje, &file, NULL);
|
||||
|
||||
if (!sd->deferred_decoration_anchor) return;
|
||||
sd->deferred_decoration_anchor = EINA_FALSE;
|
||||
|
||||
|
@ -5198,7 +5187,7 @@ _anchors_update(Eo *o, Efl_Ui_Text_Data *sd)
|
|||
rect = calloc(1, sizeof(Efl_Ui_Text_Rectangle));
|
||||
an->sel = eina_list_append(an->sel, rect);
|
||||
|
||||
ob = _decoration_create(sd, file, "elm/entry/anchor/default", EINA_TRUE);
|
||||
ob = _decoration_create(o, sd, PART_NAME_ANCHOR, EINA_TRUE);
|
||||
rect->obj_fg = ob;
|
||||
|
||||
/* Create hit rectangle to catch events */
|
||||
|
|
|
@ -4570,6 +4570,7 @@ _efl_ui_win_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Win_Data *_pd EINA_UNUSED
|
|||
{
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
|
||||
elm_widget_theme_klass_set(obj, "win");
|
||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||
|
||||
elm_widget_highlight_ignore_set(obj, EINA_TRUE);
|
||||
|
|
Loading…
Reference in New Issue