forked from enlightenment/efl
hoversel: Enabled default mirroring in hoversel.
Removed default disable automatic mirroring of hoversel. Summary: Removed below API call for hoversel, hover, box and button object elm_widget_mirrored_automatic_set(obj, EINA_FALSE); Modified theme of "elm/button/base/hoversel_vertical_entry/default" to remove console errors due to theme, and modified text.align to -1 as 'x' value to set auto align for Arabic text. Modified example hoversel_example_01.c to illustrate mirroring functionality @fix Reviewers: Hermet, seoz, tasn Subscribers: sachin.dev Differential Revision: https://phab.enlightenment.org/D1910
This commit is contained in:
parent
3df05663bd
commit
b2b4f805bb
|
@ -837,7 +837,7 @@ group { name: "elm/button/base/hoversel_vertical/default";
|
|||
}
|
||||
desc { "visible";
|
||||
inherit: "default";
|
||||
rel1.offset: 2 5;
|
||||
rel1.offset: 5 5;
|
||||
text.min: 1 1;
|
||||
text.ellipsis: -1;
|
||||
visible: 1;
|
||||
|
@ -852,7 +852,7 @@ group { name: "elm/button/base/hoversel_vertical/default";
|
|||
}
|
||||
desc { "disabled_visible";
|
||||
inherit: "default";
|
||||
rel1.offset: 2 5;
|
||||
rel1.offset: 5 5;
|
||||
color_class: "hoversel_text_disabled";
|
||||
text.min: 1 1;
|
||||
text.ellipsis: -1;
|
||||
|
@ -1085,21 +1085,27 @@ group { name: "elm/button/base/hoversel_vertical_entry/default";
|
|||
visible: 0;
|
||||
}
|
||||
}
|
||||
spacer { "text_container";
|
||||
desc { "default";
|
||||
rel1.relative: 1.0 0.0;
|
||||
rel1.to_x: "elm.swallow.content";
|
||||
rel1.to_y: "base";
|
||||
rel2.to: "base";
|
||||
}
|
||||
}
|
||||
text { "elm.text"; nomouse;
|
||||
effect: SHADOW BOTTOM;
|
||||
scale: 1;
|
||||
clip_to: "click_clip";
|
||||
desc { "default";
|
||||
rel1.offset: 0 5;
|
||||
rel1.relative: 1.0 0.0;
|
||||
rel1.to_x: "elm.swallow.content";
|
||||
rel1.to_y: "base";
|
||||
rel2.offset: -8 -8;
|
||||
rel2.to: "base";
|
||||
rel1.to: "text_container";
|
||||
rel2.to: "text_container";
|
||||
color_class: "hoversel_text";
|
||||
color3: 255 255 255 255;
|
||||
text { font: FN; size: 10;
|
||||
align: 0.0 0.5;
|
||||
align: -1 0.5;
|
||||
min: 0 0;
|
||||
text_class: "button";
|
||||
}
|
||||
|
@ -1148,7 +1154,7 @@ group { name: "elm/button/base/hoversel_vertical_entry/default";
|
|||
color3: 255 255 255 255;
|
||||
text { font: FN; size: 10;
|
||||
text_source: "elm.text";
|
||||
align: 0.0 0.5;
|
||||
align: -1 0.5;
|
||||
text_class: "hoversel_item";
|
||||
}
|
||||
visible: 0;
|
||||
|
|
|
@ -14,6 +14,26 @@ _clear_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_hoversel_clear((Evas_Object *)data);
|
||||
}
|
||||
|
||||
static void
|
||||
_reverse_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
if (!data) return;
|
||||
elm_object_mirrored_set(data, !elm_object_mirrored_get (data));
|
||||
printf("\nMirrored mode is now %s", elm_object_mirrored_get(data) ? "ON" : "OFF" );
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
Eina_Bool is_eng = EINA_TRUE;
|
||||
static void
|
||||
_arabic_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
if (!data) return;
|
||||
is_eng = !is_eng;
|
||||
elm_object_text_set(data, is_eng ?
|
||||
"Enable Arabic for new items" :
|
||||
"Enable English for new items");
|
||||
}
|
||||
|
||||
EAPI_MAIN int
|
||||
elm_main(int argc, char **argv)
|
||||
{
|
||||
|
@ -50,6 +70,20 @@ elm_main(int argc, char **argv)
|
|||
evas_object_move(btn, 10, 50);
|
||||
evas_object_show(btn);
|
||||
|
||||
btn = elm_button_add(win);
|
||||
elm_object_text_set(btn, "Change Mirror Mode");
|
||||
evas_object_smart_callback_add(btn, "clicked", _reverse_btn_clicked_cb, hoversel);
|
||||
evas_object_resize(btn, 180, 30);
|
||||
evas_object_move(btn, 10, 90);
|
||||
evas_object_show(btn);
|
||||
|
||||
btn = elm_button_add(win);
|
||||
elm_object_text_set(btn, "Enable Arabic for new items");
|
||||
evas_object_smart_callback_add(btn, "clicked", _arabic_btn_clicked_cb, btn);
|
||||
evas_object_resize(btn, 180, 30);
|
||||
evas_object_move(btn, 10, 130);
|
||||
evas_object_show(btn);
|
||||
|
||||
evas_object_resize(win, 200, 300);
|
||||
evas_object_show(win);
|
||||
|
||||
|
@ -74,10 +108,13 @@ static void
|
|||
_add_item(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
static int num = 0;
|
||||
char *str = malloc(sizeof(char) * 10);
|
||||
char *str = malloc(sizeof(char) * 11);
|
||||
Elm_Object_Item *hoversel_it;
|
||||
|
||||
snprintf(str, 10, "item %d", ++num);
|
||||
if(is_eng)
|
||||
snprintf(str, 11, "item %d", ++num);
|
||||
else
|
||||
snprintf(str, 11, "بند %d", ++num);
|
||||
|
||||
hoversel_it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL,
|
||||
str);
|
||||
|
|
|
@ -152,7 +152,6 @@ _activate(Evas_Object *obj)
|
|||
|
||||
sd->hover = elm_hover_add(sd->hover_parent);
|
||||
elm_widget_sub_object_add(obj, sd->hover);
|
||||
elm_widget_mirrored_automatic_set(sd->hover, EINA_FALSE);
|
||||
|
||||
if (sd->horizontal)
|
||||
snprintf(buf, sizeof(buf), "hoversel_horizontal/%s",
|
||||
|
@ -169,7 +168,6 @@ _activate(Evas_Object *obj)
|
|||
|
||||
/* hover's content */
|
||||
bx = elm_box_add(sd->hover);
|
||||
elm_widget_mirrored_automatic_set(bx, EINA_FALSE);
|
||||
elm_box_homogeneous_set(bx, EINA_TRUE);
|
||||
elm_box_horizontal_set(bx, sd->horizontal);
|
||||
|
||||
|
@ -184,7 +182,6 @@ _activate(Evas_Object *obj)
|
|||
{
|
||||
ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
|
||||
VIEW(item) = bt = elm_button_add(bx);
|
||||
elm_widget_mirrored_automatic_set(bt, EINA_FALSE);
|
||||
elm_widget_mirrored_set(bt, elm_widget_mirrored_get(obj));
|
||||
elm_object_style_set(bt, buf);
|
||||
elm_object_text_set(bt, item->label);
|
||||
|
@ -290,8 +287,6 @@ _elm_hoversel_evas_object_smart_add(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED)
|
|||
eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
||||
elm_widget_mirrored_automatic_set(obj, EINA_FALSE);
|
||||
|
||||
evas_object_smart_callback_add(obj, "clicked", _on_clicked, obj);
|
||||
|
||||
//What are you doing here?
|
||||
|
|
Loading…
Reference in New Issue