b28715add7cd625e785ef3cbe773421dfe1cbd05
[framework/uifw/elementary.git] / src / lib / elm_button.h
1 /**
2  * @defgroup Button Button
3  *
4  * @image html img/widget/button/preview-00.png
5  * @image latex img/widget/button/preview-00.eps
6  * @image html img/widget/button/preview-01.png
7  * @image latex img/widget/button/preview-01.eps
8  * @image html img/widget/button/preview-02.png
9  * @image latex img/widget/button/preview-02.eps
10  *
11  * This is a push-button. Press it and run some function. It can contain
12  * a simple label and icon object and it also has an autorepeat feature.
13  *
14 <<<<<<< HEAD
15  * This widgets emits the following signals:
16 =======
17  * This widget emits the following signals:
18 >>>>>>> remotes/origin/upstream
19  * @li "clicked": the user clicked the button (press/release).
20  * @li "repeated": the user pressed the button without releasing it.
21  * @li "pressed": button was pressed.
22  * @li "unpressed": button was released after being pressed.
23 <<<<<<< HEAD
24  * In all three cases, the @c event parameter of the callback will be
25 =======
26  * In all cases, the @c event parameter of the callback will be
27 >>>>>>> remotes/origin/upstream
28  * @c NULL.
29  *
30  * Also, defined in the default theme, the button has the following styles
31  * available:
32  * @li default: a normal button.
33  * @li anchor: Like default, but the button fades away when the mouse is not
34  * over it, leaving only the text or icon.
35  * @li hoversel_vertical: Internally used by @ref Hoversel to give a
36  * continuous look across its options.
37  * @li hoversel_vertical_entry: Another internal for @ref Hoversel.
38 <<<<<<< HEAD
39  *
40  * Default contents parts of the button widget that you can use for are:
41 =======
42  * @li naviframe: Internally used by @ref Naviframe for its back button.
43  * @li colorselector: Internally used by @ref Colorselector 
44  * for its left and right buttons.
45  *
46  * Default content parts of the button widget that you can use for are:
47 >>>>>>> remotes/origin/upstream
48  * @li "icon" - An icon of the button
49  *
50  * Default text parts of the button widget that you can use for are:
51  * @li "default" - Label of the button
52  *
53  * Supported elm_object common APIs.
54  * @li elm_object_part_text_set
55  * @li elm_object_part_text_get
56  * @li elm_object_part_content_set
57  * @li elm_object_part_content_get
58  * @li elm_object_part_content_unset
59  * @li elm_object_signal_emit
60  * @li elm_object_signal_callback_add
61  * @li elm_object_signal_callback_del
62  * 
63  * Follow through a complete example @ref button_example_01 "here".
64  * @{
65  */
66
67 /**
68  * Add a new button to the parent's canvas
69  *
70  * @param parent The parent object
71  * @return The new object or NULL if it cannot be created
72  */
73 EAPI Evas_Object                 *elm_button_add(Evas_Object *parent);
74
75 /**
76  * Turn on/off the autorepeat event generated when the button is kept pressed
77  *
78  * When off, no autorepeat is performed and buttons emit a normal @c clicked
79  * signal when they are clicked.
80  *
81  * When on, keeping a button pressed will continuously emit a @c repeated
82  * signal until the button is released. The time it takes until it starts
83  * emitting the signal is given by
84  * elm_button_autorepeat_initial_timeout_set(), and the time between each
85  * new emission by elm_button_autorepeat_gap_timeout_set().
86  *
87  * @param obj The button object
88  * @param on  A bool to turn on/off the event
89  */
90 EAPI void                         elm_button_autorepeat_set(Evas_Object *obj, Eina_Bool on);
91
92 /**
93  * Get whether the autorepeat feature is enabled
94  *
95  * @param obj The button object
96  * @return EINA_TRUE if autorepeat is on, EINA_FALSE otherwise
97  *
98  * @see elm_button_autorepeat_set()
99  */
100 EAPI Eina_Bool                    elm_button_autorepeat_get(const Evas_Object *obj);
101
102 /**
103  * Set the initial timeout before the autorepeat event is generated
104  *
105  * Sets the timeout, in seconds, since the button is pressed until the
106  * first @c repeated signal is emitted. If @p t is 0.0 or less, there
107 <<<<<<< HEAD
108  * won't be any delay and the even will be fired the moment the button is
109 =======
110  * won't be any delay and the event will be fired the moment the button is
111 >>>>>>> remotes/origin/upstream
112  * pressed.
113  *
114  * @param obj The button object
115  * @param t   Timeout in seconds
116  *
117  * @see elm_button_autorepeat_set()
118  * @see elm_button_autorepeat_gap_timeout_set()
119  */
120 EAPI void                         elm_button_autorepeat_initial_timeout_set(Evas_Object *obj, double t);
121
122 /**
123  * Get the initial timeout before the autorepeat event is generated
124  *
125  * @param obj The button object
126  * @return Timeout in seconds
127  *
128  * @see elm_button_autorepeat_initial_timeout_set()
129  */
130 EAPI double                       elm_button_autorepeat_initial_timeout_get(const Evas_Object *obj);
131
132 /**
133  * Set the interval between each generated autorepeat event
134  *
135  * After the first @c repeated event is fired, all subsequent ones will
136  * follow after a delay of @p t seconds for each.
137  *
138  * @param obj The button object
139  * @param t   Interval in seconds
140  *
141  * @see elm_button_autorepeat_initial_timeout_set()
142  */
143 EAPI void                         elm_button_autorepeat_gap_timeout_set(Evas_Object *obj, double t);
144
145 /**
146  * Get the interval between each generated autorepeat event
147  *
148  * @param obj The button object
149  * @return Interval in seconds
150  */
151 EAPI double                       elm_button_autorepeat_gap_timeout_get(const Evas_Object *obj);
152
153 /**
154  * @}
155  */