4 * @defgroup Calendar Calendar
6 * This is a Calendar widget. Calender widget helps applications to flexibly
7 * display a calender with day of the week, day, year and month. Applications will be
8 * able to choose a specific date that will be reported in the smart_callbacks for
9 * the calendar widget. The APIs of calendar widget let the applications perform
10 * other functions like,
11 * placing marks on specific dates
12 * Setting the bounds for the calendar (minimum and maximum years)
13 * Setting the day names of the week. ( for ex. Thu. or Thursday)
14 * Setting the year and month format.
16 * Signals that you can add callbacks for are:
17 * - @c "changed" - emitted when the date in the calendar is changed.
19 * Supported elm_object common APIs.
20 * @li elm_object_signal_emit
21 * @li elm_object_signal_callback_add
22 * @li elm_object_signal_callback_del
27 >>>>>>> remotes/origin/upstream
28 * @addtogroup Calendar
34 * @enum _Elm_Calendar_Mark_Repeat
35 * @typedef Elm_Calendar_Mark_Repeat
39 ELM_CALENDAR_UNIQUE, /**< Default value. Marks will be displayed only on event day. */
40 ELM_CALENDAR_DAILY, /**< Marks will be displayed every day after event day (inclusive). */
41 ELM_CALENDAR_WEEKLY, /**< Marks will be displayed every week after event day (inclusive) - i.e. each seven days. */
42 ELM_CALENDAR_MONTHLY, /**< Marks will be displayed every month day that coincides to event day. E.g.: if an event is set to 30th Jan, no marks will be displayed on Feb, but will be displayed on 30th Mar*/
43 ELM_CALENDAR_ANNUALLY /**< Marks will be displayed every year that coincides to event day (and month). E.g. an event added to 30th Jan 2012 will be repeated on 30th Jan 2013. */
44 } _Elm_Calendar_Mark_Repeat_Type;
47 * @enum _Elm_Calendar_Mark_Repeat_Type
48 * @typedef Elm_Calendar_Mark_Repeat_Type
49 >>>>>>> remotes/origin/upstream
51 * Event periodicity, used to define if a mark should be repeated
52 * @b beyond event's day. It's set when a mark is added.
54 * So, for a mark added to 13th May with periodicity set to WEEKLY,
55 * there will be marks every week after this date. Marks will be displayed
56 * at 13th, 20th, 27th, 3rd June ...
59 * Values don't work as bitmask, only one can be choosen.
61 * Supported elm_object common APIs.
62 * @li elm_object_signal_emit
63 * @li elm_object_signal_callback_add
64 * @li elm_object_signal_callback_del
66 * Values don't work as bitmask, only one can be chosen.
67 >>>>>>> remotes/origin/upstream
69 * @see elm_calendar_mark_add()
76 ELM_CALENDAR_UNIQUE, /**< Default value. Marks will be displayed only on event day. */
77 ELM_CALENDAR_DAILY, /**< Marks will be displayed everyday after event day (inclusive). */
78 ELM_CALENDAR_WEEKLY, /**< Marks will be displayed every week after event day (inclusive) - i.e. each seven days. */
79 ELM_CALENDAR_MONTHLY, /**< Marks will be displayed every month day that coincides to event day. E.g.: if an event is set to 30th Jan, no marks will be displayed on Feb, but will be displayed on 30th Mar*/
80 ELM_CALENDAR_ANNUALLY /**< Marks will be displayed every year that coincides to event day (and month). E.g. an event added to 30th Jan 2012 will be repeated on 30th Jan 2013. */
81 } Elm_Calendar_Mark_Repeat;
83 typedef _Elm_Calendar_Mark_Repeat_Type Elm_Calendar_Mark_Repeat_Type;
84 >>>>>>> remotes/origin/upstream
86 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(). */
91 * @typedef Elm_Calendar_Format_Cb
93 * This callback type is used to format the string that will be used
94 * to display month and year.
96 * @param stime Struct representing time.
97 * @return String representing time that will be set to calendar's text.
99 * @see elm_calendar_format_function_set()
101 typedef char * (*Elm_Calendar_Format_Cb)(struct tm *stime);
104 >>>>>>> remotes/origin/upstream
105 * Add a new calendar widget to the given parent Elementary
106 * (container) object.
108 * @param parent The parent object.
109 * @return a new calendar widget handle or @c NULL, on errors.
111 * This function inserts a new calendar widget on the canvas.
113 * @ref calendar_example_01
117 EAPI Evas_Object *elm_calendar_add(Evas_Object *parent);
120 * Get weekdays names displayed by the calendar.
122 * @param obj The calendar object.
123 * @return Array of seven strings to be used as weekday names.
125 * By default, weekdays abbreviations get from system are displayed:
126 * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
127 * The first string is related to Sunday, the second to Monday...
129 * @see elm_calendar_weekdays_name_set()
131 * @ref calendar_example_05
135 EAPI const char **elm_calendar_weekdays_names_get(const Evas_Object *obj);
138 * Set weekdays names to be displayed by the calendar.
140 * @param obj The calendar object.
141 * @param weekdays Array of seven strings to be used as weekday names.
142 * @warning It must have 7 elements, or it will access invalid memory.
143 * @warning The strings must be NULL terminated ('@\0').
145 * By default, weekdays abbreviations get from system are displayed:
146 * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
148 * The first string should be related to Sunday, the second to Monday...
150 * The usage should be like this:
152 * const char *weekdays[] =
154 * "Sunday", "Monday", "Tuesday", "Wednesday",
155 * "Thursday", "Friday", "Saturday"
157 * elm_calendar_weekdays_names_set(calendar, weekdays);
160 * @see elm_calendar_weekdays_name_get()
162 * @ref calendar_example_02
166 EAPI void elm_calendar_weekdays_names_set(Evas_Object *obj, const char *weekdays[]);
169 * Set the minimum and maximum values for the year
171 * @param obj The calendar object
172 * @param min The minimum year, greater than 1901;
173 * @param max The maximum year;
176 * Maximum must be greater than minimum, except if you don't wan't to set
178 * Maximum must be greater than minimum, except if you don't want to set
179 >>>>>>> remotes/origin/upstream
181 * Default values are 1902 and -1.
183 * If the maximum year is a negative value, it will be limited depending
184 * on the platform architecture (year 2037 for 32 bits);
186 * @see elm_calendar_min_max_year_get()
188 * @ref calendar_example_03
192 EAPI void elm_calendar_min_max_year_set(Evas_Object *obj, int min, int max);
195 * Get the minimum and maximum values for the year
197 * @param obj The calendar object.
198 * @param min The minimum year.
199 * @param max The maximum year.
201 * Default values are 1902 and -1.
203 * @see elm_calendar_min_max_year_get() for more details.
205 * @ref calendar_example_05
209 EAPI void elm_calendar_min_max_year_get(const Evas_Object *obj, int *min, int *max);
212 * Enable or disable day selection
214 * @param obj The calendar object.
216 * @param enabled @c EINA_TRUE to enable selection or @c EINA_FALSE to
219 * @param disabled @c EINA_TRUE to disable selection or @c EINA_FALSE to
221 >>>>>>> remotes/origin/upstream
223 * Enabled by default. If disabled, the user still can select months,
224 * but not days. Selected days are highlighted on calendar.
225 * It should be used if you won't need such selection for the widget usage.
227 * When a day is selected, or month is changed, smart callbacks for
228 * signal "changed" will be called.
231 * @see elm_calendar_day_selection_enable_get()
233 * @see elm_calendar_day_selection_disabled_get()
234 >>>>>>> remotes/origin/upstream
236 * @ref calendar_example_04
241 EAPI void elm_calendar_day_selection_enabled_set(Evas_Object *obj, Eina_Bool enabled);
244 * Get a value whether day selection is enabled or not.
246 * @see elm_calendar_day_selection_enable_set() for details.
248 * @param obj The calendar object.
249 * @return EINA_TRUE means day selection is enabled. EINA_FALSE indicates
250 * it's disabled. If @p obj is NULL, EINA_FALSE is returned.
252 EAPI void elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled);
255 * Get a value whether day selection is disabled or not.
257 * @param obj The calendar object.
258 * @return EINA_TRUE means day selection is disabled. EINA_FALSE indicates
259 * it's enabled. If @p obj is NULL, EINA_FALSE is returned.
261 * @see elm_calendar_day_selection_disabled_set() for details.
262 >>>>>>> remotes/origin/upstream
264 * @ref calendar_example_05
269 EAPI Eina_Bool elm_calendar_day_selection_enabled_get(const Evas_Object *obj);
271 EAPI Eina_Bool elm_calendar_day_selection_disabled_get(const Evas_Object *obj);
272 >>>>>>> remotes/origin/upstream
275 * Set selected date to be highlighted on calendar.
277 * @param obj The calendar object.
278 * @param selected_time A @b tm struct to represent the selected date.
280 * Set the selected date, changing the displayed month if needed.
281 * Selected date changes when the user goes to next/previous month or
282 * select a day pressing over it on calendar.
284 * @see elm_calendar_selected_time_get()
286 * @ref calendar_example_04
290 EAPI void elm_calendar_selected_time_set(Evas_Object *obj, struct tm *selected_time);
295 * @param obj The calendar object
296 * @param selected_time A @b tm struct to point to selected date
298 * @return EINA_FALSE means an error ocurred and returned time shouldn't
300 * @return EINA_FALSE means an error occurred and returned time shouldn't
301 >>>>>>> remotes/origin/upstream
304 * Get date selected by the user or set by function
305 * elm_calendar_selected_time_set().
306 * Selected date changes when the user goes to next/previous month or
307 * select a day pressing over it on calendar.
309 * @see elm_calendar_selected_time_get()
311 * @ref calendar_example_05
315 EAPI Eina_Bool elm_calendar_selected_time_get(const Evas_Object *obj, struct tm *selected_time);
318 * Set a function to format the string that will be used to display
321 * @param obj The calendar object
322 * @param format_function Function to set the month-year string given
325 * By default it uses strftime with "%B %Y" format string.
326 * It should allocate the memory that will be used by the string,
327 * that will be freed by the widget after usage.
328 * A pointer to the string and a pointer to the time struct will be provided.
333 * _format_month_year(struct tm *selected_time)
336 * if (!strftime(buf, sizeof(buf), "%B %Y", selected_time)) return NULL;
337 * return strdup(buf);
340 * elm_calendar_format_function_set(calendar, _format_month_year);
343 * @ref calendar_example_02
348 EAPI void elm_calendar_format_function_set(Evas_Object *obj, char *(*format_function)(struct tm *stime));
350 EAPI void elm_calendar_format_function_set(Evas_Object *obj, Elm_Calendar_Format_Cb format_func);
351 >>>>>>> remotes/origin/upstream
354 * Add a new mark to the calendar
356 * @param obj The calendar object
357 * @param mark_type A string used to define the type of mark. It will be
358 * emitted to the theme, that should display a related modification on these
359 * days representation.
360 * @param mark_time A time struct to represent the date of inclusion of the
361 * mark. For marks that repeats it will just be displayed after the inclusion
362 * date in the calendar.
363 * @param repeat Repeat the event following this periodicity. Can be a unique
364 * mark (that don't repeat), daily, weekly, monthly or annually.
365 * @return The created mark or @p NULL upon failure.
367 * Add a mark that will be drawn in the calendar respecting the insertion
368 * time and periodicity. It will emit the type as signal to the widget theme.
369 * Default theme supports "holiday" and "checked", but it can be extended.
371 * It won't immediately update the calendar, drawing the marks.
372 * For this, call elm_calendar_marks_draw(). However, when user selects
373 * next or previous month calendar forces marks drawn.
375 * Marks created with this method can be deleted with
376 * elm_calendar_mark_del().
380 * struct tm selected_time;
381 * time_t current_time;
383 * current_time = time(NULL) + 5 * 84600;
384 * localtime_r(¤t_time, &selected_time);
385 * elm_calendar_mark_add(cal, "holiday", selected_time,
386 * ELM_CALENDAR_ANNUALLY);
388 * current_time = time(NULL) + 1 * 84600;
389 * localtime_r(¤t_time, &selected_time);
390 * elm_calendar_mark_add(cal, "checked", selected_time, ELM_CALENDAR_UNIQUE);
392 * elm_calendar_marks_draw(cal);
395 * @see elm_calendar_marks_draw()
396 * @see elm_calendar_mark_del()
398 * @ref calendar_example_06
403 EAPI Elm_Calendar_Mark *elm_calendar_mark_add(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat repeat);
405 EAPI Elm_Calendar_Mark *elm_calendar_mark_add(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat_Type repeat);
406 >>>>>>> remotes/origin/upstream
409 * Delete mark from the calendar.
411 * @param mark The mark to be deleted.
413 * If deleting all calendar marks is required, elm_calendar_marks_clear()
414 * should be used instead of getting marks list and deleting each one.
416 * @see elm_calendar_mark_add()
418 * @ref calendar_example_06
422 EAPI void elm_calendar_mark_del(Elm_Calendar_Mark *mark);
425 * Remove all calendar's marks
427 * @param obj The calendar object.
429 * @see elm_calendar_mark_add()
430 * @see elm_calendar_mark_del()
434 EAPI void elm_calendar_marks_clear(Evas_Object *obj);
437 * Get a list of all the calendar marks.
439 * @param obj The calendar object.
440 * @return An @c Eina_List of calendar marks objects, or @c NULL on failure.
442 * @see elm_calendar_mark_add()
443 * @see elm_calendar_mark_del()
444 * @see elm_calendar_marks_clear()
448 EAPI const Eina_List *elm_calendar_marks_get(const Evas_Object *obj);
451 * Draw calendar marks.
453 * @param obj The calendar object.
455 * Should be used after adding, removing or clearing marks.
456 * It will go through the entire marks list updating the calendar.
457 * If lots of marks will be added, add all the marks and then call
460 * When the month is changed, i.e. user selects next or previous month,
462 * marks will be drawed.
464 * marks will be drawn.
465 >>>>>>> remotes/origin/upstream
467 * @see elm_calendar_mark_add()
468 * @see elm_calendar_mark_del()
469 * @see elm_calendar_marks_clear()
471 * @ref calendar_example_06
475 EAPI void elm_calendar_marks_draw(Evas_Object *obj);
478 * Set the interval on time updates for an user mouse button hold
479 * on calendar widgets' month selection.
481 * @param obj The calendar object
482 * @param interval The (first) interval value in seconds
484 * This interval value is @b decreased while the user holds the
485 * mouse pointer either selecting next or previous month.
487 * This helps the user to get to a given month distant from the
488 * current one easier/faster, as it will start to change quicker and
489 * quicker on mouse button holds.
491 * The calculation for the next change interval value, starting from
492 * the one set with this call, is the previous interval divided by
493 * 1.05, so it decreases a little bit.
495 * The default starting interval value for automatic changes is
498 * @see elm_calendar_interval_get()
502 EAPI void elm_calendar_interval_set(Evas_Object *obj, double interval);
505 * Get the interval on time updates for an user mouse button hold
506 * on calendar widgets' month selection.
508 * @param obj The calendar object
509 * @return The (first) interval value, in seconds, set on it
511 * @see elm_calendar_interval_set() for more details
515 EAPI double elm_calendar_interval_get(const Evas_Object *obj);