remove excution permission for source files
[framework/uifw/elementary.git] / src / lib / elm_clock.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4 /**
5  * @defgroup Clock Clock
6  * @ingroup Elementary
7  *
8  * It's a widget to show clock with animation. The update of time is
9  * shown in an animation like the flip of a sheet.
10  *
11  */
12
13 typedef struct _Widget_Data Widget_Data;
14
15 struct _Widget_Data
16 {
17    Evas_Object *clk;
18    double interval;
19    Eina_Bool seconds : 1;
20    Eina_Bool am_pm : 1;
21    Eina_Bool edit : 1;
22    Elm_Clock_Digedit digedit;
23    int hrs, min, sec;
24    Evas_Object *digit[6];
25    Evas_Object *ampm;
26    Evas_Object *sel_obj;
27    Ecore_Timer *ticker, *spin;
28    struct
29      {
30         int hrs, min, sec;
31         char ampm;
32         Eina_Bool seconds : 1;
33         Eina_Bool am_pm : 1;
34         Eina_Bool edit : 1;
35         Elm_Clock_Digedit digedit;
36      } cur;
37 };
38
39 static const char *widtype = NULL;
40 static void _del_hook(Evas_Object *obj);
41 static void _theme_hook(Evas_Object *obj);
42 static int _ticker(void *data);
43 static int _signal_clock_val_up(void *data);
44 static int _signal_clock_val_down(void *data);
45 static void _time_update(Evas_Object *obj);
46
47 static void
48 _del_hook(Evas_Object *obj)
49 {
50    Widget_Data *wd = elm_widget_data_get(obj);
51    if (!wd) return;
52    int i;
53    for (i = 0; i < 6; i++)
54      {
55         if (wd->digit[i]) evas_object_del(wd->digit[i]);
56      }
57    if (wd->ampm) evas_object_del(wd->ampm);
58    if (wd->ticker) ecore_timer_del(wd->ticker);
59    if (wd->spin) ecore_timer_del(wd->spin);
60    free(wd);
61 }
62
63 static void
64 _theme_hook(Evas_Object *obj)
65 {
66    Widget_Data *wd = elm_widget_data_get(obj);
67    if (!wd) return;
68    if (elm_widget_focus_get(obj))
69      edje_object_signal_emit(wd->clk, "elm,action,focus", "elm");
70    else
71      edje_object_signal_emit(wd->clk, "elm,action,unfocus", "elm");
72    wd->cur.am_pm = !wd->cur.am_pm; /* hack - force update */
73    _time_update(obj);
74 }
75
76 static void
77 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
78 {
79    Widget_Data *wd = elm_widget_data_get(obj);
80    if (!wd) return;
81    if (elm_widget_focus_get(obj))
82      edje_object_signal_emit(wd->clk, "elm,action,focus", "elm");
83    else
84      edje_object_signal_emit(wd->clk, "elm,action,unfocus", "elm");
85 }
86
87 static int
88 _ticker(void *data)
89 {
90    Widget_Data *wd = elm_widget_data_get(data);
91    double t;
92    struct timeval timev;
93    struct tm *tm;
94    time_t tt;
95    if (!wd) return 0;
96    gettimeofday(&timev, NULL);
97    t = ((double)(1000000 - timev.tv_usec)) / 1000000.0;
98    wd->ticker = ecore_timer_add(t, _ticker, data);
99    if (!wd->edit)
100      {
101         tt = (time_t)(timev.tv_sec);
102         tzset();
103         tm = localtime(&tt);
104         if (tm)
105           {
106              wd->hrs = tm->tm_hour;
107              wd->min = tm->tm_min;
108              wd->sec = tm->tm_sec;
109              _time_update(data);
110           }
111      }
112    return 0;
113 }
114
115 static int
116 _signal_clock_val_up(void *data)
117 {
118    Widget_Data *wd = elm_widget_data_get(data);
119    if (!wd) return;
120    if (!wd->edit) return;
121    if (!wd->sel_obj) return;
122    if (wd->sel_obj == wd->digit[0])
123      {
124         wd->hrs = wd->hrs + 10;
125         if (wd->hrs >= 24) wd->hrs -= 24;
126      }
127    if (wd->sel_obj == wd->digit[1])
128      {
129         wd->hrs = wd->hrs + 1;
130         if (wd->hrs >= 24) wd->hrs -= 24;
131      }
132    if (wd->sel_obj == wd->digit[2])
133      {
134         wd->min = wd->min + 10;
135         if (wd->min >= 60) wd->min -= 60;
136      }
137    if (wd->sel_obj == wd->digit[3])
138      {
139         wd->min = wd->min + 1;
140         if (wd->min >= 60) wd->min -= 60;
141      }
142    if (wd->sel_obj == wd->digit[4])
143      {
144         wd->sec = wd->sec + 10;
145         if (wd->sec >= 60) wd->sec -= 60;
146      }
147    if (wd->sel_obj == wd->digit[5])
148      {
149         wd->sec = wd->sec + 1;
150         if (wd->sec >= 60) wd->sec -= 60;
151      }
152    if (wd->sel_obj == wd->ampm)
153      {
154         wd->hrs = wd->hrs + 12;
155         if (wd->hrs > 23) wd->hrs -= 24;
156      }
157    wd->interval = wd->interval / 1.05;
158    ecore_timer_interval_set(wd->spin, wd->interval);
159    _time_update(data);
160    evas_object_smart_callback_call(data, "changed", NULL);
161    return ECORE_CALLBACK_RENEW;
162 }
163
164 static int
165 _signal_clock_val_down(void *data)
166 {
167    Widget_Data *wd = elm_widget_data_get(data);
168    if (!wd) return;
169    if (!wd->edit) return;
170    if (!wd->sel_obj) return;
171    if (wd->sel_obj == wd->digit[0])
172      {
173         wd->hrs = wd->hrs - 10;
174         if (wd->hrs < 0) wd->hrs += 24;
175      }
176    if (wd->sel_obj == wd->digit[1])
177      {
178         wd->hrs = wd->hrs - 1;
179         if (wd->hrs < 0) wd->hrs += 24;
180      }
181    if (wd->sel_obj == wd->digit[2])
182      {
183         wd->min = wd->min - 10;
184         if (wd->min < 0) wd->min += 60;
185      }
186    if (wd->sel_obj == wd->digit[3])
187      {
188         wd->min = wd->min - 1;
189         if (wd->min < 0) wd->min += 60;
190      }
191    if (wd->sel_obj == wd->digit[4])
192      {
193         wd->sec = wd->sec - 10;
194         if (wd->sec < 0) wd->sec += 60;
195      }
196    if (wd->sel_obj == wd->digit[5])
197      {
198         wd->sec = wd->sec - 1;
199         if (wd->sec < 0) wd->sec += 60;
200      }
201    if (wd->sel_obj == wd->ampm)
202      {
203         wd->hrs = wd->hrs - 12;
204         if (wd->hrs < 0) wd->hrs += 24;
205      }
206    wd->interval = wd->interval / 1.05;
207    ecore_timer_interval_set(wd->spin, wd->interval);
208    _time_update(data);
209    evas_object_smart_callback_call(data, "changed", NULL);
210    return ECORE_CALLBACK_RENEW;
211 }
212
213 static void
214 _signal_clock_val_up_start(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
215 {
216    Widget_Data *wd = elm_widget_data_get(data);
217    if (!wd) return;
218    wd->interval = 0.85;
219    wd->sel_obj = obj;
220    if (wd->spin) ecore_timer_del(wd->spin);
221    wd->spin = ecore_timer_add(wd->interval, _signal_clock_val_up, data);
222    _signal_clock_val_up(data);
223 }
224
225 static void
226 _signal_clock_val_down_start(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
227 {
228    Widget_Data *wd = elm_widget_data_get(data);
229    if (!wd) return;
230    wd->interval = 0.85;
231    wd->sel_obj = obj;
232    if (wd->spin) ecore_timer_del(wd->spin);
233    wd->spin = ecore_timer_add(wd->interval, _signal_clock_val_down, data);
234    _signal_clock_val_down(data);
235 }
236
237 static void
238 _signal_clock_val_change_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
239 {
240    Widget_Data *wd = elm_widget_data_get(data);
241    if (!wd) return;
242    if (wd->spin) ecore_timer_del(wd->spin);
243    wd->spin = NULL;
244    wd->sel_obj = NULL;
245 }
246
247 static void
248 _time_update(Evas_Object *obj)
249 {
250    Widget_Data *wd = elm_widget_data_get(obj);
251    Edje_Message_Int msg;
252    int ampm = 0;
253    const char *style = elm_widget_style_get(obj);
254    if (!wd) return;
255    if ((wd->cur.seconds != wd->seconds) || (wd->cur.am_pm != wd->am_pm) ||
256        (wd->cur.edit != wd->edit) || (wd->cur.digedit != wd->digedit))
257      {
258         int i;
259         Evas_Coord mw, mh;
260
261         for (i = 0; i < 6; i++)
262           {
263              if (wd->digit[i])
264                {
265                   evas_object_del(wd->digit[i]);
266                   wd->digit[i] = NULL;
267                }
268           }
269         if (wd->ampm)
270           {
271              evas_object_del(wd->ampm);
272              wd->ampm = NULL;
273           }
274
275         if ((wd->seconds) && (wd->am_pm))
276           _elm_theme_object_set(obj, wd->clk, "clock", "base-all", style);
277         else if (wd->seconds)
278           _elm_theme_object_set(obj, wd->clk, "clock", "base-seconds", style);
279         else if (wd->am_pm)
280           _elm_theme_object_set(obj, wd->clk, "clock", "base-am_pm", style);
281         else
282           _elm_theme_object_set(obj, wd->clk, "clock", "base", style);
283         edje_object_scale_set(wd->clk, elm_widget_scale_get(obj) * 
284                               _elm_config->scale);
285
286         for (i = 0; i < 6; i++)
287           {
288              char buf[16];
289
290              if ((!wd->seconds) && (i >= 4)) break;
291              wd->digit[i] = edje_object_add(evas_object_evas_get(wd->clk));
292              _elm_theme_object_set(obj, wd->digit[i], "clock", "flipdigit", style);
293              edje_object_scale_set(wd->digit[i], elm_widget_scale_get(obj) * 
294                                    _elm_config->scale);
295              if (wd->edit && (wd->digedit & (1 << i)))
296                edje_object_signal_emit(wd->digit[i], "elm,state,edit,on", "elm");
297              edje_object_signal_callback_add(wd->digit[i], "elm,action,up,start",
298                                              "", _signal_clock_val_up_start, obj);
299              edje_object_signal_callback_add(wd->digit[i], "elm,action,up,stop",
300                                              "", _signal_clock_val_change_stop, obj);
301              edje_object_signal_callback_add(wd->digit[i], "elm,action,down,start",
302                                              "", _signal_clock_val_down_start, obj);
303              edje_object_signal_callback_add(wd->digit[i], "elm,action,down,stop",
304                                              "", _signal_clock_val_change_stop, obj);
305              mw = mh = -1;
306              elm_coords_finger_size_adjust(1, &mw, 2, &mh);
307              edje_object_size_min_restricted_calc(wd->digit[i], &mw, &mh, mw, mh);
308              elm_coords_finger_size_adjust(1, &mw, 2, &mh);
309              edje_extern_object_min_size_set(wd->digit[i], mw, mh);
310              snprintf(buf, sizeof(buf), "d%i", i);
311              edje_object_part_swallow(wd->clk , buf, wd->digit[i]);
312              evas_object_show(wd->digit[i]);
313           }
314         if (wd->am_pm)
315           {
316              wd->ampm = edje_object_add(evas_object_evas_get(wd->clk));
317              _elm_theme_object_set(obj, wd->ampm, "clock", "flipampm", style);
318              edje_object_scale_set(wd->ampm, elm_widget_scale_get(obj) * 
319                                    _elm_config->scale);
320              if (wd->edit)
321                edje_object_signal_emit(wd->ampm, "elm,state,edit,on", "elm");
322              edje_object_signal_callback_add(wd->ampm, "elm,action,up,start",
323                                              "", _signal_clock_val_up_start, obj);
324              edje_object_signal_callback_add(wd->ampm, "elm,action,up,stop",
325                                              "", _signal_clock_val_change_stop, obj);
326              edje_object_signal_callback_add(wd->ampm, "elm,action,down,start",
327                                              "", _signal_clock_val_down_start, obj);
328              edje_object_signal_callback_add(wd->ampm, "elm,action,down,stop",
329                                              "", _signal_clock_val_change_stop, obj);
330              mw = mh = -1;
331              elm_coords_finger_size_adjust(1, &mw, 2, &mh);
332              edje_object_size_min_restricted_calc(wd->ampm, &mw, &mh, mw, mh);
333              elm_coords_finger_size_adjust(1, &mw, 2, &mh);
334              edje_extern_object_min_size_set(wd->ampm, mw, mh);
335              edje_object_part_swallow(wd->clk , "ampm", wd->ampm);
336              evas_object_show(wd->ampm);
337           }
338
339         edje_object_size_min_calc(wd->clk, &mw, &mh);
340         evas_object_size_hint_min_set(obj, mw, mh);
341
342         wd->cur.hrs = 0;
343         wd->cur.min = 0;
344         wd->cur.sec = 0;
345         wd->cur.ampm = -1;
346         wd->cur.seconds = wd->seconds;
347         wd->cur.am_pm = wd->am_pm;
348         wd->cur.edit = wd->edit;
349         wd->cur.digedit = wd->digedit;
350      }
351    if (wd->hrs != wd->cur.hrs)
352      {
353         int hrs;
354         int d1, d2, dc1, dc2;
355
356         hrs = wd->hrs;
357         if (wd->am_pm)
358           {
359              if (hrs >= 12)
360                {
361                   if (hrs > 12) hrs -= 12;
362                   ampm = 1;
363                }
364              else if (hrs == 0) hrs = 12;
365           }
366         d1 = hrs / 10;
367         d2 = hrs % 10;
368         dc1 = wd->cur.hrs / 10;
369         dc2 = wd->cur.hrs % 10;
370         if (d1 != dc1)
371           {
372              msg.val = d1;
373              edje_object_message_send(wd->digit[0], EDJE_MESSAGE_INT, 1, &msg);
374           }
375         if (d2 != dc2)
376           {
377              msg.val = d2;
378              edje_object_message_send(wd->digit[1], EDJE_MESSAGE_INT, 1, &msg);
379           }
380         wd->cur.hrs = hrs;
381      }
382    if (wd->min != wd->cur.min)
383      {
384         int d1, d2, dc1, dc2;
385
386         d1 = wd->min / 10;
387         d2 = wd->min % 10;
388         dc1 = wd->cur.min / 10;
389         dc2 = wd->cur.min % 10;
390         if (d1 != dc1)
391           {
392              msg.val = d1;
393              edje_object_message_send(wd->digit[2], EDJE_MESSAGE_INT, 1, &msg);
394           }
395         if (d2 != dc2)
396           {
397              msg.val = d2;
398              edje_object_message_send(wd->digit[3], EDJE_MESSAGE_INT, 1, &msg);
399           }
400         wd->cur.min = wd->min;
401      }
402    if (wd->seconds)
403      {
404         if (wd->sec != wd->cur.sec)
405           {
406              int d1, d2, dc1, dc2;
407
408              d1 = wd->sec / 10;
409              d2 = wd->sec % 10;
410              dc1 = wd->cur.sec / 10;
411              dc2 = wd->cur.sec % 10;
412              if (d1 != dc1)
413                {
414                   msg.val = d1;
415                   edje_object_message_send(wd->digit[4], EDJE_MESSAGE_INT, 1, &msg);
416                }
417              if (d2 != dc2)
418                {
419                   msg.val = d2;
420                   edje_object_message_send(wd->digit[5], EDJE_MESSAGE_INT, 1, &msg);
421                }
422              wd->cur.sec = wd->sec;
423           }
424      }
425    else
426      wd->cur.sec = -1;
427
428    if (wd->am_pm)
429      {
430         if (wd->hrs >= 12) ampm = 1;
431         if (ampm != wd->cur.ampm)
432           {
433              if (wd->cur.ampm != ampm)
434                {
435                   msg.val = ampm;
436                   edje_object_message_send(wd->ampm, EDJE_MESSAGE_INT, 1, &msg);
437                }
438              wd->cur.ampm = ampm;
439           }
440      }
441    else
442      wd->cur.ampm = -1;
443 }
444
445 /**
446  * Add a new clock to the parent
447  *
448  * @param parent The parent object
449  *
450  * This function inserts a clock widget on a given canvas to show a
451  * animated clock.
452  *
453  * @ingroup Clock
454  */
455 EAPI Evas_Object *
456 elm_clock_add(Evas_Object *parent)
457 {
458    Evas_Object *obj;
459    Evas *e;
460    Widget_Data *wd;
461
462    wd = ELM_NEW(Widget_Data);
463    e = evas_object_evas_get(parent);
464    obj = elm_widget_add(e);
465    ELM_SET_WIDTYPE(widtype, "clock");
466    elm_widget_type_set(obj, "clock");
467    elm_widget_sub_object_add(parent, obj);
468    elm_widget_data_set(obj, wd);
469    elm_widget_del_hook_set(obj, _del_hook);
470    elm_widget_theme_hook_set(obj, _theme_hook);
471    elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
472
473    wd->clk = edje_object_add(e);
474    elm_widget_resize_object_set(obj, wd->clk);
475
476    wd->cur.ampm = -1;
477    wd->cur.seconds = EINA_TRUE;
478    wd->cur.am_pm = EINA_TRUE;
479    wd->cur.edit = EINA_TRUE;
480    wd->cur.digedit = ELM_CLOCK_NONE;
481
482    _time_update(obj);
483    _ticker(obj);
484
485    return obj;
486 }
487
488 /**
489  * Set the clock time
490  *
491  * @param obj The clock object
492  * @param hrs The hours to set
493  * @param min The minutes to set
494  * @param sec The secondes to set
495  *
496  * This function updates the time that is showed by the clock widget
497  *
498  * @ingroup Clock
499  */
500 EAPI void
501 elm_clock_time_set(Evas_Object *obj, int hrs, int min, int sec)
502 {
503    ELM_CHECK_WIDTYPE(obj, widtype);
504    Widget_Data *wd = elm_widget_data_get(obj);
505    if (!wd) return;
506    wd->hrs = hrs;
507    wd->min = min;
508    wd->sec = sec;
509    _time_update(obj);
510 }
511
512 /**
513  * Get clock time
514  *
515  * @param obj The clock object
516  * @param hrs Pointer to the variable to get the hour of this clock
517  * object
518  * @param min Pointer to the variable to get the minute of this clock
519  * object
520  * @param sec Pointer to the variable to get the second of this clock
521  * object
522  *
523  * This function gets the time set of the clock widget and returns it
524  * on the variables passed as the arguments to function
525  *
526  * @ingroup Clock
527  */
528 EAPI void
529 elm_clock_time_get(const Evas_Object *obj, int *hrs, int *min, int *sec)
530 {
531    ELM_CHECK_WIDTYPE(obj, widtype);
532    Widget_Data *wd = elm_widget_data_get(obj);
533    if (!wd) return;
534    if (hrs) *hrs = wd->hrs;
535    if (min) *min = wd->min;
536    if (sec) *sec = wd->sec;
537 }
538
539 /**
540  * Set if the clock settings can be edited
541  *
542  * @param obj The clock object
543  * @param edit Bool option for edited (1 = yes, 0 = no)
544  *
545  * This function sets if the clock settings can be edited or not.
546  * By default or if digit_edit option was previously set to ELM_CLOCK_NONE,
547  * all digits are editable. To choose what digits to make editable
548  * use elm_clock_digit_edit_set().
549  *
550  * @ingroup Clock
551  */
552 EAPI void
553 elm_clock_edit_set(Evas_Object *obj, Eina_Bool edit)
554 {
555    ELM_CHECK_WIDTYPE(obj, widtype);
556    Widget_Data *wd = elm_widget_data_get(obj);
557    if (!wd) return;
558    wd->edit = edit;
559    if (edit && (wd->digedit == ELM_CLOCK_NONE))
560      elm_clock_digit_edit_set(obj, ELM_CLOCK_ALL);
561    else
562      _time_update(obj);
563 }
564
565 /**
566  * Get if the clock settings can be edited
567  *
568  * @param obj The clock object
569  * @return Bool option for edited (1 = yes, 0 = no)
570  *
571  * This function gets if the clock settings can be edited or not.
572  *
573  * @ingroup Clock
574  */
575 EAPI Eina_Bool
576 elm_clock_edit_get(const Evas_Object *obj)
577 {
578    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
579    Widget_Data *wd = elm_widget_data_get(obj);
580    if (!wd) return EINA_FALSE;
581    return wd->edit;
582 }
583
584 /**
585  * Set what digits of the clock are editable
586  *
587  * @param obj The clock object
588  * @param digedit Bit mask indicating the digits to edit
589  *
590  * If the digedit param is ELM_CLOCK_NONE, editing will be disabled.
591  *
592  * @ingroup Clock
593  */
594 EAPI void
595 elm_clock_digit_edit_set(Evas_Object *obj, Elm_Clock_Digedit digedit)
596 {
597    ELM_CHECK_WIDTYPE(obj, widtype);
598    Widget_Data *wd = elm_widget_data_get(obj);
599    if (!wd) return;
600    wd->digedit = digedit;
601    if (digedit == ELM_CLOCK_NONE)
602      elm_clock_edit_set(obj, EINA_FALSE);
603    else
604      _time_update(obj);
605 }
606
607 /**
608  * Get what digits of the clock are editable
609  *
610  * @param obj The clock object
611  * @return Bit mask indicating the digits.
612  *
613  * @ingroup Clock
614  */
615 EAPI Elm_Clock_Digedit
616 elm_clock_digit_edit_get(const Evas_Object *obj)
617 {
618    ELM_CHECK_WIDTYPE(obj, widtype) 0;
619    Widget_Data *wd = elm_widget_data_get(obj);
620    if (!wd) return 0;
621    return wd->digedit;
622 }
623
624 /**
625  * Set if the clock shows hours in military or am/pm mode
626  *
627  * @param obj The clock object
628  * @param am_pm Bool option for the hours mode
629  * (1 = am/pm, 0 = military)
630  *
631  * This function sets the clock to show hours in military or am/pm
632  * mode. Some countries like Brazil the military mode (00-24h-format)
633  * is used in opposition to the USA where the am/pm mode is more
634  * common used.
635  *
636  * @ingroup Clock
637  */
638 EAPI void
639 elm_clock_show_am_pm_set(Evas_Object *obj, Eina_Bool am_pm)
640 {
641    ELM_CHECK_WIDTYPE(obj, widtype);
642    Widget_Data *wd = elm_widget_data_get(obj);
643    if (!wd) return;
644    wd->am_pm = am_pm;
645    _time_update(obj);
646 }
647
648 /**
649  * Get if the clock shows hours in military or am/pm mode
650  *
651  * @param obj The clock object
652  * @return Bool option for the hours mode
653  * (1 = am/pm, 0 = military)
654  *
655  * This function gets if the clock show hours in military or am/pm
656  * mode. Some countries like Brazil the military mode (00-24h-format)
657  * is used in opposition to the USA where the am/pm mode is more
658  * common used.
659  *
660  * @ingroup Clock
661  */
662 EAPI Eina_Bool
663 elm_clock_show_am_pm_get(const Evas_Object *obj)
664 {
665    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
666    Widget_Data *wd = elm_widget_data_get(obj);
667    if (!wd) return EINA_FALSE;
668    return wd->am_pm;
669 }
670
671 /**
672  * Set if the clock shows hour with the seconds
673  *
674  * @param obj The clock object
675  * @param seconds Bool option for the show seconds
676  * (1 = show seconds, 0 = not show seconds)
677  *
678  * This function sets the clock to show or not to show the elapsed
679  * seconds.
680  *
681  * @ingroup Clock
682  */
683 EAPI void
684 elm_clock_show_seconds_set(Evas_Object *obj, Eina_Bool seconds)
685 {
686    ELM_CHECK_WIDTYPE(obj, widtype);
687    Widget_Data *wd = elm_widget_data_get(obj);
688    if (!wd) return;
689    wd->seconds = seconds;
690    _time_update(obj);
691 }
692
693 /**
694  * Get if the clock shows hour with the seconds
695  *
696  * @param obj The clock object
697  * @return Bool option for the show seconds
698  * (1 = show seconds, 0 = not show seconds)
699  *
700  * This function gets if the clock show or not show the elapsed
701  * seconds.
702  *
703  * @ingroup Clock
704  */
705 EAPI Eina_Bool
706 elm_clock_show_seconds_get(const Evas_Object *obj)
707 {
708    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
709    Widget_Data *wd = elm_widget_data_get(obj);
710    if (!wd) return EINA_FALSE;
711    return wd->seconds;
712 }