summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elm_calendar_eo.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary/elm_calendar_eo.h')
-rw-r--r--src/lib/elementary/elm_calendar_eo.h574
1 files changed, 574 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_calendar_eo.h b/src/lib/elementary/elm_calendar_eo.h
new file mode 100644
index 0000000..09a97eb
--- /dev/null
+++ b/src/lib/elementary/elm_calendar_eo.h
@@ -0,0 +1,574 @@
1#ifndef _ELM_CALENDAR_EO_H_
2#define _ELM_CALENDAR_EO_H_
3
4#ifndef _ELM_CALENDAR_EO_CLASS_TYPE
5#define _ELM_CALENDAR_EO_CLASS_TYPE
6
7typedef Eo Elm_Calendar;
8
9#endif
10
11#ifndef _ELM_CALENDAR_EO_TYPES
12#define _ELM_CALENDAR_EO_TYPES
13
14/**
15 * @brief Event periodicity, used to define if a mark should be repeated beyond
16 * event's day.
17 *
18 * It's set when a mark is added. So, for a mark added to 13th May with
19 * periodicity set to WEEKLY, there will be marks every week after this date.
20 * Marks will be displayed at 13th, 20th, 27th, 3rd June ...
21 *
22 * Values don't work as bitmask, only one can be chosen. See also
23 * @ref elm_obj_calendar_mark_add.
24 *
25 * @ingroup Elm_Calendar_Mark_Repeat
26 */
27typedef enum
28{
29 ELM_CALENDAR_UNIQUE = 0, /**< Default value. Marks will be displayed only on
30 * event day. */
31 ELM_CALENDAR_DAILY, /**< Marks will be displayed every day after event day
32 * (inclusive). */
33 ELM_CALENDAR_WEEKLY, /**< Marks will be displayed every week after event day
34 * (inclusive) - i.e. each seven days. */
35 ELM_CALENDAR_MONTHLY, /**< Marks will be displayed every month day that
36 * coincides to event day. E.g.: if an event is set to
37 * 30th Jan, no marks will be displayed on Feb, but
38 * will be displayed on 30th Mar. */
39 ELM_CALENDAR_ANNUALLY, /**< Marks will be displayed every year that coincides
40 * to event day (and month). E.g. an event added to
41 * 30th Jan 2012 will be repeated on 30th Jan 2013. */
42 ELM_CALENDAR_LAST_DAY_OF_MONTH, /**< Marks will be displayed every last day of
43 * month after event day (inclusive).
44 *
45 * @since 1.7 */
46 ELM_CALENDAR_REVERSE_DAILY /**< Marks will be displayed every day before event
47 * day.
48 *
49 * @since 1.19 */
50} Elm_Calendar_Mark_Repeat_Type;
51
52/**
53 * @brief A weekday
54 *
55 * See also @ref elm_obj_calendar_first_day_of_week_set.
56 *
57 * @ingroup Elm_Calendar
58 */
59typedef enum
60{
61 ELM_DAY_SUNDAY = 0, /**< Sunday weekday */
62 ELM_DAY_MONDAY, /**< Monday weekday */
63 ELM_DAY_TUESDAY, /**< Tuesday weekday */
64 ELM_DAY_WEDNESDAY, /**< Wednesday weekday */
65 ELM_DAY_THURSDAY, /**< Thursday weekday */
66 ELM_DAY_FRIDAY, /**< Friday weekday */
67 ELM_DAY_SATURDAY, /**< Saturday weekday */
68 ELM_DAY_LAST /**< Sentinel value to indicate last enum field during iteration
69 */
70} Elm_Calendar_Weekday;
71
72/**
73 * @brief The mode, who determine how user could select a day
74 *
75 * See also @ref elm_obj_calendar_select_mode_set()
76 *
77 * @ingroup Elm_Calendar_Select
78 */
79typedef enum
80{
81 ELM_CALENDAR_SELECT_MODE_DEFAULT = 0, /**< Default value. A day is always
82 * selected. */
83 ELM_CALENDAR_SELECT_MODE_ALWAYS, /**< A day is always selected. */
84 ELM_CALENDAR_SELECT_MODE_NONE, /**< None of the days can be selected. */
85 ELM_CALENDAR_SELECT_MODE_ONDEMAND /**< User may have selected a day or not. */
86} Elm_Calendar_Select_Mode;
87
88/**
89 * @brief A bitmask used to define which fields of a @c tm struct will be taken
90 * into account, when elm_calendar_selected_time_set() is invoked.
91 *
92 * See also @ref elm_obj_calendar_selectable_set,
93 * @ref elm_obj_calendar_selected_time_set.
94 *
95 * @since 1.8
96 *
97 * @ingroup Elm_Calendar
98 */
99typedef enum
100{
101 ELM_CALENDAR_SELECTABLE_NONE = 0, /**< Take no field into account */
102 ELM_CALENDAR_SELECTABLE_YEAR = 1 /* 1 >> 0 */, /**< Take year field into
103 * account */
104 ELM_CALENDAR_SELECTABLE_MONTH = 2 /* 1 >> 1 */, /**< Take month field into
105 * account */
106 ELM_CALENDAR_SELECTABLE_DAY = 4 /* 1 >> 2 */ /**< Take day field into account
107 */
108} Elm_Calendar_Selectable;
109
110/** Item handle for a calendar mark. Created with
111 * @ref elm_obj_calendar_mark_add and deleted with
112 * @ref elm_obj_calendar_mark_del.
113 *
114 * @ingroup Elm_Calendar
115 */
116typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark;
117
118
119#endif
120/**
121 * @brief Calendar widget
122 *
123 * It helps applications to flexibly display a calendar with day of the week,
124 * date, year and month. Applications are able to set specific dates to be
125 * reported back, when selected, in the smart callbacks of the calendar widget.
126 *
127 * @ingroup Elm_Calendar
128 */
129#define ELM_CALENDAR_CLASS elm_calendar_class_get()
130
131EWAPI const Efl_Class *elm_calendar_class_get(void);
132
133/**
134 * @brief The first day of week to use on calendar widgets'.
135 *
136 * @param[in] obj The object.
137 * @param[in] day Weekday enum value, see @ref Elm_Calendar_Weekday
138 *
139 * @ingroup Elm_Calendar
140 */
141EOAPI void elm_obj_calendar_first_day_of_week_set(Eo *obj, Elm_Calendar_Weekday day);
142
143/**
144 * @brief The first day of week to use on calendar widgets'.
145 *
146 * @param[in] obj The object.
147 *
148 * @return Weekday enum value, see @ref Elm_Calendar_Weekday
149 *
150 * @ingroup Elm_Calendar
151 */
152EOAPI Elm_Calendar_Weekday elm_obj_calendar_first_day_of_week_get(const Eo *obj);
153
154/**
155 * @brief Define which fields of a tm struct will be taken into account, when
156 * Elm.Calendar.selected_time.set is invoked.
157 *
158 * By Default the bitmask is set to use all fields of a tm struct (year, month
159 * and day of the month).
160 *
161 * See also @ref elm_obj_calendar_selected_time_set.
162 *
163 * @param[in] obj The object.
164 * @param[in] selectable A bitmask of Elm_Calendar_Selectable
165 *
166 * @since 1.8
167 *
168 * @ingroup Elm_Calendar
169 */
170EOAPI void elm_obj_calendar_selectable_set(Eo *obj, Elm_Calendar_Selectable selectable);
171
172/**
173 * @brief Define which fields of a tm struct will be taken into account, when
174 * Elm.Calendar.selected_time.set is invoked.
175 *
176 * By Default the bitmask is set to use all fields of a tm struct (year, month
177 * and day of the month).
178 *
179 * See also @ref elm_obj_calendar_selected_time_set.
180 *
181 * @param[in] obj The object.
182 *
183 * @return A bitmask of Elm_Calendar_Selectable
184 *
185 * @since 1.8
186 *
187 * @ingroup Elm_Calendar
188 */
189EOAPI Elm_Calendar_Selectable elm_obj_calendar_selectable_get(const Eo *obj);
190
191/**
192 * @brief The interval on time updates for an user mouse button hold on
193 * calendar widgets' month/year selection.
194 *
195 * This interval value is decreased while the user holds the mouse pointer
196 * either selecting next or previous month/year.
197 *
198 * This helps the user to get to a given month distant from the current one
199 * easier/faster, as it will start to change quicker and quicker on mouse
200 * button holds.
201 *
202 * The calculation for the next change interval value, starting from the one
203 * set with this call, is the previous interval divided by 1.05, so it
204 * decreases a little bit.
205 *
206 * The default starting interval value for automatic changes is 0.85 seconds.
207 *
208 * @param[in] obj The object.
209 * @param[in] interval The (first) interval value in seconds
210 *
211 * @ingroup Elm_Calendar
212 */
213EOAPI void elm_obj_calendar_interval_set(Eo *obj, double interval);
214
215/**
216 * @brief The interval on time updates for an user mouse button hold on
217 * calendar widgets' month/year selection.
218 *
219 * This interval value is decreased while the user holds the mouse pointer
220 * either selecting next or previous month/year.
221 *
222 * This helps the user to get to a given month distant from the current one
223 * easier/faster, as it will start to change quicker and quicker on mouse
224 * button holds.
225 *
226 * The calculation for the next change interval value, starting from the one
227 * set with this call, is the previous interval divided by 1.05, so it
228 * decreases a little bit.
229 *
230 * The default starting interval value for automatic changes is 0.85 seconds.
231 *
232 * @param[in] obj The object.
233 *
234 * @return The (first) interval value in seconds
235 *
236 * @ingroup Elm_Calendar
237 */
238EOAPI double elm_obj_calendar_interval_get(const Eo *obj);
239
240/**
241 * @brief Weekdays names to be displayed by the calendar.
242 *
243 * By default, weekdays abbreviations get from system are displayed: E.g. for
244 * an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
245 *
246 * The first string should be related to Sunday, the second to Monday...
247 *
248 * See also @ref elm_obj_calendar_weekdays_names_get.
249 *
250 * @ref calendar_example_02. @ref calendar_example_05.
251 *
252 * @param[in] obj The object.
253 * @param[in] weekdays Array of seven strings to be used as weekday names.
254 * Warning: It must have 7 elements, or it will access invalid memory. Warning:
255 * The strings must be @c null terminated ('@\0').
256 *
257 * @ingroup Elm_Calendar
258 */
259EOAPI void elm_obj_calendar_weekdays_names_set(Eo *obj, const char **weekdays);
260
261/**
262 * @brief Weekdays names to be displayed by the calendar.
263 *
264 * By default, weekdays abbreviations get from system are displayed: E.g. for
265 * an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
266 *
267 * The first string should be related to Sunday, the second to Monday...
268 *
269 * See also @ref elm_obj_calendar_weekdays_names_get.
270 *
271 * @ref calendar_example_02. @ref calendar_example_05.
272 *
273 * @param[in] obj The object.
274 *
275 * @return Array of seven strings to be used as weekday names. Warning: It must
276 * have 7 elements, or it will access invalid memory. Warning: The strings must
277 * be @c null terminated ('@\0').
278 *
279 * @ingroup Elm_Calendar
280 */
281EOAPI const char **elm_obj_calendar_weekdays_names_get(const Eo *obj);
282
283/**
284 * @brief Select day mode to use.
285 *
286 * The day selection mode used.
287 *
288 * @param[in] obj The object.
289 * @param[in] mode The select mode to use.
290 *
291 * @ingroup Elm_Calendar
292 */
293EOAPI void elm_obj_calendar_select_mode_set(Eo *obj, Elm_Calendar_Select_Mode mode);
294
295/**
296 * @brief Select day mode to use.
297 *
298 * The day selection mode used.
299 *
300 * @param[in] obj The object.
301 *
302 * @return The select mode to use.
303 *
304 * @ingroup Elm_Calendar
305 */
306EOAPI Elm_Calendar_Select_Mode elm_obj_calendar_select_mode_get(const Eo *obj);
307
308/**
309 * @brief Set a function to format the string that will be used to display
310 * month and year;
311 *
312 * By default it uses strftime with "%B %Y" format string. It should allocate
313 * the memory that will be used by the string, that will be freed by the widget
314 * after usage. A pointer to the string and a pointer to the time struct will
315 * be provided.
316 *
317 * @ref calendar_example_02.
318 *
319 * @param[in] obj The object.
320 * @param[in] format_function Function to set the month-year string given the
321 * selected date.
322 *
323 * @ingroup Elm_Calendar
324 */
325EOAPI void elm_obj_calendar_format_function_set(Eo *obj, Elm_Calendar_Format_Cb format_function);
326
327/**
328 * @brief Get a list of all the calendar marks.
329 *
330 * See also @ref elm_obj_calendar_mark_add, @ref elm_obj_calendar_mark_del(),
331 * @ref elm_obj_calendar_marks_clear.
332 *
333 * @param[in] obj The object.
334 *
335 * @return List with all calendar marks
336 *
337 * @ingroup Elm_Calendar
338 */
339EOAPI const Eina_List *elm_obj_calendar_marks_get(const Eo *obj);
340
341/**
342 * @brief Minimum date on calendar.
343 *
344 * See also @ref elm_obj_calendar_date_max_set,
345 * @ref elm_obj_calendar_date_max_get
346 *
347 * Set minimum date on calendar.
348 *
349 * Set the minimum date, changing the displayed month or year if needed.
350 * Displayed day also to be disabled if it is smaller than minimum date.
351 *
352 * @param[in] obj The object.
353 * @param[in] min A tm struct to point to minimum date.
354 *
355 * @since 1.19
356 *
357 * @ingroup Elm_Calendar
358 */
359EOAPI void elm_obj_calendar_date_min_set(Eo *obj, const Efl_Time *min);
360
361/**
362 * @brief Minimum date on calendar.
363 *
364 * See also @ref elm_obj_calendar_date_max_set,
365 * @ref elm_obj_calendar_date_max_get
366 *
367 * Get minimum date.
368 *
369 * Default value is 1 JAN,1902.
370 *
371 * @param[in] obj The object.
372 *
373 * @return A tm struct to point to minimum date.
374 *
375 * @since 1.19
376 *
377 * @ingroup Elm_Calendar
378 */
379EOAPI const Efl_Time *elm_obj_calendar_date_min_get(const Eo *obj);
380
381/**
382 * @brief Maximum date on calendar.
383 *
384 * See also @ref elm_obj_calendar_date_min_set,
385 * @ref elm_obj_calendar_date_min_get
386 *
387 * Set maximum date on calendar.
388 *
389 * Set the maximum date, changing the displayed month or year if needed.
390 * Displayed day also to be disabled if it is bigger than maximum date.
391 *
392 * @param[in] obj The object.
393 * @param[in] max A tm struct to point to maximum date.
394 *
395 * @since 1.19
396 *
397 * @ingroup Elm_Calendar
398 */
399EOAPI void elm_obj_calendar_date_max_set(Eo *obj, const Efl_Time *max);
400
401/**
402 * @brief Maximum date on calendar.
403 *
404 * See also @ref elm_obj_calendar_date_min_set,
405 * @ref elm_obj_calendar_date_min_get
406 *
407 * Get maximum date.
408 *
409 * Default maximum year is -1. Default maximum day and month are 31 and DEC.
410 *
411 * If the maximum year is a negative value, it will be limited depending on the
412 * platform architecture (year 2037 for 32 bits);
413 *
414 * @param[in] obj The object.
415 *
416 * @return A tm struct to point to maximum date.
417 *
418 * @since 1.19
419 *
420 * @ingroup Elm_Calendar
421 */
422EOAPI const Efl_Time *elm_obj_calendar_date_max_get(const Eo *obj);
423
424/**
425 * @brief Set selected date to be highlighted on calendar.
426 *
427 * Set the selected date, changing the displayed month if needed. Selected date
428 * changes when the user goes to next/previous month or select a day pressing
429 * over it on calendar.
430 *
431 * See also @ref elm_obj_calendar_selected_time_get.
432 *
433 * @ref calendar_example_04
434 *
435 * @param[in] obj The object.
436 * @param[in] selected_time A tm struct to represent the selected date.
437 *
438 * @ingroup Elm_Calendar
439 */
440EOAPI void elm_obj_calendar_selected_time_set(Eo *obj, Efl_Time *selected_time);
441
442/**
443 * @brief Get selected date.
444 *
445 * Get date selected by the user or set by function
446 * @ref elm_obj_calendar_selected_time_set(). Selected date changes when the
447 * user goes to next/previous month or select a day pressing over it on
448 * calendar.
449 *
450 * See also @ref elm_obj_calendar_selected_time_get.
451 *
452 * @ref calendar_example_05.
453 *
454 * @param[in] obj The object.
455 * @param[in,out] selected_time A tm struct to point to selected date.
456 *
457 * @return @c true if the method succeeded, @c false otherwise
458 *
459 * @ingroup Elm_Calendar
460 */
461EOAPI Eina_Bool elm_obj_calendar_selected_time_get(const Eo *obj, Efl_Time *selected_time);
462
463/**
464 * @brief Add a new mark to the calendar
465 *
466 * Add a mark that will be drawn in the calendar respecting the insertion time
467 * and periodicity. It will emit the type as signal to the widget theme.
468 * Default theme supports "holiday" and "checked", but it can be extended.
469 *
470 * It won't immediately update the calendar, drawing the marks. For this,
471 * @ref elm_obj_calendar_marks_draw(). However, when user selects next or
472 * previous month calendar forces marks drawn.
473 *
474 * Marks created with this method can be deleted with
475 * @ref elm_obj_calendar_mark_del().
476 *
477 * See also @ref elm_obj_calendar_marks_draw, @ref elm_obj_calendar_mark_del().
478 *
479 * @ref calendar_example_06
480 *
481 * @param[in] obj The object.
482 * @param[in] mark_type A string used to define the type of mark. It will be
483 * emitted to the theme, that should display a related modification on these
484 * days representation.
485 * @param[in] mark_time A time struct to represent the date of inclusion of the
486 * mark. For marks that repeats it will just be displayed after the inclusion
487 * date in the calendar.
488 * @param[in] repeat Repeat the event following this periodicity. Can be a
489 * unique mark (that don't repeat), daily, weekly, monthly or annually.
490 *
491 * @return The newly added calendar mark
492 *
493 * @ingroup Elm_Calendar
494 */
495EOAPI Elm_Calendar_Mark *elm_obj_calendar_mark_add(Eo *obj, const char *mark_type, Efl_Time *mark_time, Elm_Calendar_Mark_Repeat_Type repeat);
496
497/**
498 * @brief Delete mark from the calendar.
499 *
500 * If deleting all calendar marks is required,
501 * @ref elm_obj_calendar_marks_clear() should be used instead of getting marks
502 * list and deleting each one.
503 *
504 * See also @ref elm_obj_calendar_mark_add(),
505 * @ref elm_obj_calendar_marks_clear().
506 *
507 * @param[in] obj The object.
508 * @param[in] mark The mark to be deleted.
509 *
510 * @ingroup Elm_Calendar
511 */
512EOAPI void elm_obj_calendar_mark_del(Eo *obj, Elm_Calendar_Mark *mark);
513
514/**
515 * @brief Remove all calendar's marks
516 *
517 * See also @ref elm_obj_calendar_mark_add, @ref elm_obj_calendar_mark_del().
518 * @param[in] obj The object.
519 *
520 * @ingroup Elm_Calendar
521 */
522EOAPI void elm_obj_calendar_marks_clear(Eo *obj);
523
524/**
525 * @brief Draw calendar marks.
526 *
527 * Should be used after adding, removing or clearing marks. It will go through
528 * the entire marks list updating the calendar. If lots of marks will be added,
529 * add all the marks and then call this function.
530 *
531 * When the month is changed, i.e. user selects next or previous month, marks
532 * will be drawn.
533 *
534 * See also @ref elm_obj_calendar_mark_add, @ref elm_obj_calendar_mark_del(),
535 * @ref elm_obj_calendar_marks_clear.
536 *
537 * @ref calendar_example_06
538 * @param[in] obj The object.
539 *
540 * @ingroup Elm_Calendar
541 */
542EOAPI void elm_obj_calendar_marks_draw(Eo *obj);
543
544/**
545 * @brief Get the current time displayed in the widget
546 *
547 * @param[in] obj The object.
548 * @param[in,out] displayed_time A tm struct to point to displayed date.
549 *
550 * @return @c true if the method succeeded, @c false otherwise
551 *
552 * @since 1.8
553 *
554 * @ingroup Elm_Calendar
555 */
556EOAPI Eina_Bool elm_obj_calendar_displayed_time_get(const Eo *obj, Efl_Time *displayed_time);
557
558EWAPI extern const Efl_Event_Description _ELM_CALENDAR_EVENT_CHANGED;
559
560/** Emitted when the date in the calendar is changed
561 *
562 * @ingroup Elm_Calendar
563 */
564#define ELM_CALENDAR_EVENT_CHANGED (&(_ELM_CALENDAR_EVENT_CHANGED))
565
566EWAPI extern const Efl_Event_Description _ELM_CALENDAR_EVENT_DISPLAY_CHANGED;
567
568/** Emitted when the current month displayed in the calendar is changed
569 *
570 * @ingroup Elm_Calendar
571 */
572#define ELM_CALENDAR_EVENT_DISPLAY_CHANGED (&(_ELM_CALENDAR_EVENT_DISPLAY_CHANGED))
573
574#endif