3 * @defgroup Datetime Datetime
6 * @image html img/widget/datetime/preview-00.png
7 * @image latex img/widget/datetime/preview-00.eps
9 * @image html img/widget/datetime/preview-01.png
10 * @image latex img/widget/datetime/preview-01.eps
12 * @image html img/widget/datetime/preview-02.png
13 * @image latex img/widget/datetime/preview-02.eps
15 * Datetime widget is used to display and input date & time values.
16 * This widget displays date and time as per the <b>system's locale</b> settings (Date
17 * includes Day, Month & Year along with the defined separators and
18 * Time includes Hour, Minute & AM/PM fields. Separator for AM/PM field is ignored.
20 * The corresponding Month, AM/PM strings are displayed according to the
21 * system’s language settings.
23 * Datetime format is a combination of LIBC standard characters like
24 * “%%d %%b %%Y %%I : %%M %%p” which, as a whole represents both Date as well as Time
27 * Elm_datetime supports only the following sub set of libc date format specifiers:
29 * @b %%Y : The year as a decimal number including the century (example: 2011).
31 * @b %%y : The year as a decimal number without a century (range 00 to 99)
33 * @b %%m : The month as a decimal number (range 01 to 12).
35 * @b %%b : The abbreviated month name according to the current locale.
37 * @b %%B : The full month name according to the current locale.
39 * @b %%h : The abbreviated month name according to the current locale(same as %%b).
41 * @b %%d : The day of the month as a decimal number (range 01 to 31).
43 * @b %%e : The day of the month as a decimal number (range 1 to 31). single
44 * digits are preceded by a blank.
46 * @b %%I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
48 * @b %%H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
50 * @b %%k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
51 * digits are preceded by a blank.
53 * @b %%l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
54 * digits are preceded by a blank.
56 * @b %%M : The minute as a decimal number (range 00 to 59).
58 * @b %%p : Either 'AM' or 'PM' according to the given time value, or the
59 * corresponding strings for the current locale. Noon is treated as 'PM'
60 * and midnight as 'AM'
62 * @b %%P : Like %p but in lower case: 'am' or 'pm' or a corresponding string for
65 * @b %%c : The preferred date and time representation for the current locale.
67 * @b %%x : The preferred date representation for the current locale without the time.
69 * @b %%X : The preferred time representation for the current locale without the date.
71 * @b %%r : The complete calendar time using the AM/PM format of the current locale.
73 * @b %%R : The hour and minute in decimal numbers using the format %H:%M.
75 * @b %%T : The time of day in decimal numbers using the format %H:%M:%S.
77 * @b %%D : The date using the format %%m/%%d/%%y.
79 * @b %%F : The date using the format %%Y-%%m-%%d.
81 * (For more reference on the available <b>LIBC date format specifiers</b>, please
83 * http://www.gnu.org/s/hello/manual/libc.html#Formatting-Calendar-Time )
85 * Datetime widget can provide Unicode @b separators in between its fields
86 * except for AM/PM field.
87 * A separator can be any <b>Unicode character</b> other than the LIBC standard
88 * date format specifiers.( Example: In the format %%b %%d @b , %%y %%H @b : %%M
89 * comma(,) is separator for date field %%d and colon(:) is separator for
92 * The default format is a predefined one, based on the system Locale.
94 * Hour format 12hr(1-12) or 24hr(0-23) display can be selected by setting
95 * the corresponding user format.
97 * Datetime supports six fields: Year, Month, Date, Hour, Minute, AM/PM.
98 * Depending on the Datetime module that is loaded, the user can see
99 * different UI to select the individual field values.
101 * The individual fields of Datetime can be arranged in any order according to the format
102 * set by application.
104 * There is a provision to set the visibility of a particular field as TRUE/ FALSE
105 * so that <b>only time/ only date / only required fields</b> will be displayed.
107 * Each field is having a default minimum and maximum values just like the daily
108 * calendar information. These min/max values can be modified as per the application usage.
110 * User can enter the values only in between the range of maximum and minimum.
111 * Apart from these APIs, there is a provision to display only a limited set of
112 * values out of the possible values. APIs to select the individual field limits
113 * are intended for this purpose.
115 * The whole widget is left aligned and its size grows horizontally depending
116 * on the current format and each field's visible/disabled state.
118 * Datetime individual field selection is implemented in a modular style.
119 * Module can be implemented as a Ctxpopup based selection or an ISE based
120 * selection or even a spinner like selection etc.
122 * <b>Datetime Module design:</b>
124 * The following functions are expected to be implemented in a Datetime module:
126 * <b>Field creation:</b>
129 * __________ __________
130 * | |----- obj_hook() ---------------------->>>| |
131 * | |<<<----------------returns Mod_data ------| |
132 * | Datetime |_______ | |
133 * | widget | |Assign module call backs | Module |
134 * | base |<<<____| | |
136 * | |----- field_create() ------------------>>>| |
137 * |__________|<<<----------------returns field_obj -----|__________|
141 * <b>Field value setting:</b>
144 * __________ __________
146 * | Datetime |<<<----------elm_datetime_value_set()---| |
147 * | widget | | Module |
148 * | base |----display_field_value()------------>>>| |
149 * |__________| |__________|
155 * __________ __________
157 * | Datetime |----obj_unhook()-------------------->>>>| |
158 * | widget | | Module |
159 * | base | <<<-----frees mod_data---------| |
160 * |__________| |__________|
165 * Any module can use the following shared functions that are implemented in elm_datetime.c :
167 * <b>field_format_get()</b> - gives the field format.
169 * <b>field_limit_get()</b> - gives the field minimum, maximum limits.
171 * To enable a module, set the ELM_MODULES environment variable as shown:
173 * <b>export ELM_MODULES="datetime_input_ctxpopup>datetime/api"</b>
176 * Datetime widgets emits the following signals:
178 * @li @b "changed" - whenever Datetime field value is changed, this signal is sent.
180 * @li @b "language,changed" - whenever system locale changes, this signal is sent.
182 * Here is an example on its usage:
183 * @li @ref datetime_example
188 * @addtogroup Datetime
193 * Identifies a Datetime field, The widget supports 6 fields : Year, month,
194 * Date, Hour, Minute, AM/PM
197 typedef enum _Elm_Datetime_Field_Type
199 ELM_DATETIME_YEAR = 0, /**< Indicates Year field */
200 ELM_DATETIME_MONTH = 1, /**< Indicates Month field */
201 ELM_DATETIME_DATE = 2, /**< Indicates Date field */
202 ELM_DATETIME_HOUR = 3, /**< Indicates Hour field */
203 ELM_DATETIME_MINUTE = 4, /**< Indicates Minute field */
204 ELM_DATETIME_AMPM = 5, /**< Indicates AM/PM field */
205 } Elm_Datetime_Field_Type;
208 * @brief Adds a new datetime Widget
210 * The default datetime format and corresponding strings are based on current locale.
212 * @param parent The parent object
213 * @return The new object or NULL if it cannot be created
215 * This function inserts a new datetime widget on the canvas.
219 EAPI Evas_Object *elm_datetime_add(Evas_Object *parent);
222 * Get the datetime format. Format is a combination of allowed Libc date format
223 * specifiers like: "%b %d, %Y %I : %M %p".
225 * Maximum allowed format length is 64 chars.
227 * Format can include separators for each individual datetime field except
230 * Each separator can be a maximum of 6 UTF-8 bytes.
231 * Space is also taken as a separator but it can come only once for each field.
233 * Following are the allowed set of format specifiers for each datetime field.
235 * @b %%Y : The year as a decimal number including the century.
237 * @b %%y : The year as a decimal number without a century (range 00 to 99).
239 * @b %%m : The month as a decimal number (range 01 to 12).
241 * @b %%b : The abbreviated month name according to the current locale.
243 * @b %%B : The full month name according to the current locale.
245 * @b %%h : The abbreviated month name according to the current locale(same as %%b).
247 * @b %%d : The day of the month as a decimal number (range 01 to 31).
249 * @b %%e : The day of the month as a decimal number (range 1 to 31). single
250 * digits are preceded by a blank.
252 * @b %%I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
254 * @b %%H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
256 * @b %%k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
257 * digits are preceded by a blank.
259 * @b %%l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
260 * digits are preceded by a blank.
262 * @b %%M : The minute as a decimal number (range 00 to 59).
264 * @b %%p : Either 'AM' or 'PM' according to the given time value, or the
265 * corresponding strings for the current locale. Noon is treated as 'PM'
266 * and midnight as 'AM'.
268 * @b %%P : Like %p but in lower case: 'am' or 'pm' or a corresponding string for
269 * the current locale.
271 * @b %%c : The preferred date and time representation for the current locale.
273 * @b %%x : The preferred date representation for the current locale without the time.
275 * @b %%X : The preferred time representation for the current locale without the date.
277 * @b %%r : The complete calendar time using the AM/PM format of the current locale.
279 * @b %%R : The hour and minute in decimal numbers using the format %H:%M.
281 * @b %%T : The time of day in decimal numbers using the format %H:%M:%S.
283 * @b %%D : The date using the format %%m/%%d/%%y.
285 * @b %%F : The date using the format %%Y-%%m-%%d.
287 * These specifiers can be arranged in any order and the widget will display the
288 * fields accordingly.
290 * Default format is taken as per the system locale settings.
292 * @param obj The datetime object
293 * @return The datetime format string. Example: "%b %d, %Y %I : %M %p"
295 * @see elm_datetime_format_set()
298 EAPI const char *elm_datetime_format_get(const Evas_Object *obj);
301 * Set the datetime format. Format is a combination of allowed Libc date format
302 * specifiers like: "%b %d, %Y %I : %M %p".
304 * Maximum allowed format length is 64 chars.
306 * Format can include separators for each individual datetime field except
309 * Each separator can be a maximum of 6 UTF-8 bytes.
310 * Space is also taken as a separator but it can come only once for each field.
312 * Following are the allowed set of format specifiers for each datetime field.
314 * @b %%Y : The year as a decimal number including the century.
316 * @b %%y : The year as a decimal number without a century (range 00 to 99).
318 * @b %%m : The month as a decimal number (range 01 to 12).
320 * @b %%b : The abbreviated month name according to the current locale.
322 * @b %%B : The full month name according to the current locale.
324 * @b %%h : The abbreviated month name according to the current locale(same as %%b).
326 * @b %%d : The day of the month as a decimal number (range 01 to 31).
328 * @b %%e : The day of the month as a decimal number (range 1 to 31). single
329 * digits are preceded by a blank.
331 * @b %%I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
333 * @b %%H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
335 * @b %%k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
336 * digits are preceded by a blank.
338 * @b %%l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
339 * digits are preceded by a blank.
341 * @b %%M : The minute as a decimal number (range 00 to 59).
343 * @b %%p : Either 'AM' or 'PM' according to the given time value, or the
344 * corresponding strings for the current locale. Noon is treated as 'PM'
345 * and midnight as 'AM'.
347 * @b %%P : Like %p but in lower case: 'am' or 'pm' or a corresponding string for
348 * the current locale.
350 * @b %%c : The preferred date and time representation for the current locale.
352 * @b %%x : The preferred date representation for the current locale without the time.
354 * @b %%X : The preferred time representation for the current locale without the date.
356 * @b %%r : The complete calendar time using the AM/PM format of the current locale.
358 * @b %%R : The hour and minute in decimal numbers using the format %H:%M.
360 * @b %%T : The time of day in decimal numbers using the format %H:%M:%S.
362 * @b %%D : The date using the format %%m/%%d/%%y.
364 * @b %%F : The date using the format %%Y-%%m-%%d.
366 * These specifiers can be arranged in any order and the widget will display the
367 * fields accordingly.
369 * Default format is taken as per the system locale settings.
371 * @param obj The datetime object
372 * @param fmt The datetime format
374 * @see elm_datetime_format_get()
377 EAPI void elm_datetime_format_set(Evas_Object *obj, const char *fmt);
380 * @brief Get the upper boundary of a field.
382 * Year: years since 1900. Negative value represents year below 1900 (year
383 * value -30 represents 1870). Year default range is from 70 to 137.
385 * Month: default value range is from 0 to 11.
387 * Date: default value range is from 1 to 31 according to the month value.
389 * Hour: default value will be in terms of 24 hr format (0~23)
391 * Minute: default value range is from 0 to 59.
393 * @param obj The datetime object
394 * @param maxtime Time structure containing the maximum time value.
395 * @return int The maximum value of the field.
397 * @see elm_datetime_value_max_set()
400 EAPI Eina_Bool elm_datetime_value_max_get(const Evas_Object *obj, struct tm *maxtime);
403 * @brief Set the upper boundary of a field.
405 * Year: years since 1900. Negative value represents year below 1900 (year
406 * value -30 represents 1870). Year default range is from 70 to 137.
408 * Month: default value range is from 0 to 11.
410 * Date: default value range is from 1 to 31 according to the month value.
412 * Hour: default value will be in terms of 24 hr format (0~23)
414 * Minute: default value range is from 0 to 59.
416 * @param obj The datetime object
417 * @param maxtime Time structure containing the maximum time value.
418 * @return EINA_TRUE if maximum value is accepted.
420 * @see elm_datetime_value_max_get()
423 EAPI Eina_Bool elm_datetime_value_max_set(Evas_Object *obj, const struct tm *maxtime);
426 * @brief Get the lower boundary of a field.
428 * Year: years since 1900. Negative value represents year below 1900 (year
429 * value -30 represents 1870). Year default range is from 70 to 137.
431 * Month: default value range is from 0 to 11.
433 * Date: default value range is from 1 to 31 according to the month value.
435 * Hour: default value will be in terms of 24 hr format (0~23)
437 * Minute: default value range is from 0 to 59.
439 * @param obj The datetime object
440 * @param mintime Time structure.
441 * @return EINA_TRUE if minimum value is successfully returned.
443 * @see elm_datetime_value_min_set()
444 * @ingroup Datepicker
446 EAPI Eina_Bool elm_datetime_value_min_get(const Evas_Object *obj, struct tm *mintime);
449 * @brief Set the lower boundary of a field.
451 * Year: years since 1900. Negative value represents year below 1900 (year
452 * value -30 represents 1870). Year default range is from 70 to 137.
454 * Month: default value range is from 0 to 11.
456 * Date: default value range is from 1 to 31 according to the month value.
458 * Hour: default value will be in terms of 24 hr format (0~23)
460 * Minute: default value range is from 0 to 59.
462 * @param obj The datetime object.
463 * @param mintime Time structure containing the minimum time value.
464 * @return EINA_TRUE if minimum value is accepted.
466 * @see elm_datetime_value_min_get()
469 EAPI Eina_Bool elm_datetime_value_min_set(Evas_Object *obj, const struct tm *mintime);
472 * @brief Get the field limits of a field.
474 * Limits can be set to individual fields, independently, except for AM/PM field.
475 * Any field can display the values only in between these Minimum and Maximum limits unless
476 * the corresponding time value is restricted from MinTime to MaxTime.
477 * That is, Min/ Max field limits always works under the limitations of MinTime/ MaxTime.
479 * There is no provision to set the limits of AM/PM field.
481 * @param obj The datetime object
482 * @param fieldtype Type of the field. ELM_DATETIME_YEAR etc.
483 * @param min Reference to field's minimum value
484 * @param max Reference to field's maximum value
486 * @see elm_datetime_field_limit_set()
489 EAPI void elm_datetime_field_limit_get(const Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, int *min, int *max);
492 * @brief Set the field limits of a field.
494 * Limits can be set to individual fields, independently, except for AM/PM field.
495 * Any field can display the values only in between these Minimum and Maximum limits unless
496 * the corresponding time value is restricted from MinTime to MaxTime.
497 * That is, Min/ Max field limits always works under the limitations of MinTime/ MaxTime.
499 * There is no provision to set the limits of AM/PM field.
501 * @param obj The datetime object
502 * @param fieldtype Type of the field. ELM_DATETIME_YEAR etc.
503 * @param min Reference to field's minimum value
504 * @param max Reference to field's maximum value
506 * @see elm_datetime_field_limit_set()
509 EAPI void elm_datetime_field_limit_set(Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, int min, int max);
512 * @brief Get the current value of a field.
514 * Year: years since 1900. Negative value represents year below 1900 (year
515 * value -30 represents 1870). Year default range is from 70 to 137.
517 * Month: default value range is from 0 to 11.
519 * Date: default value range is from 1 to 31 according to the month value.
521 * Hour: default value will be in terms of 24 hr format (0~23)
523 * Minute: default value range is from 0 to 59.
525 * @param obj The datetime object.
526 * @param currtime Time structure.
527 * @return EINA_TRUE if current time is returned successfully.
529 * @see elm_datetime_field_value_set()
532 EAPI Eina_Bool elm_datetime_value_get(const Evas_Object *obj, struct tm *currtime);
535 * @brief Set the current value of a Datetime object.
537 * Year: years since 1900. Negative value represents year below 1900 (year
538 * value -30 represents 1870). Year default range is from 70 to 137.
540 * Month: default value range is from 0 to 11.
542 * Date: default value range is from 1 to 31 according to the month value.
544 * Hour: default value will be in terms of 24 hr format (0~23)
546 * Minute: default value range is from 0 to 59.
549 * @param obj The datetime object.
550 * @param newtime Time structure filled with values to be set.
551 * @return EINA_TRUE if current time is set successfully.
553 * @see elm_datetime_value_set()
556 EAPI Eina_Bool elm_datetime_value_set(Evas_Object *obj, const struct tm *newtime);
559 * @brief Get whether a field can be visible/not
561 * @param obj The datetime object
562 * @param fieldtype Type of the field. ELM_DATETIME_YEAR etc
563 * @return bool @c EINA_TRUE, if field can be visible. @c EINA_FALSE otherwise.
565 * @see elm_datetime_field_visible_set()
568 EAPI Eina_Bool elm_datetime_field_visible_get(const Evas_Object *obj, Elm_Datetime_Field_Type fieldtype);
571 * @brief Set a field to be visible or not.
572 * Setting this API True does not ensure that the field is visible, apart from
573 * this, the field's format must be present in Datetime overall format.
574 * If a field's visibility is set to False then it won't appear even though
575 * its format is present in overall format.
576 * So if and only if this API is set true and the corresponding field's format
577 * is present in Datetime format, the field is visible.
579 * By default the field visibility is set to True.
581 * @param obj The datetime object
582 * @param fieldtype Type of the field. ELM_DATETIME_YEAR etc.
583 * @param visible @c EINA_TRUE field can be visible, @c EINA_FALSE otherwise.
585 * @see elm_datetime_field_visible_get()
588 EAPI void elm_datetime_field_visible_set(Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, Eina_Bool visible);