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 * 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
24 * @see elm_calendar_mark_add()
30 ELM_CALENDAR_UNIQUE, /**< Default value. Marks will be displayed only on event day. */
31 ELM_CALENDAR_DAILY, /**< Marks will be displayed everyday after event day (inclusive). */
32 ELM_CALENDAR_WEEKLY, /**< Marks will be displayed every week after event day (inclusive) - i.e. each seven days. */
33 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*/
34 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. */
35 } Elm_Calendar_Mark_Repeat;
37 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(). */
40 * Add a new calendar widget to the given parent Elementary
43 * @param parent The parent object.
44 * @return a new calendar widget handle or @c NULL, on errors.
46 * This function inserts a new calendar widget on the canvas.
48 * @ref calendar_example_01
52 EAPI Evas_Object *elm_calendar_add(Evas_Object *parent);
55 * Get weekdays names displayed by the calendar.
57 * @param obj The calendar object.
58 * @return Array of seven strings to be used as weekday names.
60 * By default, weekdays abbreviations get from system are displayed:
61 * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
62 * The first string is related to Sunday, the second to Monday...
64 * @see elm_calendar_weekdays_name_set()
66 * @ref calendar_example_05
70 EAPI const char **elm_calendar_weekdays_names_get(const Evas_Object *obj);
73 * Set weekdays names to be displayed by the calendar.
75 * @param obj The calendar object.
76 * @param weekdays Array of seven strings to be used as weekday names.
77 * @warning It must have 7 elements, or it will access invalid memory.
78 * @warning The strings must be NULL terminated ('@\0').
80 * By default, weekdays abbreviations get from system are displayed:
81 * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
83 * The first string should be related to Sunday, the second to Monday...
85 * The usage should be like this:
87 * const char *weekdays[] =
89 * "Sunday", "Monday", "Tuesday", "Wednesday",
90 * "Thursday", "Friday", "Saturday"
92 * elm_calendar_weekdays_names_set(calendar, weekdays);
95 * @see elm_calendar_weekdays_name_get()
97 * @ref calendar_example_02
101 EAPI void elm_calendar_weekdays_names_set(Evas_Object *obj, const char *weekdays[]);
104 * Set the minimum and maximum values for the year
106 * @param obj The calendar object
107 * @param min The minimum year, greater than 1901;
108 * @param max The maximum year;
110 * Maximum must be greater than minimum, except if you don't wan't to set
112 * Default values are 1902 and -1.
114 * If the maximum year is a negative value, it will be limited depending
115 * on the platform architecture (year 2037 for 32 bits);
117 * @see elm_calendar_min_max_year_get()
119 * @ref calendar_example_03
123 EAPI void elm_calendar_min_max_year_set(Evas_Object *obj, int min, int max);
126 * Get the minimum and maximum values for the year
128 * @param obj The calendar object.
129 * @param min The minimum year.
130 * @param max The maximum year.
132 * Default values are 1902 and -1.
134 * @see elm_calendar_min_max_year_get() for more details.
136 * @ref calendar_example_05
140 EAPI void elm_calendar_min_max_year_get(const Evas_Object *obj, int *min, int *max);
143 * Enable or disable day selection
145 * @param obj The calendar object.
146 * @param enabled @c EINA_TRUE to enable selection or @c EINA_FALSE to
149 * Enabled by default. If disabled, the user still can select months,
150 * but not days. Selected days are highlighted on calendar.
151 * It should be used if you won't need such selection for the widget usage.
153 * When a day is selected, or month is changed, smart callbacks for
154 * signal "changed" will be called.
156 * @see elm_calendar_day_selection_enable_get()
158 * @ref calendar_example_04
162 EAPI void elm_calendar_day_selection_enabled_set(Evas_Object *obj, Eina_Bool enabled);
165 * Get a value whether day selection is enabled or not.
167 * @see elm_calendar_day_selection_enable_set() for details.
169 * @param obj The calendar object.
170 * @return EINA_TRUE means day selection is enabled. EINA_FALSE indicates
171 * it's disabled. If @p obj is NULL, EINA_FALSE is returned.
173 * @ref calendar_example_05
177 EAPI Eina_Bool elm_calendar_day_selection_enabled_get(const Evas_Object *obj);
180 * Set selected date to be highlighted on calendar.
182 * @param obj The calendar object.
183 * @param selected_time A @b tm struct to represent the selected date.
185 * Set the selected date, changing the displayed month if needed.
186 * Selected date changes when the user goes to next/previous month or
187 * select a day pressing over it on calendar.
189 * @see elm_calendar_selected_time_get()
191 * @ref calendar_example_04
195 EAPI void elm_calendar_selected_time_set(Evas_Object *obj, struct tm *selected_time);
200 * @param obj The calendar object
201 * @param selected_time A @b tm struct to point to selected date
202 * @return EINA_FALSE means an error ocurred and returned time shouldn't
205 * Get date selected by the user or set by function
206 * elm_calendar_selected_time_set().
207 * Selected date changes when the user goes to next/previous month or
208 * select a day pressing over it on calendar.
210 * @see elm_calendar_selected_time_get()
212 * @ref calendar_example_05
216 EAPI Eina_Bool elm_calendar_selected_time_get(const Evas_Object *obj, struct tm *selected_time);
219 * Set a function to format the string that will be used to display
222 * @param obj The calendar object
223 * @param format_function Function to set the month-year string given
226 * By default it uses strftime with "%B %Y" format string.
227 * It should allocate the memory that will be used by the string,
228 * that will be freed by the widget after usage.
229 * A pointer to the string and a pointer to the time struct will be provided.
234 * _format_month_year(struct tm *selected_time)
237 * if (!strftime(buf, sizeof(buf), "%B %Y", selected_time)) return NULL;
238 * return strdup(buf);
241 * elm_calendar_format_function_set(calendar, _format_month_year);
244 * @ref calendar_example_02
248 EAPI void elm_calendar_format_function_set(Evas_Object *obj, char *(*format_function)(struct tm *stime));
251 * Add a new mark to the calendar
253 * @param obj The calendar object
254 * @param mark_type A string used to define the type of mark. It will be
255 * emitted to the theme, that should display a related modification on these
256 * days representation.
257 * @param mark_time A time struct to represent the date of inclusion of the
258 * mark. For marks that repeats it will just be displayed after the inclusion
259 * date in the calendar.
260 * @param repeat Repeat the event following this periodicity. Can be a unique
261 * mark (that don't repeat), daily, weekly, monthly or annually.
262 * @return The created mark or @p NULL upon failure.
264 * Add a mark that will be drawn in the calendar respecting the insertion
265 * time and periodicity. It will emit the type as signal to the widget theme.
266 * Default theme supports "holiday" and "checked", but it can be extended.
268 * It won't immediately update the calendar, drawing the marks.
269 * For this, call elm_calendar_marks_draw(). However, when user selects
270 * next or previous month calendar forces marks drawn.
272 * Marks created with this method can be deleted with
273 * elm_calendar_mark_del().
277 * struct tm selected_time;
278 * time_t current_time;
280 * current_time = time(NULL) + 5 * 84600;
281 * localtime_r(¤t_time, &selected_time);
282 * elm_calendar_mark_add(cal, "holiday", selected_time,
283 * ELM_CALENDAR_ANNUALLY);
285 * current_time = time(NULL) + 1 * 84600;
286 * localtime_r(¤t_time, &selected_time);
287 * elm_calendar_mark_add(cal, "checked", selected_time, ELM_CALENDAR_UNIQUE);
289 * elm_calendar_marks_draw(cal);
292 * @see elm_calendar_marks_draw()
293 * @see elm_calendar_mark_del()
295 * @ref calendar_example_06
299 EAPI Elm_Calendar_Mark *elm_calendar_mark_add(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat repeat);
302 * Delete mark from the calendar.
304 * @param mark The mark to be deleted.
306 * If deleting all calendar marks is required, elm_calendar_marks_clear()
307 * should be used instead of getting marks list and deleting each one.
309 * @see elm_calendar_mark_add()
311 * @ref calendar_example_06
315 EAPI void elm_calendar_mark_del(Elm_Calendar_Mark *mark);
318 * Remove all calendar's marks
320 * @param obj The calendar object.
322 * @see elm_calendar_mark_add()
323 * @see elm_calendar_mark_del()
327 EAPI void elm_calendar_marks_clear(Evas_Object *obj);
330 * Get a list of all the calendar marks.
332 * @param obj The calendar object.
333 * @return An @c Eina_List of calendar marks objects, or @c NULL on failure.
335 * @see elm_calendar_mark_add()
336 * @see elm_calendar_mark_del()
337 * @see elm_calendar_marks_clear()
341 EAPI const Eina_List *elm_calendar_marks_get(const Evas_Object *obj);
344 * Draw calendar marks.
346 * @param obj The calendar object.
348 * Should be used after adding, removing or clearing marks.
349 * It will go through the entire marks list updating the calendar.
350 * If lots of marks will be added, add all the marks and then call
353 * When the month is changed, i.e. user selects next or previous month,
354 * marks will be drawed.
356 * @see elm_calendar_mark_add()
357 * @see elm_calendar_mark_del()
358 * @see elm_calendar_marks_clear()
360 * @ref calendar_example_06
364 EAPI void elm_calendar_marks_draw(Evas_Object *obj);
367 * Set the interval on time updates for an user mouse button hold
368 * on calendar widgets' month selection.
370 * @param obj The calendar object
371 * @param interval The (first) interval value in seconds
373 * This interval value is @b decreased while the user holds the
374 * mouse pointer either selecting next or previous month.
376 * This helps the user to get to a given month distant from the
377 * current one easier/faster, as it will start to change quicker and
378 * quicker on mouse button holds.
380 * The calculation for the next change interval value, starting from
381 * the one set with this call, is the previous interval divided by
382 * 1.05, so it decreases a little bit.
384 * The default starting interval value for automatic changes is
387 * @see elm_calendar_interval_get()
391 EAPI void elm_calendar_interval_set(Evas_Object *obj, double interval);
394 * Get the interval on time updates for an user mouse button hold
395 * on calendar widgets' month selection.
397 * @param obj The calendar object
398 * @return The (first) interval value, in seconds, set on it
400 * @see elm_calendar_interval_set() for more details
404 EAPI double elm_calendar_interval_get(const Evas_Object *obj);