2 * @defgroup Button Button
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
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.
14 * This widgets emits the following signals:
15 * @li "clicked": the user clicked the button (press/release).
16 * @li "repeated": the user pressed the button without releasing it.
17 * @li "pressed": button was pressed.
18 * @li "unpressed": button was released after being pressed.
19 * In all three cases, the @c event parameter of the callback will be
22 * Also, defined in the default theme, the button has the following styles
24 * @li default: a normal button.
25 * @li anchor: Like default, but the button fades away when the mouse is not
26 * over it, leaving only the text or icon.
27 * @li hoversel_vertical: Internally used by @ref Hoversel to give a
28 * continuous look across its options.
29 * @li hoversel_vertical_entry: Another internal for @ref Hoversel.
31 * Default contents parts of the button widget that you can use for are:
32 * @li "icon" - An icon of the button
34 * Default text parts of the button widget that you can use for are:
35 * @li "default" - Label of the button
37 * Follow through a complete example @ref button_example_01 "here".
42 * Add a new button to the parent's canvas
44 * @param parent The parent object
45 * @return The new object or NULL if it cannot be created
48 elm_button_add(Evas_Object *parent)
52 * Set the label used in the button
54 * The passed @p label can be NULL to clean any existing text in it and
55 * leave the button as an icon only object.
57 * @param obj The button object
58 * @param label The text will be written on the button
59 * @deprecated use elm_object_text_set() instead.
61 EINA_DEPRECATED EAPI void elm_button_label_set(Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
64 * Get the label set for the button
66 * The string returned is an internal pointer and should not be freed or
67 * altered. It will also become invalid when the button is destroyed.
68 * The string returned, if not NULL, is a stringshare, so if you need to
69 * keep it around even after the button is destroyed, you can use
70 * eina_stringshare_ref().
72 * @param obj The button object
73 * @return The text set to the label, or NULL if nothing is set
74 * @deprecated use elm_object_text_set() instead.
76 EINA_DEPRECATED EAPI const char *elm_button_label_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
79 * Set the icon used for the button
81 * Setting a new icon will delete any other that was previously set, making
82 * any reference to them invalid. If you need to maintain the previous
83 * object alive, unset it first with elm_button_icon_unset().
85 * @param obj The button object
86 * @param icon The icon object for the button
87 * @deprecated use elm_object_part_content_set() instead.
89 EINA_DEPRECATED EAPI void elm_button_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
92 * Get the icon used for the button
94 * Return the icon object which is set for this widget. If the button is
95 * destroyed or another icon is set, the returned object will be deleted
96 * and any reference to it will be invalid.
98 * @param obj The button object
99 * @return The icon object that is being used
101 * @deprecated use elm_object_part_content_get() instead
103 EINA_DEPRECATED EAPI Evas_Object *elm_button_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
106 * Remove the icon set without deleting it and return the object
108 * This function drops the reference the button holds of the icon object
109 * and returns this last object. It is used in case you want to remove any
110 * icon, or set another one, without deleting the actual object. The button
111 * will be left without an icon set.
113 * @param obj The button object
114 * @return The icon object that was being used
115 * @deprecated use elm_object_part_content_unset() instead.
117 EINA_DEPRECATED EAPI Evas_Object *elm_button_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
120 * Turn on/off the autorepeat event generated when the button is kept pressed
122 * When off, no autorepeat is performed and buttons emit a normal @c clicked
123 * signal when they are clicked.
125 * When on, keeping a button pressed will continuously emit a @c repeated
126 * signal until the button is released. The time it takes until it starts
127 * emitting the signal is given by
128 * elm_button_autorepeat_initial_timeout_set(), and the time between each
129 * new emission by elm_button_autorepeat_gap_timeout_set().
131 * @param obj The button object
132 * @param on A bool to turn on/off the event
134 EAPI void elm_button_autorepeat_set(Evas_Object *obj, Eina_Bool on) EINA_ARG_NONNULL(1);
137 * Get whether the autorepeat feature is enabled
139 * @param obj The button object
140 * @return EINA_TRUE if autorepeat is on, EINA_FALSE otherwise
142 * @see elm_button_autorepeat_set()
144 EAPI Eina_Bool elm_button_autorepeat_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
147 * Set the initial timeout before the autorepeat event is generated
149 * Sets the timeout, in seconds, since the button is pressed until the
150 * first @c repeated signal is emitted. If @p t is 0.0 or less, there
151 * won't be any delay and the even will be fired the moment the button is
154 * @param obj The button object
155 * @param t Timeout in seconds
157 * @see elm_button_autorepeat_set()
158 * @see elm_button_autorepeat_gap_timeout_set()
160 EAPI void elm_button_autorepeat_initial_timeout_set(Evas_Object *obj, double t) EINA_ARG_NONNULL(1);
163 * Get the initial timeout before the autorepeat event is generated
165 * @param obj The button object
166 * @return Timeout in seconds
168 * @see elm_button_autorepeat_initial_timeout_set()
170 EAPI double elm_button_autorepeat_initial_timeout_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
173 * Set the interval between each generated autorepeat event
175 * After the first @c repeated event is fired, all subsequent ones will
176 * follow after a delay of @p t seconds for each.
178 * @param obj The button object
179 * @param t Interval in seconds
181 * @see elm_button_autorepeat_initial_timeout_set()
183 EAPI void elm_button_autorepeat_gap_timeout_set(Evas_Object *obj, double t) EINA_ARG_NONNULL(1);
186 * Get the interval between each generated autorepeat event
188 * @param obj The button object
189 * @return Interval in seconds
191 EAPI double elm_button_autorepeat_gap_timeout_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);