Clock

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Macros | Enumerations | Functions
Clock
Elementary

## Macros
#define | ELM_CLOCK_CLASS elm_clock_class_get()
| Digital clock widget.
#define | ELM_CLOCK_EVENT_CHANGED (&(_ELM_CLOCK_EVENT_CHANGED))
| The clock's user changed the time.

## Enumerations
enum | Elm_Clock_Edit_Mode { ELM_CLOCK_EDIT_DEFAULT = 0 , ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 , ELM_CLOCK_EDIT_HOUR_UNIT = 2 , ELM_CLOCK_EDIT_MIN_DECIMAL = 4 , ELM_CLOCK_EDIT_MIN_UNIT = 8 , ELM_CLOCK_EDIT_SEC_DECIMAL = 16 , ELM_CLOCK_EDIT_SEC_UNIT = 32 , ELM_CLOCK_EDIT_ALL = 63 , ELM_CLOCK_EDIT_DEFAULT = 0 , ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 , ELM_CLOCK_EDIT_HOUR_UNIT = 2 , ELM_CLOCK_EDIT_MIN_DECIMAL = 4 , ELM_CLOCK_EDIT_MIN_UNIT = 8 , ELM_CLOCK_EDIT_SEC_DECIMAL = 16 , ELM_CLOCK_EDIT_SEC_UNIT = 32 , ELM_CLOCK_EDIT_ALL = 63 }
| Identifiers for which clock digits should be editable, when a clock widget is in editing mode. More...
enum | Elm_Clock_Edit_Mode { ELM_CLOCK_EDIT_DEFAULT = 0 , ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 , ELM_CLOCK_EDIT_HOUR_UNIT = 2 , ELM_CLOCK_EDIT_MIN_DECIMAL = 4 , ELM_CLOCK_EDIT_MIN_UNIT = 8 , ELM_CLOCK_EDIT_SEC_DECIMAL = 16 , ELM_CLOCK_EDIT_SEC_UNIT = 32 , ELM_CLOCK_EDIT_ALL = 63 , ELM_CLOCK_EDIT_DEFAULT = 0 , ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 , ELM_CLOCK_EDIT_HOUR_UNIT = 2 , ELM_CLOCK_EDIT_MIN_DECIMAL = 4 , ELM_CLOCK_EDIT_MIN_UNIT = 8 , ELM_CLOCK_EDIT_SEC_DECIMAL = 16 , ELM_CLOCK_EDIT_SEC_UNIT = 32 , ELM_CLOCK_EDIT_ALL = 63 }
| Identifiers for which clock digits should be editable, when a clock widget is in editing mode. More...

## Functions
EOAPI void | elm_obj_clock_show_am_pm_set (Eo *obj, Eina_Bool am_pm)
| If the given clock widget must show hours in military or am/pm mode.
EOAPI Eina_Bool | elm_obj_clock_show_am_pm_get (const Eo *obj)
| If the given clock widget must show hours in military or am/pm mode.
EOAPI void | elm_obj_clock_first_interval_set (Eo *obj, double interval)
| The first interval on time updates for a user mouse button hold on clock widgets' time editing.
EOAPI double | elm_obj_clock_first_interval_get (const Eo *obj)
| The first interval on time updates for a user mouse button hold on clock widgets' time editing.
EOAPI void | elm_obj_clock_show_seconds_set (Eo *obj, Eina_Bool seconds)
| If the given clock widget must show time with seconds or not.
EOAPI Eina_Bool | elm_obj_clock_show_seconds_get (const Eo *obj)
| If the given clock widget must show time with seconds or not.
EOAPI void | elm_obj_clock_edit_set (Eo *obj, Eina_Bool edit)
| Whether a given clock widget is under editing mode or under (default) displaying-only mode.
EOAPI Eina_Bool | elm_obj_clock_edit_get (const Eo *obj)
| Whether a given clock widget is under editing mode or under (default) displaying-only mode.
EOAPI void | elm_obj_clock_pause_set (Eo *obj, Eina_Bool paused)
| Whether the given clock widget should be paused or not.
EOAPI Eina_Bool | elm_obj_clock_pause_get (const Eo *obj)
| Whether the given clock widget should be paused or not.
EOAPI void | elm_obj_clock_time_set (Eo *obj, int hrs, int min, int sec)
| Clock widget's time.
EOAPI void | elm_obj_clock_time_get (const Eo *obj, int *hrs, int *min, int *sec)
| Clock widget's time.
EOAPI void | elm_obj_clock_edit_mode_set (Eo *obj, Elm_Clock_Edit_Mode digedit)
| Digits of the given clock widget should be editable when in editing mode.
EOAPI Elm_Clock_Edit_Mode | elm_obj_clock_edit_mode_get (const Eo *obj)
| Digits of the given clock widget should be editable when in editing mode.
Evas_Object * | elm_clock_add (Evas_Object *parent)
| Add a new clock widget to the given parent Elementary (container) object.

## Detailed Description

This is a digital clock widget. In its default theme, it has a vintage "flipping numbers clock" appearance, which will animate sheets of individual algorisms individually as time goes by.

A newly created clock will fetch system's time (already considering local time adjustments) to start with, and will tick accordingly. It may or may not show seconds.

Clocks have an edition mode. When in it, the sheets will display extra arrow indications on the top and bottom and the user may click on them to raise or lower the time values. After it's told to exit edition mode, it will keep ticking with that new time set (it keeps the difference from local time).

Also, when under edition mode, user clicks on the cited arrows which are held for some time will make the clock to flip the sheet, thus editing the time, continuously and automatically for the user. The interval between sheet flips will keep reducing in time, so that it helps the user to reach a time which is distant from the one set.

The time display is, by default, in military mode (24h), but an am/pm indicator may be optionally shown, too, when it will switch to 12h.

This widget inherits from the Layout one, so that all the functions acting on it also work for clock objects.

This widget emits the following signals, besides the ones sent from Layout :

- `"changed"` - the clock's user changed the time
- `"focused"` - When the clock ehas received focus. (since 1.8)
- `"unfocused"` - When the clock has lost focus. (since 1.8)
- `"language,changed"` - the program's language changed (since 1.9)

Supported elm_object common APIs.

- elm_object_signal_emit
- elm_object_signal_callback_add
- elm_object_signal_callback_del

Here is an example on its usage:

- Clock widget example

## Macro Definition Documentation

## ◆ ELM_CLOCK_CLASS

#define ELM_CLOCK_CLASS elm_clock_class_get()

Digital clock widget.

This is a digital clock widget. In its default theme, it has a vintage "flipping numbers clock" appearance, which will animate sheets of individual algorisms individually as time goes by.

A newly created clock will fetch system's time (already considering local time adjustments) to start with, and will tick accordingly.

## ◆ ELM_CLOCK_EVENT_CHANGED

#define ELM_CLOCK_EVENT_CHANGED (&(_ELM_CLOCK_EVENT_CHANGED))

The clock's user changed the time.

## Enumeration Type Documentation

## ◆ Elm_Clock_Edit_Mode [1/2]

enum Elm_Clock_Edit_Mode

Identifiers for which clock digits should be editable, when a clock widget is in editing mode.

Values may be OR-ed together to make a mask, naturally.

See also elm_obj_clock_edit_set, elm_obj_clock_edit_mode_set.

Enumerator
ELM_CLOCK_EDIT_DEFAULT | Default value. Means that all digits are editable, when in editing mode.
ELM_CLOCK_EDIT_HOUR_DECIMAL | Decimal digit of hours value should be editable.
ELM_CLOCK_EDIT_HOUR_UNIT | Unit digit of hours value should be editable.
ELM_CLOCK_EDIT_MIN_DECIMAL | Decimal digit of minutes value should be editable.
ELM_CLOCK_EDIT_MIN_UNIT | Unit digit of minutes value should be editable.
ELM_CLOCK_EDIT_SEC_DECIMAL | Decimal digit of seconds value should be editable.
ELM_CLOCK_EDIT_SEC_UNIT | Unit digit of seconds value should be editable.
ELM_CLOCK_EDIT_ALL | All digits should be editable.
ELM_CLOCK_EDIT_DEFAULT | Default value. Means that all digits are editable, when in editing mode.
ELM_CLOCK_EDIT_HOUR_DECIMAL | Decimal digit of hours value should be editable.
ELM_CLOCK_EDIT_HOUR_UNIT | Unit digit of hours value should be editable.
ELM_CLOCK_EDIT_MIN_DECIMAL | Decimal digit of minutes value should be editable.
ELM_CLOCK_EDIT_MIN_UNIT | Unit digit of minutes value should be editable.
ELM_CLOCK_EDIT_SEC_DECIMAL | Decimal digit of seconds value should be editable.
ELM_CLOCK_EDIT_SEC_UNIT | Unit digit of seconds value should be editable.
ELM_CLOCK_EDIT_ALL | All digits should be editable.

## ◆ Elm_Clock_Edit_Mode [2/2]

enum Elm_Clock_Edit_Mode

Identifiers for which clock digits should be editable, when a clock widget is in editing mode.

Values may be OR-ed together to make a mask, naturally.

See also elm_clock_edit_set, elm_clock_edit_mode_set.

Enumerator
ELM_CLOCK_EDIT_DEFAULT | Default value. Means that all digits are editable, when in editing mode.
ELM_CLOCK_EDIT_HOUR_DECIMAL | Decimal digit of hours value should be editable.
ELM_CLOCK_EDIT_HOUR_UNIT | Unit digit of hours value should be editable.
ELM_CLOCK_EDIT_MIN_DECIMAL | Decimal digit of minutes value should be editable.
ELM_CLOCK_EDIT_MIN_UNIT | Unit digit of minutes value should be editable.
ELM_CLOCK_EDIT_SEC_DECIMAL | Decimal digit of seconds value should be editable.
ELM_CLOCK_EDIT_SEC_UNIT | Unit digit of seconds value should be editable.
ELM_CLOCK_EDIT_ALL | All digits should be editable.
ELM_CLOCK_EDIT_DEFAULT | Default value. Means that all digits are editable, when in editing mode.
ELM_CLOCK_EDIT_HOUR_DECIMAL | Decimal digit of hours value should be editable.
ELM_CLOCK_EDIT_HOUR_UNIT | Unit digit of hours value should be editable.
ELM_CLOCK_EDIT_MIN_DECIMAL | Decimal digit of minutes value should be editable.
ELM_CLOCK_EDIT_MIN_UNIT | Unit digit of minutes value should be editable.
ELM_CLOCK_EDIT_SEC_DECIMAL | Decimal digit of seconds value should be editable.
ELM_CLOCK_EDIT_SEC_UNIT | Unit digit of seconds value should be editable.
ELM_CLOCK_EDIT_ALL | All digits should be editable.

## Function Documentation

## ◆ elm_obj_clock_show_am_pm_set()

EOAPI void elm_obj_clock_show_am_pm_set | ( | Eo * | obj,
|  | Eina_Bool | am_pm
| ) |  |

If the given clock widget must show hours in military or am/pm mode.

Set if the clock must show hours in military or am/pm mode. In some countries like Brazil the military mode (00-24h-format) is used, in opposition to the USA, where the am/pm mode is more commonly used.

Parameters

  [in] | obj | The object.
  [in] | am_pm | `true` to put it in am/pm mode, `false` to military mode

## ◆ elm_obj_clock_show_am_pm_get()

EOAPI Eina_Bool elm_obj_clock_show_am_pm_get | ( | const Eo * | obj | ) |

If the given clock widget must show hours in military or am/pm mode.

Set if the clock must show hours in military or am/pm mode. In some countries like Brazil the military mode (00-24h-format) is used, in opposition to the USA, where the am/pm mode is more commonly used.

Parameters

  [in] | obj | The object.

Returns
  `true` to put it in am/pm mode, `false` to military mode

## ◆ elm_obj_clock_first_interval_set()

EOAPI void elm_obj_clock_first_interval_set | ( | Eo * | obj,
|  | double | interval
| ) |  |

The first interval on time updates for a user mouse button hold on clock widgets' time editing.

This interval value is decreased while the user holds the mouse pointer either incrementing or decrementing a given the clock digit's value.

This helps the user to get to a given time distant from the current one easier/faster, as it will start to flip quicker and quicker on mouse button holds.

The calculation for the next flip interval value, starting from the one set with this call, is the previous interval divided by 1.05, so it decreases a little bit.

The default starting interval value for automatic flips is 0.85 seconds.

Parameters

  [in] | obj | The object.
  [in] | interval | The first interval value in seconds

## ◆ elm_obj_clock_first_interval_get()

EOAPI double elm_obj_clock_first_interval_get | ( | const Eo * | obj | ) |

The first interval on time updates for a user mouse button hold on clock widgets' time editing.

This interval value is decreased while the user holds the mouse pointer either incrementing or decrementing a given the clock digit's value.

This helps the user to get to a given time distant from the current one easier/faster, as it will start to flip quicker and quicker on mouse button holds.

The calculation for the next flip interval value, starting from the one set with this call, is the previous interval divided by 1.05, so it decreases a little bit.

The default starting interval value for automatic flips is 0.85 seconds.

Parameters

  [in] | obj | The object.

Returns
  The first interval value in seconds

## ◆ elm_obj_clock_show_seconds_set()

EOAPI void elm_obj_clock_show_seconds_set | ( | Eo * | obj,
|  | Eina_Bool | seconds
| ) |  |

If the given clock widget must show time with seconds or not.

This function sets if the given clock must show or not elapsed seconds. By default, they are not shown.

Parameters

  [in] | obj | The object.
  [in] | seconds | `true` to show seconds, `false` otherwise.

## ◆ elm_obj_clock_show_seconds_get()

EOAPI Eina_Bool elm_obj_clock_show_seconds_get | ( | const Eo * | obj | ) |

If the given clock widget must show time with seconds or not.

This function sets if the given clock must show or not elapsed seconds. By default, they are not shown.

Parameters

  [in] | obj | The object.

Returns
  `true` to show seconds, `false` otherwise.

## ◆ elm_obj_clock_edit_set()

EOAPI void elm_obj_clock_edit_set | ( | Eo * | obj,
|  | Eina_Bool | edit
| ) |  |

Whether a given clock widget is under editing mode or under (default) displaying-only mode.

This function makes a clock's time to be editable or not by user interaction. When in editing mode, clocks stop ticking, until one brings them back to display mode. The elm_obj_clock_edit_mode_set function will influence which digits of the clock will be editable.

Note
  am/pm sheets, if being shown, will always be editable under editing mode.

Parameters

  [in] | obj | The object.
  [in] | edit | `true` to put it in editing, `false` to put it back to "displaying only" mode

## ◆ elm_obj_clock_edit_get()

EOAPI Eina_Bool elm_obj_clock_edit_get | ( | const Eo * | obj | ) |

Whether a given clock widget is under editing mode or under (default) displaying-only mode.

This function makes a clock's time to be editable or not by user interaction. When in editing mode, clocks stop ticking, until one brings them back to display mode. The elm_obj_clock_edit_mode_set function will influence which digits of the clock will be editable.

Note
  am/pm sheets, if being shown, will always be editable under editing mode.

Parameters

  [in] | obj | The object.

Returns
  `true` to put it in editing, `false` to put it back to "displaying only" mode

## ◆ elm_obj_clock_pause_set()

EOAPI void elm_obj_clock_pause_set | ( | Eo * | obj,
|  | Eina_Bool | paused
| ) |  |

Whether the given clock widget should be paused or not.

This function pauses or starts the clock widget.

Parameters

  [in] | obj | The object.
  [in] | paused | `true` to pause clock, `false` otherwise

Since
  1.9

## ◆ elm_obj_clock_pause_get()

EOAPI Eina_Bool elm_obj_clock_pause_get | ( | const Eo * | obj | ) |

Whether the given clock widget should be paused or not.

This function pauses or starts the clock widget.

Parameters

  [in] | obj | The object.

Returns
  `true` to pause clock, `false` otherwise

Since
  1.9

## ◆ elm_obj_clock_time_set()

EOAPI void elm_obj_clock_time_set | ( | Eo * | obj,
|  | int | hrs,
|  | int | min,
|  | int | sec
| ) |  |

Clock widget's time.

Values must be set within 0-23 for hours and 0-59 for minutes and seconds, even if the clock is not in "military" mode.

Warning
  The behavior for values set out of those ranges is undefined.

Parameters

  [in] | obj | The object.
  [in] | hrs | The hours to set
  [in] | min | The minutes to set
  [in] | sec | The seconds to set

## ◆ elm_obj_clock_time_get()

EOAPI void elm_obj_clock_time_get | ( | const Eo * | obj,
|  | int * | hrs,
|  | int * | min,
|  | int * | sec
| ) |  |

Clock widget's time.

Values must be set within 0-23 for hours and 0-59 for minutes and seconds, even if the clock is not in "military" mode.

Note
  Use `null` pointers on the time values you're not interested in: they'll be ignored by the function.

Parameters

  [in] | obj | The object.
  [out] | hrs | The hours to set
  [out] | min | The minutes to set
  [out] | sec | The seconds to set

## ◆ elm_obj_clock_edit_mode_set()

EOAPI void elm_obj_clock_edit_mode_set | ( | Eo * | obj,
|  | Elm_Clock_Edit_Mode | digedit
| ) |  |

Digits of the given clock widget should be editable when in editing mode.

Parameters

  [in] | obj | The object.
  [in] | digedit | Bit mask indicating the digits to be editable (values in Elm_Clock_Edit_Mode).

## ◆ elm_obj_clock_edit_mode_get()

EOAPI Elm_Clock_Edit_Mode elm_obj_clock_edit_mode_get | ( | const Eo * | obj | ) |

Digits of the given clock widget should be editable when in editing mode.

Parameters

  [in] | obj | The object.

Returns
  Bit mask indicating the digits to be editable (values in Elm_Clock_Edit_Mode).

## ◆ elm_clock_add()

Evas_Object * elm_clock_add | ( | Evas_Object * | parent | ) |

Add a new clock widget to the given parent Elementary (container) object.

Parameters

  parent | The parent object

Returns
  a new clock widget handle or `NULL`, on errors

This function inserts a new clock widget on the canvas.

References EINA_SAFETY_ON_NULL_RETURN_VAL.