forked from enlightenment/efl
From: thiep ha <thiep.ha@samsung.com>
Subject: Re: [E-devel] [Patch] [elm_entry] New APIs for user style Thank you for your comments. I would like to send you the modified patch. Followings are my modification: - Add my part to ChangeLog, AUTHORS files as Raster's comment. - Add const to the parameter of elm_entry_text_style_user_peek and example for pop and peek to test_entry_style_user as Daniel's comment. SVN revision: 71557
This commit is contained in:
parent
9d8f93b568
commit
06f5dda19b
|
@ -58,3 +58,4 @@ M.V.K. Sumanth <sumanth.m@samsung.com> <mvksumanth@gmail.com>
|
|||
Jérôme Pinot <ngc891@gmail.com>
|
||||
Davide Andreoli (davemds) <dave@gurumeditation.it>
|
||||
Michal Pakula vel Rutka <m.pakula@samsung.com>
|
||||
Thiep Ha <thiep.ha@samsung.com>
|
||||
|
|
|
@ -124,3 +124,8 @@
|
|||
2012-05-30 Mike Blumenkrantz
|
||||
|
||||
* Fix even/odd signals for genlist items
|
||||
|
||||
2012-05-30 Thiep Ha
|
||||
|
||||
* Entry: Add 3 APIs which are elm_entry_text_style_user_push/pop/peek
|
||||
and test functions for these APIs.
|
||||
|
|
|
@ -43,6 +43,7 @@ void test_layout2(void *data, Evas_Object *obj, void *event_info);
|
|||
void test_hover(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_hover2(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_entry(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_entry_style_user(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_entry_scrolled(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_entry3(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_entry4(void *data, Evas_Object *obj, void *event_info);
|
||||
|
@ -484,6 +485,7 @@ add_tests:
|
|||
|
||||
//------------------------------//
|
||||
ADD_TEST(NULL, "Entries", "Entry", test_entry);
|
||||
ADD_TEST(NULL, "Entries", "Entry Style", test_entry_style_user);
|
||||
ADD_TEST(NULL, "Entries", "Entry Scrolled", test_entry_scrolled);
|
||||
ADD_TEST(NULL, "Entries", "Entry 3", test_entry3);
|
||||
ADD_TEST(NULL, "Entries", "Entry 4", test_entry4);
|
||||
|
|
|
@ -702,6 +702,79 @@ my_ent_bt_pas(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED
|
|||
elm_entry_selection_paste(en);
|
||||
}
|
||||
|
||||
static void
|
||||
ent_bt_style_user_peek(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *en = data;
|
||||
const char* cur_style = elm_entry_text_style_user_peek(en);
|
||||
if (cur_style)
|
||||
printf("Current style user: %s\n", cur_style);
|
||||
else
|
||||
printf("Style user stack is empty.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
ent_bt_style_user_pop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *en = data;
|
||||
elm_entry_text_style_user_pop(en);
|
||||
printf("Style user popped\n");
|
||||
}
|
||||
|
||||
void
|
||||
test_entry_style_user(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *win, *bx, *en, *bt, *bt2;
|
||||
|
||||
win = elm_win_util_standard_add("entry-style", "Entry Style");
|
||||
elm_win_autodel_set(win, EINA_TRUE);
|
||||
evas_object_resize(win, 300, 300);
|
||||
|
||||
bx = elm_box_add(win);
|
||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win, bx);
|
||||
evas_object_show(bx);
|
||||
|
||||
|
||||
en = elm_entry_add(win);
|
||||
elm_entry_line_wrap_set(en, ELM_WRAP_MIXED);
|
||||
|
||||
elm_entry_text_style_user_push(en, "DEFAULT='font_size=40 color=#FF0000'");
|
||||
elm_object_text_set(en, "Testing Text");
|
||||
|
||||
evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(bx, en);
|
||||
evas_object_resize(en, 200, 200);
|
||||
evas_object_show(en);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_object_text_set(bt, "Peek");
|
||||
evas_object_smart_callback_add(bt, "clicked", ent_bt_style_user_peek, en);
|
||||
evas_object_size_hint_weight_set(bt, 0.0, 0.0);
|
||||
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_propagate_events_set(bt, 0);
|
||||
elm_object_focus_allow_set(bt, 0);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt2 = elm_button_add(win);
|
||||
evas_object_size_hint_weight_set(bt2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_object_text_set(bt2, "Pop");
|
||||
evas_object_smart_callback_add(bt2, "clicked", ent_bt_style_user_pop, en);
|
||||
evas_object_size_hint_weight_set(bt2, 0.0, 0.0);
|
||||
evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, 0.5);
|
||||
elm_box_pack_end(bx, bt2);
|
||||
evas_object_propagate_events_set(bt2, 0);
|
||||
elm_object_focus_allow_set(bt2, 0);
|
||||
evas_object_show(bt2);
|
||||
|
||||
elm_object_focus_set(en, EINA_TRUE);
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
test_entry3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
|
|
|
@ -2550,6 +2550,35 @@ elm_entry_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_entry_text_style_user_push(Evas_Object *obj, const char *style)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
edje_object_part_text_style_user_push(wd->ent, "elm.text", style);
|
||||
_theme_hook(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_entry_text_style_user_pop(Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
edje_object_part_text_style_user_pop(wd->ent, "elm.text");
|
||||
_theme_hook(obj);
|
||||
}
|
||||
|
||||
EAPI const char*
|
||||
elm_entry_text_style_user_peek(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
return edje_object_part_text_style_user_peek(wd->ent, "elm.text");
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
|
||||
{
|
||||
|
|
|
@ -469,6 +469,36 @@ typedef Edje_Entry_Change_Info Elm_Entry_Change_Info;
|
|||
*/
|
||||
EAPI Evas_Object *elm_entry_add(Evas_Object *parent);
|
||||
|
||||
/**
|
||||
* Push the style to the top of user style stack.
|
||||
* If there is styles in the user style stack, the properties in the top style
|
||||
* of user style stack will replace the properties in current theme.
|
||||
* The input style is specified in format tag='property=value' (i.e. DEFAULT='font=Sans font_size=60'hilight=' + font_weight=Bold').
|
||||
*
|
||||
* @param obj The entry object
|
||||
* @param style The style user to push
|
||||
*/
|
||||
EAPI void elm_entry_text_style_user_push(Evas_Object *obj, const char *style);
|
||||
|
||||
/**
|
||||
* Remove the style in the top of user style stack.
|
||||
*
|
||||
* @param obj The entry object
|
||||
*
|
||||
* @see elm_entry_text_style_user_push()
|
||||
*/
|
||||
EAPI void elm_entry_text_style_user_pop(Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Retrieve the style on the top of user style stack.
|
||||
*
|
||||
* @param obj The entry object
|
||||
* @return style on the top of user style stack if exist, otherwise NULL.
|
||||
*
|
||||
* @see elm_entry_text_style_user_push()
|
||||
*/
|
||||
EAPI const char* elm_entry_text_style_user_peek(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Sets the entry to single line mode.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue