2 * @defgroup SegmentControl SegmentControl
5 * @image html img/widget/segment_control/preview-00.png
6 * @image latex img/widget/segment_control/preview-00.eps width=\textwidth
8 * @image html img/segment_control.png
9 * @image latex img/segment_control.eps width=\textwidth
11 * Segment control widget is a horizontal control made of multiple segment
12 * items, each segment item functioning similar to discrete two state button.
13 * A segment control groups the items together and provides compact
14 * single button with multiple equal size segments.
16 * Segment item size is determined by base widget
17 * size and the number of items added.
18 * Only one segment item can be at selected state. A segment item can display
19 * combination of Text and any Evas_Object like Images or other widget.
21 * Smart callbacks one can listen to:
22 * - "changed" - When the user clicks on a segment item which is not
23 * previously selected and get selected. The event_info parameter is the
24 * segment item pointer.
26 * Available styles for it:
30 * Default contents parts of the segment control items that you can use for are:
32 * Default content parts of the segment control items that you can use for are:
33 >>>>>>> remotes/origin/upstream
34 * @li "icon" - An icon in a segment control item
36 * Default text parts of the segment control items that you can use for are:
37 * @li "default" - Title label in a segment control item
39 * Supported elm_object common APIs.
40 * @li elm_object_disabled_set
41 * @li elm_object_disabled_get
43 * Supported elm_object_item common APIs.
44 * @li elm_object_item_part_text_set
45 * @li elm_object_item_part_text_get
46 * @li elm_object_item_part_content_set
47 * @li elm_object_item_part_content_get
49 * Here is an example on its usage:
50 * @li @ref segment_control_example
55 * @addtogroup SegmentControl
60 * Add a new segment control widget to the given parent Elementary
63 * @param parent The parent object.
64 * @return a new segment control widget handle or @c NULL, on errors.
66 * This function inserts a new segment control widget on the canvas.
68 * @ingroup SegmentControl
70 EAPI Evas_Object *elm_segment_control_add(Evas_Object *parent);
73 * Append a new item to the segment control object.
75 * @param obj The segment control object.
76 * @param icon The icon object to use for the left side of the item. An
77 * icon can be any Evas object, but usually it is an icon created
78 * with elm_icon_add().
79 * @param label The label of the item.
80 * Note that, NULL is different from empty string "".
81 * @return The created item or @c NULL upon failure.
83 * A new item will be created and appended to the segment control, i.e., will
84 * be set as @b last item.
86 * If it should be inserted at another position,
87 * elm_segment_control_item_insert_at() should be used instead.
89 * Items created with this function can be deleted with function
90 * elm_object_item_del() or elm_segment_control_item_del_at().
92 * @note @p label set to @c NULL is different from empty string "".
94 * only has icon, it will be displayed bigger and centered. If it has
95 * icon and label, even that an empty string, icon will be smaller and
100 * sc = elm_segment_control_add(win);
101 * ic = elm_icon_add(win);
102 * elm_icon_file_set(ic, "path/to/image", NULL);
104 * elm_icon_scale_set(ic, EINA_TRUE, EINA_TRUE);
106 * elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
107 >>>>>>> remotes/origin/upstream
108 * elm_segment_control_item_add(sc, ic, "label");
109 * evas_object_show(sc);
112 * @see elm_segment_control_item_insert_at()
113 * @see elm_object_item_del()
115 * @ingroup SegmentControl
117 EAPI Elm_Object_Item *elm_segment_control_item_add(Evas_Object *obj, Evas_Object *icon, const char *label);
120 * Insert a new item to the segment control object at specified position.
122 * @param obj The segment control object.
123 * @param icon The icon object to use for the left side of the item. An
124 * icon can be any Evas object, but usually it is an icon created
125 * with elm_icon_add().
126 * @param label The label of the item.
127 * @param index Item position. Value should be between 0 and items count.
128 * @return The created item or @c NULL upon failure.
130 * Index values must be between @c 0, when item will be prepended to
131 * segment control, and items count, that can be get with
132 * elm_segment_control_item_count_get(), case when item will be appended
133 * to segment control, just like elm_segment_control_item_add().
135 * Items created with this function can be deleted with function
136 * elm_object_item_del() or elm_segment_control_item_del_at().
138 * @note @p label set to @c NULL is different from empty string "".
140 * only has icon, it will be displayed bigger and centered. If it has
141 * icon and label, even that an empty string, icon will be smaller and
142 * positioned at left.
144 * @see elm_segment_control_item_add()
145 * @see elm_segment_control_item_count_get()
146 * @see elm_object_item_del()
148 * @ingroup SegmentControl
150 EAPI Elm_Object_Item *elm_segment_control_item_insert_at(Evas_Object *obj, Evas_Object *icon, const char *label, int index);
153 * Remove a segment control item at given index from its parent,
156 * @param obj The segment control object.
157 * @param index The position of the segment control item to be deleted.
159 * Items can be added with elm_segment_control_item_add() or
160 * elm_segment_control_item_insert_at().
162 * @ingroup SegmentControl
164 EAPI void elm_segment_control_item_del_at(Evas_Object *obj, int index);
167 * Get the Segment items count from segment control.
169 * @param obj The segment control object.
170 * @return Segment items count.
172 * It will just return the number of items added to segment control @p obj.
174 * @ingroup SegmentControl
176 EAPI int elm_segment_control_item_count_get(const Evas_Object *obj);
179 * Get the item placed at specified index.
181 * @param obj The segment control object.
182 * @param index The index of the segment item.
183 * @return The segment control item or @c NULL on failure.
185 * Index is the position of an item in segment control widget. Its
186 * range is from @c 0 to <tt> count - 1 </tt>.
187 * Count is the number of items, that can be get with
188 * elm_segment_control_item_count_get().
190 * @ingroup SegmentControl
192 EAPI Elm_Object_Item *elm_segment_control_item_get(const Evas_Object *obj, int index);
195 * Get the label of item.
197 * @param obj The segment control object.
198 * @param index The index of the segment item.
199 * @return The label of the item at @p index.
201 * The return value is a pointer to the label associated to the item when
202 * it was created, with function elm_segment_control_item_add(), or later
203 * with function elm_segment_control_item_label_set. If no label
204 * was passed as argument, it will return @c NULL.
206 * @see elm_segment_control_item_label_set() for more details.
207 * @see elm_segment_control_item_add()
209 * @ingroup SegmentControl
211 EAPI const char *elm_segment_control_item_label_get(const Evas_Object *obj, int index);
214 * Get the icon associated to the item.
216 * @param obj The segment control object.
217 * @param index The index of the segment item.
218 * @return The left side icon associated to the item at @p index.
220 * The return value is a pointer to the icon associated to the item when
221 * it was created, with function elm_segment_control_item_add(), or later
222 * with function elm_segment_control_item_icon_set(). If no icon
223 * was passed as argument, it will return @c NULL.
225 * @see elm_segment_control_item_add()
226 * @see elm_segment_control_item_icon_set()
228 * @ingroup SegmentControl
230 EAPI Evas_Object *elm_segment_control_item_icon_get(const Evas_Object *obj, int index);
233 * Get the index of an item.
235 * @param it The segment control item.
236 * @return The position of item in segment control widget.
238 * Index is the position of an item in segment control widget. Its
239 * range is from @c 0 to <tt> count - 1 </tt>.
240 * Count is the number of items, that can be get with
241 * elm_segment_control_item_count_get().
243 * @ingroup SegmentControl
245 EAPI int elm_segment_control_item_index_get(const Elm_Object_Item *it);
248 * Get the base object of the item.
250 * @param it The segment control item.
251 * @return The base object associated with @p it.
253 * Base object is the @c Evas_Object that represents that item.
255 * @ingroup SegmentControl
257 EAPI Evas_Object *elm_segment_control_item_object_get(const Elm_Object_Item *it);
260 * Get the selected item.
262 * @param obj The segment control object.
263 * @return The selected item or @c NULL if none of segment items is
266 * The selected item can be unselected with function
267 * elm_segment_control_item_selected_set().
269 * The selected item always will be highlighted on segment control.
271 * @ingroup SegmentControl
273 EAPI Elm_Object_Item *elm_segment_control_item_selected_get(const Evas_Object *obj);
276 * Set the selected state of an item.
278 * @param it The segment control item
279 * @param select The selected state
281 * This sets the selected state of the given item @p it.
282 * @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
285 * If a new item is selected the previosly selected will be unselected.
286 * Previoulsy selected item can be get with function
288 * If a new item is selected the previously selected will be unselected.
289 * Selected item can be got with function
290 >>>>>>> remotes/origin/upstream
291 * elm_segment_control_item_selected_get().
293 * The selected item always will be highlighted on segment control.
295 * @see elm_segment_control_item_selected_get()
297 * @ingroup SegmentControl
299 EAPI void elm_segment_control_item_selected_set(Elm_Object_Item *it, Eina_Bool select);