Hello!
Thank you for your response.
I am thoroughly impressed with your in-depth review.
All of your feedback is reflected on the latest attached patch.
Please verify and review this again. Thanks!
Sincerely,
Shinwoo Kim.
2011/4/4 Carsten Haitzler <ras...@rasterman.com>
> On Mon, 28 Mar 2011 12:04:19 +0900 cnook <kimci...@gmail.com> said:
>
> too many problems with this patch :( can you fix the below and re-submit?
>
> 1. fails. malformed patch even.
> patching file src/lib/elm_diskselector.c
> Hunk #5 FAILED at 136.
> Hunk #19 succeeded at 780 with fuzz 2.
> 1 out of 29 hunks FAILED -- saving rejects to file
> src/lib/elm_diskselector.c.rej patching file src/lib/Elementary.h.in
> patching file src/bin/test_diskselector.c
> patching file data/themes/default.edc
> patch: **** malformed patch at line 553:
> 2. math relying on operator precedence rather than being explicit with
> ()'s:
> + evas_object_resize(wd->main_box, w / wd->display_item_num *
> (wd->item_count + CEIL(wd->display_item_num) * 2), h);
> + evas_object_resize(wd->main_box, w / wd->display_item_num *
> (wd->item_count + CEIL(wd->display_item_num)), h);
> 3. divide by 0 waiting to happen:
> + (int)(w / wd->display_item_num), 0);
> (you never check the return of atoi so it can happily return 0 or theme
> could
> literally use a 0)
> 4. no space between if and ():
> + if(!wd->display_item_num_by_api)
> 5. no check of atoi result to stop invalid values (<= 0):
> + if (str) wd->display_item_num = atoi(str);
> 6. no check of atoi() to check for <= -2:
> + if (str) wd->minw = atoi(str);
> + if (str) wd->minh = atoi(str);
> 7. no check of atoi result to stop invalid values:
> + if (str) wd->display_item_num = atoi(str);
> 8. use: if (!strcmp(...)):
> + if (strcmp(item->label, it->label) == 0) edje_object_signal_emit
> (item->base.view, "elm,state,selected", "elm");
> 9. add space between void and * and no space between ) and it->:
> + if (it->func) it->func((void*) it->base.data, it->base.widget, it);
> 10. more operator precedence reliance here. use ()'s to collect statements:
> + if (x > w / wd->display_item_num * (wd->item_count +
> (wd->display_item_num % 2)))
> + x - w /
> wd->display_item_num *
> wd->item_count,
> + x + w /
> wd->display_item_num *
> wd->item_count,
> 11. add space between for and (:
> + for(i = 2; i < CEIL(wd->display_item_num); i++)
> + for(i = 3; i <= CEIL(wd->display_item_num); i++)
> + for(i = 2; i < CEIL(wd->display_item_num); i++)
> + for(i = 3; i <= CEIL(wd->display_item_num); i++)
> + for(idx = 0; idx < sizeof(month_list) / sizeof(month_list[0]); idx++)
> + for(idx = 1; idx < 31; idx++)
> 12. please declare vars at top of function or {} section where you can:
> + char *month_list[] = {
> + char date[3];
>
>
> > Hi All,
> >
> > Thanks for your response and suggestion always.
> > I have attached new patch file which has following modification.
> >
> > - remove warning message
> > - support setting by theme and api
> >
> > Others are also reasonable suggestion, some of them especially vertical
> mode
> > would be fine. But till now there is no design for that as raster
> mentioned.
> > setting min/max "display item num" is reasonable also but user can set
> > content size differently. So if elm_diskselector restrict its min/max
> > "display item num", it would occur that user cannot set "display item
> num"
> > more than max value even though there is enough space.
> >
> > Thanks again.
> >
> > Sincerely,
> > Shinwoo Kim.
> >
> > 2011/3/25 Carsten Haitzler <ras...@rasterman.com>
> >
> > > On Wed, 23 Mar 2011 08:19:13 -0700 Daniel Juyung Seo <
> seojuyu...@gmail.com
> > > >
> > > said:
> > >
> > > you're going to hate me :)
> > >
> > > you did go the right way - theme defines default, code can override...
> > > BUT..
> > > you are ALSO missing a fit POLICY. you are fitting just N items in the
> > > visible
> > > region. i think... you are missing the ability to say "fit as many
> items
> > > ads
> > > you can" either based on largest item in list (homogeneous layout in
> the
> > > box)
> > > or have all items a different size (actually i might argue that this is
> > > dubiously useful except maybe in a case where MOST items are small and
> 1 or
> > > 2
> > > are longer eg a list like: 1,2,3,4,5,NONE).
> > >
> > > so THEME should provide the default FIT policy (fixed count, best fit,
> > > compact
> > > fit). fixed count uses the theme number defined as you did already and
> code
> > > can
> > > override that, and other policies as above. also code should be allowed
> to
> > > override this too.
> > >
> > > (and yes a horizontal scrolling list of items where they change size
> > > horizontally is not that great as gustavo mentioned... but i know that
> you
> > > didn't design the widget, so not a lot of use going on about that - BUT
> his
> > > point implies that we should have a vertical diskselector mode too...
> use
> > > that
> > > for horizontally expanding items, and vice-versa).
> > >
> > > > I attached a screen shot :)
> > > > This is a screen shot from elementary_test "Disk Selector" which
> cnook
> > > > attached.
> > > >
> > > > Btw, cnook, I have one comment.
> > > > _item_click_cb()'s parameter is wrong.
> > > > Please check elm_diskselector.c code.
> > > >
> > > > elm_diskselector.c: In function ‘_item_new’:
> > > > elm_diskselector.c:137: warning: passing argument 4 of
> > > > ‘edje_object_signal_callback_add’ f
> > > > rom incompatible pointer type
> > > > /usr/local/include/edje-1/Edje.h:550: note: expected ‘Edje_Signal_Cb’
> > > > but argument is of t
> > > > ype ‘void (*)(void *, struct Evas_Object *, void *)’
> > > >
> > > > Thanks.
> > > > Daniel Juyung Seo (SeoZ)
> > > >
> > > >
> > > >
> > > >
> > > > On Wed, Mar 23, 2011 at 7:15 AM, Gustavo Sverzut Barbieri
> > > > <barbi...@profusion.mobi> wrote:
> > > > > On Wed, Mar 23, 2011 at 1:54 PM, cnook <kimci...@gmail.com> wrote:
> > > > >> Dear All,
> > > > >>
> > > > >> Thanks for your response.
> > > > >>
> > > > >> I have attached "elm_diskselector" patch using API and getting
> default
> > > > >> value from theme.
> > > > >> But the default value from "elementary/themes/default.edc" is
> applied
> > > only.
> > > > >> If user wants new default value from his/her own theme file, it
> will
> > > not be
> > > > >> applied.
> > > > >>
> > > > >>
> > > > >> Why I have changed like this.. because there is one case I worry
> > > about
> > > > >
> > > > >
> > > > > Do you have the screenshot? Nobody replied to my mail.
> > > > >
> > > > >
> > > > > --
> > > > > Gustavo Sverzut Barbieri
> > > > > http://profusion.mobi embedded systems
> > > > > --------------------------------------
> > > > > MSN: barbi...@gmail.com
> > > > > Skype: gsbarbieri
> > > > > Mobile: +55 (19) 9225-2202
> > > > >
> > > > >
> > >
> ------------------------------------------------------------------------------
> > > > > Enable your software for Intel(R) Active Management Technology to
> meet
> > > the
> > > > > growing manageability and security demands of your customers.
> > > Businesses
> > > > > are taking advantage of Intel(R) vPro (TM) technology - will your
> > > software
> > > > > be a part of the solution? Download the Intel(R) Manageability
> Checker
> > > > > today! http://p.sf.net/sfu/intel-dev2devmar
> > > > > _______________________________________________
> > > > > enlightenment-devel mailing list
> > > > > enlightenment-devel@lists.sourceforge.net
> > > > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > > > >
> > >
> > >
> > > --
> > > ------------- Codito, ergo sum - "I code, therefore I am"
> --------------
> > > The Rasterman (Carsten Haitzler) ras...@rasterman.com
> > >
> > >
>
>
> --
> ------------- Codito, ergo sum - "I code, therefore I am" --------------
> The Rasterman (Carsten Haitzler) ras...@rasterman.com
>
>
Index: src/lib/elm_diskselector.c
===================================================================
--- src/lib/elm_diskselector.c (revision 58359)
+++ src/lib/elm_diskselector.c (working copy)
@@ -20,6 +20,12 @@
# define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
+#ifndef CEIL
+#define CEIL(a) (((a) % 2 != 0) ? ((a) / 2 + 1) : ((a) / 2))
+#endif
+
+#define DISPLAY_ITEM_NUM_MIN 3
+
typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
@@ -36,11 +42,15 @@
Elm_Diskselector_Item *last;
Eina_List *items;
Eina_List *r_items;
- int item_count, len_threshold, len_side;
+ Eina_List *over_items;
+ Eina_List *under_items;
+ int item_count, len_threshold, len_side, display_item_num;
Ecore_Idler *idler;
Ecore_Idler *check_idler;
+ Evas_Coord minw, minh;
Eina_Bool init:1;
Eina_Bool round:1;
+ Eina_Bool display_item_num_by_api:1;
};
struct _Elm_Diskselector_Item
@@ -68,6 +78,10 @@
static void _sub_del(void *data, Evas_Object * obj, void *event_info);
static void _round_items_del(Widget_Data *wd);
static void _scroller_move_cb(void *data, Evas_Object *obj, void *event_info);
+static void _item_click_cb(void *data, Evas_Object *obj __UNUSED__,
+ const char *emission __UNUSED__,
+ const char *source __UNUSED__);
+static void _selected_item_indicate(Elm_Diskselector_Item *it);
static const char SIG_SELECTED[] = "selected";
static const Evas_Smart_Cb_Description _signals[] = {
@@ -79,25 +93,25 @@
_diskselector_object_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Widget_Data *wd;
- Evas_Coord w, h, minw = -1, minh = -1;
+ Evas_Coord w, h;
wd = elm_widget_data_get(data);
if (!wd) return;
- elm_coords_finger_size_adjust(6, &minw, 1, &minh);
+ if (wd->minw == -1 && wd->minh == -1) elm_coords_finger_size_adjust(6, &wd->minw, 1, &wd->minh);
edje_object_size_min_restricted_calc(elm_smart_scroller_edje_object_get(
- wd->scroller), &minw, &minh, minw, minh);
- evas_object_size_hint_min_set(obj, minw, minh);
+ wd->scroller), &wd->minw, &wd->minh, wd->minw, wd->minh);
+ evas_object_size_hint_min_set(obj, wd->minw, wd->minh);
evas_object_size_hint_max_set(obj, -1, -1);
evas_object_geometry_get(wd->scroller, NULL, NULL, &w, &h);
if (wd->round)
- evas_object_resize(wd->main_box, w / 3 * (wd->item_count + 4), h);
+ evas_object_resize(wd->main_box, (w / wd->display_item_num) * (wd->item_count + (CEIL(wd->display_item_num) * 2)), h);
else
- evas_object_resize(wd->main_box, w / 3 * (wd->item_count + 2), h);
+ evas_object_resize(wd->main_box, (w / wd->display_item_num) * (wd->item_count + CEIL(wd->display_item_num)), h);
elm_smart_scroller_paging_set(wd->scroller, 0, 0,
- (int)(w / 3), 0);
+ (int)(w / wd->display_item_num), 0);
if (!wd->idler)
wd->idler = ecore_idler_add(_move_scroller, data);
@@ -125,7 +139,10 @@
evas_object_show(it->base.view);
if (it->label)
- edje_object_part_text_set(it->base.view, "elm.text", it->label);
+ {
+ edje_object_part_text_set(it->base.view, "elm.text", it->label);
+ edje_object_signal_callback_add(it->base.view, "elm,action,click", "", _item_click_cb, it);
+ }
if (it->icon)
{
evas_object_size_hint_min_set(it->icon, 24, 24);
@@ -152,11 +169,35 @@
{
const char* str;
str = edje_object_data_get(wd->right_blank, "len_threshold");
- if (str) wd->len_threshold = atoi(str);
+ if (str) wd->len_threshold = MAX(0, atoi(str));
else wd->len_threshold = 0;
+
+ if (!wd->display_item_num_by_api)
+ {
+ str = edje_object_data_get(wd->right_blank, "display_item_num");
+ if (str) wd->display_item_num = MAX(DISPLAY_ITEM_NUM_MIN, atoi(str));
+ else wd->display_item_num = DISPLAY_ITEM_NUM_MIN;
+ }
+
+ str = edje_object_data_get(wd->right_blank, "min_width");
+ if (str) wd->minw = MAX(-1, atoi(str));
+ else wd->minw = -1;
+
+ str = edje_object_data_get(wd->right_blank, "min_height");
+ if (str) wd->minh = MAX(-1, atoi(str));
+ else wd->minh = -1;
}
static void
+_default_display_item_num_set(Widget_Data *wd)
+{
+ const char* str;
+ str = edje_object_data_get(wd->right_blank, "display_item_num");
+ if (str) wd->display_item_num = MAX(DISPLAY_ITEM_NUM_MIN, atoi(str));
+ else wd->display_item_num = DISPLAY_ITEM_NUM_MIN;
+}
+
+static void
_del_hook(Evas_Object * obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
@@ -168,6 +209,8 @@
_del_pre_hook(Evas_Object * obj)
{
Elm_Diskselector_Item *it;
+ Eina_List *l;
+
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
@@ -200,6 +243,26 @@
free(wd->first);
}
+ EINA_LIST_FOREACH(wd->under_items, l, it)
+ {
+ if (it)
+ {
+ eina_stringshare_del(it->label);
+ evas_object_del(wd->first->base.view);
+ free(it);
+ }
+ }
+
+ EINA_LIST_FOREACH(wd->over_items, l, it)
+ {
+ if (it)
+ {
+ eina_stringshare_del(it->label);
+ evas_object_del(wd->first->base.view);
+ free(it);
+ }
+ }
+
EINA_LIST_FREE(wd->items, it) _item_del(it);
eina_list_free(wd->r_items);
}
@@ -239,6 +302,8 @@
elm_widget_style_get(obj));
}
}
+ _elm_theme_object_set(obj, wd->right_blank, "diskselector", "item",
+ elm_widget_style_get(obj));
_theme_data_get(wd);
_sizing_eval(obj);
}
@@ -275,6 +340,7 @@
if (!it) return;
Widget_Data *wd = elm_widget_data_get(it->base.widget);
wd->selected_item = it;
+ _selected_item_indicate(wd->selected_item);
if (it->func) it->func((void *)it->base.data, it->base.widget, it);
evas_object_smart_callback_call(it->base.widget, SIG_SELECTED, it);
}
@@ -439,6 +505,46 @@
}
static void
+_selected_item_indicate(Elm_Diskselector_Item *it)
+{
+ Elm_Diskselector_Item *item;
+ Eina_List *l;
+ Widget_Data *wd;
+ wd = elm_widget_data_get(it->base.widget);
+
+ if (!wd) return;
+
+ EINA_LIST_FOREACH(wd->r_items, l, item)
+ {
+ if (!strcmp(item->label, it->label)) edje_object_signal_emit(item->base.view, "elm,state,selected", "elm");
+ else
+ edje_object_signal_emit(item->base.view, "elm,state,default", "elm");
+ }
+}
+
+static void
+_item_click_cb(void *data, Evas_Object *obj __UNUSED__,
+ const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ Elm_Diskselector_Item *it = data;
+
+ if (!it) return;
+
+ Widget_Data *wd;
+ wd = elm_widget_data_get(it->base.widget);
+
+ if (!wd) return;
+
+ if (wd->selected_item != it)
+ {
+ wd->selected_item = it;
+ _selected_item_indicate(wd->selected_item);
+ }
+
+ if (it->func) it->func((void *)it->base.data, it->base.widget, it);
+}
+
+static void
_scroller_move_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Coord x, y, w, h, bw;
@@ -450,13 +556,13 @@
if (wd->round)
{
evas_object_geometry_get(wd->main_box, NULL, NULL, &bw, NULL);
- if (x > w / 3 * (wd->item_count + 1))
- elm_smart_scroller_child_region_show(wd->scroller,
- x - w / 3 * wd->item_count,
+ if (x > ((w / wd->display_item_num) * (wd->item_count + (wd->display_item_num % 2))))
+ elm_smart_scroller_child_region_show(wd->scroller,
+ x - ((w / wd->display_item_num) * wd->item_count),
y, w, h);
else if (x < 0)
- elm_smart_scroller_child_region_show(wd->scroller,
- x + w / 3 * wd->item_count,
+ elm_smart_scroller_child_region_show(wd->scroller,
+ x + ((w / wd->display_item_num) * wd->item_count),
y, w, h);
}
}
@@ -523,7 +629,7 @@
}
evas_object_geometry_get(wd->scroller, NULL, &y, &w, &h);
- elm_smart_scroller_child_region_show(wd->scroller, w / 3 * i, y, w, h);
+ elm_smart_scroller_child_region_show(wd->scroller, w / wd->display_item_num * i, y, w, h);
_select_item(dit);
if (wd->idler)
{
@@ -550,6 +656,9 @@
static void
_round_items_del(Widget_Data *wd)
{
+ Eina_List *l;
+ Elm_Diskselector_Item * it;
+
_round_item_del(wd, wd->last);
wd->last = NULL;
_round_item_del(wd, wd->s_last);
@@ -558,6 +667,18 @@
wd->second = NULL;
_round_item_del(wd, wd->first);
wd->first = NULL;
+
+ EINA_LIST_FOREACH(wd->under_items, l, it)
+ {
+ _round_item_del(wd, it);
+ it = NULL;
+ }
+
+ EINA_LIST_FOREACH(wd->over_items, l, it)
+ {
+ _round_item_del(wd, it);
+ it = NULL;
+ }
}
static void
@@ -565,7 +686,8 @@
{
Elm_Diskselector_Item *dit;
Elm_Diskselector_Item *it;
-
+ Elm_Diskselector_Item *temp_it;
+ int i = 0;
dit = it = eina_list_nth(wd->items, 0);
if (!dit) return;
@@ -588,6 +710,16 @@
wd->r_items = eina_list_append(wd->r_items, wd->second);
}
+ // if more than 3 itmes should be displayed
+ for (i = 2; i < CEIL(wd->display_item_num); i++)
+ {
+ it = eina_list_nth(wd->items, i);
+ if (!it) it = dit;
+ temp_it = _item_new(it->base.widget, it->icon, it->label, it->func, it->base.data);
+ wd->over_items = eina_list_append(wd->over_items, temp_it);
+ wd->r_items = eina_list_append(wd->r_items, temp_it);
+ }
+
it = eina_list_nth(wd->items, wd->item_count - 1);
if (!it)
it = dit;
@@ -609,6 +741,16 @@
wd->s_last->node = it->node;
wd->r_items = eina_list_prepend(wd->r_items, wd->s_last);
}
+
+ // if more than 3 itmes should be displayed
+ for (i = 3; i <= CEIL(wd->display_item_num); i++)
+ {
+ it = eina_list_nth(wd->items, wd->item_count - i);
+ if (!it) it = dit;
+ temp_it = _item_new(it->base.widget, it->icon, it->label, it->func, it->base.data);
+ wd->under_items = eina_list_append(wd->under_items, temp_it);
+ wd->r_items = eina_list_prepend(wd->r_items, temp_it);
+ }
}
/**
@@ -644,6 +786,7 @@
wd->round = EINA_FALSE;
wd->init = EINA_FALSE;
wd->len_side = 3;
+ wd->display_item_num_by_api = EINA_FALSE;
wd->scroller = elm_smart_scroller_add(e);
elm_smart_scroller_widget_set(wd->scroller, obj);
@@ -736,6 +879,9 @@
EAPI void
elm_diskselector_round_set(Evas_Object * obj, Eina_Bool round)
{
+ Eina_List *elist;
+ Elm_Diskselector_Item *it;
+
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
@@ -760,10 +906,19 @@
elm_box_pack_start(wd->main_box, wd->last->base.view);
if (wd->s_last)
elm_box_pack_start(wd->main_box, wd->s_last->base.view);
+
+ // if more than 3 items should be displayed
+ EINA_LIST_FOREACH(wd->under_items, elist, it)
+ elm_box_pack_start(wd->main_box, it->base.view);
+
if (wd->first)
elm_box_pack_end(wd->main_box, wd->first->base.view);
if (wd->second)
elm_box_pack_end(wd->main_box, wd->second->base.view);
+
+ // if more than 3 items should be displayed
+ EINA_LIST_FOREACH(wd->over_items, elist, it)
+ elm_box_pack_end(wd->main_box, it->base.view);
}
else
{
@@ -773,6 +928,8 @@
eina_list_free(wd->r_items);
wd->r_items = NULL;
}
+
+ _selected_item_indicate(wd->selected_item);
_sizing_eval(obj);
}
@@ -1015,6 +1172,9 @@
{
ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
Elm_Diskselector_Item *dit;
+ Elm_Diskselector_Item *item;
+ Eina_List *l;
+ int i = 0;
Widget_Data *wd = elm_widget_data_get(it->base.widget);
if (!wd) return;
@@ -1032,6 +1192,8 @@
wd->selected_item = dit;
else
wd->selected_item = eina_list_nth(wd->items, 1);
+
+ _selected_item_indicate(wd->selected_item);
}
_item_del(it);
@@ -1045,6 +1207,12 @@
evas_object_hide(wd->second->base.view);
evas_object_hide(wd->last->base.view);
evas_object_hide(wd->s_last->base.view);
+
+ EINA_LIST_FOREACH(wd->under_items, l, item)
+ evas_object_hide(item->base.view);
+
+ EINA_LIST_FOREACH(wd->over_items, l, item)
+ evas_object_hide(item->base.view);
}
else
{
@@ -1062,6 +1230,15 @@
edje_object_part_text_set(wd->second->base.view, "elm.text",
wd->second->label);
}
+ // if more than 3 itmes should be displayed
+ for (i = 2; i < CEIL(wd->display_item_num); i++)
+ {
+ dit = eina_list_nth(wd->items, i);
+ item = eina_list_nth(wd->over_items, i - 2);
+ eina_stringshare_replace(&item->label, dit->label);
+ edje_object_part_text_set(item->base.view, "elm.text", item->label);
+ }
+
dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 1);
if (dit)
{
@@ -1076,6 +1253,14 @@
edje_object_part_text_set(wd->s_last->base.view, "elm.text",
wd->s_last->label);
}
+ // if more than 3 itmes should be displayed
+ for (i = 3; i <= CEIL(wd->display_item_num); i++)
+ {
+ dit = eina_list_nth(wd->items, wd->item_count - i);
+ item = eina_list_nth(wd->under_items, i - 3);
+ eina_stringshare_replace(&item->label, dit->label);
+ edje_object_part_text_set(item->base.view, "elm.text", item->label);
+ }
}
}
wd->check_idler = ecore_idler_add(_check_string, wd);
@@ -1157,7 +1342,10 @@
if ((wd->selected_item == it) && (!selected))
wd->selected_item = eina_list_data_get(wd->items);
else
- wd->selected_item = it;
+ {
+ wd->selected_item = it;
+ _selected_item_indicate(wd->selected_item);
+ }
if (!wd->idler)
ecore_idler_add(_move_scroller, it->base.widget);
@@ -1542,3 +1730,21 @@
ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
return elm_widget_item_cursor_engine_only_get(item);
}
+/**
+ * Set the number of items to be displayed
+ *
+ * @param obj The diskselector object
+ * @param num The number of itmes that diskselector will display
+ *
+ * @ingroup Diskselector
+ */
+EAPI void
+elm_diskselector_display_item_num_set(Evas_Object *obj, int num)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (num < DISPLAY_ITEM_NUM_MIN) num = DISPLAY_ITEM_NUM_MIN;
+ wd->display_item_num = num;
+ wd->display_item_num_by_api = EINA_TRUE;
+}
Index: src/lib/Elementary.h.in
===================================================================
--- src/lib/Elementary.h.in (revision 58359)
+++ src/lib/Elementary.h.in (working copy)
@@ -2551,6 +2551,7 @@
EAPI const char *elm_diskselector_item_cursor_style_get(const Elm_Diskselector_Item *item) EINA_ARG_NONNULL(1);
EAPI void elm_diskselector_item_cursor_engine_only_set(Elm_Diskselector_Item *item, Eina_Bool engine_only) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_diskselector_item_cursor_engine_only_get(const Elm_Diskselector_Item *item) EINA_ARG_NONNULL(1);
+ EAPI void elm_diskselector_display_item_num_set(Evas_Object *obj, int num) EINA_ARG_NONNULL(1);
/* smart callbacks called:
* "selected" - when item is selected (scroller stops)
*/
Index: src/bin/test_diskselector.c
===================================================================
--- src/bin/test_diskselector.c (revision 58359)
+++ src/bin/test_diskselector.c (working copy)
@@ -61,7 +61,16 @@
Evas_Object *win, *bg, *bx, *disk, *ic;
Elm_Diskselector_Item *it;
char buf[PATH_MAX];
+ int idx = 0;
+ char *month_list[] = {
+ "Jan", "Feb", "Mar",
+ "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep",
+ "Oct", "Nov", "Dec"
+ };
+ char date[3];
+
win = elm_win_add(NULL, "diskselector", ELM_WIN_BASIC);
elm_win_title_set(win, "Disk Selector");
elm_win_autodel_set(win, 1);
@@ -124,6 +133,42 @@
evas_object_show(disk);
evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
+ // displayed item number setting example
+ disk = elm_diskselector_add(win);
+ elm_diskselector_display_item_num_set(disk, 5);
+
+ for(idx = 0; idx < sizeof(month_list) / sizeof(month_list[0]); idx++)
+ {
+ it = elm_diskselector_item_append(disk, month_list[idx], NULL, NULL, NULL);
+ }
+
+ elm_diskselector_item_selected_set(it, EINA_TRUE);
+ elm_diskselector_round_set(disk, EINA_TRUE);
+ evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, disk);
+ evas_object_show(disk);
+ evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
+
+ // displayed item number setting example
+ disk = elm_diskselector_add(win);
+ elm_diskselector_display_item_num_set(disk, 7);
+
+ for(idx = 1; idx < 31; idx++)
+ {
+ snprintf(date, sizeof(date), "%d", idx);
+ it = elm_diskselector_item_append(disk, date, NULL, NULL, NULL);
+ }
+
+ elm_diskselector_item_selected_set(it, EINA_TRUE);
+ elm_diskselector_round_set(disk, EINA_TRUE);
+ evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, disk);
+ evas_object_show(disk);
+ evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
+
+
evas_object_resize(win, 320, 480);
evas_object_show(win);
}
Index: data/themes/default.edc
===================================================================
--- data/themes/default.edc (revision 58359)
+++ data/themes/default.edc (working copy)
@@ -35072,6 +35072,9 @@
data {
item: "len_threshold" "14";
+ item: "display_item_num" "3";
+ item: "min_height" "-1";
+ item: "min_width" "-1";
}
parts {
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel