elementary: elm_calendar deprecate elm_calendar_day_selection_disabled_set/get, instead now use elm_calendar_select_mode_set/get. ELM_CALENDAR_SELECT_MODE_ONDEMAND is present but not supported yet
SVN revision: 70319
This commit is contained in:
parent
397215dc27
commit
e18646e52a
|
@ -70,7 +70,7 @@ set_api_state(api_data *api)
|
||||||
time_t sec_per_day = (60*60*24);
|
time_t sec_per_day = (60*60*24);
|
||||||
time_t sec_per_year = sec_per_day * 365;
|
time_t sec_per_year = sec_per_day * 365;
|
||||||
time_t the_time = (sec_per_year * 41) + (sec_per_day * 10); /* Set date to JAN 01, 2011 */
|
time_t the_time = (sec_per_year * 41) + (sec_per_day * 10); /* Set date to JAN 01, 2011 */
|
||||||
elm_calendar_day_selection_disabled_set(cal, EINA_TRUE);
|
elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_NONE);
|
||||||
elm_calendar_selected_time_set(cal, gmtime(&the_time));
|
elm_calendar_selected_time_set(cal, gmtime(&the_time));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -81,7 +81,7 @@ set_api_state(api_data *api)
|
||||||
time_t sec_per_year = sec_per_day * 365;
|
time_t sec_per_year = sec_per_day * 365;
|
||||||
time_t the_time = (sec_per_year * 41) + (sec_per_day * 40); /* Set date to FEB 01, 2011 */
|
time_t the_time = (sec_per_year * 41) + (sec_per_day * 40); /* Set date to FEB 01, 2011 */
|
||||||
elm_calendar_marks_clear(cal);
|
elm_calendar_marks_clear(cal);
|
||||||
elm_calendar_day_selection_disabled_set(cal, EINA_TRUE);
|
elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_NONE);
|
||||||
elm_calendar_selected_time_set(cal, gmtime(&the_time));
|
elm_calendar_selected_time_set(cal, gmtime(&the_time));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -174,7 +174,7 @@ _print_cal_info(Evas_Object *cal, Evas_Object *en)
|
||||||
|
|
||||||
interval = elm_calendar_interval_get(cal);
|
interval = elm_calendar_interval_get(cal);
|
||||||
elm_calendar_min_max_year_get(cal, &year_min, &year_max);
|
elm_calendar_min_max_year_get(cal, &year_min, &year_max);
|
||||||
sel_enabled = !elm_calendar_day_selection_disabled_get(cal);
|
sel_enabled = !!(elm_calendar_select_mode_get(cal) != ELM_CALENDAR_SELECT_NONE);
|
||||||
wds = elm_calendar_weekdays_names_get(cal);
|
wds = elm_calendar_weekdays_names_get(cal);
|
||||||
|
|
||||||
snprintf(info, sizeof(info),
|
snprintf(info, sizeof(info),
|
||||||
|
@ -241,7 +241,7 @@ test_calendar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
|
||||||
cal2 = elm_calendar_add(win);
|
cal2 = elm_calendar_add(win);
|
||||||
evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_calendar_day_selection_disabled_set(cal2, EINA_TRUE);
|
elm_calendar_select_mode_set(cal2, ELM_CALENDAR_SELECT_NONE);
|
||||||
evas_object_show(cal2);
|
evas_object_show(cal2);
|
||||||
elm_box_pack_end(bxh, cal2);
|
elm_box_pack_end(bxh, cal2);
|
||||||
|
|
||||||
|
@ -307,4 +307,53 @@ test_calendar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
|
||||||
evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, en);
|
evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, en);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
test_calendar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *cal, *bxx;
|
||||||
|
api_data *api = calloc(1, sizeof(api_data));
|
||||||
|
|
||||||
|
win = elm_win_util_standard_add("calendar", "Calendar");
|
||||||
|
elm_win_autodel_set(win, EINA_TRUE);
|
||||||
|
evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
|
||||||
|
|
||||||
|
bxx = elm_box_add(win);
|
||||||
|
elm_win_resize_object_add(win, bxx);
|
||||||
|
evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_show(bxx);
|
||||||
|
/*
|
||||||
|
|
||||||
|
bx = elm_box_add(win);
|
||||||
|
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
api->box = bx;
|
||||||
|
evas_object_show(bx);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "Next API function");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
|
||||||
|
elm_box_pack_end(bxx, bt);
|
||||||
|
elm_object_disabled_set(bt, api->state == API_STATE_LAST);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
elm_box_pack_end(bxx, bx);
|
||||||
|
*/
|
||||||
|
|
||||||
|
cal = elm_calendar_add(win);
|
||||||
|
elm_calendar_first_day_of_week_set(cal, ELM_DAY_THURSDAY);
|
||||||
|
elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_ONDEMAND);
|
||||||
|
evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
elm_box_pack_end(bxx, cal);
|
||||||
|
//
|
||||||
|
// time_t sec_per_day = (60*60*24);
|
||||||
|
// time_t sec_per_year = sec_per_day * 365;
|
||||||
|
// time_t the_time = (sec_per_year * 41) + (sec_per_day * 9); /* Set date to DEC 31, 2010 */
|
||||||
|
// elm_calendar_selected_time_set(cal, gmtime(&the_time));
|
||||||
|
// elm_calendar_min_max_year_set(cal, 2010, 2012);
|
||||||
|
//
|
||||||
|
evas_object_show(cal);
|
||||||
|
|
||||||
|
evas_object_show(win);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct _Widget_Data
|
||||||
const char *weekdays[ELM_DAY_LAST];
|
const char *weekdays[ELM_DAY_LAST];
|
||||||
struct tm current_time, selected_time;
|
struct tm current_time, selected_time;
|
||||||
Day_Color day_color[42]; // EINA_DEPRECATED
|
Day_Color day_color[42]; // EINA_DEPRECATED
|
||||||
Eina_Bool selection_enabled : 1;
|
Elm_Calendar_Select_Mode select_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Elm_Calendar_Mark
|
struct _Elm_Calendar_Mark
|
||||||
|
@ -302,7 +302,7 @@ _populate(Evas_Object *obj)
|
||||||
if ((wd->selected_it > -1) && (wd->selected_it != i))
|
if ((wd->selected_it > -1) && (wd->selected_it != i))
|
||||||
_unselect(wd, wd->selected_it);
|
_unselect(wd, wd->selected_it);
|
||||||
|
|
||||||
if (wd->selection_enabled) _select(wd, i);
|
if (wd->select_mode != ELM_CALENDAR_SELECT_NONE) _select(wd, i);
|
||||||
|
|
||||||
wd->selected_it = i;
|
wd->selected_it = i;
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ _update_sel_it(Evas_Object *obj, int sel_it)
|
||||||
{
|
{
|
||||||
int day;
|
int day;
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
if ((!wd) || (!wd->selection_enabled))
|
if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_NONE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
day = _get_item_day(obj, sel_it);
|
day = _get_item_day(obj, sel_it);
|
||||||
|
@ -621,7 +621,7 @@ _day_selected(void *data, Evas_Object *obj __UNUSED__, const char *emission __UN
|
||||||
{
|
{
|
||||||
int sel_it;
|
int sel_it;
|
||||||
Widget_Data *wd = elm_widget_data_get(data);
|
Widget_Data *wd = elm_widget_data_get(data);
|
||||||
if ((!wd) || (!wd->selection_enabled))
|
if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_NONE))
|
||||||
return;
|
return;
|
||||||
sel_it = atoi(source);
|
sel_it = atoi(source);
|
||||||
|
|
||||||
|
@ -668,7 +668,7 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
|
||||||
|
|
||||||
if (!wd) return EINA_FALSE;
|
if (!wd) return EINA_FALSE;
|
||||||
if (elm_widget_disabled_get(obj)) return EINA_FALSE;
|
if (elm_widget_disabled_get(obj)) return EINA_FALSE;
|
||||||
if (!wd->selection_enabled) return EINA_FALSE;
|
if (wd->select_mode == ELM_CALENDAR_SELECT_NONE) return EINA_FALSE;
|
||||||
|
|
||||||
if ((!strcmp(ev->keyname, "Left")) ||
|
if ((!strcmp(ev->keyname, "Left")) ||
|
||||||
((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
|
((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
|
||||||
|
@ -736,7 +736,6 @@ elm_calendar_add(Evas_Object *parent)
|
||||||
wd->today_it = -1;
|
wd->today_it = -1;
|
||||||
wd->selected_it = -1;
|
wd->selected_it = -1;
|
||||||
wd->first_day_it = -1;
|
wd->first_day_it = -1;
|
||||||
wd->selection_enabled = EINA_TRUE;
|
|
||||||
wd->format_func = _format_month_year;
|
wd->format_func = _format_month_year;
|
||||||
wd->marks = NULL;
|
wd->marks = NULL;
|
||||||
|
|
||||||
|
@ -864,26 +863,22 @@ elm_calendar_min_max_year_get(const Evas_Object *obj, int *min, int *max)
|
||||||
if (max) *max = wd->year_max + 1900;
|
if (max) *max = wd->year_max + 1900;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EINA_DEPRECATED EAPI void
|
||||||
elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled)
|
elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
if (disabled)
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_NONE);
|
||||||
if (!wd) return;
|
|
||||||
wd->selection_enabled = (!disabled);
|
|
||||||
if (!disabled)
|
|
||||||
_select(wd, wd->selected_it);
|
|
||||||
else
|
else
|
||||||
_unselect(wd, wd->selected_it);
|
elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EINA_DEPRECATED EAPI Eina_Bool
|
||||||
elm_calendar_day_selection_disabled_get(const Evas_Object *obj)
|
elm_calendar_day_selection_disabled_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
if (!wd) return EINA_FALSE;
|
if (!wd) return EINA_FALSE;
|
||||||
return (!wd->selection_enabled);
|
return !!(wd->select_mode == ELM_CALENDAR_SELECT_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -1003,3 +998,32 @@ elm_calendar_first_day_of_week_get(const Evas_Object *obj)
|
||||||
if (!wd) return -1;
|
if (!wd) return -1;
|
||||||
return wd->first_week_day;
|
return wd->first_week_day;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
elm_calendar_select_mode_set(Evas_Object *obj, Elm_Calendar_Select_Mode mode)
|
||||||
|
{
|
||||||
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
if (!wd) return;
|
||||||
|
if ((mode >= ELM_CALENDAR_SELECT_DEFAULT)
|
||||||
|
&& (mode <= ELM_CALENDAR_SELECT_ONDEMAND)
|
||||||
|
&& (wd->select_mode != mode))
|
||||||
|
{
|
||||||
|
wd->select_mode = mode;
|
||||||
|
if (wd->select_mode == ELM_CALENDAR_SELECT_ALWAYS)
|
||||||
|
_select(wd, wd->selected_it);
|
||||||
|
else
|
||||||
|
_unselect(wd, wd->selected_it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Elm_Calendar_Select_Mode
|
||||||
|
elm_calendar_select_mode_get(const Evas_Object *obj)
|
||||||
|
{
|
||||||
|
ELM_CHECK_WIDTYPE(obj, widtype) -1;
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
if (!wd) return -1;
|
||||||
|
return wd->select_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,27 @@ typedef enum
|
||||||
*/
|
*/
|
||||||
typedef _Elm_Calendar_Weekday Elm_Calendar_Weekday;
|
typedef _Elm_Calendar_Weekday Elm_Calendar_Weekday;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
ELM_CALENDAR_SELECT_DEFAULT = 0, /**< Default value. a day is always selected. */
|
||||||
|
ELM_CALENDAR_SELECT_ALWAYS, /**< a day is always selected. */
|
||||||
|
ELM_CALENDAR_SELECT_NONE, /**< None of the days can be selected. */
|
||||||
|
ELM_CALENDAR_SELECT_ONDEMAND /**< User may have selected a day or not. (not supported yet)*/
|
||||||
|
} _Elm_Calendar_Select_Mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum _Elm_Calendar_Select_Mode
|
||||||
|
* @typedef Elm_Calendar_Select_Mode
|
||||||
|
*
|
||||||
|
* the mode, who determine how user could select a day
|
||||||
|
*
|
||||||
|
* @see elm_calendar_select_mode_set()
|
||||||
|
*
|
||||||
|
* @ingroup Calendar
|
||||||
|
*/
|
||||||
|
typedef _Elm_Calendar_Select_Mode Elm_Calendar_Select_Mode;
|
||||||
|
|
||||||
typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark; /**< Item handle for a calendar mark. Created with elm_calendar_mark_add() and deleted with elm_calendar_mark_del(). */
|
typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark; /**< Item handle for a calendar mark. Created with elm_calendar_mark_add() and deleted with elm_calendar_mark_del(). */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,41 +228,31 @@ EAPI void elm_calendar_min_max_year_set(Evas_Object *obj, int mi
|
||||||
EAPI void elm_calendar_min_max_year_get(const Evas_Object *obj, int *min, int *max);
|
EAPI void elm_calendar_min_max_year_get(const Evas_Object *obj, int *min, int *max);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable day selection
|
* Set select day mode to use.
|
||||||
*
|
*
|
||||||
* @param obj The calendar object.
|
* @param obj The calendar object.
|
||||||
* @param disabled @c EINA_TRUE to disable selection or @c EINA_FALSE to
|
* @param select_mdoe The select mode to use.
|
||||||
* enable it.
|
|
||||||
*
|
*
|
||||||
* Enabled by default. If disabled, the user still can select months,
|
* Set the day selection mode used.
|
||||||
* but not days. Selected days are highlighted on calendar.
|
|
||||||
* It should be used if you won't need such selection for the widget usage.
|
|
||||||
*
|
|
||||||
* When a day is selected, or month is changed, smart callbacks for
|
|
||||||
* signal "changed" will be called.
|
|
||||||
*
|
|
||||||
* @see elm_calendar_day_selection_disabled_get()
|
|
||||||
*
|
|
||||||
* @ref calendar_example_04
|
|
||||||
*
|
*
|
||||||
* @ingroup Calendar
|
* @ingroup Calendar
|
||||||
*/
|
*/
|
||||||
EAPI void elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled);
|
EAPI void elm_calendar_select_mode_set(Evas_Object *obj, Elm_Calendar_Select_Mode mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a value whether day selection is disabled or not.
|
* Get the select day mode used.
|
||||||
*
|
*
|
||||||
* @param obj The calendar object.
|
* @param obj The calendar object.
|
||||||
* @return EINA_TRUE means day selection is disabled. EINA_FALSE indicates
|
|
||||||
* it's enabled. If @p obj is NULL, EINA_FALSE is returned.
|
|
||||||
*
|
*
|
||||||
* @see elm_calendar_day_selection_disabled_set() for details.
|
* @return the selected mode
|
||||||
*
|
*
|
||||||
* @ref calendar_example_05
|
* Get the day selection mode used.
|
||||||
|
*
|
||||||
|
* @see elm_calendar_select_mode_set() for more details
|
||||||
*
|
*
|
||||||
* @ingroup Calendar
|
* @ingroup Calendar
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool elm_calendar_day_selection_disabled_get(const Evas_Object *obj);
|
EAPI Elm_Calendar_Select_Mode elm_calendar_select_mode_get(const Evas_Object *obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set selected date to be highlighted on calendar.
|
* Set selected date to be highlighted on calendar.
|
||||||
|
|
|
@ -410,3 +410,14 @@ EINA_DEPRECATED EAPI void * elm_multibuttonentry_item_data_get(const Elm_Object_
|
||||||
* @deprecated Use elm_object_item_data_set instead.
|
* @deprecated Use elm_object_item_data_set instead.
|
||||||
*/
|
*/
|
||||||
EINA_DEPRECATED EAPI void elm_multibuttonentry_item_data_set(Elm_Object_Item *it, void *data);
|
EINA_DEPRECATED EAPI void elm_multibuttonentry_item_data_set(Elm_Object_Item *it, void *data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use elm_calendar_select_mode_set instead.
|
||||||
|
*/
|
||||||
|
EINA_DEPRECATED EAPI void elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use elm_calendar_select_mode_get instead.
|
||||||
|
*/
|
||||||
|
EINA_DEPRECATED EAPI Eina_Bool elm_calendar_day_selection_disabled_get(const Evas_Object *obj);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue