From: hermet Date: Mon, 9 Jan 2012 08:06:43 +0000 (+0000) Subject: elementary/fileselector_button, fileselector_entry - deprecated APIs. X-Git-Tag: REL_F_I9500_20120323_1~17^2~911 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5b49483618079977ebb4bd97c53cbc2a7cbe006;p=framework%2Fuifw%2Felementary.git elementary/fileselector_button, fileselector_entry - deprecated APIs. elm_fileselector_button_icon_set elm_fileselector_button_icon_get elm_fileselector_button_icon_unset elm_fileselector_entry_button_icon_set elm_fileselector_entry_button_icon_get elm_fileselector_entry_button_icon_unset git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@66988 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/doc/widgets/widget_preview_fileselector_button2.c b/doc/widgets/widget_preview_fileselector_button2.c index 2952576..2868d0e 100644 --- a/doc/widgets/widget_preview_fileselector_button2.c +++ b/doc/widgets/widget_preview_fileselector_button2.c @@ -9,7 +9,7 @@ elm_object_text_set(o, "FS Button"); Evas_Object *o2 = elm_icon_add(win); elm_icon_standard_set(o2, "home"); -elm_fileselector_button_icon_set(o, o2); +elm_object_part_content_set(o, "icon", o2); evas_object_show(o2); #include "widget_preview_tmpl_foot.c" diff --git a/doc/widgets/widget_preview_fileselector_button3.c b/doc/widgets/widget_preview_fileselector_button3.c index fad9dd7..beb892a 100644 --- a/doc/widgets/widget_preview_fileselector_button3.c +++ b/doc/widgets/widget_preview_fileselector_button3.c @@ -7,7 +7,7 @@ evas_object_show(o); Evas_Object *o2 = elm_icon_add(win); elm_icon_standard_set(o2, "home"); -elm_fileselector_button_icon_set(o, o2); +elm_object_part_content_set(o, "icon", o2); evas_object_show(o2); #include "widget_preview_tmpl_foot.c" diff --git a/src/bin/test_eio.c b/src/bin/test_eio.c index 3cc9aaa..5030ddc 100644 --- a/src/bin/test_eio.c +++ b/src/bin/test_eio.c @@ -153,7 +153,7 @@ test_eio(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); fs_bt = elm_fileselector_button_add(win); elm_object_text_set(fs_bt, "Select a dir"); - elm_fileselector_button_icon_set(fs_bt, ic); + elm_object_part_content_set(fs_bt, "icon", ic); elm_fileselector_button_inwin_mode_set(fs_bt, EINA_TRUE); elm_fileselector_button_folder_only_set(fs_bt, EINA_TRUE); diff --git a/src/bin/test_fileselector_button.c b/src/bin/test_fileselector_button.c index 24f881b..4948f97 100644 --- a/src/bin/test_fileselector_button.c +++ b/src/bin/test_fileselector_button.c @@ -92,7 +92,7 @@ test_fileselector_button(void *data __UNUSED__, evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); fs_bt = elm_fileselector_button_add(win); elm_object_text_set(fs_bt, "Select a file"); - elm_fileselector_button_icon_set(fs_bt, ic); + elm_object_part_content_set(fs_bt, "icon", ic); elm_box_pack_end(vbox, fs_bt); evas_object_show(fs_bt); diff --git a/src/bin/test_fileselector_entry.c b/src/bin/test_fileselector_entry.c index d340668..6004f13 100644 --- a/src/bin/test_fileselector_entry.c +++ b/src/bin/test_fileselector_entry.c @@ -32,7 +32,7 @@ _folder_only_toggle(void *data, void *event_info __UNUSED__) { Evas_Object *fs_en = data; - Evas_Object *ic = elm_fileselector_entry_button_icon_get(fs_en); + Evas_Object *ic = elm_object_part_content_get(fs_en, "button icon"); Eina_Bool value = elm_fileselector_entry_folder_only_get(fs_en); elm_fileselector_entry_folder_only_set(fs_en, !value); printf("Folder only flag set to: %s\n", value ? "false" : "true"); @@ -97,7 +97,7 @@ test_fileselector_entry(void *data __UNUSED__, evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); fs_en = elm_fileselector_entry_add(win); elm_object_text_set(fs_en, "Select a file"); - elm_fileselector_entry_button_icon_set(fs_en, ic); + elm_object_part_content_set(fs_en, "button icon", ic); evas_object_size_hint_weight_set(fs_en, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(fs_en, EVAS_HINT_FILL, EVAS_HINT_FILL); diff --git a/src/edje_externals/elm_fileselector_button.c b/src/edje_externals/elm_fileselector_button.c index 87e22c7..53aad85 100644 --- a/src/edje_externals/elm_fileselector_button.c +++ b/src/edje_externals/elm_fileselector_button.c @@ -30,7 +30,7 @@ external_fileselector_button_state_set(void *data __UNUSED__, Evas_Object *obj, if (p->label) elm_object_text_set(obj, p->label); - if (p->icon) elm_fileselector_button_icon_set(obj, p->icon); + if (p->icon) elm_object_part_content_set(obj, "icon", p->icon); if (p->fs.path) elm_fileselector_button_path_set(obj, p->fs.path); if (p->fs.is_save_set) elm_fileselector_button_is_save_set(obj, p->fs.is_save); @@ -47,61 +47,61 @@ external_fileselector_button_param_set(void *data __UNUSED__, Evas_Object *obj, { if (!strcmp(param->name, "label")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - elm_object_text_set(obj, param->s); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } } else if (!strcmp(param->name, "icon")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - Evas_Object *icon = external_common_param_icon_get(obj, param); - if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; - elm_fileselector_button_icon_set(obj, icon); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } } else if (!strcmp(param->name, "path")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - elm_fileselector_button_path_set(obj, param->s); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_fileselector_button_path_set(obj, param->s); + return EINA_TRUE; + } } else if (!strcmp(param->name, "save")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - elm_fileselector_button_is_save_set(obj, param->i); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_button_is_save_set(obj, param->i); + return EINA_TRUE; + } } else if (!strcmp(param->name, "folder only")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - elm_fileselector_button_folder_only_set(obj, param->i); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_button_folder_only_set(obj, param->i); + return EINA_TRUE; + } } else if (!strcmp(param->name, "expandable")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - elm_fileselector_button_expandable_set(obj, param->i); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_button_expandable_set(obj, param->i); + return EINA_TRUE; + } } else if (!strcmp(param->name, "inwin mode")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - elm_fileselector_button_inwin_mode_set(obj, param->i); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_button_inwin_mode_set(obj, param->i); + return EINA_TRUE; + } } ERR("unknown parameter '%s' of type '%s'", @@ -115,56 +115,56 @@ external_fileselector_button_param_get(void *data __UNUSED__, const Evas_Object { if (!strcmp(param->name, "label")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - param->s = elm_object_text_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "icon")) { - /* not easy to get icon name back from live object */ - return EINA_FALSE; + /* not easy to get icon name back from live object */ + return EINA_FALSE; } else if (!strcmp(param->name, "path")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - param->s = elm_fileselector_button_path_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_fileselector_button_path_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "save")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - param->i = elm_fileselector_button_is_save_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_button_is_save_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "folder only")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - param->i = elm_fileselector_button_folder_only_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_button_folder_only_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "expandable")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - param->i = elm_fileselector_button_expandable_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_button_expandable_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "inwin mode")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - param->i = elm_fileselector_button_inwin_mode_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_button_inwin_mode_get(obj); + return EINA_TRUE; + } } ERR("unknown parameter '%s' of type '%s'", @@ -188,40 +188,39 @@ external_fileselector_button_params_parse(void *data __UNUSED__, Evas_Object *ob EINA_LIST_FOREACH(params, l, param) { - if (!strcmp(param->name, "path")) - mem->fs.path = eina_stringshare_add(param->s); - else if (!strcmp(param->name, "save")) - { - mem->fs.is_save = !!param->i; - mem->fs.is_save_set = EINA_TRUE; - } - else if (!strcmp(param->name, "folder only")) - { - mem->fs.folder_only = !!param->i; - mem->fs.folder_only_set = EINA_TRUE; - } - else if (!strcmp(param->name, "expandable")) - { - mem->fs.expandable = !!param->i; - mem->fs.expandable_set = EINA_TRUE; - } - else if (!strcmp(param->name, "inwin mode")) - { - mem->fs.inwin_mode = !!param->i; - mem->fs.inwin_mode_set = EINA_TRUE; - } - else if (!strcmp(param->name, "label")) - mem->label = eina_stringshare_add(param->s); + if (!strcmp(param->name, "path")) + mem->fs.path = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "save")) + { + mem->fs.is_save = !!param->i; + mem->fs.is_save_set = EINA_TRUE; + } + else if (!strcmp(param->name, "folder only")) + { + mem->fs.folder_only = !!param->i; + mem->fs.folder_only_set = EINA_TRUE; + } + else if (!strcmp(param->name, "expandable")) + { + mem->fs.expandable = !!param->i; + mem->fs.expandable_set = EINA_TRUE; + } + else if (!strcmp(param->name, "inwin mode")) + { + mem->fs.inwin_mode = !!param->i; + mem->fs.inwin_mode_set = EINA_TRUE; + } + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); } return mem; } -static Evas_Object *external_fileselector_button_content_get(void *data __UNUSED__, - const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +static Evas_Object *external_fileselector_button_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) { - ERR("No content."); - return NULL; + ERR("No content."); + return NULL; } static void diff --git a/src/edje_externals/elm_fileselector_entry.c b/src/edje_externals/elm_fileselector_entry.c index 9e61f9c..11bd1fe 100644 --- a/src/edje_externals/elm_fileselector_entry.c +++ b/src/edje_externals/elm_fileselector_entry.c @@ -30,7 +30,7 @@ external_fileselector_entry_state_set(void *data __UNUSED__, Evas_Object *obj, c if (p->label) elm_object_text_set(obj, p->label); - if (p->icon) elm_fileselector_entry_button_icon_set(obj, p->icon); + if (p->icon) elm_object_part_content_set(obj, "button icon", p->icon); if (p->fs.path) elm_fileselector_entry_selected_set(obj, p->fs.path); if (p->fs.is_save_set) elm_fileselector_entry_is_save_set(obj, p->fs.is_save); @@ -47,61 +47,61 @@ external_fileselector_entry_param_set(void *data __UNUSED__, Evas_Object *obj, c { if (!strcmp(param->name, "label")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - elm_object_text_set(obj, param->s); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } } else if (!strcmp(param->name, "icon")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - Evas_Object *icon = external_common_param_icon_get(obj, param); - if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; - elm_fileselector_entry_button_icon_set(obj, icon); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "button icon", icon); + return EINA_TRUE; + } } else if (!strcmp(param->name, "path")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - elm_fileselector_entry_selected_set(obj, param->s); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_fileselector_entry_selected_set(obj, param->s); + return EINA_TRUE; + } } else if (!strcmp(param->name, "save")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - elm_fileselector_entry_is_save_set(obj, param->i); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_entry_is_save_set(obj, param->i); + return EINA_TRUE; + } } else if (!strcmp(param->name, "folder only")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - elm_fileselector_entry_folder_only_set(obj, param->i); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_entry_folder_only_set(obj, param->i); + return EINA_TRUE; + } } else if (!strcmp(param->name, "expandable")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - elm_fileselector_entry_expandable_set(obj, param->i); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_entry_expandable_set(obj, param->i); + return EINA_TRUE; + } } else if (!strcmp(param->name, "inwin mode")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - elm_fileselector_entry_inwin_mode_set(obj, param->i); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_entry_inwin_mode_set(obj, param->i); + return EINA_TRUE; + } } ERR("unknown parameter '%s' of type '%s'", @@ -115,56 +115,56 @@ external_fileselector_entry_param_get(void *data __UNUSED__, const Evas_Object * { if (!strcmp(param->name, "label")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - param->s = elm_object_text_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "icon")) { - /* not easy to get icon name back from live object */ - return EINA_FALSE; + /* not easy to get icon name back from live object */ + return EINA_FALSE; } else if (!strcmp(param->name, "path")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) - { - param->s = elm_fileselector_entry_selected_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_fileselector_entry_selected_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "save")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - param->i = elm_fileselector_entry_is_save_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_entry_is_save_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "folder only")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - param->i = elm_fileselector_entry_folder_only_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_entry_folder_only_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "expandable")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - param->i = elm_fileselector_entry_expandable_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_entry_expandable_get(obj); + return EINA_TRUE; + } } else if (!strcmp(param->name, "inwin mode")) { - if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - { - param->i = elm_fileselector_entry_inwin_mode_get(obj); - return EINA_TRUE; - } + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_entry_inwin_mode_get(obj); + return EINA_TRUE; + } } ERR("unknown parameter '%s' of type '%s'", @@ -188,43 +188,43 @@ external_fileselector_entry_params_parse(void *data __UNUSED__, Evas_Object *obj EINA_LIST_FOREACH(params, l, param) { - if (!strcmp(param->name, "path")) - mem->fs.path = eina_stringshare_add(param->s); - else if (!strcmp(param->name, "save")) - { - mem->fs.is_save = !!param->i; - mem->fs.is_save_set = EINA_TRUE; - } - else if (!strcmp(param->name, "folder only")) - { - mem->fs.folder_only = !!param->i; - mem->fs.folder_only_set = EINA_TRUE; - } - else if (!strcmp(param->name, "expandable")) - { - mem->fs.expandable = !!param->i; - mem->fs.expandable_set = EINA_TRUE; - } - else if (!strcmp(param->name, "inwin mode")) - { - mem->fs.inwin_mode = !!param->i; - mem->fs.inwin_mode_set = EINA_TRUE; - } - else if (!strcmp(param->name, "label")) - mem->label = eina_stringshare_add(param->s); + if (!strcmp(param->name, "path")) + mem->fs.path = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "save")) + { + mem->fs.is_save = !!param->i; + mem->fs.is_save_set = EINA_TRUE; + } + else if (!strcmp(param->name, "folder only")) + { + mem->fs.folder_only = !!param->i; + mem->fs.folder_only_set = EINA_TRUE; + } + else if (!strcmp(param->name, "expandable")) + { + mem->fs.expandable = !!param->i; + mem->fs.expandable_set = EINA_TRUE; + } + else if (!strcmp(param->name, "inwin mode")) + { + mem->fs.inwin_mode = !!param->i; + mem->fs.inwin_mode_set = EINA_TRUE; + } + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); } return mem; } static Evas_Object *external_fileselector_entry_content_get(void *data __UNUSED__, - const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) { - ERR("No content."); - return NULL; + ERR("No content."); + return NULL; } - static void +static void external_fileselector_entry_params_free(void *params) { Elm_Params_fileselector_entry *mem = params; diff --git a/src/examples/fileselector_button_example.c b/src/examples/fileselector_button_example.c index a76cede..fdc26bd 100644 --- a/src/examples/fileselector_button_example.c +++ b/src/examples/fileselector_button_example.c @@ -118,7 +118,7 @@ elm_main(int argc __UNUSED__, fs_bt = elm_fileselector_button_add(win); elm_fileselector_button_path_set(fs_bt, "/tmp"); elm_object_text_set(fs_bt, "Select a file"); - elm_fileselector_button_icon_set(fs_bt, ic); + elm_object_part_content_set(fs_bt, "icon", ic); elm_box_pack_end(vbox, fs_bt); evas_object_show(fs_bt); diff --git a/src/examples/fileselector_entry_example.c b/src/examples/fileselector_entry_example.c index 2007f5d..51fdc9c 100644 --- a/src/examples/fileselector_entry_example.c +++ b/src/examples/fileselector_entry_example.c @@ -117,7 +117,7 @@ elm_main(int argc __UNUSED__, evas_object_size_hint_align_set(fs_entry, EVAS_HINT_FILL, 0); elm_fileselector_entry_path_set(fs_entry, "/tmp"); elm_object_text_set(fs_entry, "Select a file"); - elm_fileselector_entry_button_icon_set(fs_entry, ic); + elm_object_part_content_set(fs_entry, "button icon", ic); elm_box_pack_end(vbox, fs_entry); evas_object_show(fs_entry); diff --git a/src/lib/elc_fileselector_button.c b/src/lib/elc_fileselector_button.c index 8abf0de..702f115 100644 --- a/src/lib/elc_fileselector_button.c +++ b/src/lib/elc_fileselector_button.c @@ -274,6 +274,33 @@ _elm_fileselector_button_label_get(const Evas_Object *obj, const char *item) return elm_object_text_get(wd->btn); } +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_object_part_content_set(wd->btn, part, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return elm_object_part_content_get(wd->btn, part); +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return elm_object_part_content_unset(wd->btn, part); +} + EAPI Evas_Object * elm_fileselector_button_add(Evas_Object *parent) { @@ -296,6 +323,9 @@ elm_fileselector_button_add(Evas_Object *parent) elm_widget_activate_hook_set(obj, _activate_hook); elm_widget_text_set_hook_set(obj, _elm_fileselector_button_label_set); elm_widget_text_get_hook_set(obj, _elm_fileselector_button_label_get); + 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); wd->self = obj; wd->window_title = eina_stringshare_add(DEFAULT_WINDOW_TITLE); @@ -505,31 +535,18 @@ EAPI void elm_fileselector_button_icon_set(Evas_Object *obj, Evas_Object *icon) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) - { - evas_object_del(icon); - return; - } - elm_object_part_content_set(wd->btn, "icon", icon); + _content_set_hook(obj, NULL, icon); } EAPI Evas_Object * elm_fileselector_button_icon_get(const Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - return elm_object_part_content_get(wd->btn, "icon"); + return _content_get_hook(obj, NULL); } EAPI Evas_Object * elm_fileselector_button_icon_unset(Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - return elm_object_part_content_unset(wd->btn, "icon"); + return _content_unset_hook(obj, NULL); } diff --git a/src/lib/elc_fileselector_button.h b/src/lib/elc_fileselector_button.h index 99442d6..30273c0 100644 --- a/src/lib/elc_fileselector_button.h +++ b/src/lib/elc_fileselector_button.h @@ -33,9 +33,16 @@ * are: * @li "default" - Label of the fileselector_button * + * Default contents parts of the fileselector_button widget that you can use for + * are: + * @li "icon" - Icon of the fileselector_button + * * Supported elm_object common APIs. * @li elm_object_part_text_set * @li elm_object_part_text_get + * @li elm_object_part_content_set + * @li elm_object_part_content_get + * @li elm_object_part_content_unset * @li elm_object_disabled_set * @li elm_object_disabled_get * @@ -57,45 +64,6 @@ EAPI Evas_Object *elm_fileselector_button_add(Evas_Object *parent); /** - * Set the icon on a given file selector button widget - * - * @param obj The file selector button widget - * @param icon The icon object for the button - * - * Once the icon object is set, a previously set one will be - * deleted. If you want to keep the latter, use the - * elm_fileselector_button_icon_unset() function. - * - * @see elm_fileselector_button_icon_get() - */ -EAPI void elm_fileselector_button_icon_set(Evas_Object *obj, Evas_Object *icon); - -/** - * Get the icon set for a given file selector button widget - * - * @param obj The file selector button widget - * @return The icon object currently set on @p obj or @c NULL, if - * none is - * - * @see elm_fileselector_button_icon_set() - */ -EAPI Evas_Object *elm_fileselector_button_icon_get(const Evas_Object *obj); - -/** - * Unset the icon used in a given file selector button widget - * - * @param obj The file selector button widget - * @return The icon object that was being used on @p obj or @c - * NULL, on errors - * - * Unparent and return the icon object which was set for this - * widget. - * - * @see elm_fileselector_button_icon_set() - */ -EAPI Evas_Object *elm_fileselector_button_icon_unset(Evas_Object *obj); - -/** * Set the title for a given file selector button widget's window * * @param obj The file selector button widget diff --git a/src/lib/elc_fileselector_entry.c b/src/lib/elc_fileselector_entry.c index 96769d0..b37c19e 100644 --- a/src/lib/elc_fileselector_entry.c +++ b/src/lib/elc_fileselector_entry.c @@ -233,6 +233,36 @@ _elm_fileselector_entry_button_label_get(const Evas_Object *obj, const char *ite return elm_object_text_get(wd->button); } +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (part && strcmp(part, "button icon")) return; + elm_object_part_content_set(wd->button, NULL, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (part && strcmp(part, "button icon")) return NULL; + return elm_object_part_content_get(wd->button, NULL); +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (part && strcmp(part, "button icon")) return NULL; + return elm_object_part_content_unset(wd->button, NULL); +} + EAPI Evas_Object * elm_fileselector_entry_add(Evas_Object *parent) { @@ -254,6 +284,9 @@ elm_fileselector_entry_add(Evas_Object *parent) elm_widget_theme_hook_set(obj, _theme_hook); elm_widget_text_set_hook_set(obj, _elm_fileselector_entry_button_label_set); elm_widget_text_get_hook_set(obj, _elm_fileselector_entry_button_label_get); + 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); wd->edje = edje_object_add(e); _elm_theme_object_set(obj, wd->edje, "fileselector_entry", "base", "default"); @@ -472,26 +505,17 @@ elm_fileselector_entry_inwin_mode_get(const Evas_Object *obj) EAPI void elm_fileselector_entry_button_icon_set(Evas_Object *obj, Evas_Object *icon) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return; - elm_fileselector_button_icon_set(wd->button, icon); + _content_set_hook(obj, NULL, icon); } EAPI Evas_Object * elm_fileselector_entry_button_icon_get(const Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - return elm_fileselector_button_icon_get(wd->button); + return _content_get_hook(obj, NULL); } EAPI Evas_Object * elm_fileselector_entry_button_icon_unset(Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - return elm_fileselector_button_icon_unset(wd->button); + return _content_unset_hook(obj, NULL); } diff --git a/src/lib/elc_fileselector_entry.h b/src/lib/elc_fileselector_entry.h index 45b07c8..4396ba0 100644 --- a/src/lib/elc_fileselector_entry.h +++ b/src/lib/elc_fileselector_entry.h @@ -45,9 +45,16 @@ * are: * @li "default" - Label of the fileselector_button * + * Default contents parts of the fileselector_entry widget that you can use for + * are: + * @li "button icon" - Button icon of the fileselector_entry + * * Supported elm_object common APIs. * @li elm_object_part_text_set * @li elm_object_part_text_get + * @li elm_object_part_content_set + * @li elm_object_part_content_get + * @li elm_object_part_content_unset * @li elm_object_disabled_set * @li elm_object_disabled_get * @@ -69,46 +76,6 @@ EAPI Evas_Object *elm_fileselector_entry_add(Evas_Object *parent); /** - * Set the icon on a given file selector entry widget's button - * - * @param obj The file selector entry widget - * @param icon The icon object for the entry's button - * - * Once the icon object is set, a previously set one will be - * deleted. If you want to keep the latter, use the - * elm_fileselector_entry_button_icon_unset() function. - * - * @see elm_fileselector_entry_button_icon_get() - */ -EAPI void elm_fileselector_entry_button_icon_set(Evas_Object *obj, Evas_Object *icon); - -/** - * Get the icon set for a given file selector entry widget's button - * - * @param obj The file selector entry widget - * @return The icon object currently set on @p obj widget's button - * or @c NULL, if none is - * - * @see elm_fileselector_entry_button_icon_set() - */ -EAPI Evas_Object *elm_fileselector_entry_button_icon_get(const Evas_Object *obj); - -/** - * Unset the icon used in a given file selector entry widget's - * button - * - * @param obj The file selector entry widget - * @return The icon object that was being used on @p obj widget's - * button or @c NULL, on errors - * - * Unparent and return the icon object which was set for this - * widget's button. - * - * @see elm_fileselector_entry_button_icon_set() - */ -EAPI Evas_Object *elm_fileselector_entry_button_icon_unset(Evas_Object *obj); - -/** * Set the title for a given file selector entry widget's window * * @param obj The file selector entry widget diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h index 427af08..29ef155 100644 --- a/src/lib/elm_deprecated.h +++ b/src/lib/elm_deprecated.h @@ -454,6 +454,48 @@ EINA_DEPRECATED EAPI void elm_fileselector_button_label_set(Evas_Object * EINA_DEPRECATED EAPI const char *elm_fileselector_button_label_get(const Evas_Object *obj); /** + * Set the icon on a given file selector button widget + * + * @param obj The file selector button widget + * @param icon The icon object for the button + * + * Once the icon object is set, a previously set one will be + * deleted. If you want to keep the latter, use the + * elm_fileselector_button_icon_unset() function. + * + * @deprecated Use elm_object_part_content_set() instead + * @see elm_fileselector_button_icon_get() + */ +EINA_DEPRECATED EAPI void elm_fileselector_button_icon_set(Evas_Object *obj, Evas_Object *icon); + +/** + * Get the icon set for a given file selector button widget + * + * @param obj The file selector button widget + * @return The icon object currently set on @p obj or @c NULL, if + * none is + * + * @deprecated Use elm_object_part_content_get() instead + * @see elm_fileselector_button_icon_set() + */ +EINA_DEPRECATED EAPI Evas_Object *elm_fileselector_button_icon_get(const Evas_Object *obj); + +/** + * Unset the icon used in a given file selector button widget + * + * @param obj The file selector button widget + * @return The icon object that was being used on @p obj or @c + * NULL, on errors + * + * Unparent and return the icon object which was set for this + * widget. + * + * @deprecated Use elm_object_part_content_unset() instead + * @see elm_fileselector_button_icon_set() + */ +EINA_DEPRECATED EAPI Evas_Object *elm_fileselector_button_icon_unset(Evas_Object *obj); + +/** * Set the label for a given file selector entry widget's button * * @param obj The file selector entry widget @@ -475,6 +517,49 @@ EINA_DEPRECATED EAPI void elm_fileselector_entry_button_label_set(Evas_Ob EINA_DEPRECATED EAPI const char *elm_fileselector_entry_button_label_get(const Evas_Object *obj); /** + * Set the icon on a given file selector entry widget's button + * + * @param obj The file selector entry widget + * @param icon The icon object for the entry's button + * + * Once the icon object is set, a previously set one will be + * deleted. If you want to keep the latter, use the + * elm_fileselector_entry_button_icon_unset() function. + * + * @deprecated Use elm_object_part_content_set() instead + * @see elm_fileselector_entry_button_icon_get() + */ +EINA_DEPRECATED EAPI void elm_fileselector_entry_button_icon_set(Evas_Object *obj, Evas_Object *icon); + +/** + * Get the icon set for a given file selector entry widget's button + * + * @param obj The file selector entry widget + * @return The icon object currently set on @p obj widget's button + * or @c NULL, if none is + * + * @deprecated Use elm_object_part_content_get() instead + * @see elm_fileselector_entry_button_icon_set() + */ +EINA_DEPRECATED EAPI Evas_Object *elm_fileselector_entry_button_icon_get(const Evas_Object *obj); + +/** + * Unset the icon used in a given file selector entry widget's + * button + * + * @param obj The file selector entry widget + * @return The icon object that was being used on @p obj widget's + * button or @c NULL, on errors + * + * Unparent and return the icon object which was set for this + * widget's button. + * + * @deprecated Use elm_object_part_content_unset() instead + * @see elm_fileselector_entry_button_icon_set() + */ +EINA_DEPRECATED EAPI Evas_Object *elm_fileselector_entry_button_icon_unset(Evas_Object *obj); + +/** * @brief Set the hoversel button label * * @param obj The hoversel object