summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael BOUCHAUD <michael.bouchaud@gmail.com>2012-04-19 09:03:59 +0000
committerMichael BOUCHAUD <michael.bouchaud@gmail.com>2012-04-19 09:03:59 +0000
commite52ac2a690306a5a8c74112c38cd9fc29e3ddbb5 (patch)
tree6a66b05ba07d31379d57edf94d8f944098627688
parente1f626acd08287ab9d32aff71d45b87ab9cbea3d (diff)
elemntary: mr proper with council from SeoZ. Add _MODE_ to the enum
SVN revision: 70326
-rw-r--r--src/bin/test_calendar.c34
-rw-r--r--src/lib/elm_calendar.c21
-rw-r--r--src/lib/elm_calendar.h8
3 files changed, 21 insertions, 42 deletions
diff --git a/src/bin/test_calendar.c b/src/bin/test_calendar.c
index d7995f413..153cf7e47 100644
--- a/src/bin/test_calendar.c
+++ b/src/bin/test_calendar.c
@@ -70,7 +70,7 @@ set_api_state(api_data *api)
70 time_t sec_per_day = (60*60*24); 70 time_t sec_per_day = (60*60*24);
71 time_t sec_per_year = sec_per_day * 365; 71 time_t sec_per_year = sec_per_day * 365;
72 time_t the_time = (sec_per_year * 41) + (sec_per_day * 10); /* Set date to JAN 01, 2011 */ 72 time_t the_time = (sec_per_year * 41) + (sec_per_day * 10); /* Set date to JAN 01, 2011 */
73 elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_NONE); 73 elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE);
74 elm_calendar_selected_time_set(cal, gmtime(&the_time)); 74 elm_calendar_selected_time_set(cal, gmtime(&the_time));
75 } 75 }
76 break; 76 break;
@@ -81,7 +81,7 @@ set_api_state(api_data *api)
81 time_t sec_per_year = sec_per_day * 365; 81 time_t sec_per_year = sec_per_day * 365;
82 time_t the_time = (sec_per_year * 41) + (sec_per_day * 40); /* Set date to FEB 01, 2011 */ 82 time_t the_time = (sec_per_year * 41) + (sec_per_day * 40); /* Set date to FEB 01, 2011 */
83 elm_calendar_marks_clear(cal); 83 elm_calendar_marks_clear(cal);
84 elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_NONE); 84 elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE);
85 elm_calendar_selected_time_set(cal, gmtime(&the_time)); 85 elm_calendar_selected_time_set(cal, gmtime(&the_time));
86 } 86 }
87 break; 87 break;
@@ -174,7 +174,7 @@ _print_cal_info(Evas_Object *cal, Evas_Object *en)
174 174
175 interval = elm_calendar_interval_get(cal); 175 interval = elm_calendar_interval_get(cal);
176 elm_calendar_min_max_year_get(cal, &year_min, &year_max); 176 elm_calendar_min_max_year_get(cal, &year_min, &year_max);
177 sel_enabled = !!(elm_calendar_select_mode_get(cal) != ELM_CALENDAR_SELECT_NONE); 177 sel_enabled = !!(elm_calendar_select_mode_get(cal) != ELM_CALENDAR_SELECT_MODE_NONE);
178 wds = elm_calendar_weekdays_names_get(cal); 178 wds = elm_calendar_weekdays_names_get(cal);
179 179
180 snprintf(info, sizeof(info), 180 snprintf(info, sizeof(info),
@@ -241,7 +241,7 @@ test_calendar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
241 cal2 = elm_calendar_add(win); 241 cal2 = elm_calendar_add(win);
242 evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 242 evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
243 evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL); 243 evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL);
244 elm_calendar_select_mode_set(cal2, ELM_CALENDAR_SELECT_NONE); 244 elm_calendar_select_mode_set(cal2, ELM_CALENDAR_SELECT_MODE_NONE);
245 evas_object_show(cal2); 245 evas_object_show(cal2);
246 elm_box_pack_end(bxh, cal2); 246 elm_box_pack_end(bxh, cal2);
247 247
@@ -322,35 +322,13 @@ test_calendar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
322 elm_win_resize_object_add(win, bxx); 322 elm_win_resize_object_add(win, bxx);
323 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 323 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
324 evas_object_show(bxx); 324 evas_object_show(bxx);
325 /*
326
327 bx = elm_box_add(win);
328 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
329 api->box = bx;
330 evas_object_show(bx);
331
332 bt = elm_button_add(win);
333 elm_object_text_set(bt, "Next API function");
334 evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
335 elm_box_pack_end(bxx, bt);
336 elm_object_disabled_set(bt, api->state == API_STATE_LAST);
337 evas_object_show(bt);
338
339 elm_box_pack_end(bxx, bx);
340 */
341 325
342 cal = elm_calendar_add(win); 326 cal = elm_calendar_add(win);
343 elm_calendar_first_day_of_week_set(cal, ELM_DAY_THURSDAY); 327 elm_calendar_first_day_of_week_set(cal, ELM_DAY_THURSDAY);
344 elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_ONDEMAND); 328 elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_ONDEMAND);
345 evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 329 evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
346 elm_box_pack_end(bxx, cal); 330 elm_box_pack_end(bxx, cal);
347// 331
348// time_t sec_per_day = (60*60*24);
349// time_t sec_per_year = sec_per_day * 365;
350// time_t the_time = (sec_per_year * 41) + (sec_per_day * 9); /* Set date to DEC 31, 2010 */
351// elm_calendar_selected_time_set(cal, gmtime(&the_time));
352// elm_calendar_min_max_year_set(cal, 2010, 2012);
353//
354 evas_object_show(cal); 332 evas_object_show(cal);
355 333
356 evas_object_show(win); 334 evas_object_show(win);
diff --git a/src/lib/elm_calendar.c b/src/lib/elm_calendar.c
index 3b65ce0f1..f90d8fe0e 100644
--- a/src/lib/elm_calendar.c
+++ b/src/lib/elm_calendar.c
@@ -302,7 +302,8 @@ _populate(Evas_Object *obj)
302 if ((wd->selected_it > -1) && (wd->selected_it != i)) 302 if ((wd->selected_it > -1) && (wd->selected_it != i))
303 _unselect(wd, wd->selected_it); 303 _unselect(wd, wd->selected_it);
304 304
305 if (wd->select_mode != ELM_CALENDAR_SELECT_NONE) _select(wd, i); 305 if (wd->select_mode != ELM_CALENDAR_SELECT_MODE_NONE)
306 _select(wd, i);
306 307
307 wd->selected_it = i; 308 wd->selected_it = i;
308 } 309 }
@@ -600,7 +601,7 @@ _update_sel_it(Evas_Object *obj, int sel_it)
600{ 601{
601 int day; 602 int day;
602 Widget_Data *wd = elm_widget_data_get(obj); 603 Widget_Data *wd = elm_widget_data_get(obj);
603 if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_NONE)) 604 if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE))
604 return; 605 return;
605 606
606 day = _get_item_day(obj, sel_it); 607 day = _get_item_day(obj, sel_it);
@@ -621,7 +622,7 @@ _day_selected(void *data, Evas_Object *obj __UNUSED__, const char *emission __UN
621{ 622{
622 int sel_it; 623 int sel_it;
623 Widget_Data *wd = elm_widget_data_get(data); 624 Widget_Data *wd = elm_widget_data_get(data);
624 if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_NONE)) 625 if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE))
625 return; 626 return;
626 sel_it = atoi(source); 627 sel_it = atoi(source);
627 628
@@ -668,7 +669,7 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
668 669
669 if (!wd) return EINA_FALSE; 670 if (!wd) return EINA_FALSE;
670 if (elm_widget_disabled_get(obj)) return EINA_FALSE; 671 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
671 if (wd->select_mode == ELM_CALENDAR_SELECT_NONE) return EINA_FALSE; 672 if (wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE) return EINA_FALSE;
672 673
673 if ((!strcmp(ev->keyname, "Left")) || 674 if ((!strcmp(ev->keyname, "Left")) ||
674 ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) 675 ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
@@ -867,9 +868,9 @@ EINA_DEPRECATED EAPI void
867elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled) 868elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled)
868{ 869{
869 if (disabled) 870 if (disabled)
870 elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_NONE); 871 elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_MODE_NONE);
871 else 872 else
872 elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_DEFAULT); 873 elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_MODE_DEFAULT);
873} 874}
874 875
875EINA_DEPRECATED EAPI Eina_Bool 876EINA_DEPRECATED EAPI Eina_Bool
@@ -878,7 +879,7 @@ elm_calendar_day_selection_disabled_get(const Evas_Object *obj)
878 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; 879 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
879 Widget_Data *wd = elm_widget_data_get(obj); 880 Widget_Data *wd = elm_widget_data_get(obj);
880 if (!wd) return EINA_FALSE; 881 if (!wd) return EINA_FALSE;
881 return !!(wd->select_mode == ELM_CALENDAR_SELECT_NONE); 882 return !!(wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE);
882} 883}
883 884
884EAPI void 885EAPI void
@@ -1005,12 +1006,12 @@ elm_calendar_select_mode_set(Evas_Object *obj, Elm_Calendar_Select_Mode mode)
1005 ELM_CHECK_WIDTYPE(obj, widtype); 1006 ELM_CHECK_WIDTYPE(obj, widtype);
1006 Widget_Data *wd = elm_widget_data_get(obj); 1007 Widget_Data *wd = elm_widget_data_get(obj);
1007 if (!wd) return; 1008 if (!wd) return;
1008 if ((mode >= ELM_CALENDAR_SELECT_DEFAULT) 1009 if ((mode >= ELM_CALENDAR_SELECT_MODE_DEFAULT)
1009 && (mode <= ELM_CALENDAR_SELECT_ONDEMAND) 1010 && (mode <= ELM_CALENDAR_SELECT_MODE_ONDEMAND)
1010 && (wd->select_mode != mode)) 1011 && (wd->select_mode != mode))
1011 { 1012 {
1012 wd->select_mode = mode; 1013 wd->select_mode = mode;
1013 if (wd->select_mode == ELM_CALENDAR_SELECT_ALWAYS) 1014 if (wd->select_mode == ELM_CALENDAR_SELECT_MODE_ALWAYS)
1014 _select(wd, wd->selected_it); 1015 _select(wd, wd->selected_it);
1015 else 1016 else
1016 _unselect(wd, wd->selected_it); 1017 _unselect(wd, wd->selected_it);
diff --git a/src/lib/elm_calendar.h b/src/lib/elm_calendar.h
index c33d0500e..6778018ab 100644
--- a/src/lib/elm_calendar.h
+++ b/src/lib/elm_calendar.h
@@ -89,10 +89,10 @@ typedef _Elm_Calendar_Weekday Elm_Calendar_Weekday;
89 89
90typedef enum 90typedef enum
91{ 91{
92 ELM_CALENDAR_SELECT_DEFAULT = 0, /**< Default value. a day is always selected. */ 92 ELM_CALENDAR_SELECT_MODE_DEFAULT = 0, /**< Default value. a day is always selected. */
93 ELM_CALENDAR_SELECT_ALWAYS, /**< a day is always selected. */ 93 ELM_CALENDAR_SELECT_MODE_ALWAYS, /**< a day is always selected. */
94 ELM_CALENDAR_SELECT_NONE, /**< None of the days can be selected. */ 94 ELM_CALENDAR_SELECT_MODE_NONE, /**< None of the days can be selected. */
95 ELM_CALENDAR_SELECT_ONDEMAND /**< User may have selected a day or not. (not supported yet)*/ 95 ELM_CALENDAR_SELECT_MODE_ONDEMAND /**< User may have selected a day or not. (not supported yet)*/
96} _Elm_Calendar_Select_Mode; 96} _Elm_Calendar_Select_Mode;
97 97
98/** 98/**