diff --git a/legacy/elementary/src/bin/test_fileselector.c b/legacy/elementary/src/bin/test_fileselector.c index 027ed1543a..a0e0030085 100644 --- a/legacy/elementary/src/bin/test_fileselector.c +++ b/legacy/elementary/src/bin/test_fileselector.c @@ -4,20 +4,24 @@ #endif #ifndef ELM_LIB_QUICKLAUNCH static void -my_fileselector_done(void *data, Evas_Object *obj __UNUSED__, void *event_info) +my_fileselector_done(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) { /* event_info conatin the full path of the selected file * or NULL if none is selected or cancel is pressed */ - const char *selected = event_info; + const char *selected = event_info; - if (selected) - printf("Selected file: %s\n", selected); - else - evas_object_del(data); /* delete the test window */ + if (selected) + printf("Selected file: %s\n", selected); + else + evas_object_del(data); /* delete the test window */ } static void -my_fileselector_selected(void *data __UNUSED__, Evas_Object *obj, void *event_info) +my_fileselector_selected(void *data __UNUSED__, + Evas_Object *obj, + void *event_info) { /* event_info conatin the full path of the selected file */ const char *selected = event_info; @@ -28,54 +32,66 @@ my_fileselector_selected(void *data __UNUSED__, Evas_Object *obj, void *event_in } static void -_is_save_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_is_save_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs = data; printf("Toggle Is save\n"); if (elm_fileselector_is_save_get(fs)) - elm_fileselector_is_save_set(fs, EINA_FALSE); + elm_fileselector_is_save_set(fs, EINA_FALSE); else - elm_fileselector_is_save_set(fs, EINA_TRUE); + elm_fileselector_is_save_set(fs, EINA_TRUE); } static void -_folder_only_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_folder_only_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs = data; printf("Toggle Folder only\n"); if (elm_fileselector_folder_only_get(fs)) - elm_fileselector_folder_only_set(fs, EINA_FALSE); + elm_fileselector_folder_only_set(fs, EINA_FALSE); else - elm_fileselector_folder_only_set(fs, EINA_TRUE); + elm_fileselector_folder_only_set(fs, EINA_TRUE); } static void -_expandable_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_expandable_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs = data; printf("Toggle Expandable\n"); if (elm_fileselector_expandable_get(fs)) - elm_fileselector_expandable_set(fs, EINA_FALSE); + elm_fileselector_expandable_set(fs, EINA_FALSE); else - elm_fileselector_expandable_set(fs, EINA_TRUE); + elm_fileselector_expandable_set(fs, EINA_TRUE); } static void -_sel_get_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_sel_get_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs = data; printf("Get Selected: %s\n", elm_fileselector_selected_get(fs)); } static void -_path_get_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_path_get_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs = data; printf("Get Path: %s\n", elm_fileselector_path_get(fs)); } void -test_fileselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +test_fileselector(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *win, *fs, *bg, *vbox, *hbox, *bt, *sep; @@ -111,12 +127,13 @@ test_fileselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *even evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(vbox, fs); evas_object_show(fs); // TODO fix this is the widget - + /* the 'done' cb is called when the user press ok/cancel */ evas_object_smart_callback_add(fs, "done", my_fileselector_done, win); /* the 'selected' cb is called when the user click on a file/dir */ - evas_object_smart_callback_add(fs, "selected", my_fileselector_selected, win); - + evas_object_smart_callback_add(fs, "selected", my_fileselector_selected, + win); + /* test buttons */ sep = elm_separator_add(win); elm_separator_horizontal_set(sep, EINA_TRUE); @@ -127,14 +144,14 @@ test_fileselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *even elm_box_horizontal_set(hbox, EINA_TRUE); elm_box_pack_end(vbox, hbox); evas_object_show(hbox); - + bt = elm_check_add(win); elm_check_label_set(bt, "is save"); elm_check_state_set(bt, elm_fileselector_is_save_get(fs)); evas_object_smart_callback_add(bt, "changed", _is_save_clicked, fs); elm_box_pack_end(hbox, bt); evas_object_show(bt); - + bt = elm_check_add(win); elm_check_label_set(bt, "folder only"); elm_check_state_set(bt, elm_fileselector_folder_only_get(fs)); @@ -169,4 +186,5 @@ test_fileselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *even evas_object_resize(win, 240, 350); evas_object_show(win); } + #endif diff --git a/legacy/elementary/src/bin/test_fileselector_button.c b/legacy/elementary/src/bin/test_fileselector_button.c index 61eae20488..00c8d076fd 100644 --- a/legacy/elementary/src/bin/test_fileselector_button.c +++ b/legacy/elementary/src/bin/test_fileselector_button.c @@ -5,7 +5,9 @@ #ifndef ELM_LIB_QUICKLAUNCH static void -_file_chosen(void *data, Evas_Object *obj __UNUSED__, void *event_info) +_file_chosen(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) { Evas_Object *entry = data; const char *file = event_info; @@ -19,7 +21,9 @@ _file_chosen(void *data, Evas_Object *obj __UNUSED__, void *event_info) } static void -_inwin_mode_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_inwin_mode_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs_bt = data; Eina_Bool value = elm_fileselector_button_inwin_mode_get(fs_bt); @@ -28,7 +32,9 @@ _inwin_mode_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __U } static void -_current_sel_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_current_sel_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs_bt = data; Eina_Bool value = elm_fileselector_button_is_save_get(fs_bt); @@ -38,7 +44,9 @@ _current_sel_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __ } static void -_folder_only_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_folder_only_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs_bt = data; Eina_Bool value = elm_fileselector_button_folder_only_get(fs_bt); @@ -47,7 +55,9 @@ _folder_only_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __ } static void -_expandable_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_expandable_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs_bt = data; Eina_Bool value = elm_fileselector_button_expandable_get(fs_bt); @@ -56,7 +66,9 @@ _expandable_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __U } void -test_fileselector_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +test_fileselector_button(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *win, *bg, *vbox, *hbox, *ic, *bt, *fs_bt, *en, *lb; @@ -74,11 +86,6 @@ test_fileselector_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, voi evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(vbox); - vbox = elm_box_add(win); - evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, vbox); - evas_object_show(vbox); - /* file selector button */ ic = elm_icon_add(win); elm_icon_standard_set(ic, "file"); @@ -136,4 +143,5 @@ test_fileselector_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, voi evas_object_resize(win, 400, 400); evas_object_show(win); } + #endif diff --git a/legacy/elementary/src/bin/test_fileselector_entry.c b/legacy/elementary/src/bin/test_fileselector_entry.c index 9b8f31b152..0359dd5197 100644 --- a/legacy/elementary/src/bin/test_fileselector_entry.c +++ b/legacy/elementary/src/bin/test_fileselector_entry.c @@ -5,7 +5,9 @@ #ifndef ELM_LIB_QUICKLAUNCH static void -_file_chosen(void *data, Evas_Object *obj __UNUSED__, void *event_info) +_file_chosen(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) { Evas_Object *entry = data; char *file = event_info; @@ -14,7 +16,9 @@ _file_chosen(void *data, Evas_Object *obj __UNUSED__, void *event_info) } static void -_inwin_mode_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_inwin_mode_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs_en = data; Eina_Bool value = elm_fileselector_entry_inwin_mode_get(fs_en); @@ -23,7 +27,9 @@ _inwin_mode_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __U } static void -_folder_only_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_folder_only_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs_en = data; Evas_Object *ic = elm_fileselector_entry_button_icon_get(fs_en); @@ -43,7 +49,9 @@ _folder_only_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __ } static void -_expandable_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_expandable_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs_en = data; Eina_Bool value = elm_fileselector_entry_expandable_get(fs_en); @@ -52,7 +60,9 @@ _expandable_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __U } static void -_disabled_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_disabled_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs_en = data; Eina_Bool value = elm_object_disabled_get(fs_en); @@ -61,7 +71,9 @@ _disabled_toggle(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNU } void -test_fileselector_entry(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +test_fileselector_entry(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *win, *bg, *vbox, *hbox, *ic, *bt, *fs_en, *en, *lb; @@ -74,11 +86,6 @@ test_fileselector_entry(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); - vbox = elm_box_add(win); - elm_win_resize_object_add(win, vbox); - evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(vbox); - vbox = elm_box_add(win); evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, vbox); @@ -138,7 +145,6 @@ test_fileselector_entry(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void elm_box_pack_end(hbox, bt); evas_object_show(bt); - en = elm_entry_add(win); elm_entry_line_wrap_set(en, EINA_FALSE); elm_entry_editable_set(en, EINA_FALSE); @@ -149,4 +155,5 @@ test_fileselector_entry(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void evas_object_resize(win, 400, 500); evas_object_show(win); } + #endif diff --git a/legacy/elementary/src/lib/elc_fileselector.c b/legacy/elementary/src/lib/elc_fileselector.c index 2482a02040..f4a6da3286 100644 --- a/legacy/elementary/src/lib/elc_fileselector.c +++ b/legacy/elementary/src/lib/elc_fileselector.c @@ -1,10 +1,10 @@ /** * @defgroup Fileselector Fileselector * - * A fileselector is a widget that allows a user to navigate through a tree - * of files. It contains buttons for Home(~) and Up(..) as well as cancel/ok - * buttons to confirm/cancel a selection. This widget is currently very much - * in progress. + * A fileselector is a widget that allows a user to navigate through a + * tree of files. It contains buttons for Home(~) and Up(..) as well + * as cancel/ok buttons to confirm/cancel a selection. This widget is + * currently very much in progress. * * TODO * userdefined icon/label cb @@ -18,7 +18,8 @@ * Signals that you can add callbacks for are: * * "selected" - the user clicks on a file - * "directory,open" - the list is populated with a new content. event_info is a directory. + * "directory,open" - the list is populated with new content. + * event_info is a directory. * "done" - the user clicks on the ok or cancel button */ @@ -39,38 +40,41 @@ struct _Widget_Data Evas_Object *ok_button; Evas_Object *cancel_button; - const char *path; - const char *selection; + const char *path; + const char *selection; Ecore_Idler *sel_idler; - const char *path_separator; + const char *path_separator; - Eina_Bool only_folder : 1; - Eina_Bool expand : 1; + Eina_Bool only_folder : 1; + Eina_Bool expand : 1; }; struct sel_data { Evas_Object *fs; - const char *path; + const char *path; }; Elm_Genlist_Item_Class itc; static const char *widtype = NULL; -static const char SIG_DIRECTORY_OPEN[]= "directory,open"; +static const char SIG_DIRECTORY_OPEN[] = "directory,open"; static const char SIG_DONE[] = "done"; static const char SIG_SELECTED[] = "selected"; static const Evas_Smart_Cb_Description _signals[] = { - {SIG_DIRECTORY_OPEN, "s"}, - {SIG_DONE, "s"}, - {SIG_SELECTED, "s"}, - {NULL, NULL} + {SIG_DIRECTORY_OPEN, "s"}, + {SIG_DONE, "s"}, + {SIG_SELECTED, "s"}, + {NULL, NULL} }; -static void _populate(Evas_Object *obj, const char *path, Elm_Genlist_Item *parent); -static void _do_anchors(Evas_Object *obj, const char *path); +static void _populate(Evas_Object *obj, + const char *path, + Elm_Genlist_Item *parent); +static void _do_anchors(Evas_Object *obj, + const char *path); /*** ELEMENTARY WIDGET ***/ static void @@ -86,8 +90,8 @@ _del_hook(Evas_Object *obj) if (wd->selection) eina_stringshare_del(wd->selection); if (wd->sel_idler) { - sd = ecore_idler_del(wd->sel_idler); - free(sd); + sd = ecore_idler_del(wd->sel_idler); + free(sd); } free(wd); } @@ -103,15 +107,15 @@ _sizing_eval(Evas_Object *obj) evas_object_size_hint_min_set(obj, minw, minh); } -#define SWALLOW(part_name, object_ptn) \ - if (object_ptn) \ - { \ - elm_widget_style_set(object_ptn, buf); \ - if (edje_object_part_swallow(wd->edje, part_name, object_ptn)) \ - evas_object_show(object_ptn); \ - else \ - evas_object_hide(object_ptn); \ - } +#define SWALLOW(part_name, object_ptn) \ + if (object_ptn) \ + { \ + elm_widget_style_set(object_ptn, buf); \ + if (edje_object_part_swallow(wd->edje, part_name, object_ptn)) \ + evas_object_show(object_ptn); \ + else \ + evas_object_hide(object_ptn); \ + } static void _theme_hook(Evas_Object *obj) @@ -125,7 +129,7 @@ _theme_hook(Evas_Object *obj) _elm_theme_object_set(obj, wd->edje, "fileselector", "base", style); if (elm_object_disabled_get(obj)) - edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm"); + edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm"); data = edje_object_data_get(wd->edje, "path_separator"); if (data) @@ -153,25 +157,32 @@ _theme_hook(Evas_Object *obj) } /*** GENLIST "MODEL" ***/ -static char* -_itc_label_get(void *data, Evas_Object *obj __UNUSED__, const char *source __UNUSED__) +static char * +_itc_label_get(void *data, + Evas_Object *obj __UNUSED__, + const char *source __UNUSED__) { - return strdup(ecore_file_file_get(data)); // NOTE this will be free() by the caller + return strdup(ecore_file_file_get(data)); /* NOTE this will be + * free() by the + * caller */ } -static Evas_Object* -_itc_icon_get(void *data, Evas_Object *obj, const char *source) +static Evas_Object * +_itc_icon_get(void *data, + Evas_Object *obj, + const char *source) { Evas_Object *ic; if (!strcmp(source, "elm.swallow.icon")) { ic = elm_icon_add(obj); - if (ecore_file_is_dir((char*)data)) + if (ecore_file_is_dir((char *)data)) elm_icon_standard_set(ic, "folder"); else elm_icon_standard_set(ic, "file"); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); evas_object_show(ic); return ic; } @@ -179,19 +190,24 @@ _itc_icon_get(void *data, Evas_Object *obj, const char *source) } static Eina_Bool -_itc_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *source __UNUSED__) +_itc_state_get(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + const char *source __UNUSED__) { return EINA_FALSE; } static void -_itc_del(void *data, Evas_Object *obj __UNUSED__) +_itc_del(void *data, + Evas_Object *obj __UNUSED__) { eina_stringshare_del(data); } static void -_expand_done(void *data, Evas_Object *obj __UNUSED__, void *event_info) +_expand_done(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) { Elm_Genlist_Item *it = event_info; const char *path = elm_genlist_item_data_get(it); @@ -199,21 +215,27 @@ _expand_done(void *data, Evas_Object *obj __UNUSED__, void *event_info) } static void -_contract_done(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_contract_done(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) { Elm_Genlist_Item *it = event_info; elm_genlist_item_subitems_clear(it); } static void -_expand_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_expand_req(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) { Elm_Genlist_Item *it = event_info; elm_genlist_item_expanded_set(it, 1); } static void -_contract_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_contract_req(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) { Elm_Genlist_Item *it = event_info; elm_genlist_item_expanded_set(it, 0); @@ -237,7 +259,8 @@ _sel_do(void *data) if (wd->expand) { _do_anchors(sd->fs, path); - if (wd->filename_entry) elm_scrolled_entry_entry_set(wd->filename_entry, ""); + if (wd->filename_entry) + elm_scrolled_entry_entry_set(wd->filename_entry, ""); } else { @@ -251,19 +274,22 @@ _sel_do(void *data) else { if (wd->filename_entry) - elm_scrolled_entry_entry_set(wd->filename_entry, ecore_file_file_get(path)); + elm_scrolled_entry_entry_set(wd->filename_entry, + ecore_file_file_get(path)); } evas_object_smart_callback_call(sd->fs, SIG_SELECTED, (void *)path); - end: +end: wd->sel_idler = NULL; free(sd); return ECORE_CALLBACK_CANCEL; } static void -_sel(void *data, Evas_Object *obj __UNUSED__, void *event_info) +_sel(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) { struct sel_data *sd; Widget_Data *wd; @@ -287,7 +313,7 @@ _sel(void *data, Evas_Object *obj __UNUSED__, void *event_info) { eina_stringshare_replace(&wd->path, ""); } - + if (wd->sel_idler) { old_sd = ecore_idler_del(wd->sel_idler); @@ -297,7 +323,9 @@ _sel(void *data, Evas_Object *obj __UNUSED__, void *event_info) } static void -_up(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_up(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs = data; char *parent; @@ -310,29 +338,37 @@ _up(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) } static void -_home(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_home(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs = data; _populate(fs, getenv("HOME"), NULL); } static void -_ok(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_ok(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs = data; evas_object_smart_callback_call(fs, SIG_DONE, - (void *)elm_fileselector_selected_get(fs)); + (void *)elm_fileselector_selected_get(fs)); } static void -_canc(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_canc(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *fs = data; evas_object_smart_callback_call(fs, SIG_DONE, NULL); } static void -_anchor_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info) +_anchor_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) { Evas_Object *fs = data; Widget_Data *wd = elm_widget_data_get(fs); @@ -347,10 +383,11 @@ _anchor_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info) } static void -_do_anchors(Evas_Object *obj, const char *path) +_do_anchors(Evas_Object *obj, + const char *path) { Widget_Data *wd = elm_widget_data_get(obj); - char **tok, buf[PATH_MAX*3]; + char **tok, buf[PATH_MAX * 3]; int i, j; if (!wd) return; buf[0] = '\0'; @@ -378,7 +415,9 @@ _do_anchors(Evas_Object *obj, const char *path) } static void -_populate(Evas_Object *obj, const char *path, Elm_Genlist_Item *parent) +_populate(Evas_Object *obj, + const char *path, + Elm_Genlist_Item *parent) { Widget_Data *wd = elm_widget_data_get(obj); DIR *dir; @@ -401,10 +440,12 @@ _populate(Evas_Object *obj, const char *path, Elm_Genlist_Item *parent) if (wd->filename_entry) elm_scrolled_entry_entry_set(wd->filename_entry, ""); while ((dp = readdir(dir))) { - if (dp->d_name[0] == '.') continue; // TODO make this configurable + if (dp->d_name[0] == '.') continue; // TODO make this configurable snprintf(buf, sizeof(buf), "%s/%s", path, dp->d_name); - real = ecore_file_realpath(buf); //TODO this will resolv symlinks...I dont like it + real = ecore_file_realpath(buf); /* TODO: this will resolv + * symlinks...I dont like + * it*/ if (ecore_file_is_dir(real)) dirs = eina_list_append(dirs, real); else if (!wd->only_folder) @@ -412,7 +453,8 @@ _populate(Evas_Object *obj, const char *path, Elm_Genlist_Item *parent) } closedir(dir); - files = eina_list_sort(files, eina_list_count(files), EINA_COMPARE_CB(strcoll)); + files = eina_list_sort(files, eina_list_count(files), + EINA_COMPARE_CB(strcoll)); dirs = eina_list_sort(dirs, eina_list_count(dirs), EINA_COMPARE_CB(strcoll)); EINA_LIST_FOREACH(dirs, l, real) { @@ -564,7 +606,8 @@ elm_fileselector_add(Evas_Object *parent) * @ingroup Fileselector */ EAPI void -elm_fileselector_is_save_set(Evas_Object *obj, Eina_Bool is_save) +elm_fileselector_is_save_set(Evas_Object *obj, + Eina_Bool is_save) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -595,7 +638,6 @@ elm_fileselector_is_save_get(const Evas_Object *obj) return elm_object_disabled_get(wd->filename_entry); } - /** * This enables/disables folder-only view in the fileselector. * @@ -606,7 +648,8 @@ elm_fileselector_is_save_get(const Evas_Object *obj) * @ingroup Fileselector */ EAPI void -elm_fileselector_folder_only_set(Evas_Object *obj, Eina_Bool only) +elm_fileselector_folder_only_set(Evas_Object *obj, + Eina_Bool only) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -615,7 +658,6 @@ elm_fileselector_folder_only_set(Evas_Object *obj, Eina_Bool only) wd->only_folder = !!only; } - /** * This gets the state of file display in the fileselector. * @@ -634,7 +676,6 @@ elm_fileselector_folder_only_get(const Evas_Object *obj) return wd->only_folder; } - /** * This enables/disables the ok,cancel buttons. * @@ -645,7 +686,8 @@ elm_fileselector_folder_only_get(const Evas_Object *obj) * @ingroup Fileselector */ EAPI void -elm_fileselector_buttons_ok_cancel_set(Evas_Object *obj, Eina_Bool visible) +elm_fileselector_buttons_ok_cancel_set(Evas_Object *obj, + Eina_Bool visible) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -701,7 +743,6 @@ elm_fileselector_buttons_ok_cancel_get(const Evas_Object *obj) return wd->ok_button ? EINA_TRUE : EINA_FALSE; } - /** * This enables tree view in the fileselector. Arrows are created on the * sides of directories, allowing them to expand in place. @@ -713,7 +754,8 @@ elm_fileselector_buttons_ok_cancel_get(const Evas_Object *obj) * @ingroup Fileselector */ EAPI void -elm_fileselector_expandable_set(Evas_Object *obj, Eina_Bool expand) +elm_fileselector_expandable_set(Evas_Object *obj, + Eina_Bool expand) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd; @@ -751,7 +793,8 @@ elm_fileselector_expandable_get(const Evas_Object *obj) * @ingroup Fileselector */ EAPI void -elm_fileselector_path_set(Evas_Object *obj, const char *path) +elm_fileselector_path_set(Evas_Object *obj, + const char *path) { ELM_CHECK_WIDTYPE(obj, widtype); _populate(obj, path, NULL); @@ -818,7 +861,8 @@ elm_fileselector_selected_get(const Evas_Object *obj) * @ingroup Fileselector */ EAPI Eina_Bool -elm_fileselector_selected_set(Evas_Object *obj, const char *path) +elm_fileselector_selected_set(Evas_Object *obj, + const char *path) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); @@ -834,7 +878,8 @@ elm_fileselector_selected_set(Evas_Object *obj, const char *path) _populate(obj, ecore_file_dir_get(path), NULL); if (wd->filename_entry) { - elm_scrolled_entry_entry_set(wd->filename_entry, ecore_file_file_get(path)); + elm_scrolled_entry_entry_set(wd->filename_entry, + ecore_file_file_get(path)); eina_stringshare_replace(&wd->selection, path); } } diff --git a/legacy/elementary/src/lib/elc_fileselector_button.c b/legacy/elementary/src/lib/elc_fileselector_button.c index 595971edca..bd98effccf 100644 --- a/legacy/elementary/src/lib/elc_fileselector_button.c +++ b/legacy/elementary/src/lib/elc_fileselector_button.c @@ -1,7 +1,7 @@ #include #include "elm_priv.h" - /** +/** * @defgroup File_Selector_Button File Selector Button * * A button that, when clicked, creates an Elementary window (or inner @@ -15,15 +15,16 @@ typedef struct _Widget_Data Widget_Data; struct _Widget_Data { Evas_Object *self, *btn, *fs, *fsw; - const char *window_title; - Evas_Coord w, h; - struct { + const char *window_title; + Evas_Coord w, h; + struct + { const char *path; - Eina_Bool expandable:1; - Eina_Bool folder_only:1; - Eina_Bool is_save:1; + Eina_Bool expandable : 1; + Eina_Bool folder_only : 1; + Eina_Bool is_save : 1; } fsd; - Eina_Bool inwin_mode:1; + Eina_Bool inwin_mode : 1; }; #define DEFAULT_WINDOW_TITLE "Select a file" @@ -34,15 +35,21 @@ static void _del_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); static void _disable_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); -static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _on_focus_hook(void *data, Evas_Object *obj); -static void _selection_done(void *data, Evas_Object *obj, void *event_info); +static void _changed_size_hints(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _on_focus_hook(void *data, + Evas_Object *obj); +static void _selection_done(void *data, + Evas_Object *obj, + void *event_info); static void _activate(Widget_Data *wd); static const char SIG_FILE_CHOSEN[] = "file,chosen"; static const Evas_Smart_Cb_Description _signals[] = { - {SIG_FILE_CHOSEN, "s"}, - {NULL, NULL} + {SIG_FILE_CHOSEN, "s"}, + {NULL, NULL} }; static void @@ -58,14 +65,15 @@ _del_hook(Evas_Object *obj) if (wd->fsd.path) eina_stringshare_del(wd->fsd.path); if (wd->fs) { - win = evas_object_data_del(obj, "win"); - evas_object_del(win); + win = evas_object_data_del(obj, "win"); + evas_object_del(win); } free(wd); } static void -_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +_on_focus_hook(void *data __UNUSED__, + Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -79,7 +87,8 @@ _theme_hook(Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); char buf[4096]; if (!wd) return; - snprintf(buf, sizeof(buf), "fileselector_button/%s", elm_widget_style_get(obj)); + snprintf(buf, sizeof(buf), "fileselector_button/%s", + elm_widget_style_get(obj)); elm_object_style_set(wd->btn, buf); _sizing_eval(obj); } @@ -105,7 +114,10 @@ _sizing_eval(Evas_Object *obj) } static void -_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_changed_size_hints(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Widget_Data *wd = elm_widget_data_get(data); if (!wd) return; @@ -122,7 +134,9 @@ _activate_hook(Evas_Object *obj) } static void -_button_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_button_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { _activate(data); } @@ -163,11 +177,11 @@ _activate(Widget_Data *wd) if (wd->inwin_mode) { - wd->fsw = _parent_win_get(wd->self); + wd->fsw = _parent_win_get(wd->self); - if (!wd->fsw) + if (!wd->fsw) wd->fsw = _new_window_add(wd); - else + else { wd->fsw = elm_win_inwin_add(wd->fsw); is_inwin = EINA_TRUE; @@ -182,25 +196,27 @@ _activate(Widget_Data *wd) elm_fileselector_is_save_set(wd->fs, wd->fsd.is_save); elm_fileselector_selected_set(wd->fs, wd->fsd.path); evas_object_size_hint_weight_set(wd->fs, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(wd->fs, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(wd->fs, "done", _selection_done, wd); evas_object_show(wd->fs); if (is_inwin) { - elm_win_inwin_content_set(wd->fsw, wd->fs); - elm_win_inwin_activate(wd->fsw); + elm_win_inwin_content_set(wd->fsw, wd->fs); + elm_win_inwin_activate(wd->fsw); } else { - elm_win_resize_object_add(wd->fsw, wd->fs); - evas_object_show(wd->fsw); + elm_win_resize_object_add(wd->fsw, wd->fs); + evas_object_show(wd->fsw); } } static void -_selection_done(void *data, Evas_Object *obj __UNUSED__, void *event_info) +_selection_done(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) { const char *file = event_info; Widget_Data *wd = data; @@ -214,7 +230,7 @@ _selection_done(void *data, Evas_Object *obj __UNUSED__, void *event_info) wd->fsw = NULL; evas_object_del(del); - evas_object_smart_callback_call(wd->self, SIG_FILE_CHOSEN, + evas_object_smart_callback_call(wd->self, SIG_FILE_CHOSEN, (void *)wd->fsd.path); } @@ -260,7 +276,7 @@ elm_fileselector_button_add(Evas_Object *parent) wd->btn = elm_button_add(parent); elm_widget_resize_object_set(obj, wd->btn); evas_object_event_callback_add(wd->btn, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _changed_size_hints, obj); + _changed_size_hints, obj); evas_object_smart_callback_add(wd->btn, "clicked", _button_clicked, wd); elm_widget_sub_object_add(obj, wd->btn); @@ -278,7 +294,8 @@ elm_fileselector_button_add(Evas_Object *parent) * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_label_set(Evas_Object *obj, const char *label) +elm_fileselector_button_label_set(Evas_Object *obj, + const char *label) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -286,7 +303,6 @@ elm_fileselector_button_label_set(Evas_Object *obj, const char *label) elm_button_label_set(wd->btn, label); } - /** * Get the label used in the file selector button. * @@ -316,7 +332,8 @@ elm_fileselector_button_label_get(const Evas_Object *obj) * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_window_title_set(Evas_Object *obj, const char *title) +elm_fileselector_button_window_title_set(Evas_Object *obj, + const char *title) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -359,7 +376,9 @@ elm_fileselector_button_window_title_get(const Evas_Object *obj) * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height) +elm_fileselector_button_window_size_set(Evas_Object *obj, + Evas_Coord width, + Evas_Coord height) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -382,7 +401,9 @@ elm_fileselector_button_window_size_set(Evas_Object *obj, Evas_Coord width, Evas * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height) +elm_fileselector_button_window_size_get(const Evas_Object *obj, + Evas_Coord *width, + Evas_Coord *height) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -404,7 +425,8 @@ elm_fileselector_button_window_size_get(const Evas_Object *obj, Evas_Coord *widt * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_path_set(Evas_Object *obj, const char *path) +elm_fileselector_button_path_set(Evas_Object *obj, + const char *path) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -414,7 +436,6 @@ elm_fileselector_button_path_set(Evas_Object *obj, const char *path) if (wd->fs) elm_fileselector_selected_set(wd->fs, wd->fsd.path); - } /** @@ -445,7 +466,8 @@ elm_fileselector_button_path_get(const Evas_Object *obj) * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_expandable_set(Evas_Object *obj, Eina_Bool value) +elm_fileselector_button_expandable_set(Evas_Object *obj, + Eina_Bool value) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -485,7 +507,8 @@ elm_fileselector_button_expandable_get(const Evas_Object *obj) * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_folder_only_set(Evas_Object *obj, Eina_Bool value) +elm_fileselector_button_folder_only_set(Evas_Object *obj, + Eina_Bool value) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -525,7 +548,8 @@ elm_fileselector_button_folder_only_get(const Evas_Object *obj) * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_is_save_set(Evas_Object *obj, Eina_Bool value) +elm_fileselector_button_is_save_set(Evas_Object *obj, + Eina_Bool value) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -566,7 +590,8 @@ elm_fileselector_button_is_save_get(const Evas_Object *obj) * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_inwin_mode_set(Evas_Object *obj, Eina_Bool value) +elm_fileselector_button_inwin_mode_set(Evas_Object *obj, + Eina_Bool value) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -606,7 +631,8 @@ elm_fileselector_button_inwin_mode_get(const Evas_Object *obj) * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_icon_set(Evas_Object *obj, Evas_Object *icon) +elm_fileselector_button_icon_set(Evas_Object *obj, + Evas_Object *icon) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -653,3 +679,4 @@ elm_fileselector_button_icon_unset(Evas_Object *obj) if (!wd) return NULL; return elm_button_icon_unset(wd->btn); } + diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 6f6bfe2c06..f808b888d5 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -2,9 +2,9 @@ #include #include "elm_priv.h" -#define SWIPE_MOVES 12 +#define SWIPE_MOVES 12 #define MAX_ITEMS_PER_BLOCK 32 -#define LONGPRESS_TIMEOUT 1.0 +#define LONGPRESS_TIMEOUT 1.0 /** * @defgroup Genlist Genlist @@ -263,174 +263,185 @@ */ typedef struct _Widget_Data Widget_Data; -typedef struct _Item_Block Item_Block; -typedef struct _Pan Pan; -typedef struct _Item_Cache Item_Cache; +typedef struct _Item_Block Item_Block; +typedef struct _Pan Pan; +typedef struct _Item_Cache Item_Cache; struct _Widget_Data { - Evas_Object *obj, *scr, *pan_smart; - Eina_Inlist *items, *blocks; - Pan *pan; - Evas_Coord pan_x, pan_y, w, h, minw, minh, realminw, prev_viewport_w; - Ecore_Job *calc_job, *update_job; - Ecore_Idler *queue_idler; - Ecore_Idler *must_recalc_idler; - Eina_List *queue, *selected; + Evas_Object *obj, *scr, *pan_smart; + Eina_Inlist *items, *blocks; + Pan *pan; + Evas_Coord pan_x, pan_y, w, h, minw, minh, realminw, prev_viewport_w; + Ecore_Job *calc_job, *update_job; + Ecore_Idler *queue_idler; + Ecore_Idler *must_recalc_idler; + Eina_List *queue, *selected; Elm_Genlist_Item *show_item; Elm_Genlist_Item *last_selected_item; - Eina_Inlist *item_cache; + Eina_Inlist *item_cache; Elm_Genlist_Item *anchor_item; - Evas_Coord anchor_y; - Elm_List_Mode mode; - Eina_Bool on_hold : 1; - Eina_Bool multi : 1; - Eina_Bool always_select : 1; - Eina_Bool longpressed : 1; - Eina_Bool wasselected : 1; - Eina_Bool no_select : 1; - Eina_Bool bring_in : 1; - Eina_Bool compress : 1; - Eina_Bool height_for_width : 1; - Eina_Bool homogeneous : 1; - Eina_Bool clear_me : 1; - Eina_Bool swipe : 1; - struct { - Evas_Coord x, y; + Evas_Coord anchor_y; + Elm_List_Mode mode; + Eina_Bool on_hold : 1; + Eina_Bool multi : 1; + Eina_Bool always_select : 1; + Eina_Bool longpressed : 1; + Eina_Bool wasselected : 1; + Eina_Bool no_select : 1; + Eina_Bool bring_in : 1; + Eina_Bool compress : 1; + Eina_Bool height_for_width : 1; + Eina_Bool homogeneous : 1; + Eina_Bool clear_me : 1; + Eina_Bool swipe : 1; + struct + { + Evas_Coord x, y; } history[SWIPE_MOVES]; - int item_cache_count; - int item_cache_max; - int movements; - int walking; - int item_width; - int item_height; - int max_items_per_block; - double longpress_timeout; + int item_cache_count; + int item_cache_max; + int movements; + int walking; + int item_width; + int item_height; + int max_items_per_block; + double longpress_timeout; }; struct _Item_Block { EINA_INLIST; - int count; - int num; + int count; + int num; Widget_Data *wd; - Eina_List *items; - Evas_Coord x, y, w, h, minw, minh; - Eina_Bool want_unrealize : 1; - Eina_Bool realized : 1; - Eina_Bool changed : 1; - Eina_Bool updateme : 1; - Eina_Bool showme : 1; - Eina_Bool must_recalc : 1; + Eina_List *items; + Evas_Coord x, y, w, h, minw, minh; + Eina_Bool want_unrealize : 1; + Eina_Bool realized : 1; + Eina_Bool changed : 1; + Eina_Bool updateme : 1; + Eina_Bool showme : 1; + Eina_Bool must_recalc : 1; }; struct _Elm_Genlist_Item { - Elm_Widget_Item base; + Elm_Widget_Item base; EINA_INLIST; - Widget_Data *wd; - Item_Block *block; - Eina_List *items; - Evas_Coord x, y, w, h, minw, minh; + Widget_Data *wd; + Item_Block *block; + Eina_List *items; + Evas_Coord x, y, w, h, minw, minh; const Elm_Genlist_Item_Class *itc; - Elm_Genlist_Item *parent; - Elm_Genlist_Item_Flags flags; - struct { - Evas_Smart_Cb func; - const void *data; + Elm_Genlist_Item *parent; + Elm_Genlist_Item_Flags flags; + struct + { + Evas_Smart_Cb func; + const void *data; } func; - Evas_Object *spacer; - Eina_List *labels, *icons, *states, *icon_objs; - Ecore_Timer *long_timer; - Ecore_Timer *swipe_timer; - Evas_Coord dx, dy; + Evas_Object *spacer; + Eina_List *labels, *icons, *states, *icon_objs; + Ecore_Timer *long_timer; + Ecore_Timer *swipe_timer; + Evas_Coord dx, dy; Elm_Genlist_Item *rel; - struct { - const void *data; - Elm_Tooltip_Item_Content_Cb content_cb; - Evas_Smart_Cb del_cb; - const char *style; + struct + { + const void *data; + Elm_Tooltip_Item_Content_Cb content_cb; + Evas_Smart_Cb del_cb; + const char *style; } tooltip; const char *mouse_cursor; - int relcount; - int walking; - int expanded_depth; - int order_num_in; - - Eina_Bool before : 1; + int relcount; + int walking; + int expanded_depth; + int order_num_in; - Eina_Bool want_unrealize : 1; - Eina_Bool realized : 1; - Eina_Bool selected : 1; - Eina_Bool hilighted : 1; - Eina_Bool expanded : 1; - Eina_Bool disabled : 1; - Eina_Bool display_only : 1; - Eina_Bool mincalcd : 1; - Eina_Bool queued : 1; - Eina_Bool showme : 1; - Eina_Bool delete_me : 1; - Eina_Bool down : 1; - Eina_Bool dragging : 1; - Eina_Bool updateme : 1; + Eina_Bool before : 1; + + Eina_Bool want_unrealize : 1; + Eina_Bool realized : 1; + Eina_Bool selected : 1; + Eina_Bool hilighted : 1; + Eina_Bool expanded : 1; + Eina_Bool disabled : 1; + Eina_Bool display_only : 1; + Eina_Bool mincalcd : 1; + Eina_Bool queued : 1; + Eina_Bool showme : 1; + Eina_Bool delete_me : 1; + Eina_Bool down : 1; + Eina_Bool dragging : 1; + Eina_Bool updateme : 1; }; struct _Item_Cache { - EINA_INLIST; + EINA_INLIST; - Evas_Object *base_view, *spacer; - - const char *item_style; // it->itc->item_style - Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS - Eina_Bool compress : 1; // it->wd->compress - Eina_Bool odd : 1; // in & 0x1 - - Eina_Bool selected : 1; // it->selected - Eina_Bool disabled : 1; // it->disabled - Eina_Bool expanded : 1; // it->expanded + Evas_Object *base_view, *spacer; + + const char *item_style; // it->itc->item_style + Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS + Eina_Bool compress : 1; // it->wd->compress + Eina_Bool odd : 1; // in & 0x1 + + Eina_Bool selected : 1; // it->selected + Eina_Bool disabled : 1; // it->disabled + Eina_Bool expanded : 1; // it->expanded }; -#define ELM_GENLIST_ITEM_FROM_INLIST(item) \ +#define ELM_GENLIST_ITEM_FROM_INLIST(item) \ ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Genlist_Item) : NULL) struct _Pan { Evas_Object_Smart_Clipped_Data __clipped_data; - Widget_Data *wd; - Ecore_Job *resize_job; + Widget_Data *wd; + Ecore_Job *resize_job; }; static const char *widtype = NULL; -static void _item_cache_zero(Widget_Data *wd); -static void _del_hook(Evas_Object *obj); -static void _theme_hook(Evas_Object *obj); +static void _item_cache_zero(Widget_Data *wd); +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); //static void _show_region_hook(void *data, Evas_Object *obj); -static void _sizing_eval(Evas_Object *obj); -static void _item_unrealize(Elm_Genlist_Item *it); -static void _item_block_unrealize(Item_Block *itb); -static void _calc_job(void *data); -static void _on_focus_hook(void *data, Evas_Object *obj); -static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, - Evas_Callback_Type type, void *event_info); +static void _sizing_eval(Evas_Object *obj); +static void _item_unrealize(Elm_Genlist_Item *it); +static void _item_block_unrealize(Item_Block *itb); +static void _calc_job(void *data); +static void _on_focus_hook(void *data, + Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, + Evas_Object *src, + Evas_Callback_Type type, + void *event_info); static Eina_Bool _item_multi_select_up(Widget_Data *wd); static Eina_Bool _item_multi_select_down(Widget_Data *wd); static Eina_Bool _item_single_select_up(Widget_Data *wd); static Eina_Bool _item_single_select_down(Widget_Data *wd); -static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, - Evas_Callback_Type type, void *event_info); +static Eina_Bool _event_hook(Evas_Object *obj, + Evas_Object *src, + Evas_Callback_Type type, + void *event_info); static Eina_Bool _deselect_all_items(Widget_Data *wd); -static void _pan_calculate(Evas_Object *obj); +static void _pan_calculate(Evas_Object *obj); static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION; static Eina_Bool -_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +_event_hook(Evas_Object *obj, + Evas_Object *src __UNUSED__, + Evas_Callback_Type type, + void *event_info) { if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; Evas_Event_Key_Down *ev = event_info; @@ -459,14 +470,15 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty { x -= step_x; } - else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right"))) + else if ((!strcmp(ev->keyname, "Right")) || + (!strcmp(ev->keyname, "KP_Right"))) { x += step_x; } - else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up"))) + else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up"))) { if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && - (_item_multi_select_up(wd))) + (_item_multi_select_up(wd))) || (_item_single_select_up(wd))) { ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; @@ -478,7 +490,7 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down"))) { if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && - (_item_multi_select_down(wd))) + (_item_multi_select_down(wd))) || (_item_single_select_down(wd))) { ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; @@ -530,9 +542,9 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty } else if (!strcmp(ev->keyname, "Escape")) { - if (!_deselect_all_items(wd)) return EINA_FALSE; - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - return EINA_TRUE; + if (!_deselect_all_items(wd)) return EINA_FALSE; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; } else return EINA_FALSE; @@ -640,7 +652,8 @@ _item_single_select_down(Widget_Data *wd) } static void -_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +_on_focus_hook(void *data __UNUSED__, + Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -687,37 +700,38 @@ _theme_hook(Evas_Object *obj) Item_Block *itb; if (!wd) return; _item_cache_zero(wd); - elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base", elm_widget_style_get(obj)); + elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base", + elm_widget_style_get(obj)); // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); wd->item_width = wd->item_height = 0; wd->minw = wd->minh = wd->realminw = 0; EINA_INLIST_FOREACH(wd->blocks, itb) - { - Eina_List *l; - Elm_Genlist_Item *it; + { + Eina_List *l; + Elm_Genlist_Item *it; - if (itb->realized) _item_block_unrealize(itb); - EINA_LIST_FOREACH(itb->items, l, it) - it->mincalcd = EINA_FALSE; + if (itb->realized) _item_block_unrealize(itb); + EINA_LIST_FOREACH(itb->items, l, it) + it->mincalcd = EINA_FALSE; - itb->changed = EINA_TRUE; - } + itb->changed = EINA_TRUE; + } if (wd->calc_job) ecore_job_del(wd->calc_job); wd->calc_job = ecore_job_add(_calc_job, wd); _sizing_eval(obj); } /* -static void -_show_region_hook(void *data, Evas_Object *obj) -{ + static void + _show_region_hook(void *data, Evas_Object *obj) + { Widget_Data *wd = elm_widget_data_get(data); Evas_Coord x, y, w, h; if (!wd) return; elm_widget_show_region_get(obj, &x, &y, &w, &h); elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); -} -*/ + } + */ static void _sizing_eval(Evas_Object *obj) @@ -730,41 +744,42 @@ _sizing_eval(Evas_Object *obj) minh = -1; if (wd->height_for_width) { - Evas_Coord vw, vh; - - elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); - if ((vw != 0) && (vw != wd->prev_viewport_w)) - { - Item_Block *itb; - - wd->prev_viewport_w = vw; - EINA_INLIST_FOREACH(wd->blocks, itb) + Evas_Coord vw, vh; + + elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); + if ((vw != 0) && (vw != wd->prev_viewport_w)) + { + Item_Block *itb; + + wd->prev_viewport_w = vw; + EINA_INLIST_FOREACH(wd->blocks, itb) { - itb->must_recalc = EINA_TRUE; + itb->must_recalc = EINA_TRUE; } - if (wd->calc_job) ecore_job_del(wd->calc_job); - wd->calc_job = ecore_job_add(_calc_job, wd); - } + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + } } if (wd->mode == ELM_LIST_LIMIT) { - Evas_Coord vmw, vmh, vw, vh; + Evas_Coord vmw, vmh, vw, vh; minw = wd->realminw; maxw = -1; elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); if ((minw > 0) && (vw < minw)) vw = minw; - else if ((maxw > 0) && (vw > maxw)) vw = maxw; + else if ((maxw > 0) && (vw > maxw)) + vw = maxw; edje_object_size_min_calc - (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh); + (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh); minw = vmw + minw; } else { - Evas_Coord vmw, vmh; + Evas_Coord vmw, vmh; edje_object_size_min_calc - (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh); + (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh); minw = vmw; minh = vmh; } @@ -824,7 +839,8 @@ _item_block_del(Elm_Genlist_Item *it) itbp->count++; itbp->changed = EINA_TRUE; } - it->wd->blocks = eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb)); + it->wd->blocks = eina_inlist_remove(it->wd->blocks, + EINA_INLIST_GET(itb)); free(itb); } else if ((itbn) && ((itbn->count + itb->count) < 48)) @@ -841,7 +857,7 @@ _item_block_del(Elm_Genlist_Item *it) itbn->changed = EINA_TRUE; } it->wd->blocks = - eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb)); + eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb)); free(itb); } } @@ -877,7 +893,7 @@ _item_del(Elm_Genlist_Item *it) if (it->tooltip.del_cb) it->tooltip.del_cb((void *)it->tooltip.data, it->base.widget, it); - + elm_widget_item_del(it); } @@ -892,7 +908,7 @@ _item_select(Elm_Genlist_Item *it) } it->selected = EINA_TRUE; it->wd->selected = eina_list_append(it->wd->selected, it); - call: +call: it->walking++; it->wd->walking++; if (it->func.func) it->func.func((void *)it->func.data, it->base.widget, it); @@ -901,7 +917,7 @@ _item_select(Elm_Genlist_Item *it) it->walking--; it->wd->walking--; if ((it->wd->clear_me) && (!it->wd->walking)) - elm_genlist_clear(it->base.widget); + elm_genlist_clear(it->base.widget); else { if ((!it->walking) && (it->delete_me)) @@ -924,7 +940,7 @@ _item_unselect(Elm_Genlist_Item *it) if ((selectraise) && (!strcmp(selectraise, "on"))) { if ((stacking) && (!strcmp(stacking, "below"))) - evas_object_lower(it->base.view); + evas_object_lower(it->base.view); } it->hilighted = EINA_FALSE; if (it->selected) @@ -936,7 +952,10 @@ _item_unselect(Elm_Genlist_Item *it) } static void -_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info) +_mouse_move(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj, + void *event_info) { Elm_Genlist_Item *it = data; Evas_Event_Mouse_Move *ev = event_info; @@ -948,7 +967,7 @@ _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_inf { it->wd->on_hold = EINA_TRUE; if (!it->wd->wasselected) - _item_unselect(it); + _item_unselect(it); } } if ((it->dragging) && (it->down)) @@ -958,7 +977,8 @@ _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_inf { it->wd->history[it->wd->movements].x = ev->cur.canvas.x; it->wd->history[it->wd->movements].y = ev->cur.canvas.y; - if (abs((it->wd->history[it->wd->movements].x - it->wd->history[0].x)) > 40) + if (abs((it->wd->history[it->wd->movements].x - + it->wd->history[0].x)) > 40) it->wd->swipe = EINA_TRUE; else it->wd->movements++; @@ -971,7 +991,7 @@ _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_inf evas_object_smart_callback_call(it->base.widget, "drag", it); return; } - if ((!it->down)/* || (it->wd->on_hold)*/ || (it->wd->longpressed)) + if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed)) { if (it->long_timer) { @@ -1006,29 +1026,30 @@ _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_inf if (dy < 0) { if (ady > adx) - evas_object_smart_callback_call(it->base.widget, "drag,start,up", it); + evas_object_smart_callback_call(it->base.widget, + "drag,start,up", it); else { if (dx < 0) - evas_object_smart_callback_call(it->base.widget, + evas_object_smart_callback_call(it->base.widget, "drag,start,left", it); else - evas_object_smart_callback_call(it->base.widget, + evas_object_smart_callback_call(it->base.widget, "drag,start,right", it); } } else { if (ady > adx) - evas_object_smart_callback_call(it->base.widget, + evas_object_smart_callback_call(it->base.widget, "drag,start,down", it); else { if (dx < 0) - evas_object_smart_callback_call(it->base.widget, + evas_object_smart_callback_call(it->base.widget, "drag,start,left", it); else - evas_object_smart_callback_call(it->base.widget, + evas_object_smart_callback_call(it->base.widget, "drag,start,right", it); } } @@ -1041,7 +1062,8 @@ _long_press(void *data) Elm_Genlist_Item *it = data; it->long_timer = NULL; - if ((it->disabled) || (it->dragging) || (it->display_only)) return ECORE_CALLBACK_CANCEL; + if ((it->disabled) || (it->dragging) || (it->display_only)) + return ECORE_CALLBACK_CANCEL; it->wd->longpressed = EINA_TRUE; evas_object_smart_callback_call(it->base.widget, "longpressed", it); return ECORE_CALLBACK_CANCEL; @@ -1077,7 +1099,10 @@ _swipe_cancel(void *data) } static void -_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info) +_mouse_down(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj, + void *event_info) { Elm_Genlist_Item *it = data; Evas_Event_Mouse_Down *ev = event_info; @@ -1085,12 +1110,12 @@ _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_inf if (ev->button != 1) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) - { - it->wd->on_hold = EINA_TRUE; - } + { + it->wd->on_hold = EINA_TRUE; + } it->down = 1; - it->dragging = 0; + it->dragging = 0; evas_object_geometry_get(obj, &x, &y, NULL, NULL); it->dx = ev->canvas.x - x; it->dy = ev->canvas.y - y; @@ -1106,7 +1131,8 @@ _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_inf if (it->swipe_timer) ecore_timer_del(it->swipe_timer); it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it); if (it->realized) - it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press, it); + it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press, + it); else it->long_timer = NULL; it->wd->swipe = EINA_FALSE; @@ -1114,7 +1140,10 @@ _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_inf } static void -_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_mouse_up(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) { Elm_Genlist_Item *it = data; Evas_Event_Mouse_Up *ev = event_info; @@ -1191,7 +1220,7 @@ _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void * Elm_Genlist_Item *it2; EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2) - if (it2 != it) _item_unselect(it2); + if (it2 != it) _item_unselect(it2); //_item_hilight(it); //_item_select(it); } @@ -1201,7 +1230,10 @@ _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void * } static void -_signal_expand_toggle(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +_signal_expand_toggle(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) { Elm_Genlist_Item *it = data; @@ -1212,7 +1244,10 @@ _signal_expand_toggle(void *data, Evas_Object *obj __UNUSED__, const char *emiss } static void -_signal_expand(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +_signal_expand(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) { Elm_Genlist_Item *it = data; @@ -1221,7 +1256,10 @@ _signal_expand(void *data, Evas_Object *obj __UNUSED__, const char *emission __U } static void -_signal_contract(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +_signal_contract(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) { Elm_Genlist_Item *it = data; @@ -1229,127 +1267,131 @@ _signal_contract(void *data, Evas_Object *obj __UNUSED__, const char *emission _ evas_object_smart_callback_call(it->base.widget, "contract,request", it); } - static void _item_cache_clean(Widget_Data *wd) { - while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max)) - { - Item_Cache *itc; - - itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache); - wd->item_cache = eina_inlist_remove(wd->item_cache, - wd->item_cache->last); - wd->item_cache_count--; - if (itc->spacer) evas_object_del(itc->spacer); - if (itc->base_view) evas_object_del(itc->base_view); - if (itc->item_style) eina_stringshare_del(itc->item_style); - free(itc); - } + while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max)) + { + Item_Cache *itc; + + itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache); + wd->item_cache = eina_inlist_remove(wd->item_cache, + wd->item_cache->last); + wd->item_cache_count--; + if (itc->spacer) evas_object_del(itc->spacer); + if (itc->base_view) evas_object_del(itc->base_view); + if (itc->item_style) eina_stringshare_del(itc->item_style); + free(itc); + } } static void _item_cache_zero(Widget_Data *wd) { - int pmax = wd->item_cache_max; - wd->item_cache_max = 0; - _item_cache_clean(wd); - wd->item_cache_max = pmax; + int pmax = wd->item_cache_max; + wd->item_cache_max = 0; + _item_cache_clean(wd); + wd->item_cache_max = pmax; } static void _item_cache_add(Elm_Genlist_Item *it) { - Item_Cache *itc; + Item_Cache *itc; - if (it->wd->item_cache_max <= 0) - { - evas_object_del(it->base.view); - it->base.view = NULL; - evas_object_del(it->spacer); - it->spacer = NULL; - return; - } - - it->wd->item_cache_count++; - itc = calloc(1, sizeof(Item_Cache)); - it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache, EINA_INLIST_GET(itc)); - itc->spacer = it->spacer; - it->spacer = NULL; - itc->base_view = it->base.view; - it->base.view = NULL; - evas_object_hide(itc->base_view); - evas_object_move(itc->base_view, -9999, -9999); - itc->item_style = eina_stringshare_add(it->itc->item_style); - if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1; - itc->compress = (it->wd->compress); - itc->odd = (it->order_num_in & 0x1); - itc->selected = it->selected; - itc->disabled = it->disabled; - itc->expanded = it->expanded; - if (it->long_timer) - { - ecore_timer_del(it->long_timer); - it->long_timer = NULL; - } - if (it->swipe_timer) - { - ecore_timer_del(it->swipe_timer); - it->swipe_timer = NULL; - } - // FIXME: other callbacks? - edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand,toggle", - "elm", _signal_expand_toggle, it); - edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand", "elm", - _signal_expand, it); - edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract", - "elm", _signal_contract, it); - evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN, - _mouse_down, it); - evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP, - _mouse_up, it); - evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE, - _mouse_move, it); - _item_cache_clean(it->wd); + if (it->wd->item_cache_max <= 0) + { + evas_object_del(it->base.view); + it->base.view = NULL; + evas_object_del(it->spacer); + it->spacer = NULL; + return; + } + + it->wd->item_cache_count++; + itc = calloc(1, sizeof(Item_Cache)); + it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache, + EINA_INLIST_GET(itc)); + itc->spacer = it->spacer; + it->spacer = NULL; + itc->base_view = it->base.view; + it->base.view = NULL; + evas_object_hide(itc->base_view); + evas_object_move(itc->base_view, -9999, -9999); + itc->item_style = eina_stringshare_add(it->itc->item_style); + if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1; + itc->compress = (it->wd->compress); + itc->odd = (it->order_num_in & 0x1); + itc->selected = it->selected; + itc->disabled = it->disabled; + itc->expanded = it->expanded; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (it->swipe_timer) + { + ecore_timer_del(it->swipe_timer); + it->swipe_timer = NULL; + } + // FIXME: other callbacks? + edje_object_signal_callback_del_full(itc->base_view, + "elm,action,expand,toggle", + "elm", _signal_expand_toggle, it); + edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand", + "elm", + _signal_expand, it); + edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract", + "elm", _signal_contract, it); + evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, it); + evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, it); + evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, it); + _item_cache_clean(it->wd); } static Item_Cache * _item_cache_find(Elm_Genlist_Item *it) { - Item_Cache *itc; - Eina_Bool tree = 0, odd; - - if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1; - odd = (it->order_num_in & 0x1); - EINA_INLIST_FOREACH(it->wd->item_cache, itc) - { + Item_Cache *itc; + Eina_Bool tree = 0, odd; + + if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1; + odd = (it->order_num_in & 0x1); + EINA_INLIST_FOREACH(it->wd->item_cache, itc) + { if ((itc->selected) || (itc->disabled) || (itc->expanded)) continue; - if ((itc->tree == tree) && - (itc->odd == odd) && + if ((itc->tree == tree) && + (itc->odd == odd) && (itc->compress == it->wd->compress) && - (!strcmp(it->itc->item_style, itc->item_style))) + (!strcmp(it->itc->item_style, itc->item_style))) { - it->wd->item_cache = eina_inlist_remove(it->wd->item_cache, - EINA_INLIST_GET(itc)); - it->wd->item_cache_count--; - return itc; + it->wd->item_cache = eina_inlist_remove(it->wd->item_cache, + EINA_INLIST_GET(itc)); + it->wd->item_cache_count--; + return itc; } - } - return NULL; + } + return NULL; } static void _item_cache_free(Item_Cache *itc) { - if (itc->spacer) evas_object_del(itc->spacer); - if (itc->base_view) evas_object_del(itc->base_view); - if (itc->item_style) eina_stringshare_del(itc->item_style); - free(itc); + if (itc->spacer) evas_object_del(itc->spacer); + if (itc->base_view) evas_object_del(itc->base_view); + if (itc->item_style) eina_stringshare_del(itc->item_style); + free(itc); } static void -_item_realize(Elm_Genlist_Item *it, int in, int calc) +_item_realize(Elm_Genlist_Item *it, + int in, + int calc) { Elm_Genlist_Item *it2; const char *stacking; @@ -1357,7 +1399,7 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) char buf[1024]; int depth, tsize = 20; Item_Cache *itc; - + if ((it->realized) || (it->delete_me)) return; it->order_num_in = in; @@ -1371,24 +1413,29 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) } else { - it->base.view = edje_object_add(evas_object_evas_get(it->base.widget)); - edje_object_scale_set(it->base.view, elm_widget_scale_get(it->base.widget) * - _elm_config->scale); - evas_object_smart_member_add(it->base.view, it->wd->pan_smart); - elm_widget_sub_object_add(it->base.widget, it->base.view); - - if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) strncpy(buf, "tree", sizeof(buf)); - else strncpy(buf, "item", sizeof(buf)); - if (it->wd->compress) strncat(buf, "_compress", sizeof(buf) - strlen(buf)); - - if (in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf)); - strncat(buf, "/", sizeof(buf) - strlen(buf)); - strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf)); - - _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf, elm_widget_style_get(it->base.widget)); - it->spacer = evas_object_rectangle_add(evas_object_evas_get(it->base.widget)); - evas_object_color_set(it->spacer, 0, 0, 0, 0); - elm_widget_sub_object_add(it->base.widget, it->spacer); + it->base.view = edje_object_add(evas_object_evas_get(it->base.widget)); + edje_object_scale_set(it->base.view, + elm_widget_scale_get(it->base.widget) * + _elm_config->scale); + evas_object_smart_member_add(it->base.view, it->wd->pan_smart); + elm_widget_sub_object_add(it->base.widget, it->base.view); + + if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) + strncpy(buf, "tree", sizeof(buf)); + else strncpy(buf, "item", sizeof(buf)); + if (it->wd->compress) + strncat(buf, "_compress", sizeof(buf) - strlen(buf)); + + if (in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf)); + strncat(buf, "/", sizeof(buf) - strlen(buf)); + strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf)); + + _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf, + elm_widget_style_get(it->base.widget)); + it->spacer = + evas_object_rectangle_add(evas_object_evas_get(it->base.widget)); + evas_object_color_set(it->spacer, 0, 0, 0, 0); + elm_widget_sub_object_add(it->base.widget, it->spacer); } for (it2 = it, depth = 0; it2->parent; it2 = it2->parent) depth += 1; it->expanded_depth = depth; @@ -1399,17 +1446,19 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) edje_object_part_swallow(it->base.view, "elm.swallow.pad", it->spacer); if (!calc) { - edje_object_signal_callback_add(it->base.view, "elm,action,expand,toggle", + edje_object_signal_callback_add(it->base.view, + "elm,action,expand,toggle", "elm", _signal_expand_toggle, it); - edje_object_signal_callback_add(it->base.view, "elm,action,expand", "elm", - _signal_expand, it); + edje_object_signal_callback_add(it->base.view, "elm,action,expand", + "elm", _signal_expand, it); edje_object_signal_callback_add(it->base.view, "elm,action,contract", "elm", _signal_contract, it); stacking = edje_object_data_get(it->base.view, "stacking"); if (stacking) { if (!strcmp(stacking, "below")) evas_object_lower(it->base.view); - else if (!strcmp(stacking, "above")) evas_object_raise(it->base.view); + else if (!strcmp(stacking, "above")) + evas_object_raise(it->base.view); } evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, it); @@ -1421,40 +1470,46 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) { if (it->selected != itc->selected) { - if (it->selected) - edje_object_signal_emit(it->base.view, "elm,state,selected", "elm"); + if (it->selected) + edje_object_signal_emit(it->base.view, + "elm,state,selected", "elm"); } if (it->disabled != itc->disabled) { - if (it->disabled) - edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm"); + if (it->disabled) + edje_object_signal_emit(it->base.view, + "elm,state,disabled", "elm"); } if (it->expanded != itc->expanded) { - if (it->expanded) - edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm"); + if (it->expanded) + edje_object_signal_emit(it->base.view, + "elm,state,expanded", "elm"); } } else { - if (it->selected) - edje_object_signal_emit(it->base.view, "elm,state,selected", "elm"); - if (it->disabled) - edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm"); - if (it->expanded) - edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm"); + if (it->selected) + edje_object_signal_emit(it->base.view, + "elm,state,selected", "elm"); + if (it->disabled) + edje_object_signal_emit(it->base.view, + "elm,state,disabled", "elm"); + if (it->expanded) + edje_object_signal_emit(it->base.view, + "elm,state,expanded", "elm"); } } if ((calc) && (it->wd->homogeneous) && (it->wd->item_width)) { /* homogenous genlist shortcut */ - if (!it->mincalcd) - { - it->w = it->minw = it->wd->item_width; - it->h = it->minh = it->wd->item_height; - it->mincalcd = EINA_TRUE; - } + if (!it->mincalcd) + { + it->w = it->minw = it->wd->item_width; + it->h = it->minh = it->wd->item_height; + it->mincalcd = EINA_TRUE; + } } else { @@ -1463,11 +1518,13 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) const Eina_List *l; const char *key; - it->labels = elm_widget_stringlist_get(edje_object_data_get(it->base.view, "labels")); + it->labels = + elm_widget_stringlist_get(edje_object_data_get(it->base.view, + "labels")); EINA_LIST_FOREACH(it->labels, l, key) { char *s = it->itc->func.label_get - ((void *)it->base.data, it->base.widget, l->data); + ((void *)it->base.data, it->base.widget, l->data); if (s) { @@ -1483,11 +1540,13 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) const Eina_List *l; const char *key; - it->icons = elm_widget_stringlist_get(edje_object_data_get(it->base.view, "icons")); + it->icons = + elm_widget_stringlist_get(edje_object_data_get(it->base.view, + "icons")); EINA_LIST_FOREACH(it->icons, l, key) { Evas_Object *ic = it->itc->func.icon_get - ((void *)it->base.data, it->base.widget, l->data); + ((void *)it->base.data, it->base.widget, l->data); if (ic) { @@ -1503,11 +1562,13 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) const Eina_List *l; const char *key; - it->states = elm_widget_stringlist_get(edje_object_data_get(it->base.view, "states")); + it->states = + elm_widget_stringlist_get(edje_object_data_get(it->base.view, + "states")); EINA_LIST_FOREACH(it->states, l, key) { Eina_Bool on = it->itc->func.state_get - ((void *)it->base.data, it->base.widget, l->data); + ((void *)it->base.data, it->base.widget, l->data); if (on) { @@ -1528,11 +1589,12 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) if (it->wd->height_for_width) mw = it->wd->w; if (!it->display_only) - elm_coords_finger_size_adjust(1, &mw, 1, &mh); + elm_coords_finger_size_adjust(1, &mw, 1, &mh); if (it->wd->height_for_width) mw = it->wd->prev_viewport_w; - edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh); + edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, + mh); if (!it->display_only) - elm_coords_finger_size_adjust(1, &mw, 1, &mh); + elm_coords_finger_size_adjust(1, &mw, 1, &mh); it->w = it->minw = mw; it->h = it->minh = mh; it->mincalcd = EINA_TRUE; @@ -1583,7 +1645,7 @@ _item_unrealize(Elm_Genlist_Item *it) it->icons = NULL; elm_widget_stringlist_free(it->states); - EINA_LIST_FREE(it->icon_objs, icon) + EINA_LIST_FREE(it->icon_objs, icon) evas_object_del(icon); it->states = NULL; @@ -1592,7 +1654,10 @@ _item_unrealize(Elm_Genlist_Item *it) } static int -_item_block_recalc(Item_Block *itb, int in, int qadd, int norender) +_item_block_recalc(Item_Block *itb, + int in, + int qadd, + int norender) { const Eina_List *l; Elm_Genlist_Item *it; @@ -1640,7 +1705,9 @@ _item_block_recalc(Item_Block *itb, int in, int qadd, int norender) } static void -_item_block_realize(Item_Block *itb, int in, int full) +_item_block_realize(Item_Block *itb, + int in, + int full) { const Eina_List *l; Elm_Genlist_Item *it; @@ -1684,7 +1751,8 @@ _item_block_unrealize(Item_Block *itb) } static void -_item_block_position(Item_Block *itb, int in) +_item_block_position(Item_Block *itb, + int in) { const Eina_List *l; Elm_Genlist_Item *it; @@ -1692,7 +1760,8 @@ _item_block_position(Item_Block *itb, int in) int vis; evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh); - evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy, &cvw, &cvh); + evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy, + &cvw, &cvh); EINA_LIST_FOREACH(itb->items, l, it) { if (it->delete_me) continue; @@ -1730,11 +1799,11 @@ _item_block_position(Item_Block *itb, int in) static Eina_Bool _must_recalc_idler(void *data) { - Widget_Data *wd = data; - if (wd->calc_job) ecore_job_del(wd->calc_job); - wd->calc_job = ecore_job_add(_calc_job, wd); - wd->must_recalc_idler = NULL; - return ECORE_CALLBACK_CANCEL; + Widget_Data *wd = data; + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + wd->must_recalc_idler = NULL; + return ECORE_CALLBACK_CANCEL; } static void @@ -1759,78 +1828,82 @@ _calc_job(void *data) } EINA_INLIST_FOREACH(wd->blocks, itb) - { - int showme = 0; + { + int showme = 0; - itb->num = in; - showme = itb->showme; - itb->showme = 0; - if (chb) - { - if (itb->realized) _item_block_unrealize(itb); - } - if ((itb->changed) || (changed) || - ((itb->must_recalc) && (!did_must_recalc))) - { - if ((changed) || (itb->must_recalc)) - { - Eina_List *l; - Elm_Genlist_Item *it; - EINA_LIST_FOREACH(itb->items, l, it) - if (it->mincalcd) it->mincalcd = EINA_FALSE; - itb->changed = EINA_TRUE; - if (itb->must_recalc) did_must_recalc = EINA_TRUE; - itb->must_recalc = EINA_FALSE; - } - if (itb->realized) _item_block_unrealize(itb); - showme = _item_block_recalc(itb, in, 0, 1); - chb = itb; - } - itb->y = y; - itb->x = 0; - minh += itb->minh; - if (minw == -1) minw = itb->minw; - else if ((!itb->must_recalc) && (minw < itb->minw)) - { - minw = itb->minw; - minw_change = 1; - } - itb->w = minw; - itb->h = itb->minh; - y += itb->h; - in += itb->count; - if ((showme) && (wd->show_item)) - { - wd->show_item->showme = 0; - if (wd->bring_in) - elm_smart_scroller_region_bring_in(wd->scr, - wd->show_item->x + wd->show_item->block->x, - wd->show_item->y + wd->show_item->block->y, + itb->num = in; + showme = itb->showme; + itb->showme = 0; + if (chb) + { + if (itb->realized) _item_block_unrealize(itb); + } + if ((itb->changed) || (changed) || + ((itb->must_recalc) && (!did_must_recalc))) + { + if ((changed) || (itb->must_recalc)) + { + Eina_List *l; + Elm_Genlist_Item *it; + EINA_LIST_FOREACH(itb->items, l, it) + if (it->mincalcd) it->mincalcd = EINA_FALSE; + itb->changed = EINA_TRUE; + if (itb->must_recalc) did_must_recalc = EINA_TRUE; + itb->must_recalc = EINA_FALSE; + } + if (itb->realized) _item_block_unrealize(itb); + showme = _item_block_recalc(itb, in, 0, 1); + chb = itb; + } + itb->y = y; + itb->x = 0; + minh += itb->minh; + if (minw == -1) minw = itb->minw; + else if ((!itb->must_recalc) && (minw < itb->minw)) + { + minw = itb->minw; + minw_change = 1; + } + itb->w = minw; + itb->h = itb->minh; + y += itb->h; + in += itb->count; + if ((showme) && (wd->show_item)) + { + wd->show_item->showme = 0; + if (wd->bring_in) + elm_smart_scroller_region_bring_in(wd->scr, + wd->show_item->x + + wd->show_item->block->x, + wd->show_item->y + + wd->show_item->block->y, + wd->show_item->block->w, + wd->show_item->h); + else + elm_smart_scroller_child_region_show(wd->scr, + wd->show_item->x + + wd->show_item->block->x, + wd->show_item->y + + wd->show_item->block->y, wd->show_item->block->w, wd->show_item->h); - else - elm_smart_scroller_child_region_show(wd->scr, - wd->show_item->x + wd->show_item->block->x, - wd->show_item->y + wd->show_item->block->y, - wd->show_item->block->w, - wd->show_item->h); - wd->show_item = NULL; - } - } + wd->show_item = NULL; + } + } if (minw_change) { EINA_INLIST_FOREACH(wd->blocks, itb) - { - itb->minw = minw; - itb->w = itb->minw; - } + { + itb->minw = minw; + itb->w = itb->minw; + } } if ((chb) && (EINA_INLIST_GET(chb)->next)) { EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb) - { - if (itb->realized) _item_block_unrealize(itb); - } + { + if (itb->realized) _item_block_unrealize(itb); + } } wd->realminw = minw; if (minw < wd->w) minw = wd->w; @@ -1842,23 +1915,23 @@ _calc_job(void *data) _sizing_eval(wd->obj); if ((wd->anchor_item) && (wd->anchor_item->block)) { - Elm_Genlist_Item *it; - Evas_Coord it_y; - - it = wd->anchor_item; - it_y = wd->anchor_y; - elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x, - it->block->y + it->y + it_y); - wd->anchor_item = it; - wd->anchor_y = it_y; + Elm_Genlist_Item *it; + Evas_Coord it_y; + + it = wd->anchor_item; + it_y = wd->anchor_y; + elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x, + it->block->y + it->y + it_y); + wd->anchor_item = it; + wd->anchor_y = it_y; } } - t = ecore_time_get(); - if (did_must_recalc) - { - if (!wd->must_recalc_idler) - wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd); - } + t = ecore_time_get(); + if (did_must_recalc) + { + if (!wd->must_recalc_idler) + wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd); + } wd->calc_job = NULL; evas_object_smart_changed(wd->pan_smart); } @@ -1874,52 +1947,52 @@ _update_job(void *data) wd->update_job = NULL; num = 0; EINA_INLIST_FOREACH(wd->blocks, itb) - { - Evas_Coord itminw, itminh; - Elm_Genlist_Item *it; + { + Evas_Coord itminw, itminh; + Elm_Genlist_Item *it; - if (!itb->updateme) - { - num += itb->count; - if (position) - _item_block_position(itb, num); - continue; - } - num0 = num; - recalc = 0; - EINA_LIST_FOREACH(itb->items, l2, it) - { - if (it->updateme) - { - itminw = it->w; - itminh = it->h; + if (!itb->updateme) + { + num += itb->count; + if (position) + _item_block_position(itb, num); + continue; + } + num0 = num; + recalc = 0; + EINA_LIST_FOREACH(itb->items, l2, it) + { + if (it->updateme) + { + itminw = it->w; + itminh = it->h; - it->updateme = 0; - if (it->realized) - { - _item_unrealize(it); - _item_realize(it, num, 0); - position = 1; - } - else - { - _item_realize(it, num, 1); - _item_unrealize(it); - } - if ((it->minw != itminw) || (it->minh != itminh)) - recalc = 1; - } - num++; - } - itb->updateme = 0; - if (recalc) - { - position = 1; - itb->changed = EINA_TRUE; - _item_block_recalc(itb, num0, 0, 1); - _item_block_position(itb, num0); - } - } + it->updateme = 0; + if (it->realized) + { + _item_unrealize(it); + _item_realize(it, num, 0); + position = 1; + } + else + { + _item_realize(it, num, 1); + _item_unrealize(it); + } + if ((it->minw != itminw) || (it->minh != itminh)) + recalc = 1; + } + num++; + } + itb->updateme = 0; + if (recalc) + { + position = 1; + itb->changed = EINA_TRUE; + _item_block_recalc(itb, num0, 0, 1); + _item_block_position(itb, num0); + } + } if (position) { if (wd->calc_job) ecore_job_del(wd->calc_job); @@ -1928,11 +2001,13 @@ _update_job(void *data) } static void -_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +_pan_set(Evas_Object *obj, + Evas_Coord x, + Evas_Coord y) { - Pan *sd = evas_object_smart_data_get(obj); - Item_Block *itb; - + Pan *sd = evas_object_smart_data_get(obj); + Item_Block *itb; + // Evas_Coord ow, oh; // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); // ow = sd->wd->minw - ow; @@ -1943,34 +2018,36 @@ _pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) // if (y < 0) y = 0; // if (x > ow) x = ow; // if (y > oh) y = oh; - if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return; - sd->wd->pan_x = x; - sd->wd->pan_y = y; - - EINA_INLIST_FOREACH(sd->wd->blocks, itb) - { + if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return; + sd->wd->pan_x = x; + sd->wd->pan_y = y; + + EINA_INLIST_FOREACH(sd->wd->blocks, itb) + { if ((itb->y + itb->h) > y) { - Elm_Genlist_Item *it; - Eina_List *l2; - - EINA_LIST_FOREACH(itb->items, l2, it) - { - if ((itb->y + it->y) >= y) - { - sd->wd->anchor_item = it; - sd->wd->anchor_y = -(itb->y + it->y - y); - goto done; - } - } + Elm_Genlist_Item *it; + Eina_List *l2; + + EINA_LIST_FOREACH(itb->items, l2, it) + { + if ((itb->y + it->y) >= y) + { + sd->wd->anchor_item = it; + sd->wd->anchor_y = -(itb->y + it->y - y); + goto done; + } + } } - } + } done: - evas_object_smart_changed(obj); + evas_object_smart_changed(obj); } static void -_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +_pan_get(Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y) { Pan *sd = evas_object_smart_data_get(obj); @@ -1979,7 +2056,9 @@ _pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) } static void -_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +_pan_max_get(Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y) { Pan *sd = evas_object_smart_data_get(obj); Evas_Coord ow, oh; @@ -1994,14 +2073,18 @@ _pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) } static void -_pan_min_get(Evas_Object *obj __UNUSED__, Evas_Coord *x, Evas_Coord *y) +_pan_min_get(Evas_Object *obj __UNUSED__, + Evas_Coord *x, + Evas_Coord *y) { if (x) *x = 0; if (y) *y = 0; } static void -_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) +_pan_child_size_get(Evas_Object *obj, + Evas_Coord *w, + Evas_Coord *h) { Pan *sd = evas_object_smart_data_get(obj); @@ -2032,8 +2115,8 @@ _pan_del(Evas_Object *obj) if (!sd) return; if (sd->resize_job) { - ecore_job_del(sd->resize_job); - sd->resize_job = NULL; + ecore_job_del(sd->resize_job); + sd->resize_job = NULL; } _pan_sc.del(obj); } @@ -2041,13 +2124,15 @@ _pan_del(Evas_Object *obj) static void _pan_resize_job(void *data) { - Pan *sd = data; - _sizing_eval(sd->wd->obj); - sd->resize_job = NULL; + Pan *sd = data; + _sizing_eval(sd->wd->obj); + sd->resize_job = NULL; } static void -_pan_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +_pan_resize(Evas_Object *obj, + Evas_Coord w, + Evas_Coord h) { Pan *sd = evas_object_smart_data_get(obj); Evas_Coord ow, oh; @@ -2055,10 +2140,10 @@ _pan_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); if ((ow == w) && (oh == h)) return; if ((sd->wd->height_for_width) && (ow != w)) - { - if (sd->resize_job) ecore_job_del(sd->resize_job); - sd->resize_job = ecore_job_add(_pan_resize_job, sd); - } + { + if (sd->resize_job) ecore_job_del(sd->resize_job); + sd->resize_job = ecore_job_add(_pan_resize_job, sd); + } if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job); sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd); } @@ -2074,27 +2159,29 @@ _pan_calculate(Evas_Object *obj) evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh); EINA_INLIST_FOREACH(sd->wd->blocks, itb) - { - itb->w = sd->wd->minw; - if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox, - itb->y - sd->wd->pan_y + oy, - itb->w, itb->h, - cvx, cvy, cvw, cvh)) - { - if ((!itb->realized) || (itb->changed)) - _item_block_realize(itb, in, 0); - _item_block_position(itb, in); - } - else - { - if (itb->realized) _item_block_unrealize(itb); - } - in += itb->count; - } + { + itb->w = sd->wd->minw; + if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox, + itb->y - sd->wd->pan_y + oy, + itb->w, itb->h, + cvx, cvy, cvw, cvh)) + { + if ((!itb->realized) || (itb->changed)) + _item_block_realize(itb, in, 0); + _item_block_position(itb, in); + } + else + { + if (itb->realized) _item_block_unrealize(itb); + } + in += itb->count; + } } static void -_pan_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__) +_pan_move(Evas_Object *obj, + Evas_Coord x __UNUSED__, + Evas_Coord y __UNUSED__) { Pan *sd = evas_object_smart_data_get(obj); @@ -2103,7 +2190,9 @@ _pan_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__) } static void -_hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +_hold_on(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -2111,7 +2200,9 @@ _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) } static void -_hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +_hold_off(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -2119,7 +2210,9 @@ _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) } static void -_freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +_freeze_on(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -2127,7 +2220,9 @@ _freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) } static void -_freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +_freeze_off(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -2135,28 +2230,36 @@ _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__ } static void -_scroll_edge_left(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__) +_scroll_edge_left(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *obj = data; evas_object_smart_callback_call(obj, "scroll,edge,left", NULL); } static void -_scroll_edge_right(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__) +_scroll_edge_right(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *obj = data; evas_object_smart_callback_call(obj, "scroll,edge,right", NULL); } static void -_scroll_edge_top(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__) +_scroll_edge_top(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *obj = data; evas_object_smart_callback_call(obj, "scroll,edge,top", NULL); } static void -_scroll_edge_bottom(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__) +_scroll_edge_bottom(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) { Evas_Object *obj = data; evas_object_smart_callback_call(obj, "scroll,edge,bottom", NULL); @@ -2219,9 +2322,11 @@ elm_genlist_add(Evas_Object *parent) elm_widget_resize_object_set(obj, wd->scr); evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj); - evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right, obj); + evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right, + obj); evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj); - evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom, obj); + evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom, + obj); wd->obj = obj; wd->mode = ELM_LIST_SCROLL; @@ -2251,11 +2356,13 @@ elm_genlist_add(Evas_Object *parent) } static Elm_Genlist_Item * -_item_new(Widget_Data *wd, const Elm_Genlist_Item_Class *itc, - const void *data, Elm_Genlist_Item *parent, - Elm_Genlist_Item_Flags flags, - Evas_Smart_Cb func, - const void *func_data) +_item_new(Widget_Data *wd, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Genlist_Item *parent, + Elm_Genlist_Item_Flags flags, + Evas_Smart_Cb func, + const void *func_data) { Elm_Genlist_Item *it; @@ -2274,7 +2381,8 @@ _item_new(Widget_Data *wd, const Elm_Genlist_Item_Class *itc, } static void -_item_block_add(Widget_Data *wd, Elm_Genlist_Item *it) +_item_block_add(Widget_Data *wd, + Elm_Genlist_Item *it) { Item_Block *itb = NULL; @@ -2288,29 +2396,27 @@ newblock: itb->wd = wd; if (!it->rel->block) { - wd->blocks = - eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); + wd->blocks = + eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); itb->items = eina_list_append(itb->items, it); } else { if (it->before) { - wd->blocks = - eina_inlist_prepend_relative(wd->blocks, - EINA_INLIST_GET(itb), - EINA_INLIST_GET(it->rel->block)); - itb->items = - eina_list_prepend_relative(itb->items, it, it->rel); + wd->blocks = eina_inlist_prepend_relative + (wd->blocks, EINA_INLIST_GET(itb), + EINA_INLIST_GET(it->rel->block)); + itb->items = + eina_list_prepend_relative(itb->items, it, it->rel); } else { - wd->blocks = - eina_inlist_append_relative(wd->blocks, - EINA_INLIST_GET(itb), - EINA_INLIST_GET(it->rel->block)); - itb->items = - eina_list_append_relative(itb->items, it, it->rel); + wd->blocks = eina_inlist_append_relative + (wd->blocks, EINA_INLIST_GET(itb), + EINA_INLIST_GET(it->rel->block)); + itb->items = + eina_list_append_relative(itb->items, it, it->rel); } } } @@ -2326,8 +2432,8 @@ newblock: itb = calloc(1, sizeof(Item_Block)); if (!itb) return; itb->wd = wd; - wd->blocks = - eina_inlist_prepend(wd->blocks, + wd->blocks = + eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb)); } } @@ -2336,8 +2442,8 @@ newblock: itb = calloc(1, sizeof(Item_Block)); if (!itb) return; itb->wd = wd; - wd->blocks = - eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb)); + wd->blocks = + eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb)); } itb->items = eina_list_prepend(itb->items, it); } @@ -2351,9 +2457,9 @@ newblock: itb = calloc(1, sizeof(Item_Block)); if (!itb) return; itb->wd = wd; - wd->blocks = - eina_inlist_append(wd->blocks, - EINA_INLIST_GET(itb)); + wd->blocks = + eina_inlist_append(wd->blocks, + EINA_INLIST_GET(itb)); } } else @@ -2361,8 +2467,8 @@ newblock: itb = calloc(1, sizeof(Item_Block)); if (!itb) return; itb->wd = wd; - wd->blocks = - eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); + wd->blocks = + eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); } itb->items = eina_list_append(itb->items, it); } @@ -2373,9 +2479,9 @@ newblock: itb = it->rel->block; if (!itb) goto newblock; if (it->before) - itb->items = eina_list_prepend_relative(itb->items, it, it->rel); + itb->items = eina_list_prepend_relative(itb->items, it, it->rel); else - itb->items = eina_list_append_relative(itb->items, it, it->rel); + itb->items = eina_list_append_relative(itb->items, it, it->rel); } itb->count++; itb->changed = EINA_TRUE; @@ -2386,7 +2492,7 @@ newblock: { it->rel->relcount--; if ((it->rel->delete_me) && (!it->rel->relcount)) - _item_del(it->rel); + _item_del(it->rel); it->rel = NULL; } if (itb->count > itb->wd->max_items_per_block) @@ -2399,9 +2505,9 @@ newblock: itb2 = calloc(1, sizeof(Item_Block)); if (!itb2) return; itb2->wd = wd; - wd->blocks = - eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2), - EINA_INLIST_GET(itb)); + wd->blocks = + eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2), + EINA_INLIST_GET(itb)); itb2->changed = EINA_TRUE; while ((itb->count > newc) && (itb->items)) { @@ -2420,7 +2526,8 @@ newblock: } static int -_queue_proecess(Widget_Data *wd, int norender) +_queue_proecess(Widget_Data *wd, + int norender) { int n, showme = 0; double t0, t; @@ -2437,7 +2544,8 @@ _queue_proecess(Widget_Data *wd, int norender) t = ecore_time_get(); if (it->block->changed) { - showme = _item_block_recalc(it->block, it->block->num, 1, norender); + showme = _item_block_recalc(it->block, it->block->num, 1, + norender); it->block->changed = 0; } if (showme) it->block->showme = 1; @@ -2454,11 +2562,11 @@ _item_idler(void *data) { Widget_Data *wd = data; - //xxx - //static double q_start = 0.0; - //if (q_start == 0.0) q_start = ecore_time_get(); - //xxx - + //xxx + //static double q_start = 0.0; + //if (q_start == 0.0) q_start = ecore_time_get(); + //xxx + if (_queue_proecess(wd, 1) > 0) { if (wd->calc_job) ecore_job_del(wd->calc_job); @@ -2466,9 +2574,9 @@ _item_idler(void *data) } if (!wd->queue) { - //xxx - //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start); - //xxx + //xxx + //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start); + //xxx wd->queue_idler = NULL; return ECORE_CALLBACK_CANCEL; } @@ -2476,7 +2584,8 @@ _item_idler(void *data) } static void -_item_queue(Widget_Data *wd, Elm_Genlist_Item *it) +_item_queue(Widget_Data *wd, + Elm_Genlist_Item *it) { if (it->queued) return; it->queued = EINA_TRUE; @@ -2496,8 +2605,8 @@ _item_queue(Widget_Data *wd, Elm_Genlist_Item *it) /** * Append item to the end of the genlist * - * This appends the given item to the end of the list or the end of the - * children if the parent is given. + * This appends the given item to the end of the list or the end of + * the children if the parent is given. * * @param obj The genlist object * @param itc The item class for the item @@ -2511,14 +2620,18 @@ _item_queue(Widget_Data *wd, Elm_Genlist_Item *it) * @ingroup Genlist */ EAPI Elm_Genlist_Item * -elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, - const void *data, Elm_Genlist_Item *parent, - Elm_Genlist_Item_Flags flags, - Evas_Smart_Cb func, const void *func_data) +elm_genlist_item_append(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Genlist_Item *parent, + Elm_Genlist_Item_Flags flags, + Evas_Smart_Cb func, + const void *func_data) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); - Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, func_data); + Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, + func_data); if (!wd) return NULL; if (!it) return NULL; if (!it->parent) @@ -2533,9 +2646,9 @@ elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, if (ll) it2 = ll->data; it->parent->items = eina_list_append(it->parent->items, it); if (!it2) it2 = it->parent; - wd->items = - eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), - EINA_INLIST_GET(it2)); + wd->items = + eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(it2)); it->rel = it2; it->rel->relcount++; } @@ -2547,8 +2660,8 @@ elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, /** * Prepend item at start of the genlist * - * This adds an item to the beginning of the list or beginning of the children - * of the parent if given. + * This adds an item to the beginning of the list or beginning of the + * children of the parent if given. * * @param obj The genlist object * @param itc The item class for the item @@ -2562,18 +2675,22 @@ elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, * @ingroup Genlist */ EAPI Elm_Genlist_Item * -elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, - const void *data, Elm_Genlist_Item *parent, - Elm_Genlist_Item_Flags flags, - Evas_Smart_Cb func, const void *func_data) +elm_genlist_item_prepend(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Genlist_Item *parent, + Elm_Genlist_Item_Flags flags, + Evas_Smart_Cb func, + const void *func_data) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); - Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, func_data); + Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, + func_data); if (!wd) return NULL; if (!it) return NULL; if (!it->parent) - wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it)); + wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it)); else { printf("FIXME: 12 tree not handled yet\n"); @@ -2587,8 +2704,8 @@ elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, /** * Insert item before another in the genlist * - * This inserts an item before another in the list. It will be in the same tree - * level as the item it is inseted before. + * This inserts an item before another in the list. It will be in the + * same tree level as the item it is inseted before. * * @param obj The genlist object * @param itc The item class for the item @@ -2602,20 +2719,24 @@ elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, * @ingroup Genlist */ EAPI Elm_Genlist_Item * -elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, - const void *data, Elm_Genlist_Item *before, - Elm_Genlist_Item_Flags flags, - Evas_Smart_Cb func, const void *func_data) +elm_genlist_item_insert_before(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Genlist_Item *before, + Elm_Genlist_Item_Flags flags, + Evas_Smart_Cb func, + const void *func_data) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL); Widget_Data *wd = elm_widget_data_get(obj); - Elm_Genlist_Item *it = _item_new(wd, itc, data, NULL, flags, func, func_data); + Elm_Genlist_Item *it = _item_new(wd, itc, data, NULL, flags, func, + func_data); if (!wd) return NULL; if (!it) return NULL; if (!it->parent) - wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), - EINA_INLIST_GET(before)); + wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(before)); else { printf("FIXME: 13 tree not handled yet\n"); @@ -2630,8 +2751,8 @@ elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *i /** * Insert and item after another in the genlst * - * This inserts an item after another in the list. It will be in the same tree - * level as the item it is inseted after. + * This inserts an item after another in the list. It will be in the + * same tree level as the item it is inseted after. * * @param obj The genlist object * @param itc The item class for the item @@ -2645,19 +2766,23 @@ elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *i * @ingroup Genlist */ EAPI Elm_Genlist_Item * -elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, - const void *data, Elm_Genlist_Item *after, - Elm_Genlist_Item_Flags flags, - Evas_Smart_Cb func, const void *func_data) +elm_genlist_item_insert_after(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Genlist_Item *after, + Elm_Genlist_Item_Flags flags, + Evas_Smart_Cb func, + const void *func_data) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL); Widget_Data *wd = elm_widget_data_get(obj); - Elm_Genlist_Item *it = _item_new(wd, itc, data, NULL, flags, func, func_data); + Elm_Genlist_Item *it = _item_new(wd, itc, data, NULL, flags, func, + func_data); if (!wd) return NULL; if (!it) return NULL; if (!it->parent) - wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), + wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after)); else { @@ -2691,9 +2816,9 @@ elm_genlist_clear(Evas_Object *obj) wd->clear_me = 1; EINA_INLIST_FOREACH(wd->items, it) - { - it->delete_me = 1; - } + { + it->delete_me = 1; + } return; } wd->clear_me = 0; @@ -2701,17 +2826,18 @@ elm_genlist_clear(Evas_Object *obj) { Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items); - if (wd->anchor_item == it) - { - wd->anchor_item = (Elm_Genlist_Item *)(EINA_INLIST_GET(it)->next); - if (!wd->anchor_item) - wd->anchor_item = (Elm_Genlist_Item *)(EINA_INLIST_GET(it)->prev); - } + if (wd->anchor_item == it) + { + wd->anchor_item = (Elm_Genlist_Item *)(EINA_INLIST_GET(it)->next); + if (!wd->anchor_item) + wd->anchor_item = + (Elm_Genlist_Item *)(EINA_INLIST_GET(it)->prev); + } wd->items = eina_inlist_remove(wd->items, wd->items); elm_widget_item_pre_notify_del(it); if (it->realized) _item_unrealize(it); if (it->itc->func.del) - it->itc->func.del((void *)it->base.data, it->base.widget); + it->itc->func.del((void *)it->base.data, it->base.widget); if (it->long_timer) ecore_timer_del(it->long_timer); if (it->swipe_timer) ecore_timer_del(it->swipe_timer); elm_widget_item_del(it); @@ -2766,8 +2892,8 @@ elm_genlist_clear(Evas_Object *obj) /** * Enable or disable multi-select in the genlist * - * This enables (EINA_TRUE) or disableds (EINA_FALSE) multi-select in the list. This allows - * more than 1 item to be selected. + * This enables (EINA_TRUE) or disableds (EINA_FALSE) multi-select in + * the list. This allows more than 1 item to be selected. * * @param obj The genlist object * @param multi Multi-select enable/disable @@ -2775,7 +2901,8 @@ elm_genlist_clear(Evas_Object *obj) * @ingroup Genlist */ EAPI void -elm_genlist_multi_select_set(Evas_Object *obj, Eina_Bool multi) +elm_genlist_multi_select_set(Evas_Object *obj, + Eina_Bool multi) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -2801,13 +2928,13 @@ elm_genlist_multi_select_get(const Evas_Object *obj) return wd->multi; } - /** * Get the selectd item in the genlist * - * This gets the selected item in the list (if multi-select is enabled only - * the first item in the list is selected - which is not very useful, so see - * elm_genlist_selected_items_get()for when multi-select is used). + * This gets the selected item in the list (if multi-select is enabled + * only the first item in the list is selected - which is not very + * useful, so see elm_genlist_selected_items_get()for when + * multi-select is used). * * If no item is selected, NULL is returned. * @@ -2829,9 +2956,10 @@ elm_genlist_selected_item_get(const Evas_Object *obj) /** * Get a list of selected items in the genlist * - * This retgurns a list of the selected items. This list pointer is only valid - * so long as no items are selected or unselected (or unselected implicitly - * by deletion). The list contains Elm_Genlist_Item pointers. + * This retgurns a list of the selected items. This list pointer is + * only valid so long as no items are selected or unselected (or + * unselected implicitly by deletion). The list contains + * Elm_Genlist_Item pointers. * * @param obj The genlist object * @return The list of selected items, nor NULL if none are selected. @@ -2852,9 +2980,9 @@ elm_genlist_selected_items_get(const Evas_Object *obj) * * This returns a list of the realized items in the genlist. The list * contains Elm_Genlist_Item pointers. The list must be freed by the - * caller when done with eina_list_free(). The item pointers in the list - * are only vallid so long as those items are not deleted or the genlist is - * not deleted. + * caller when done with eina_list_free(). The item pointers in the + * list are only vallid so long as those items are not deleted or the + * genlist is not deleted. * * @param obj The genlist object * @return The list of realized items, nor NULL if none are realized. @@ -2871,37 +2999,38 @@ elm_genlist_realized_items_get(const Evas_Object *obj) Eina_Bool done = EINA_FALSE; if (!wd) return NULL; EINA_INLIST_FOREACH(wd->blocks, itb) - { - if (itb->realized) - { - Eina_List *l; - Elm_Genlist_Item *it; + { + if (itb->realized) + { + Eina_List *l; + Elm_Genlist_Item *it; - done = 1; - EINA_LIST_FOREACH(itb->items, l, it) - { - if (it->realized) list = eina_list_append(list, it); - } - } - else - { - if (done) break; - } - } + done = 1; + EINA_LIST_FOREACH(itb->items, l, it) + { + if (it->realized) list = eina_list_append(list, it); + } + } + else + { + if (done) break; + } + } return list; } /** * Get the item that is at the x, y canvas coords * - * This returns the item at the given coordinates (which are canvas relative - * not object-relative). If an item is at that coordinate, that item handle - * is returned, and if @p posret is not NULL, the integer pointed to is set - * to a value of -1, 0 or 1, depending if the coordinate is on the upper - * portion of that item (-1), on the middle section (0) or on the lower part - * (1). If NULL is returned as an item (no item found there), then posret - * may indicate -1 or 1 based if the coordinate is above or below all items - * respectively in the genlist. + * This returns the item at the given coordinates (which are canvas + * relative not object-relative). If an item is at that coordinate, + * that item handle is returned, and if @p posret is not NULL, the + * integer pointed to is set to a value of -1, 0 or 1, depending if + * the coordinate is on the upper portion of that item (-1), on the + * middle section (0) or on the lower part (1). If NULL is returned as + * an item (no item found there), then posret may indicate -1 or 1 + * based if the coordinate is above or below all items respectively in + * the genlist. * * @param it The item * @param x The input x coordinate @@ -2912,7 +3041,10 @@ elm_genlist_realized_items_get(const Evas_Object *obj) * @ingroup Genlist */ EAPI Elm_Genlist_Item * -elm_genlist_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *posret) +elm_genlist_at_xy_item_get(const Evas_Object *obj, + Evas_Coord x, + Evas_Coord y, + int *posret) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); @@ -2923,33 +3055,34 @@ elm_genlist_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, i evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh); lasty = oy; EINA_INLIST_FOREACH(wd->blocks, itb) - { - Eina_List *l; - Elm_Genlist_Item *it; + { + Eina_List *l; + Elm_Genlist_Item *it; - if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x, - oy + itb->y - itb->wd->pan_y, - itb->w, itb->h, x, y, 1, 1)) - continue; - EINA_LIST_FOREACH(itb->items, l, it) - { - Evas_Coord itx, ity; + if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x, + oy + itb->y - itb->wd->pan_y, + itb->w, itb->h, x, y, 1, 1)) + continue; + EINA_LIST_FOREACH(itb->items, l, it) + { + Evas_Coord itx, ity; - itx = ox + itb->x + it->x - itb->wd->pan_x; - ity = oy + itb->y + it->y - itb->wd->pan_y; - if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1)) - { - if (posret) - { - if (y <= (ity + (it->h / 4))) *posret = -1; - else if (y >= (ity + it->h - (it->h / 4))) *posret = 1; - else *posret = 0; - } - return it; - } - lasty = ity + it->h; - } - } + itx = ox + itb->x + it->x - itb->wd->pan_x; + ity = oy + itb->y + it->y - itb->wd->pan_y; + if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1)) + { + if (posret) + { + if (y <= (ity + (it->h / 4))) *posret = -1; + else if (y >= (ity + it->h - (it->h / 4))) + *posret = 1; + else *posret = 0; + } + return it; + } + lasty = ity + it->h; + } + } if (posret) { if (y > lasty) *posret = 1; @@ -2977,7 +3110,7 @@ elm_genlist_first_item_get(const Evas_Object *obj) if (!wd->items) return NULL; Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items); while ((it) && (it->delete_me)) - it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); + it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); return it; } @@ -2999,7 +3132,7 @@ elm_genlist_last_item_get(const Evas_Object *obj) Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last); if (!wd) return NULL; while ((it) && (it->delete_me)) - it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); + it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); return it; } @@ -3116,7 +3249,8 @@ elm_genlist_item_subitems_clear(Elm_Genlist_Item *it) * @ingroup Genlist */ EAPI void -elm_genlist_item_selected_set(Elm_Genlist_Item *it, Eina_Bool selected) +elm_genlist_item_selected_set(Elm_Genlist_Item *it, + Eina_Bool selected) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); Widget_Data *wd = elm_widget_data_get(it->base.widget); @@ -3130,7 +3264,7 @@ elm_genlist_item_selected_set(Elm_Genlist_Item *it, Eina_Bool selected) if (!wd->multi) { while (wd->selected) - _item_unselect(wd->selected->data); + _item_unselect(wd->selected->data); } _item_hilight(it); _item_select(it); @@ -3168,7 +3302,8 @@ elm_genlist_item_selected_get(const Elm_Genlist_Item *it) * @ingroup Genlist */ EAPI void -elm_genlist_item_expanded_set(Elm_Genlist_Item *it, Eina_Bool expanded) +elm_genlist_item_expanded_set(Elm_Genlist_Item *it, + Eina_Bool expanded) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); if (it->expanded == expanded) return; @@ -3176,13 +3311,13 @@ elm_genlist_item_expanded_set(Elm_Genlist_Item *it, Eina_Bool expanded) if (it->expanded) { if (it->realized) - edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm"); + edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm"); evas_object_smart_callback_call(it->base.widget, "expanded", it); } else { if (it->realized) - edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm"); + edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm"); evas_object_smart_callback_call(it->base.widget, "contracted", it); } } @@ -3222,9 +3357,9 @@ elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it) /** * Sets the disabled state of an item. * - * A disabled item cannot be selected or unselected. It will also change - * appearance to appear disabled. This sets the disabled state (1 disabled, 0 - * not disabled). + * A disabled item cannot be selected or unselected. It will also + * change appearance to appear disabled. This sets the disabled state + * (1 disabled, 0 not disabled). * * @param it The item * @param disabled The disabled state @@ -3232,7 +3367,8 @@ elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it) * @ingroup Genlist */ EAPI void -elm_genlist_item_disabled_set(Elm_Genlist_Item *it, Eina_Bool disabled) +elm_genlist_item_disabled_set(Elm_Genlist_Item *it, + Eina_Bool disabled) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); if (it->disabled == disabled) return; @@ -3241,9 +3377,9 @@ elm_genlist_item_disabled_set(Elm_Genlist_Item *it, Eina_Bool disabled) if (it->realized) { if (it->disabled) - edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm"); + edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm"); else - edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm"); + edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm"); } } @@ -3268,9 +3404,10 @@ elm_genlist_item_disabled_get(const Elm_Genlist_Item *it) /** * Sets the display only state of an item. * - * A display only item cannot be selected or unselected. It is for display - * only and not selecting or otherwise clicking, dragging etc. by the user, - * thus finger size rules will not be applied to this item. + * A display only item cannot be selected or unselected. It is for + * display only and not selecting or otherwise clicking, dragging + * etc. by the user, thus finger size rules will not be applied to + * this item. * * @param it The item * @param display_only The display only state @@ -3278,7 +3415,8 @@ elm_genlist_item_disabled_get(const Elm_Genlist_Item *it) * @ingroup Genlist */ EAPI void -elm_genlist_item_display_only_set(Elm_Genlist_Item *it, Eina_Bool display_only) +elm_genlist_item_display_only_set(Elm_Genlist_Item *it, + Eina_Bool display_only) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); if (!it->block) return; @@ -3313,8 +3451,8 @@ elm_genlist_item_display_only_get(const Elm_Genlist_Item *it) /** * Show the given item * - * This causes genlist to jump to the given item @p it and show it (by scrolling), - * if it is not fully visible. + * This causes genlist to jump to the given item @p it and show it (by + * scrolling), if it is not fully visible. * * @param it The item * @@ -3346,9 +3484,9 @@ elm_genlist_item_show(Elm_Genlist_Item *it) /** * Bring in the given item * - * This causes genlist to jump to the given item @p it and show it (by scrolling), - * if it is not fully visible. This may use animation to do so and take a - * period of time + * This causes genlist to jump to the given item @p it and show it (by + * scrolling), if it is not fully visible. This may use animation to + * do so and take a period of time * * @param it The item * @@ -3380,8 +3518,8 @@ elm_genlist_item_bring_in(Elm_Genlist_Item *it) /** * Show the given item at the top * - * This causes genlist to jump to the given item @p it and show it (by scrolling), - * if it is not fully visible. + * This causes genlist to jump to the given item @p it and show it (by + * scrolling), if it is not fully visible. * * @param it The item * @@ -3416,9 +3554,9 @@ elm_genlist_item_top_show(Elm_Genlist_Item *it) /** * Bring in the given item at the top * - * This causes genlist to jump to the given item @p it and show it (by scrolling), - * if it is not fully visible. This may use animation to do so and take a - * period of time + * This causes genlist to jump to the given item @p it and show it (by + * scrolling), if it is not fully visible. This may use animation to + * do so and take a period of time * * @param it The item * @@ -3453,8 +3591,8 @@ elm_genlist_item_top_bring_in(Elm_Genlist_Item *it) /** * Show the given item at the middle * - * This causes genlist to jump to the given item @p it and show it (by scrolling), - * if it is not fully visible. + * This causes genlist to jump to the given item @p it and show it (by + * scrolling), if it is not fully visible. * * @param it The item * @@ -3482,17 +3620,16 @@ elm_genlist_item_middle_show(Elm_Genlist_Item *it) evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh); elm_smart_scroller_child_region_show(it->wd->scr, it->x + it->block->x, - it->y + it->block->y - oh/2 + it->h/2, - it->block->w, oh); + it->y + it->block->y - oh / 2 + + it->h / 2, it->block->w, oh); } - /** * Bring in the given item at the middle * - * This causes genlist to jump to the given item @p it and show it (by scrolling), - * if it is not fully visible. This may use animation to do so and take a - * period of time + * This causes genlist to jump to the given item @p it and show it (by + * scrolling), if it is not fully visible. This may use animation to + * do so and take a period of time * * @param it The item * @@ -3520,15 +3657,15 @@ elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it) evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh); elm_smart_scroller_region_bring_in(it->wd->scr, it->x + it->block->x, - it->y + it->block->y - oh/2 + it->h/2, + it->y + it->block->y - oh / 2 + it->h / 2, it->block->w, oh); } /** * Delete a given item * - * This deletes the item from genlist and calls the genlist item del class - * callback defined in the item class, if it is set. + * This deletes the item from genlist and calls the genlist item del + * class callback defined in the item class, if it is set. * * @param it The item * @@ -3544,7 +3681,9 @@ elm_genlist_item_del(Elm_Genlist_Item *it) elm_genlist_item_subitems_clear(it); it->delete_me = EINA_TRUE; if (it->wd->show_item == it) it->wd->show_item = NULL; - if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it); + if (it->selected) + it->wd->selected = eina_list_remove(it->wd->selected, + it); if (it->block) { if (it->realized) _item_unrealize(it); @@ -3553,7 +3692,7 @@ elm_genlist_item_del(Elm_Genlist_Item *it) it->wd->calc_job = ecore_job_add(_calc_job, it->wd); } if (it->itc->func.del) - it->itc->func.del((void *)it->base.data, it->base.widget); + it->itc->func.del((void *)it->base.data, it->base.widget); return; } _item_del(it); @@ -3573,7 +3712,8 @@ elm_genlist_item_del(Elm_Genlist_Item *it) * @ingroup Genlist */ EAPI void -elm_genlist_item_data_set(Elm_Genlist_Item *it, const void *data) +elm_genlist_item_data_set(Elm_Genlist_Item *it, + const void *data) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); elm_widget_item_data_set(it, data); @@ -3583,8 +3723,8 @@ elm_genlist_item_data_set(Elm_Genlist_Item *it, const void *data) /** * Get the data item from the genlist item * - * This returns the data value passed on the elm_genlist_item_append() and - * related item addition calls. + * This returns the data value passed on the elm_genlist_item_append() + * and related item addition calls. * * @param it The item * @return The data pointer provided when created @@ -3601,9 +3741,10 @@ elm_genlist_item_data_get(const Elm_Genlist_Item *it) /** * Tells genlist to "orphan" icons fetchs by the item class * - * This instructs genlist to release references to icons in the item, meaning - * that they will no longer be managed by genlist and are floating "orphans" - * that can be re-used elsewhere if the user wants to. + * This instructs genlist to release references to icons in the item, + * meaning that they will no longer be managed by genlist and are + * floating "orphans" that can be re-used elsewhere if the user wants + * to. * * @param it The item * @@ -3625,12 +3766,12 @@ elm_genlist_item_icons_orphan(Elm_Genlist_Item *it) /** * Get the real evas object of the genlist item * - * This returns the actual evas object used for the specified genlist item. - * This may be NULL as it may not be created, and ma be deleted at any time - * by genlist. Do not modify this object (move, resize, show, hide etc.) as - * genlist is controlling it. This function is for querying, emitting - * custom signals or hooking lower level callbacks for events. Do not - * delete this object under any circumstances. + * This returns the actual evas object used for the specified genlist + * item. This may be NULL as it may not be created, and ma be deleted + * at any time by genlist. Do not modify this object (move, resize, + * show, hide etc.) as genlist is controlling it. This function is for + * querying, emitting custom signals or hooking lower level callbacks + * for events. Do not delete this object under any circumstances. * * @param it The item * @return The objct pointer @@ -3647,9 +3788,9 @@ elm_genlist_item_object_get(const Elm_Genlist_Item *it) /** * Update the contents of an item * - * This updates an item by calling all the item class functions again to get - * the icons, labels and states. Use this when the original item data has - * changed and the changes are desired to be reflected. + * This updates an item by calling all the item class functions again + * to get the icons, labels and states. Use this when the original + * item data has changed and the changes are desired to be reflected. * * @param it The item * @@ -3677,7 +3818,8 @@ elm_genlist_item_update(Elm_Genlist_Item *it) * @ingroup Genlist */ EAPI void -elm_genlist_item_item_class_update(Elm_Genlist_Item *it, const Elm_Genlist_Item_Class *itc) +elm_genlist_item_item_class_update(Elm_Genlist_Item *it, + const Elm_Genlist_Item_Class *itc) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); if (!it->block) return; @@ -3688,7 +3830,9 @@ elm_genlist_item_item_class_update(Elm_Genlist_Item *it, const Elm_Genlist_Item_ } static Evas_Object * -_elm_genlist_item_label_create(void *data, Evas_Object *obj, void *item __UNUSED__) +_elm_genlist_item_label_create(void *data, + Evas_Object *obj, + void *item __UNUSED__) { Evas_Object *label = elm_label_add(obj); if (!label) @@ -3699,7 +3843,9 @@ _elm_genlist_item_label_create(void *data, Evas_Object *obj, void *item __UNUSED } static void -_elm_genlist_item_label_del_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_elm_genlist_item_label_del_cb(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { eina_stringshare_del(data); } @@ -3710,27 +3856,30 @@ _elm_genlist_item_label_del_cb(void *data, Evas_Object *obj __UNUSED__, void *ev * @param item Target item * @param text The text to set in the content * - * Setup the text as tooltip to object. The item can have only one tooltip, - * so any previous tooltip data is removed. + * Setup the text as tooltip to object. The item can have only one + * tooltip, so any previous tooltip data is removed. * * @ingroup Genlist */ EAPI void -elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item, const char *text) +elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item, + const char *text) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item); text = eina_stringshare_add(text); - elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create, text, _elm_genlist_item_label_del_cb); + elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create, + text, + _elm_genlist_item_label_del_cb); } /** * Set the content to be shown in the tooltip item * - * Setup the tooltip to item. The item can have only one tooltip, - * so any previous tooltip data is removed. @p func(with @p data) will - * be called every time that need show the tooltip and it should - * return a valid Evas_Object. This object is then managed fully by - * tooltip system and is deleted when the tooltip is gone. + * Setup the tooltip to item. The item can have only one tooltip, so + * any previous tooltip data is removed. @p func(with @p data) will be + * called every time that need show the tooltip and it should return a + * valid Evas_Object. This object is then managed fully by tooltip + * system and is deleted when the tooltip is gone. * * @param item the genlist item being attached a tooltip. * @param func the function used to create the tooltip contents. @@ -3744,7 +3893,10 @@ elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item, const char *text) * @ingroup Genlist */ EAPI void -elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb) +elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item, + Elm_Tooltip_Item_Content_Cb func, + const void *data, + Evas_Smart_Cb del_cb) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error); @@ -3752,8 +3904,8 @@ elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item, Elm_Tooltip_Item return; if (item->tooltip.del_cb) - item->tooltip.del_cb((void *)item->tooltip.data, - item->base.widget, item); + item->tooltip.del_cb((void *)item->tooltip.data, + item->base.widget, item); item->tooltip.content_cb = func; item->tooltip.data = data; @@ -3769,7 +3921,7 @@ elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item, Elm_Tooltip_Item return; - error: +error: if (del_cb) del_cb((void *)data, NULL, NULL); } @@ -3815,7 +3967,8 @@ elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item) * @ingroup Genlist */ EAPI void -elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item, const char *style) +elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item, + const char *style) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item); eina_stringshare_replace(&item->tooltip.style, style); @@ -3848,7 +4001,8 @@ elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item) * @ingroup Genlist */ EAPI void -elm_genlist_item_cursor_set(Elm_Genlist_Item *item, const char *cursor) +elm_genlist_item_cursor_set(Elm_Genlist_Item *item, + const char *cursor) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item); eina_stringshare_replace(&item->mouse_cursor, cursor); @@ -3904,7 +4058,8 @@ elm_genlist_item_cursor_unset(Elm_Genlist_Item *item) * @ingroup Genlist */ EAPI void -elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item, const char *style) +elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item, + const char *style) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item); elm_widget_item_cursor_style_set(item, style); @@ -3930,18 +4085,20 @@ elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item) * Set if the cursor set should be searched on the theme or should use * the provided by the engine, only. * - * @note before you set if should look on theme you should define a cursor - * with elm_object_cursor_set(). By default it will only look for cursors - * provided by the engine. + * @note before you set if should look on theme you should define a + * cursor with elm_object_cursor_set(). By default it will only look + * for cursors provided by the engine. * * @param item widget item with cursor already set. - * @param engine_only boolean to define it cursors should be looked only - * between the provided by the engine or searched on widget's theme as well. + * @param engine_only boolean to define it cursors should be looked + * only between the provided by the engine or searched on widget's + * theme as well. * * @ingroup Genlist */ EAPI void -elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item, Eina_Bool engine_only) +elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item, + Eina_Bool engine_only) { ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item); elm_widget_item_cursor_engine_only_set(item, engine_only); @@ -3951,9 +4108,10 @@ elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item, Eina_Bool engine * Get the cursor engine only usage for this item cursor. * * @param item widget item with cursor already set. - * @return engine_only boolean to define it cursors should be looked only - * between the provided by the engine or searched on widget's theme as well. If - * the object does not have a cursor set, then EINA_FALSE is returned. + * @return engine_only boolean to define it cursors should be looked + * only between the provided by the engine or searched on widget's + * theme as well. If the object does not have a cursor set, then + * EINA_FALSE is returned. * * @ingroup Genlist */ @@ -3967,12 +4125,13 @@ elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item) /** * This sets the horizontal stretching mode * - * This sets the mode used for sizing items horizontally. Valid modes are - * ELM_LIST_LIMIT and ELM_LIST_SCROLL. The default is ELM_LIST_SCROLL. This - * mode means that if items are too wide to fit, the scroller will scroll - * horizontally. Otherwise items are expanded to fill the width of the - * viewport of the scroller. If it is ELM_LIST_LIMIT, Items will be expanded - * to the viewport width and limited to that size. + * This sets the mode used for sizing items horizontally. Valid modes + * are ELM_LIST_LIMIT and ELM_LIST_SCROLL. The default is + * ELM_LIST_SCROLL. This mode means that if items are too wide to fit, + * the scroller will scroll horizontally. Otherwise items are expanded + * to fill the width of the viewport of the scroller. If it is + * ELM_LIST_LIMIT, Items will be expanded to the viewport width and + * limited to that size. * * @param obj The genlist object * @param mode The mode to use @@ -3980,7 +4139,8 @@ elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item) * @ingroup Genlist */ EAPI void -elm_genlist_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode) +elm_genlist_horizontal_mode_set(Evas_Object *obj, + Elm_List_Mode mode) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4011,10 +4171,11 @@ elm_genlist_horizontal_mode_get(const Evas_Object *obj) /** * Set the always select mode. * - * Items will only call their selection func and callback when first becoming - * selected. Any further clicks will do nothing, unless you enable always - * select with elm_genlist_always_select_mode_set(). This means even if - * selected, every click will make the selected callbacks be called. + * Items will only call their selection func and callback when first + * becoming selected. Any further clicks will do nothing, unless you + * enable always select with + * elm_genlist_always_select_mode_set(). This means even if selected, + * every click will make the selected callbacks be called. * * @param obj The genlist object * @param always_select The always select mode @@ -4023,7 +4184,8 @@ elm_genlist_horizontal_mode_get(const Evas_Object *obj) * @ingroup Genlist */ EAPI void -elm_genlist_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select) +elm_genlist_always_select_mode_set(Evas_Object *obj, + Eina_Bool always_select) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4052,8 +4214,8 @@ elm_genlist_always_select_mode_get(const Evas_Object *obj) /** * Set no select mode * - * This will turn off the ability to select items entirely and they will - * neither appear selected nor call selected callback functions. + * This will turn off the ability to select items entirely and they + * will neither appear selected nor call selected callback functions. * * @param obj The genlist object * @param no_select The no select mode @@ -4062,7 +4224,8 @@ elm_genlist_always_select_mode_get(const Evas_Object *obj) * @ingroup Genlist */ EAPI void -elm_genlist_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select) +elm_genlist_no_select_mode_set(Evas_Object *obj, + Eina_Bool no_select) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4091,10 +4254,11 @@ elm_genlist_no_select_mode_get(const Evas_Object *obj) /** * Set compress mode * - * This will enable the compress mode where items are "compressed" horizontally - * to fit the genlist scrollable viewport width. This is special for genlist. - * Do not rely on elm_genlist_horizontal_mode_set() being set to - * ELM_LIST_COMPRESS to work as genlist needs to handle it specially. + * This will enable the compress mode where items are "compressed" + * horizontally to fit the genlist scrollable viewport width. This is + * special for genlist. Do not rely on + * elm_genlist_horizontal_mode_set() being set to ELM_LIST_COMPRESS to + * work as genlist needs to handle it specially. * * @param obj The genlist object * @param compress The compress mode @@ -4103,7 +4267,8 @@ elm_genlist_no_select_mode_get(const Evas_Object *obj) * @ingroup Genlist */ EAPI void -elm_genlist_compress_mode_set(Evas_Object *obj, Eina_Bool compress) +elm_genlist_compress_mode_set(Evas_Object *obj, + Eina_Bool compress) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4147,12 +4312,14 @@ elm_genlist_compress_mode_get(const Evas_Object *obj) * disables homogeneous (see elm_genlist_homogeneous_set()). * * @param obj The genlist object - * @param setting The height-for-width mode (EINA_TRUE = on, EINA_FALSE = off) + * @param setting The height-for-width mode (EINA_TRUE = on, + * EINA_FALSE = off) * * @ingroup Genlist */ EAPI void -elm_genlist_height_for_width_mode_set(Evas_Object *obj, Eina_Bool height_for_width) +elm_genlist_height_for_width_mode_set(Evas_Object *obj, + Eina_Bool height_for_width) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4169,7 +4336,8 @@ elm_genlist_height_for_width_mode_set(Evas_Object *obj, Eina_Bool height_for_wid * Get the height-for-width mode * * @param obj The genlist object - * @return The height-for-width mode (EINA_TRUE = on, EINA_FALSE = off) + * @return The height-for-width mode (EINA_TRUE = on, EINA_FALSE = + * off) * * @ingroup Genlist */ @@ -4185,8 +4353,8 @@ elm_genlist_height_for_width_mode_get(const Evas_Object *obj) /** * Set bounce mode * - * This will enable or disable the scroller bounce mode for the genlist. See - * elm_scroller_bounce_set() for details + * This will enable or disable the scroller bounce mode for the + * genlist. See elm_scroller_bounce_set() for details * * @param obj The genlist object * @param h_bounce Allow bounce horizontally @@ -4195,7 +4363,9 @@ elm_genlist_height_for_width_mode_get(const Evas_Object *obj) * @ingroup Genlist */ EAPI void -elm_genlist_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) +elm_genlist_bounce_set(Evas_Object *obj, + Eina_Bool h_bounce, + Eina_Bool v_bounce) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4213,7 +4383,9 @@ elm_genlist_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) * @ingroup Genlist */ EAPI void -elm_genlist_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) +elm_genlist_bounce_get(const Evas_Object *obj, + Eina_Bool *h_bounce, + Eina_Bool *v_bounce) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4224,17 +4396,19 @@ elm_genlist_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v /** * Set homogenous mode * - * This will enable the homogeneous mode where items are of the same height and width - * so that genlist may do the lazy-loading at its maximum. This implies 'compressed' mode + * This will enable the homogeneous mode where items are of the same + * height and width so that genlist may do the lazy-loading at its + * maximum. This implies 'compressed' mode * * @param obj The genlist object - * @param homogeneous Assume the items within the genlist are of the same height and width - * (EINA_TRUE = on, EINA_FALSE = off) + * @param homogeneous Assume the items within the genlist are of the + * same height and width (EINA_TRUE = on, EINA_FALSE = off) * * @ingroup Genlist */ EAPI void -elm_genlist_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous) +elm_genlist_homogeneous_set(Evas_Object *obj, + Eina_Bool homogeneous) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4247,8 +4421,8 @@ elm_genlist_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous) * Get the homogenous mode * * @param obj The genlist object - * @return Assume the items within the genlist are of the same height and width - * (EINA_TRUE = on, EINA_FALSE = off) + * @return Assume the items within the genlist are of the same height + * and width (EINA_TRUE = on, EINA_FALSE = off) * * @ingroup Genlist */ @@ -4264,7 +4438,8 @@ elm_genlist_homogeneous_get(const Evas_Object *obj) /** * Set the maximum number of items within an item block * - * This will configure the block count to tune to the target with particular performance matrix. + * This will configure the block count to tune to the target with + * particular performance matrix. * * @param obj The genlist object * @param n Maximum number of items within an item block @@ -4272,7 +4447,8 @@ elm_genlist_homogeneous_get(const Evas_Object *obj) * @ingroup Genlist */ EAPI void -elm_genlist_block_count_set(Evas_Object *obj, int n) +elm_genlist_block_count_set(Evas_Object *obj, + int n) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4301,14 +4477,15 @@ elm_genlist_block_count_get(const Evas_Object *obj) /** * Set the timeout in seconds for the longpress event - * + * * @param obj The genlist object * @param timeout timeout in seconds - * + * * @ingroup Genlist */ EAPI void -elm_genlist_longpress_timeout_set(Evas_Object *obj, double timeout) +elm_genlist_longpress_timeout_set(Evas_Object *obj, + double timeout) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4318,10 +4495,10 @@ elm_genlist_longpress_timeout_set(Evas_Object *obj, double timeout) /** * Get the timeout in seconds for the longpress event - * + * * @param obj The genlist object * @return timeout in seconds - * + * * @ingroup Genlist */ EAPI double @@ -4336,11 +4513,12 @@ elm_genlist_longpress_timeout_get(const Evas_Object *obj) /** * Set the scrollbar policy * - * This sets the scrollbar visibility policy for the given genlist scroller. - * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it - * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns - * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off. - * This applies respectively for the horizontal and vertical scrollbars. + * This sets the scrollbar visibility policy for the given genlist + * scroller. ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is + * made visible if it is needed, and otherwise kept + * hidden. ELM_SMART_SCROLLER_POLICY_ON turns it on all the time, and + * ELM_SMART_SCROLLER_POLICY_OFF always keeps it off. This applies + * respectively for the horizontal and vertical scrollbars. * * @param obj The genlist object * @param policy_h Horizontal scrollbar policy @@ -4349,7 +4527,9 @@ elm_genlist_longpress_timeout_get(const Evas_Object *obj) * @ingroup List */ EAPI void -elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v) +elm_genlist_scroller_policy_set(Evas_Object *obj, + Elm_Scroller_Policy policy_h, + Elm_Scroller_Policy policy_v) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -4362,13 +4542,15 @@ elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, } EAPI void -elm_genlist_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v) +elm_genlist_scroller_policy_get(const Evas_Object *obj, + Elm_Scroller_Policy *policy_h, + Elm_Scroller_Policy *policy_v) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); Elm_Smart_Scroller_Policy s_policy_h, s_policy_v; if ((!wd) || (!wd->scr)) return; elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v); - if (policy_h) *policy_h = (Elm_Scroller_Policy) s_policy_h; - if (policy_v) *policy_v = (Elm_Scroller_Policy) s_policy_v; + if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h; + if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v; }