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()
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
47 EAPI Evas_Object *elm_calendar_add(Evas_Object *parent);
50 * Get weekdays names displayed by the calendar.
52 * @param obj The calendar object.
53 * @return Array of seven strings to be used as weekday names.
55 * By default, weekdays abbreviations get from system are displayed:
56 * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
57 * The first string is related to Sunday, the second to Monday...
59 * @see elm_calendar_weekdays_name_set()
61 * @ref calendar_example_05
65 EAPI const char **elm_calendar_weekdays_names_get(const Evas_Object *obj);
68 * Set weekdays names to be displayed by the calendar.
70 * @param obj The calendar object.
71 * @param weekdays Array of seven strings to be used as weekday names.
72 * @warning It must have 7 elements, or it will access invalid memory.
73 * @warning The strings must be NULL terminated ('@\0').
75 * By default, weekdays abbreviations get from system are displayed:
76 * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
78 * The first string should be related to Sunday, the second to Monday...
80 * The usage should be like this:
82 * const char *weekdays[] =
84 * "Sunday", "Monday", "Tuesday", "Wednesday",
85 * "Thursday", "Friday", "Saturday"
87 * elm_calendar_weekdays_names_set(calendar, weekdays);
90 * @see elm_calendar_weekdays_name_get()
92 * @ref calendar_example_02
96 EAPI void elm_calendar_weekdays_names_set(Evas_Object *obj, const char *weekdays[]);
99 * Set the minimum and maximum values for the year
101 * @param obj The calendar object
102 * @param min The minimum year, greater than 1901;
103 * @param max The maximum year;
105 * Maximum must be greater than minimum, except if you don't wan't to set
107 * Default values are 1902 and -1.
109 * If the maximum year is a negative value, it will be limited depending
110 * on the platform architecture (year 2037 for 32 bits);
112 * @see elm_calendar_min_max_year_get()
114 * @ref calendar_example_03
118 EAPI void elm_calendar_min_max_year_set(Evas_Object *obj, int min, int max);
121 * Get the minimum and maximum values for the year
123 * @param obj The calendar object.
124 * @param min The minimum year.
125 * @param max The maximum year.
127 * Default values are 1902 and -1.
129 * @see elm_calendar_min_max_year_get() for more details.
131 * @ref calendar_example_05
135 EAPI void elm_calendar_min_max_year_get(const Evas_Object *obj, int *min, int *max);
138 * Enable or disable day selection
140 * @param obj The calendar object.
141 * @param enabled @c EINA_TRUE to enable selection or @c EINA_FALSE to
144 * Enabled by default. If disabled, the user still can select months,
145 * but not days. Selected days are highlighted on calendar.
146 * It should be used if you won't need such selection for the widget usage.
148 * When a day is selected, or month is changed, smart callbacks for
149 * signal "changed" will be called.
151 * @see elm_calendar_day_selection_enable_get()
153 * @ref calendar_example_04
157 EAPI void elm_calendar_day_selection_enabled_set(Evas_Object *obj, Eina_Bool enabled);
160 * Get a value whether day selection is enabled or not.
162 * @see elm_calendar_day_selection_enable_set() for details.
164 * @param obj The calendar object.
165 * @return EINA_TRUE means day selection is enabled. EINA_FALSE indicates
166 * it's disabled. If @p obj is NULL, EINA_FALSE is returned.
168 * @ref calendar_example_05
172 EAPI Eina_Bool elm_calendar_day_selection_enabled_get(const Evas_Object *obj);
175 * Set selected date to be highlighted on calendar.
177 * @param obj The calendar object.
178 * @param selected_time A @b tm struct to represent the selected date.
180 * Set the selected date, changing the displayed month if needed.
181 * Selected date changes when the user goes to next/previous month or
182 * select a day pressing over it on calendar.
184 * @see elm_calendar_selected_time_get()
186 * @ref calendar_example_04
190 EAPI void elm_calendar_selected_time_set(Evas_Object *obj, struct tm *selected_time);
195 * @param obj The calendar object
196 * @param selected_time A @b tm struct to point to selected date
197 * @return EINA_FALSE means an error ocurred and returned time shouldn't
200 * Get date selected by the user or set by function
201 * elm_calendar_selected_time_set().
202 * Selected date changes when the user goes to next/previous month or
203 * select a day pressing over it on calendar.
205 * @see elm_calendar_selected_time_get()
207 * @ref calendar_example_05
211 EAPI Eina_Bool elm_calendar_selected_time_get(const Evas_Object *obj, struct tm *selected_time);
214 * Set a function to format the string that will be used to display
217 * @param obj The calendar object
218 * @param format_function Function to set the month-year string given
221 * By default it uses strftime with "%B %Y" format string.
222 * It should allocate the memory that will be used by the string,
223 * that will be freed by the widget after usage.
224 * A pointer to the string and a pointer to the time struct will be provided.
229 * _format_month_year(struct tm *selected_time)
232 * if (!strftime(buf, sizeof(buf), "%B %Y", selected_time)) return NULL;
233 * return strdup(buf);
236 * elm_calendar_format_function_set(calendar, _format_month_year);
239 * @ref calendar_example_02
243 EAPI void elm_calendar_format_function_set(Evas_Object *obj, char *(*format_function)(struct tm *stime));
246 * Add a new mark to the calendar
248 * @param obj The calendar object
249 * @param mark_type A string used to define the type of mark. It will be
250 * emitted to the theme, that should display a related modification on these
251 * days representation.
252 * @param mark_time A time struct to represent the date of inclusion of the
253 * mark. For marks that repeats it will just be displayed after the inclusion
254 * date in the calendar.
255 * @param repeat Repeat the event following this periodicity. Can be a unique
256 * mark (that don't repeat), daily, weekly, monthly or annually.
257 * @return The created mark or @p NULL upon failure.
259 * Add a mark that will be drawn in the calendar respecting the insertion
260 * time and periodicity. It will emit the type as signal to the widget theme.
261 * Default theme supports "holiday" and "checked", but it can be extended.
263 * It won't immediately update the calendar, drawing the marks.
264 * For this, call elm_calendar_marks_draw(). However, when user selects
265 * next or previous month calendar forces marks drawn.
267 * Marks created with this method can be deleted with
268 * elm_calendar_mark_del().
272 * struct tm selected_time;
273 * time_t current_time;
275 * current_time = time(NULL) + 5 * 84600;
276 * localtime_r(¤t_time, &selected_time);
277 * elm_calendar_mark_add(cal, "holiday", selected_time,
278 * ELM_CALENDAR_ANNUALLY);
280 * current_time = time(NULL) + 1 * 84600;
281 * localtime_r(¤t_time, &selected_time);
282 * elm_calendar_mark_add(cal, "checked", selected_time, ELM_CALENDAR_UNIQUE);
284 * elm_calendar_marks_draw(cal);
287 * @see elm_calendar_marks_draw()
288 * @see elm_calendar_mark_del()
290 * @ref calendar_example_06
294 EAPI Elm_Calendar_Mark *elm_calendar_mark_add(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat repeat);
297 * Delete mark from the calendar.
299 * @param mark The mark to be deleted.
301 * If deleting all calendar marks is required, elm_calendar_marks_clear()
302 * should be used instead of getting marks list and deleting each one.
304 * @see elm_calendar_mark_add()
306 * @ref calendar_example_06
310 EAPI void elm_calendar_mark_del(Elm_Calendar_Mark *mark);
313 * Remove all calendar's marks
315 * @param obj The calendar object.
317 * @see elm_calendar_mark_add()
318 * @see elm_calendar_mark_del()
322 EAPI void elm_calendar_marks_clear(Evas_Object *obj);
325 * Get a list of all the calendar marks.
327 * @param obj The calendar object.
328 * @return An @c Eina_List of calendar marks objects, or @c NULL on failure.
330 * @see elm_calendar_mark_add()
331 * @see elm_calendar_mark_del()
332 * @see elm_calendar_marks_clear()
336 EAPI const Eina_List *elm_calendar_marks_get(const Evas_Object *obj);
339 * Draw calendar marks.
341 * @param obj The calendar object.
343 * Should be used after adding, removing or clearing marks.
344 * It will go through the entire marks list updating the calendar.
345 * If lots of marks will be added, add all the marks and then call
348 * When the month is changed, i.e. user selects next or previous month,
349 * marks will be drawed.
351 * @see elm_calendar_mark_add()
352 * @see elm_calendar_mark_del()
353 * @see elm_calendar_marks_clear()
355 * @ref calendar_example_06
359 EAPI void elm_calendar_marks_draw(Evas_Object *obj);
362 * Set the interval on time updates for an user mouse button hold
363 * on calendar widgets' month selection.
365 * @param obj The calendar object
366 * @param interval The (first) interval value in seconds
368 * This interval value is @b decreased while the user holds the
369 * mouse pointer either selecting next or previous month.
371 * This helps the user to get to a given month distant from the
372 * current one easier/faster, as it will start to change quicker and
373 * quicker on mouse button holds.
375 * The calculation for the next change interval value, starting from
376 * the one set with this call, is the previous interval divided by
377 * 1.05, so it decreases a little bit.
379 * The default starting interval value for automatic changes is
382 * @see elm_calendar_interval_get()
386 EAPI void elm_calendar_interval_set(Evas_Object *obj, double interval);
389 * Get the interval on time updates for an user mouse button hold
390 * on calendar widgets' month selection.
392 * @param obj The calendar object
393 * @return The (first) interval value, in seconds, set on it
395 * @see elm_calendar_interval_set() for more details
399 EAPI double elm_calendar_interval_get(const Evas_Object *obj);