aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/lib/elm_segment_control.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/elementary/src/lib/elm_segment_control.c742
1 files changed, 742 insertions, 0 deletions
diff --git a/libraries/elementary/src/lib/elm_segment_control.c b/libraries/elementary/src/lib/elm_segment_control.c
new file mode 100644
index 0000000..6ff6411
--- /dev/null
+++ b/libraries/elementary/src/lib/elm_segment_control.c
@@ -0,0 +1,742 @@
1#include <Elementary.h>
2#include "elm_priv.h"
3
4typedef struct _Widget_Data Widget_Data;
5typedef struct _Elm_Segment_Item Elm_Segment_Item;
6
7struct _Widget_Data
8{
9 Evas_Object *obj;
10 Evas_Object *base;
11 Eina_List *seg_items;
12 int item_count;
13 Elm_Segment_Item *selected_item;
14 int item_width;
15};
16
17struct _Elm_Segment_Item
18{
19 ELM_WIDGET_ITEM;
20 Evas_Object *icon;
21 const char *label;
22 int seg_index;
23};
24
25static const char *widtype = NULL;
26static void _sizing_eval(Evas_Object *obj);
27static void _del_hook(Evas_Object *obj);
28static void _theme_hook(Evas_Object *obj);
29static void _disable_hook(Evas_Object *obj);
30static void _item_free(Elm_Segment_Item *it);
31static void _segment_off(Elm_Segment_Item *it);
32static void _segment_on(Elm_Segment_Item *it);
33static void _position_items(Widget_Data *wd);
34static void _on_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj
35 __UNUSED__, void *event_info __UNUSED__);
36static void _mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj
37 __UNUSED__, void *event_info __UNUSED__);
38static void _mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj
39 __UNUSED__, void *event_info __UNUSED__);
40static void _swallow_item_objects(Elm_Segment_Item *it);
41static void _update_list(Widget_Data *wd);
42static Elm_Segment_Item * _item_find(const Evas_Object *obj, int index);
43static Elm_Segment_Item* _item_new(Evas_Object *obj, Evas_Object *icon,
44 const char *label);
45
46static const char SIG_CHANGED[] = "changed";
47
48static const Evas_Smart_Cb_Description _signals[] = {
49 {SIG_CHANGED, ""},
50 {NULL, NULL}
51};
52
53static void
54_sizing_eval(Evas_Object *obj)
55{
56 Widget_Data *wd;
57 Evas_Coord minw = -1, minh = -1;
58 Evas_Coord w, h;
59
60 wd = elm_widget_data_get(obj);
61 if (!wd) return;
62
63 elm_coords_finger_size_adjust(wd->item_count, &minw, 1, &minh);
64 edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh);
65 elm_coords_finger_size_adjust(wd->item_count, &minw, 1, &minh);
66
67 evas_object_size_hint_min_get(obj, &w, &h);
68 if (w > minw) minw = w;
69 if (h > minh) minh = h;
70 evas_object_size_hint_min_set(obj, minw, minh);
71}
72
73static void
74_del_hook(Evas_Object *obj)
75{
76 Elm_Segment_Item *it;
77 Widget_Data *wd;
78
79 wd = elm_widget_data_get(obj);
80 if (!wd) return;
81
82 EINA_LIST_FREE(wd->seg_items, it)
83 {
84 _item_free(it);
85 elm_widget_item_free(it);
86 }
87
88 free(wd);
89}
90
91static void
92_theme_hook(Evas_Object *obj)
93{
94 Eina_List *l;
95 Eina_Bool rtl;
96 Elm_Segment_Item *it;
97 Widget_Data *wd;
98
99 wd = elm_widget_data_get(obj);
100 if (!wd) return;
101
102 _elm_widget_mirrored_reload(obj);
103 rtl = elm_widget_mirrored_get(obj);
104 edje_object_mirrored_set(wd->base, rtl);
105
106 _elm_theme_object_set(obj, wd->base, "segment_control", "base",
107 elm_widget_style_get(obj));
108 edje_object_scale_set(wd->base, elm_widget_scale_get(wd->base)
109 *_elm_config->scale);
110
111 EINA_LIST_FOREACH(wd->seg_items, l, it)
112 {
113 _elm_theme_object_set(obj, VIEW(it), "segment_control",
114 "item", elm_widget_style_get(obj));
115 edje_object_scale_set(VIEW(it), elm_widget_scale_get(VIEW(it))
116 *_elm_config->scale);
117 edje_object_mirrored_set(VIEW(it), rtl);
118 }
119
120 _update_list(wd);
121}
122
123static void
124_disable_hook(Evas_Object *obj)
125{
126 Widget_Data *wd;
127
128 wd = elm_widget_data_get(obj);
129 if (!wd) return;
130 _update_list(wd);
131}
132
133// TODO: Elm_widget elm_widget_focus_list_next_get supports only Elm_widget list,
134// Not the Elm_Widget_item. Focus switching with in widget not supported until
135// it is supported in elm_widget
136#if 0
137static void *
138_elm_list_data_get(const Eina_List *list)
139{
140 Elm_Segment_Item *it = eina_list_data_get(list);
141
142 if (it) return NULL;
143
144 edje_object_signal_emit(VIEW(it), "elm,state,segment,selected", "elm");
145 return VIEW(it);
146}
147
148static Eina_Bool
149_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir,
150 Evas_Object **next)
151{
152 static int count=0;
153 Widget_Data *;
154 const Eina_List *items;
155 void *(*list_data_get) (const Eina_List *list);
156
157 wd = elm_widget_data_get(obj);
158 if ((!wd)) return EINA_FALSE;
159
160 /* Focus chain */
161 /* TODO: Change this to use other chain */
162 if ((items = elm_widget_focus_custom_chain_get(obj)))
163 list_data_get = eina_list_data_get;
164 else
165 {
166 items = wd->seg_items;
167 list_data_get = _elm_list_data_get;
168 if (!items) return EINA_FALSE;
169 }
170 return elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
171}
172#endif
173
174static void
175_item_free(Elm_Segment_Item *it)
176{
177 Widget_Data *wd;
178
179 if (!it) return;
180
181 wd = elm_widget_item_data_get(it);
182 if (!wd) return;
183
184 if (wd->selected_item == it) wd->selected_item = NULL;
185 if (wd->seg_items) wd->seg_items = eina_list_remove(wd->seg_items, it);
186
187 if (it->icon) evas_object_del(it->icon);
188 if (it->label) eina_stringshare_del(it->label);
189}
190
191static void
192_segment_off(Elm_Segment_Item *it)
193{
194 Widget_Data *wd;
195
196 if (!it) return;
197
198 wd = elm_widget_item_data_get(it);
199 if (!wd) return;
200
201 edje_object_signal_emit(VIEW(it), "elm,state,segment,normal", "elm");
202
203 if (wd->selected_item == it) wd->selected_item = NULL;
204}
205
206static void
207_segment_on(Elm_Segment_Item *it)
208{
209 Widget_Data *wd;
210
211 if (!it) return;
212
213 wd = elm_widget_item_data_get(it);
214 if (!wd) return;
215 if (it == wd->selected_item) return;
216
217 if (wd->selected_item) _segment_off(wd->selected_item);
218
219 edje_object_signal_emit(VIEW(it), "elm,state,segment,selected", "elm");
220
221 wd->selected_item = it;
222 evas_object_smart_callback_call(wd->obj, SIG_CHANGED, it);
223}
224
225static void
226_position_items(Widget_Data *wd)
227{
228 Eina_List *l;
229 Elm_Segment_Item *it;
230 Eina_Bool rtl;
231 int bx, by, bw, bh, pos;
232
233 wd->item_count = eina_list_count(wd->seg_items);
234 if (wd->item_count <= 0) return;
235
236 evas_object_geometry_get(wd->base, &bx, &by, &bw, &bh);
237 wd->item_width = bw / wd->item_count;
238 rtl = elm_widget_mirrored_get(wd->obj);
239
240 if (rtl)
241 pos = bx + bw - wd->item_width;
242 else
243 pos = bx;
244
245 EINA_LIST_FOREACH(wd->seg_items, l, it)
246 {
247 evas_object_move(VIEW(it), pos, by);
248 evas_object_resize(VIEW(it), wd->item_width, bh);
249 if (rtl)
250 pos -= wd->item_width;
251 else
252 pos += wd->item_width;
253 }
254 _sizing_eval(wd->obj);
255}
256
257static void
258_on_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
259 void *event_info __UNUSED__)
260{
261 Widget_Data *wd;
262
263 wd = elm_widget_data_get(data);
264 if (!wd) return;
265
266 _position_items(wd);
267
268}
269
270static void
271_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
272 void *event_info)
273{
274 Widget_Data *wd;
275 Elm_Segment_Item *it;
276 Evas_Event_Mouse_Up *ev;
277 Evas_Coord x, y, w, h;
278
279 it = data;
280 if (!it) return;
281
282 wd = elm_widget_item_data_get(it);
283 if (!wd) return;
284
285 if (elm_widget_disabled_get(wd->obj)) return;
286
287 if (it == wd->selected_item) return;
288
289 ev = event_info;
290 evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
291
292 if ((ev->canvas.x >= x) && (ev->output.x <= (x + w)) && (ev->canvas.y >= y)
293 && (ev->canvas.y <= (y + h)))
294 _segment_on(it);
295 else
296 edje_object_signal_emit(VIEW(it), "elm,state,segment,normal", "elm");
297}
298
299static void
300_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
301 void *event_info __UNUSED__)
302{
303 Widget_Data *wd;
304 Elm_Segment_Item *it;
305
306 it = data;
307 if (!it) return;
308
309 wd = elm_widget_item_data_get(it);
310 if (!wd) return;
311
312 if (elm_widget_disabled_get(wd->obj)) return;
313
314 if (it == wd->selected_item) return;
315
316 edje_object_signal_emit(VIEW(it), "elm,state,segment,pressed", "elm");
317}
318
319static void
320_swallow_item_objects(Elm_Segment_Item *it)
321{
322 if (!it) return;
323
324 if (it->icon)
325 {
326 edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon);
327 edje_object_signal_emit(VIEW(it), "elm,state,icon,visible", "elm");
328 }
329 else
330 edje_object_signal_emit(VIEW(it), "elm,state,icon,hidden", "elm");
331
332 if (it->label)
333 {
334 edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label);
335 edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm");
336 }
337 else
338 edje_object_signal_emit(VIEW(it), "elm,state,text,hidden", "elm");
339 edje_object_message_signal_process(VIEW(it));
340}
341
342static void
343_update_list(Widget_Data *wd)
344{
345 Eina_List *l;
346 Elm_Segment_Item *it;
347 Eina_Bool rtl;
348 int idx = 0;
349
350 _position_items(wd);
351
352 if (wd->item_count == 1)
353 {
354 it = eina_list_nth(wd->seg_items, 0);
355 it->seg_index = 0;
356
357 //Set the segment type
358 edje_object_signal_emit(VIEW(it),
359 "elm,type,segment,single", "elm");
360
361 //Set the segment state
362 if (wd->selected_item == it)
363 edje_object_signal_emit(VIEW(it),
364 "elm,state,segment,selected", "elm");
365 else
366 edje_object_signal_emit(VIEW(it),
367 "elm,state,segment,normal", "elm");
368
369 if (elm_widget_disabled_get(wd->obj))
370 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
371 else
372 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
373
374 _swallow_item_objects(it);
375 return;
376 }
377
378 rtl = elm_widget_mirrored_get(wd->obj);
379 EINA_LIST_FOREACH(wd->seg_items, l, it)
380 {
381 it->seg_index = idx;
382
383 //Set the segment type
384 if (idx == 0)
385 {
386 if (rtl)
387 edje_object_signal_emit(VIEW(it),
388 "elm,type,segment,right", "elm");
389 else
390 edje_object_signal_emit(VIEW(it),
391 "elm,type,segment,left", "elm");
392 }
393 else if (idx == (wd->item_count - 1))
394 {
395 if (rtl)
396 edje_object_signal_emit(VIEW(it),
397 "elm,type,segment,left", "elm");
398 else
399 edje_object_signal_emit(VIEW(it),
400 "elm,type,segment,right", "elm");
401 }
402 else
403 edje_object_signal_emit(VIEW(it),
404 "elm,type,segment,middle", "elm");
405
406 //Set the segment state
407 if (wd->selected_item == it)
408 edje_object_signal_emit(VIEW(it),
409 "elm,state,segment,selected", "elm");
410 else
411 edje_object_signal_emit(VIEW(it),
412 "elm,state,segment,normal", "elm");
413
414 if (elm_widget_disabled_get(wd->obj))
415 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
416 else
417 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
418
419 _swallow_item_objects(it);
420 idx++;
421 }
422}
423
424static Elm_Segment_Item *
425_item_find(const Evas_Object *obj, int idx)
426{
427 Widget_Data *wd;
428 Elm_Segment_Item *it;
429
430 wd = elm_widget_data_get(obj);
431 if (!wd) return NULL;
432
433 it = eina_list_nth(wd->seg_items, idx);
434 return it;
435}
436
437static void
438_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label)
439{
440 Widget_Data *wd;
441 Elm_Segment_Item *item;
442
443 if (part && strcmp(part, "default")) return;
444
445 item = (Elm_Segment_Item *)it;
446 wd = elm_widget_item_data_get(item);
447 if (!wd) return;
448
449 eina_stringshare_replace(&item->label, label);
450 if (item->label)
451 edje_object_signal_emit(VIEW(item), "elm,state,text,visible", "elm");
452 else
453 edje_object_signal_emit(VIEW(item), "elm,state,text,hidden", "elm");
454 edje_object_message_signal_process(VIEW(item));
455 //label can be NULL also.
456 edje_object_part_text_escaped_set(VIEW(item), "elm.text", item->label);
457}
458
459static const char *
460_item_text_get_hook(const Elm_Object_Item *it, const char *part)
461{
462 if (part && strcmp(part, "default")) return NULL;
463 return ((Elm_Segment_Item *)it)->label;
464}
465
466static void
467_item_content_set_hook(Elm_Object_Item *it,
468 const char *part,
469 Evas_Object *content)
470{
471 Elm_Segment_Item *item;
472 if (part && strcmp(part, "icon")) return;
473
474 item = (Elm_Segment_Item *)it;
475 if (content == item->icon) return;
476
477 //Remove the existing icon
478 if (item->icon) evas_object_del(item->icon);
479 item->icon = content;
480 if (item->icon)
481 {
482 elm_widget_sub_object_add(VIEW(item), item->icon);
483 edje_object_part_swallow(VIEW(item), "elm.swallow.icon", item->icon);
484 edje_object_signal_emit(VIEW(item), "elm,state,icon,visible", "elm");
485 }
486 else
487 edje_object_signal_emit(VIEW(item), "elm,state,icon,hidden", "elm");
488}
489
490static Evas_Object *
491_item_content_get_hook(const Elm_Object_Item *it, const char *part)
492{
493 if (part && strcmp(part, "icon")) return NULL;
494 return ((Elm_Segment_Item *)it)->icon;
495}
496
497static Eina_Bool
498_item_del_pre_hook(Elm_Object_Item *it)
499{
500 Widget_Data *wd;
501 Elm_Segment_Item *item = (Elm_Segment_Item *)it;
502
503 wd = elm_widget_item_data_get(item);
504 if (!wd) return EINA_FALSE;
505
506 _item_free(item);
507 _update_list(wd);
508
509 return EINA_TRUE;
510}
511
512static Elm_Segment_Item*
513_item_new(Evas_Object *obj, Evas_Object *icon, const char *label)
514{
515 Elm_Segment_Item *it;
516 Widget_Data *wd;
517
518 wd = elm_widget_data_get(obj);
519 if (!wd) return NULL;
520
521 it = elm_widget_item_new(obj, Elm_Segment_Item);
522 if (!it) return NULL;
523 elm_widget_item_data_set(it, wd);
524 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
525 elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
526 elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
527 elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
528 elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
529
530 VIEW(it) = edje_object_add(evas_object_evas_get(obj));
531 edje_object_scale_set(VIEW(it), elm_widget_scale_get(VIEW(it))
532 *_elm_config->scale);
533 evas_object_smart_member_add(VIEW(it), obj);
534 elm_widget_sub_object_add(obj, VIEW(it));
535 _elm_theme_object_set(obj, VIEW(it), "segment_control", "item",
536 elm_object_style_get(obj));
537 edje_object_mirrored_set(VIEW(it),
538 elm_widget_mirrored_get(WIDGET(it)));
539
540 if (label)
541 eina_stringshare_replace(&it->label, label);
542 if (it->label)
543 edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm");
544 else
545 edje_object_signal_emit(VIEW(it), "elm,state,text,hidden", "elm");
546 edje_object_message_signal_process(VIEW(it));
547 edje_object_part_text_escaped_set(VIEW(it), "elm.text", label);
548
549 it->icon = icon;
550 if (it->icon) elm_widget_sub_object_add(VIEW(it), it->icon);
551 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
552 _mouse_down, it);
553 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
554 _mouse_up, it);
555 evas_object_show(VIEW(it));
556
557 return it;
558}
559
560EAPI Evas_Object *
561elm_segment_control_add(Evas_Object *parent)
562{
563 Evas_Object *obj;
564 Evas *e;
565 Widget_Data *wd;
566
567 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
568
569 ELM_SET_WIDTYPE(widtype, "segment_control");
570 elm_widget_type_set(obj, "segment_control");
571 elm_widget_sub_object_add(parent, obj);
572 elm_widget_data_set(obj, wd);
573 elm_widget_del_hook_set(obj, _del_hook);
574 elm_widget_theme_hook_set(obj, _theme_hook);
575 elm_widget_disable_hook_set(obj, _disable_hook);
576
577 // TODO: Focus switch support to Elm_widget_Item not supported yet.
578#if 0
579 elm_widget_focus_next_hook_set(obj, _focus_next_hook);
580#endif
581
582 wd->obj = obj;
583
584 wd->base = edje_object_add(e);
585 edje_object_scale_set(wd->base, elm_widget_scale_get(wd->base)
586 *_elm_config->scale);
587 _elm_theme_object_set(obj, wd->base, "segment_control", "base", "default");
588 elm_widget_resize_object_set(obj, wd->base);
589
590 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
591 _on_move_resize, obj);
592 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
593 _on_move_resize, obj);
594
595 evas_object_smart_callbacks_descriptions_set(obj, _signals);
596
597 return obj;
598}
599
600EAPI Elm_Object_Item *
601elm_segment_control_item_add(Evas_Object *obj, Evas_Object *icon,
602 const char *label)
603{
604 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
605 Elm_Segment_Item *it;
606 Widget_Data *wd;
607
608 wd = elm_widget_data_get(obj);
609 if (!wd) return NULL;
610
611 it = _item_new(obj, icon, label);
612 if (!it) return NULL;
613
614 wd->seg_items = eina_list_append(wd->seg_items, it);
615 _update_list(wd);
616
617 return (Elm_Object_Item *)it;
618}
619
620EAPI Elm_Object_Item *
621elm_segment_control_item_insert_at(Evas_Object *obj, Evas_Object *icon,
622 const char *label, int idx)
623{
624 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
625 Elm_Segment_Item *it, *it_rel;
626 Widget_Data *wd;
627
628 wd = elm_widget_data_get(obj);
629 if (!wd) return NULL;
630 if (idx < 0) idx = 0;
631
632 it = _item_new(obj, icon, label);
633 if (!it) return NULL;
634
635 it_rel = _item_find(obj, idx);
636 if (it_rel)
637 wd->seg_items = eina_list_prepend_relative(wd->seg_items, it, it_rel);
638 else
639 wd->seg_items = eina_list_append(wd->seg_items, it);
640
641 _update_list(wd);
642 return (Elm_Object_Item *)it;
643}
644
645EAPI void
646elm_segment_control_item_del_at(Evas_Object *obj, int idx)
647{
648 ELM_CHECK_WIDTYPE(obj, widtype);
649 Elm_Segment_Item *it;
650 Widget_Data *wd;
651
652 wd = elm_widget_data_get(obj);
653 if (!wd) return;
654
655 it = _item_find(obj, idx);
656 if (!it) return;
657 elm_object_item_del((Elm_Object_Item *)it);
658}
659
660EAPI const char*
661elm_segment_control_item_label_get(const Evas_Object *obj, int idx)
662{
663 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
664 Elm_Segment_Item *it = _item_find(obj, idx);
665 if (it) return it->label;
666 return NULL;
667}
668
669EAPI Evas_Object *
670elm_segment_control_item_icon_get(const Evas_Object *obj, int idx)
671{
672 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
673 Elm_Segment_Item *it = _item_find(obj, idx);
674 if (it) return it->icon;
675 return NULL;
676}
677
678EAPI int
679elm_segment_control_item_count_get(const Evas_Object *obj)
680{
681 ELM_CHECK_WIDTYPE(obj, widtype) 0;
682 Widget_Data *wd;
683
684 wd = elm_widget_data_get(obj);
685 if (!wd) return 0;
686
687 return eina_list_count(wd->seg_items);
688}
689
690EAPI Evas_Object*
691elm_segment_control_item_object_get(const Elm_Object_Item *it)
692{
693 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
694 return VIEW(it);
695}
696
697EAPI Elm_Object_Item*
698elm_segment_control_item_selected_get(const Evas_Object *obj)
699{
700 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
701 Widget_Data *wd = elm_widget_data_get(obj);
702 if (!wd) return NULL;
703 return (Elm_Object_Item *) wd->selected_item;
704}
705
706EAPI void
707elm_segment_control_item_selected_set(Elm_Object_Item *it, Eina_Bool selected)
708{
709 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
710 Widget_Data *wd;
711 Elm_Segment_Item *item = (Elm_Segment_Item *)it;
712
713 wd = elm_widget_item_data_get(item);
714 if (!wd) return;
715
716 if (item == wd->selected_item)
717 {
718 //already in selected state.
719 if (selected) return;
720
721 //unselect case
722 _segment_off(item);
723 }
724 else if (selected)
725 _segment_on(item);
726
727 return;
728}
729
730EAPI Elm_Object_Item *
731elm_segment_control_item_get(const Evas_Object *obj, int idx)
732{
733 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
734 return (Elm_Object_Item *) _item_find(obj, idx);
735}
736
737EAPI int
738elm_segment_control_item_index_get(const Elm_Object_Item *it)
739{
740 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, -1);
741 return ((Elm_Segment_Item *)it)->seg_index;
742}