2 * @defgroup Clock Clock
5 * @image html img/widget/clock/preview-00.png
6 * @image latex img/widget/clock/preview-00.eps
8 * This is a @b digital clock widget. In its default theme, it has a
9 * vintage "flipping numbers clock" appearance, which will animate
10 * sheets of individual algarisms individually as time goes by.
12 * A newly created clock will fetch system's time (already
13 * considering local time adjustments) to start with, and will tick
14 * accordingly. It may or may not show seconds.
16 * Clocks have an @b edition mode. When in it, the sheets will
17 * display extra arrow indications on the top and bottom and the
18 * user may click on them to raise or lower the time values. After
19 * it's told to exit edition mode, it will keep ticking with that
20 * new time set (it keeps the difference from local time).
22 * Also, when under edition mode, user clicks on the cited arrows
23 * which are @b held for some time will make the clock to flip the
24 * sheet, thus editing the time, continuously and automatically for
25 * the user. The interval between sheet flips will keep growing in
26 * time, so that it helps the user to reach a time which is distant
29 * The time display is, by default, in military mode (24h), but an
30 * am/pm indicator may be optionally shown, too, when it will
33 * Smart callbacks one can register to:
34 * - "changed" - the clock's user changed the time
36 * Supported elm_object common APIs.
37 * @li @ref elm_object_signal_emit
38 * @li @ref elm_object_signal_callback_add
39 * @li @ref elm_object_signal_callback_del
41 * Here is an example on its usage:
42 * @li @ref clock_example
51 * Identifiers for which clock digits should be editable, when a
52 * clock widget is in edition mode. Values may be OR-ed together to
53 * make a mask, naturally.
55 * @see elm_clock_edit_set()
56 * @see elm_clock_edit_mode_set()
60 ELM_CLOCK_EDIT_DEFAULT = 0, /**< Default value. Means that all digits are editable, when in edition mode. */
61 ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 << 0, /**< Decimal algarism of hours value should be editable */
62 ELM_CLOCK_EDIT_HOUR_UNIT = 1 << 1, /**< Unit algarism of hours value should be editable */
63 ELM_CLOCK_EDIT_MIN_DECIMAL = 1 << 2, /**< Decimal algarism of minutes value should be editable */
64 ELM_CLOCK_EDIT_MIN_UNIT = 1 << 3, /**< Unit algarism of minutes value should be editable */
65 ELM_CLOCK_EDIT_SEC_DECIMAL = 1 << 4, /**< Decimal algarism of seconds value should be editable */
66 ELM_CLOCK_EDIT_SEC_UNIT = 1 << 5, /**< Unit algarism of seconds value should be editable */
67 ELM_CLOCK_EDIT_ALL = (1 << 6) - 1 /**< All digits should be editable */
68 } Elm_Clock_Edit_Mode;
71 * Add a new clock widget to the given parent Elementary
74 * @param parent The parent object
75 * @return a new clock widget handle or @c NULL, on errors
77 * This function inserts a new clock widget on the canvas.
81 EAPI Evas_Object *elm_clock_add(Evas_Object *parent);
84 * Set a clock widget's time, programmatically
86 * @param obj The clock widget object
87 * @param hrs The hours to set
88 * @param min The minutes to set
89 * @param sec The seconds to set
91 * This function updates the time that is showed by the clock
94 * Values @b must be set within the following ranges:
96 * - 0 - 59, for minutes
97 * - 0 - 59, for seconds,
99 * even if the clock is not in "military" mode.
101 * @warning The behavior for values set out of those ranges is @b
106 EAPI void elm_clock_time_set(Evas_Object *obj, int hrs, int min, int sec);
109 * Get a clock widget's time values
111 * @param obj The clock object
112 * @param[out] hrs Pointer to the variable to get the hours value
113 * @param[out] min Pointer to the variable to get the minutes value
114 * @param[out] sec Pointer to the variable to get the seconds value
116 * This function gets the time set for @p obj, returning
117 * it on the variables passed as the arguments to function
119 * @note Use @c NULL pointers on the time values you're not
120 * interested in: they'll be ignored by the function.
124 EAPI void elm_clock_time_get(const Evas_Object *obj, int *hrs, int *min, int *sec);
127 * Set whether a given clock widget is under <b>edition mode</b> or
128 * under (default) displaying-only mode.
130 * @param obj The clock object
131 * @param edit @c EINA_TRUE to put it in edition, @c EINA_FALSE to
132 * put it back to "displaying only" mode
134 * This function makes a clock's time to be editable or not <b>by
135 * user interaction</b>. When in edition mode, clocks @b stop
136 * ticking, until one brings them back to canonical mode. The
137 * elm_clock_edit_mode_set() function will influence which digits
138 * of the clock will be editable. By default, all of them will be
141 * @note am/pm sheets, if being shown, will @b always be editable
142 * under edition mode.
144 * @see elm_clock_edit_get()
148 EAPI void elm_clock_edit_set(Evas_Object *obj, Eina_Bool edit);
151 * Retrieve whether a given clock widget is under editing mode
152 * or under (default) displaying-only mode.
154 * @param obj The clock object
155 * @return @c EINA_TRUE, if it's in edition mode, @c EINA_FALSE otherwise
157 * This function retrieves whether the clock's time can be edited
158 * or not by user interaction.
160 * @see elm_clock_edit_set() for more details
164 EAPI Eina_Bool elm_clock_edit_get(const Evas_Object *obj);
167 * Set what digits of the given clock widget should be editable
168 * when in edition mode.
170 * @param obj The clock object
171 * @param digedit Bit mask indicating the digits to be editable
172 * (values in #Elm_Clock_Edit_Mode).
174 * If the @p digedit param is #ELM_CLOCK_NONE, editing will be
175 * disabled on @p obj (same effect as elm_clock_edit_set(), with @c
178 * @see elm_clock_edit_mode_get()
182 EAPI void elm_clock_edit_mode_set(Evas_Object *obj, Elm_Clock_Edit_Mode digedit);
185 * Retrieve what digits of the given clock widget should be
186 * editable when in edition mode.
188 * @param obj The clock object
189 * @return Bit mask indicating the digits to be editable
190 * (values in #Elm_Clock_Edit_Mode).
192 * @see elm_clock_edit_mode_set() for more details
196 EAPI Elm_Clock_Edit_Mode elm_clock_edit_mode_get(const Evas_Object *obj);
199 * Set if the given clock widget must show hours in military or
202 * @param obj The clock object
203 * @param am_pm @c EINA_TRUE to put it in am/pm mode, @c EINA_FALSE
206 * This function sets if the clock must show hours in military or
207 * am/pm mode. In some countries like Brazil the military mode
208 * (00-24h-format) is used, in opposition to the USA, where the
209 * am/pm mode is more commonly used.
211 * @see elm_clock_show_am_pm_get()
215 EAPI void elm_clock_show_am_pm_set(Evas_Object *obj, Eina_Bool am_pm);
218 * Get if the given clock widget shows hours in military or am/pm
221 * @param obj The clock object
222 * @return @c EINA_TRUE, if in am/pm mode, @c EINA_FALSE if in
225 * This function gets if the clock shows hours in military or am/pm
228 * @see elm_clock_show_am_pm_set() for more details
232 EAPI Eina_Bool elm_clock_show_am_pm_get(const Evas_Object *obj);
235 * Set if the given clock widget must show time with seconds or not
237 * @param obj The clock object
238 * @param seconds @c EINA_TRUE to show seconds, @c EINA_FALSE otherwise
240 * This function sets if the given clock must show or not elapsed
241 * seconds. By default, they are @b not shown.
243 * @see elm_clock_show_seconds_get()
247 EAPI void elm_clock_show_seconds_set(Evas_Object *obj, Eina_Bool seconds);
250 * Get whether the given clock widget is showing time with seconds
253 * @param obj The clock object
254 * @return @c EINA_TRUE if it's showing seconds, @c EINA_FALSE otherwise
256 * This function gets whether @p obj is showing or not the elapsed
259 * @see elm_clock_show_seconds_set()
263 EAPI Eina_Bool elm_clock_show_seconds_get(const Evas_Object *obj);
266 * Set the first interval on time updates for a user mouse button hold
267 * on clock widgets' time edition.
269 * @param obj The clock object
270 * @param interval The first interval value in seconds
272 * This interval value is @b decreased while the user holds the
273 * mouse pointer either incrementing or decrementing a given the
274 * clock digit's value.
276 * This helps the user to get to a given time distant from the
277 * current one easier/faster, as it will start to flip quicker and
278 * quicker on mouse button holds.
280 * The calculation for the next flip interval value, starting from
281 * the one set with this call, is the previous interval divided by
282 * 1.05, so it decreases a little bit.
284 * The default starting interval value for automatic flips is
287 * @see elm_clock_first_interval_get()
291 EAPI void elm_clock_first_interval_set(Evas_Object *obj, double interval);
294 * Get the first interval on time updates for a user mouse button hold
295 * on clock widgets' time edition.
297 * @param obj The clock object
298 * @return The first interval value, in seconds, set on it
300 * @see elm_clock_first_interval_set() for more details
304 EAPI double elm_clock_first_interval_get(const Evas_Object *obj);