7 * @enum _Elm_Calendar_Mark_Repeat
8 * @typedef Elm_Calendar_Mark_Repeat
10 * Event periodicity, used to define if a mark should be repeated
11 * @b beyond event's day. It's set when a mark is added.
13 * So, for a mark added to 13th May with periodicity set to WEEKLY,
14 * there will be marks every week after this date. Marks will be displayed
15 * at 13th, 20th, 27th, 3rd June ...
17 * Values don't work as bitmask, only one can be choosen.
19 * @see elm_calendar_mark_add()
23 typedef enum _Elm_Calendar_Mark_Repeat
25 ELM_CALENDAR_UNIQUE, /**< Default value. Marks will be displayed only on event day. */
26 ELM_CALENDAR_DAILY, /**< Marks will be displayed everyday after event day (inclusive). */
27 ELM_CALENDAR_WEEKLY, /**< Marks will be displayed every week after event day (inclusive) - i.e. each seven days. */
28 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*/
29 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. */
30 } Elm_Calendar_Mark_Repeat;
32 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(). */
35 * Add a new calendar widget to the given parent Elementary
38 * @param parent The parent object.
39 * @return a new calendar widget handle or @c NULL, on errors.
41 * This function inserts a new calendar widget on the canvas.
43 * @ref calendar_example_01
48 elm_calendar_add(Evas_Object *parent)
52 * Get weekdays names displayed by the calendar.
54 * @param obj The calendar object.
55 * @return Array of seven strings to be used as weekday names.
57 * By default, weekdays abbreviations get from system are displayed:
58 * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
59 * The first string is related to Sunday, the second to Monday...
61 * @see elm_calendar_weekdays_name_set()
63 * @ref calendar_example_05
67 EAPI const char **elm_calendar_weekdays_names_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
70 * Set weekdays names to be displayed by the calendar.
72 * @param obj The calendar object.
73 * @param weekdays Array of seven strings to be used as weekday names.
74 * @warning It must have 7 elements, or it will access invalid memory.
75 * @warning The strings must be NULL terminated ('@\0').
77 * By default, weekdays abbreviations get from system are displayed:
78 * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
80 * The first string should be related to Sunday, the second to Monday...
82 * The usage should be like this:
84 * const char *weekdays[] =
86 * "Sunday", "Monday", "Tuesday", "Wednesday",
87 * "Thursday", "Friday", "Saturday"
89 * elm_calendar_weekdays_names_set(calendar, weekdays);
92 * @see elm_calendar_weekdays_name_get()
94 * @ref calendar_example_02
98 EAPI void elm_calendar_weekdays_names_set(Evas_Object *obj, const char *weekdays[]) EINA_ARG_NONNULL(1, 2);
101 * Set the minimum and maximum values for the year
103 * @param obj The calendar object
104 * @param min The minimum year, greater than 1901;
105 * @param max The maximum year;
107 * Maximum must be greater than minimum, except if you don't wan't to set
109 * Default values are 1902 and -1.
111 * If the maximum year is a negative value, it will be limited depending
112 * on the platform architecture (year 2037 for 32 bits);
114 * @see elm_calendar_min_max_year_get()
116 * @ref calendar_example_03
120 EAPI void elm_calendar_min_max_year_set(Evas_Object *obj, int min, int max) EINA_ARG_NONNULL(1);
123 * Get the minimum and maximum values for the year
125 * @param obj The calendar object.
126 * @param min The minimum year.
127 * @param max The maximum year.
129 * Default values are 1902 and -1.
131 * @see elm_calendar_min_max_year_get() for more details.
133 * @ref calendar_example_05
137 EAPI void elm_calendar_min_max_year_get(const Evas_Object *obj, int *min, int *max) EINA_ARG_NONNULL(1);
140 * Enable or disable day selection
142 * @param obj The calendar object.
143 * @param enabled @c EINA_TRUE to enable selection or @c EINA_FALSE to
146 * Enabled by default. If disabled, the user still can select months,
147 * but not days. Selected days are highlighted on calendar.
148 * It should be used if you won't need such selection for the widget usage.
150 * When a day is selected, or month is changed, smart callbacks for
151 * signal "changed" will be called.
153 * @see elm_calendar_day_selection_enable_get()
155 * @ref calendar_example_04
159 EAPI void elm_calendar_day_selection_enabled_set(Evas_Object *obj, Eina_Bool enabled) EINA_ARG_NONNULL(1);
162 * Get a value whether day selection is enabled or not.
164 * @see elm_calendar_day_selection_enable_set() for details.
166 * @param obj The calendar object.
167 * @return EINA_TRUE means day selection is enabled. EINA_FALSE indicates
168 * it's disabled. If @p obj is NULL, EINA_FALSE is returned.
170 * @ref calendar_example_05
174 EAPI Eina_Bool elm_calendar_day_selection_enabled_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
177 * Set selected date to be highlighted on calendar.
179 * @param obj The calendar object.
180 * @param selected_time A @b tm struct to represent the selected date.
182 * Set the selected date, changing the displayed month if needed.
183 * Selected date changes when the user goes to next/previous month or
184 * select a day pressing over it on calendar.
186 * @see elm_calendar_selected_time_get()
188 * @ref calendar_example_04
192 EAPI void elm_calendar_selected_time_set(Evas_Object *obj, struct tm *selected_time) EINA_ARG_NONNULL(1);
197 * @param obj The calendar object
198 * @param selected_time A @b tm struct to point to selected date
199 * @return EINA_FALSE means an error ocurred and returned time shouldn't
202 * Get date selected by the user or set by function
203 * elm_calendar_selected_time_set().
204 * Selected date changes when the user goes to next/previous month or
205 * select a day pressing over it on calendar.
207 * @see elm_calendar_selected_time_get()
209 * @ref calendar_example_05
213 EAPI Eina_Bool elm_calendar_selected_time_get(const Evas_Object *obj, struct tm *selected_time) EINA_ARG_NONNULL(1, 2);
216 * Set a function to format the string that will be used to display
219 * @param obj The calendar object
220 * @param format_function Function to set the month-year string given
223 * By default it uses strftime with "%B %Y" format string.
224 * It should allocate the memory that will be used by the string,
225 * that will be freed by the widget after usage.
226 * A pointer to the string and a pointer to the time struct will be provided.
231 * _format_month_year(struct tm *selected_time)
234 * if (!strftime(buf, sizeof(buf), "%B %Y", selected_time)) return NULL;
235 * return strdup(buf);
238 * elm_calendar_format_function_set(calendar, _format_month_year);
241 * @ref calendar_example_02
245 EAPI void elm_calendar_format_function_set(Evas_Object *obj, char *(*format_function)(struct tm *stime)) EINA_ARG_NONNULL(1);
248 * Add a new mark to the calendar
250 * @param obj The calendar object
251 * @param mark_type A string used to define the type of mark. It will be
252 * emitted to the theme, that should display a related modification on these
253 * days representation.
254 * @param mark_time A time struct to represent the date of inclusion of the
255 * mark. For marks that repeats it will just be displayed after the inclusion
256 * date in the calendar.
257 * @param repeat Repeat the event following this periodicity. Can be a unique
258 * mark (that don't repeat), daily, weekly, monthly or annually.
259 * @return The created mark or @p NULL upon failure.
261 * Add a mark that will be drawn in the calendar respecting the insertion
262 * time and periodicity. It will emit the type as signal to the widget theme.
263 * Default theme supports "holiday" and "checked", but it can be extended.
265 * It won't immediately update the calendar, drawing the marks.
266 * For this, call elm_calendar_marks_draw(). However, when user selects
267 * next or previous month calendar forces marks drawn.
269 * Marks created with this method can be deleted with
270 * elm_calendar_mark_del().
274 * struct tm selected_time;
275 * time_t current_time;
277 * current_time = time(NULL) + 5 * 84600;
278 * localtime_r(¤t_time, &selected_time);
279 * elm_calendar_mark_add(cal, "holiday", selected_time,
280 * ELM_CALENDAR_ANNUALLY);
282 * current_time = time(NULL) + 1 * 84600;
283 * localtime_r(¤t_time, &selected_time);
284 * elm_calendar_mark_add(cal, "checked", selected_time, ELM_CALENDAR_UNIQUE);
286 * elm_calendar_marks_draw(cal);
289 * @see elm_calendar_marks_draw()
290 * @see elm_calendar_mark_del()
292 * @ref calendar_example_06
296 EAPI Elm_Calendar_Mark *elm_calendar_mark_add(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat repeat) EINA_ARG_NONNULL(1);
299 * Delete mark from the calendar.
301 * @param mark The mark to be deleted.
303 * If deleting all calendar marks is required, elm_calendar_marks_clear()
304 * should be used instead of getting marks list and deleting each one.
306 * @see elm_calendar_mark_add()
308 * @ref calendar_example_06
312 EAPI void elm_calendar_mark_del(Elm_Calendar_Mark *mark) EINA_ARG_NONNULL(1);
315 * Remove all calendar's marks
317 * @param obj The calendar object.
319 * @see elm_calendar_mark_add()
320 * @see elm_calendar_mark_del()
324 EAPI void elm_calendar_marks_clear(Evas_Object *obj) EINA_ARG_NONNULL(1);
327 * Get a list of all the calendar marks.
329 * @param obj The calendar object.
330 * @return An @c Eina_List of calendar marks objects, or @c NULL on failure.
332 * @see elm_calendar_mark_add()
333 * @see elm_calendar_mark_del()
334 * @see elm_calendar_marks_clear()
338 EAPI const Eina_List *elm_calendar_marks_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
341 * Draw calendar marks.
343 * @param obj The calendar object.
345 * Should be used after adding, removing or clearing marks.
346 * It will go through the entire marks list updating the calendar.
347 * If lots of marks will be added, add all the marks and then call
350 * When the month is changed, i.e. user selects next or previous month,
351 * marks will be drawed.
353 * @see elm_calendar_mark_add()
354 * @see elm_calendar_mark_del()
355 * @see elm_calendar_marks_clear()
357 * @ref calendar_example_06
361 EAPI void elm_calendar_marks_draw(Evas_Object *obj) EINA_ARG_NONNULL(1);
364 * Set a day text color to the same that represents Saturdays.
366 * @param obj The calendar object.
367 * @param pos The text position. Position is the cell counter, from left
368 * to right, up to down. It starts on 0 and ends on 41.
370 * @deprecated use elm_calendar_mark_add() instead like:
373 * struct tm t = { 0, 0, 12, 6, 0, 0, 6, 6, -1 };
374 * elm_calendar_mark_add(obj, "sat", &t, ELM_CALENDAR_WEEKLY);
377 * @see elm_calendar_mark_add()
381 EINA_DEPRECATED EAPI void elm_calendar_text_saturday_color_set(Evas_Object *obj, int pos) EINA_ARG_NONNULL(1);
384 * Set a day text color to the same that represents Sundays.
386 * @param obj The calendar object.
387 * @param pos The text position. Position is the cell counter, from left
388 * to right, up to down. It starts on 0 and ends on 41.
390 * @deprecated use elm_calendar_mark_add() instead like:
393 * struct tm t = { 0, 0, 12, 7, 0, 0, 0, 0, -1 };
394 * elm_calendar_mark_add(obj, "sat", &t, ELM_CALENDAR_WEEKLY);
397 * @see elm_calendar_mark_add()
401 EINA_DEPRECATED EAPI void elm_calendar_text_sunday_color_set(Evas_Object *obj, int pos) EINA_ARG_NONNULL(1);
404 * Set a day text color to the same that represents Weekdays.
406 * @param obj The calendar object
407 * @param pos The text position. Position is the cell counter, from left
408 * to right, up to down. It starts on 0 and ends on 41.
410 * @deprecated use elm_calendar_mark_add() instead like:
413 * struct tm t = { 0, 0, 12, 1, 0, 0, 0, 0, -1 };
415 * elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // monday
416 * t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
417 * elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // tuesday
418 * t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
419 * elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // wednesday
420 * t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
421 * elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // thursday
422 * t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
423 * elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // friday
426 * @see elm_calendar_mark_add()
430 EINA_DEPRECATED EAPI void elm_calendar_text_weekday_color_set(Evas_Object *obj, int pos) EINA_ARG_NONNULL(1);
433 * Set the interval on time updates for an user mouse button hold
434 * on calendar widgets' month selection.
436 * @param obj The calendar object
437 * @param interval The (first) interval value in seconds
439 * This interval value is @b decreased while the user holds the
440 * mouse pointer either selecting next or previous month.
442 * This helps the user to get to a given month distant from the
443 * current one easier/faster, as it will start to change quicker and
444 * quicker on mouse button holds.
446 * The calculation for the next change interval value, starting from
447 * the one set with this call, is the previous interval divided by
448 * 1.05, so it decreases a little bit.
450 * The default starting interval value for automatic changes is
453 * @see elm_calendar_interval_get()
457 EAPI void elm_calendar_interval_set(Evas_Object *obj, double interval) EINA_ARG_NONNULL(1);
460 * Get the interval on time updates for an user mouse button hold
461 * on calendar widgets' month selection.
463 * @param obj The calendar object
464 * @return The (first) interval value, in seconds, set on it
466 * @see elm_calendar_interval_set() for more details
470 EAPI double elm_calendar_interval_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);