1 #ifndef EFL_UI_BUTTON_PRIVATE_H
2 #define EFL_UI_BUTTON_PRIVATE_H
3 
4 #include "Elementary.h"
5 
6 /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
7  * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
8  * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
9  * IT AT RUNTIME.
10  */
11 
12 /**
13  * @addtogroup Widget
14  * @{
15  *
16  * @section elm-button-class The Elementary Button Class
17  *
18  * Elementary, besides having the @ref Button widget, exposes its
19  * foundation -- the Elementary Button Class -- in order to create
20  * other widgets which are, basically, a button with some more logic
21  * on top.
22  */
23 
24 /**
25  * Base widget smart data extended with button instance data.
26  */
27 typedef struct _Efl_Ui_button_Data
28 {
29    /* auto-repeat stuff */
30    double                ar_initial_timeout; /**< Time to wait until first auto-repeated click is generated */
31    double                ar_gap_timeout; /**< Time frame for subsequent auto-repeated clicks, after the first automatic one is triggerred */
32 
33    Ecore_Timer          *timer; /**< Internal timer object for auto-repeat behavior */
34 
35    Eina_Bool             autorepeat : 1; /**< Whether auto-repetition of clicks is enabled or not (bound to _Elm_Button_Smart_Class::admits_autorepeat) */
36    Eina_Bool             repeating : 1; /**< Whether auto-repetition is going on */
37 } Efl_Ui_Button_Data;
38 
39 /**
40  * @}
41  */
42 
43 #define ELM_BUTTON_DATA_GET(o, sd) \
44   Efl_Ui_Button_Data * sd = efl_data_scope_get(o, EFL_UI_BUTTON_CLASS)
45 
46 #define ELM_BUTTON_DATA_GET_OR_RETURN(o, ptr)        \
47   ELM_BUTTON_DATA_GET(o, ptr);                       \
48   if (EINA_UNLIKELY(!ptr))                           \
49     {                                                \
50        ERR("No widget data for object %p (%s)",      \
51            o, evas_object_type_get(o));              \
52        return;                                       \
53     }
54 
55 #define ELM_BUTTON_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
56   ELM_BUTTON_DATA_GET(o, ptr);                         \
57   if (EINA_UNLIKELY(!ptr))                             \
58     {                                                  \
59        ERR("No widget data for object %p (%s)",        \
60            o, evas_object_type_get(o));                \
61        return val;                                     \
62     }
63 
64 #define ELM_BUTTON_CHECK(obj)                              \
65   if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_BUTTON_CLASS))) \
66     return
67 
68 #endif
69