1 #include <Elementary.h>
4 typedef struct _Widget_Data Widget_Data;
5 typedef struct _Subinfo Subinfo;
6 typedef struct _Part_Cursor Part_Cursor;
13 Eina_List *parts_cursors;
14 Eina_Bool needs_size_calc:1;
15 const char *clas, *group, *style;
33 const Evas_Object *reference;
37 unsigned short col, row, colspan, rowspan;
51 Eina_Bool engine_only:1;
54 static const char *widtype = NULL;
55 static void _del_hook(Evas_Object *obj);
56 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
57 static void _theme_hook(Evas_Object *obj);
58 static void _sizing_eval(Widget_Data *wd);
59 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
60 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
61 static void _part_cursor_free(Part_Cursor *pc);
63 static const char SIG_THEME_CHANGED[] = "theme,changed";
65 static const Evas_Smart_Cb_Description _signals[] = {
66 {SIG_THEME_CHANGED, ""},
71 _del_hook(Evas_Object *obj)
73 Widget_Data *wd = elm_widget_data_get(obj);
78 EINA_LIST_FREE(wd->subs, si)
80 eina_stringshare_del(si->part);
82 eina_stringshare_del(si->p.text.text);
85 EINA_LIST_FREE(wd->parts_cursors, pc) _part_cursor_free(pc);
90 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
92 Widget_Data *wd = elm_widget_data_get(obj);
94 edje_object_mirrored_set(wd->lay, rtl);
98 _theme_hook(Evas_Object *obj)
100 Widget_Data *wd = elm_widget_data_get(obj);
102 _elm_widget_mirrored_reload(obj);
103 _mirrored_set(obj, elm_widget_mirrored_get(obj));
104 _elm_theme_object_set(obj, wd->lay, wd->clas, wd->group, wd->style);
105 edje_object_scale_set(wd->lay, elm_widget_scale_get(obj) *
107 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
112 _changed_hook(Evas_Object *obj)
114 Widget_Data *wd = elm_widget_data_get(obj);
116 if (wd->needs_size_calc)
119 wd->needs_size_calc = 0;
124 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
126 Widget_Data *wd = elm_widget_data_get(obj);
127 edje_object_signal_emit(wd->lay, emission, source);
131 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
133 Widget_Data *wd = elm_widget_data_get(obj);
134 edje_object_signal_callback_add(wd->lay, emission, source, func_cb, data);
138 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
140 Widget_Data *wd = elm_widget_data_get(obj);
141 edje_object_signal_callback_del_full(wd->lay, emission, source, func_cb,
147 _elm_layout_list_data_get(const Eina_List *list)
149 Subinfo *si = eina_list_data_get(list);
154 _elm_layout_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
156 Widget_Data *wd = elm_widget_data_get(obj);
157 const Eina_List *items;
158 void *(*list_data_get) (const Eina_List *list);
160 if ((!wd) || (!wd->subs))
163 /* Focus chain (This block is diferent of elm_win cycle)*/
164 if ((items = elm_widget_focus_custom_chain_get(obj)))
165 list_data_get = eina_list_data_get;
169 list_data_get = _elm_layout_list_data_get;
171 if (!items) return EINA_FALSE;
174 return elm_widget_focus_list_next_get(obj, items, list_data_get, dir,
179 _sizing_eval(Widget_Data *wd)
181 Evas_Coord minw = -1, minh = -1;
182 edje_object_size_min_calc(wd->lay, &minw, &minh);
183 evas_object_size_hint_min_set(wd->obj, minw, minh);
184 evas_object_size_hint_max_set(wd->obj, -1, -1);
188 _request_sizing_eval(Widget_Data *wd)
190 if (wd->needs_size_calc) return;
191 wd->needs_size_calc = 1;
192 evas_object_smart_changed(wd->obj);
196 _part_cursor_free(Part_Cursor *pc)
198 eina_stringshare_del(pc->part);
199 eina_stringshare_del(pc->style);
200 eina_stringshare_del(pc->cursor);
205 _part_cursor_part_apply(const Part_Cursor *pc)
207 elm_object_cursor_set(pc->obj, pc->cursor);
208 elm_object_cursor_style_set(pc->obj, pc->style);
209 elm_object_cursor_theme_search_enabled_set(pc->obj, pc->engine_only);
213 _parts_cursors_find(Widget_Data *wd, const char *part)
217 EINA_LIST_FOREACH(wd->parts_cursors, l, pc)
219 if (!strcmp(pc->part, part))
226 _parts_cursors_apply(Widget_Data *wd)
228 const char *file, *group;
232 edje_object_file_get(wd->lay, &file, &group);
234 EINA_LIST_FOREACH(wd->parts_cursors, l, pc)
236 Evas_Object *obj = (Evas_Object *)edje_object_part_object_get
242 WRN("no part '%s' in group '%s' of file '%s'. "
243 "Cannot set cursor '%s'",
244 pc->part, group, file, pc->cursor);
247 else if (evas_object_pass_events_get(obj))
250 WRN("part '%s' in group '%s' of file '%s' has mouse_events: 0. "
251 "Cannot set cursor '%s'",
252 pc->part, group, file, pc->cursor);
257 _part_cursor_part_apply(pc);
262 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
264 _request_sizing_eval(data);
268 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
270 Widget_Data *wd = elm_widget_data_get(obj);
271 Evas_Object *sub = event_info;
275 EINA_LIST_FOREACH(wd->subs, l, si)
279 evas_object_event_callback_del_full(sub,
280 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
283 wd->subs = eina_list_remove_list(wd->subs, l);
284 eina_stringshare_del(si->part);
292 _signal_size_eval(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
294 _request_sizing_eval(data);
298 _parts_text_fix(Widget_Data *wd)
303 EINA_LIST_FOREACH(wd->subs, l, si)
305 if (si->type == TEXT)
306 edje_object_part_text_set(wd->lay, si->part, si->p.text.text);
311 _elm_layout_label_set(Evas_Object *obj, const char *part, const char *text)
313 Widget_Data *wd = elm_widget_data_get(obj);
316 ELM_CHECK_WIDTYPE(obj, widtype);
317 if (!part) part = "elm.text";
319 EINA_LIST_FOREACH(wd->subs, l, si)
321 if ((si->type == TEXT) && (!strcmp(part, si->part)))
325 eina_stringshare_del(si->part);
326 eina_stringshare_del(si->p.text.text);
328 edje_object_part_text_set(wd->lay, part, NULL);
329 wd->subs = eina_list_remove_list(wd->subs, l);
340 si = ELM_NEW(Subinfo);
343 si->part = eina_stringshare_add(part);
344 wd->subs = eina_list_append(wd->subs, si);
347 eina_stringshare_replace(&si->p.text.text, text);
348 edje_object_part_text_set(wd->lay, part, text);
349 _request_sizing_eval(wd);
353 _elm_layout_label_get(const Evas_Object *obj, const char *part)
355 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
356 Widget_Data *wd = elm_widget_data_get(obj);
357 if (!part) part = "elm.text";
358 return edje_object_part_text_get(wd->lay, part);
362 _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
364 ELM_CHECK_WIDTYPE(obj, widtype);
365 Widget_Data *wd = elm_widget_data_get(obj);
369 EINA_LIST_FOREACH(wd->subs, l, si)
371 if ((si->type == SWALLOW) && (!strcmp(part, si->part)))
373 if (content == si->obj) return;
374 evas_object_del(si->obj);
380 elm_widget_sub_object_add(obj, content);
381 evas_object_event_callback_add(content,
382 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
383 _changed_size_hints, wd);
384 if (!edje_object_part_swallow(wd->lay, part, content))
385 WRN("could not swallow %p into part '%s'", content, part);
386 si = ELM_NEW(Subinfo);
388 si->part = eina_stringshare_add(part);
390 wd->subs = eina_list_append(wd->subs, si);
392 _request_sizing_eval(wd);
396 _content_get_hook(const Evas_Object *obj, const char *part)
398 Widget_Data *wd = elm_widget_data_get(obj);
401 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
403 EINA_LIST_FOREACH(wd->subs, l, si)
405 if ((si->type == SWALLOW) && !strcmp(part, si->part))
412 _content_unset_hook(Evas_Object *obj, const char *part)
414 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
415 Widget_Data *wd = elm_widget_data_get(obj);
418 if (!wd) return NULL;
419 EINA_LIST_FOREACH(wd->subs, l, si)
421 if ((si->type == SWALLOW) && (!strcmp(part, si->part)))
423 Evas_Object *content;
424 if (!si->obj) return NULL;
425 content = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */
426 elm_widget_sub_object_del(obj, content);
427 evas_object_event_callback_del_full(content,
428 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
429 _changed_size_hints, wd);
430 edje_object_part_unswallow(wd->lay, content);
438 elm_layout_add(Evas_Object *parent)
444 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
446 ELM_SET_WIDTYPE(widtype, "layout");
447 elm_widget_type_set(obj, "layout");
448 elm_widget_sub_object_add(parent, obj);
449 elm_widget_data_set(obj, wd);
450 elm_widget_del_hook_set(obj, _del_hook);
451 elm_widget_theme_hook_set(obj, _theme_hook);
452 elm_widget_changed_hook_set(obj, _changed_hook);
453 elm_widget_can_focus_set(obj, EINA_FALSE);
454 elm_widget_focus_next_hook_set(obj, _elm_layout_focus_next_hook);
455 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
456 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
457 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
458 elm_widget_text_set_hook_set(obj, _elm_layout_label_set);
459 elm_widget_text_get_hook_set(obj, _elm_layout_label_get);
460 elm_widget_content_set_hook_set(obj, _content_set_hook);
461 elm_widget_content_get_hook_set(obj, _content_get_hook);
462 elm_widget_content_unset_hook_set(obj, _content_unset_hook);
465 wd->lay = edje_object_add(e);
466 elm_widget_resize_object_set(obj, wd->lay);
467 edje_object_signal_callback_add(wd->lay, "size,eval", "elm",
468 _signal_size_eval, wd);
470 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
471 evas_object_smart_callbacks_descriptions_set(obj, _signals);
473 _mirrored_set(obj, elm_widget_mirrored_get(obj));
474 _request_sizing_eval(wd);
479 elm_layout_file_set(Evas_Object *obj, const char *file, const char *group)
481 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
482 Widget_Data *wd = elm_widget_data_get(obj);
483 if (!wd) return EINA_FALSE;
484 Eina_Bool ret = edje_object_file_set(wd->lay, file, group);
488 _request_sizing_eval(wd);
489 _parts_cursors_apply(wd);
491 else DBG("failed to set edje file '%s', group '%s': %s",
493 edje_load_error_str(edje_object_load_error_get(wd->lay)));
498 elm_layout_theme_set(Evas_Object *obj, const char *clas, const char *group, const char *style)
500 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
501 Widget_Data *wd = elm_widget_data_get(obj);
502 if (!wd) return EINA_FALSE;
503 Eina_Bool ret = _elm_theme_object_set(obj, wd->lay, clas, group, style);
510 _request_sizing_eval(wd);
511 _parts_cursors_apply(wd);
517 elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content)
519 _content_set_hook(obj, swallow, content);
524 elm_layout_content_get(const Evas_Object *obj, const char *swallow)
526 return _content_get_hook(obj, swallow);
530 elm_layout_content_unset(Evas_Object *obj, const char *swallow)
532 return _content_unset_hook(obj, swallow);
536 elm_layout_text_set(Evas_Object *obj, const char *part, const char *text)
538 _elm_layout_label_set(obj, part, text);
542 elm_layout_text_get(const Evas_Object *obj, const char *part)
544 return _elm_layout_label_get(obj, part);
548 elm_layout_box_append(Evas_Object *obj, const char *part, Evas_Object *child)
550 ELM_CHECK_WIDTYPE(obj, widtype);
551 Widget_Data *wd = elm_widget_data_get(obj);
555 if (!edje_object_part_box_append(wd->lay, part, child))
556 WRN("child %p could not be appended to box part '%s'", child, part);
557 elm_widget_sub_object_add(obj, child);
558 evas_object_event_callback_add
559 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
561 si = ELM_NEW(Subinfo);
562 si->type = BOX_APPEND;
563 si->part = eina_stringshare_add(part);
565 wd->subs = eina_list_append(wd->subs, si);
566 _request_sizing_eval(wd);
570 elm_layout_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child)
572 ELM_CHECK_WIDTYPE(obj, widtype);
573 Widget_Data *wd = elm_widget_data_get(obj);
577 if (!edje_object_part_box_prepend(wd->lay, part, child))
578 WRN("child %p could not be prepended to box part '%s'", child, part);
579 elm_widget_sub_object_add(obj, child);
580 evas_object_event_callback_add
581 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
583 si = ELM_NEW(Subinfo);
584 si->type = BOX_PREPEND;
585 si->part = eina_stringshare_add(part);
587 wd->subs = eina_list_prepend(wd->subs, si);
588 _request_sizing_eval(wd);
592 _box_reference_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
595 si->p.box.reference = NULL;
599 elm_layout_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference)
601 ELM_CHECK_WIDTYPE(obj, widtype);
602 Widget_Data *wd = elm_widget_data_get(obj);
606 if (!edje_object_part_box_insert_before(wd->lay, part, child, reference))
607 WRN("child %p could not be inserted before %p inf box part '%s'",
608 child, reference, part);
610 si = ELM_NEW(Subinfo);
611 si->type = BOX_INSERT_BEFORE;
612 si->part = eina_stringshare_add(part);
614 si->p.box.reference = reference;
616 elm_widget_sub_object_add(obj, child);
617 evas_object_event_callback_add
618 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
619 evas_object_event_callback_add
620 ((Evas_Object *)reference, EVAS_CALLBACK_DEL, _box_reference_del, si);
622 wd->subs = eina_list_append(wd->subs, si);
623 _request_sizing_eval(wd);
627 elm_layout_box_insert_at(Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos)
629 ELM_CHECK_WIDTYPE(obj, widtype);
630 Widget_Data *wd = elm_widget_data_get(obj);
634 if (!edje_object_part_box_insert_at(wd->lay, part, child, pos))
635 WRN("child %p could not be inserted at %u to box part '%s'",
638 elm_widget_sub_object_add(obj, child);
639 evas_object_event_callback_add
640 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
642 si = ELM_NEW(Subinfo);
643 si->type = BOX_INSERT_AT;
644 si->part = eina_stringshare_add(part);
647 wd->subs = eina_list_append(wd->subs, si);
648 _request_sizing_eval(wd);
652 _sub_box_remove(Widget_Data *wd, Subinfo *si)
656 if (si->type == BOX_INSERT_BEFORE)
657 evas_object_event_callback_del_full
658 ((Evas_Object *)si->p.box.reference,
659 EVAS_CALLBACK_DEL, _box_reference_del, si);
661 child = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */
662 edje_object_part_box_remove(wd->lay, si->part, child);
663 elm_widget_sub_object_del(wd->obj, child);
668 _sub_table_remove(Widget_Data *wd, Subinfo *si)
672 child = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */
673 edje_object_part_table_unpack(wd->lay, si->part, child);
674 elm_widget_sub_object_del(wd->obj, child);
679 _sub_box_is(const Subinfo *si)
685 case BOX_INSERT_BEFORE:
694 elm_layout_box_remove(Evas_Object *obj, const char *part, Evas_Object *child)
696 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
697 Widget_Data *wd = elm_widget_data_get(obj);
701 if (!wd) return NULL;
703 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
704 EINA_SAFETY_ON_NULL_RETURN_VAL(child, NULL);
705 EINA_LIST_FOREACH(wd->subs, l, si)
707 if (!_sub_box_is(si)) continue;
708 if ((si->obj == child) && (!strcmp(si->part, part)))
709 return _sub_box_remove(wd, si);
715 elm_layout_box_remove_all(Evas_Object *obj, const char *part, Eina_Bool clear)
717 ELM_CHECK_WIDTYPE(obj, widtype);
718 Widget_Data *wd = elm_widget_data_get(obj);
723 EINA_SAFETY_ON_NULL_RETURN(part);
725 lst = eina_list_clone(wd->subs);
726 EINA_LIST_FREE(lst, si)
728 if (!_sub_box_is(si)) continue;
729 if (!strcmp(si->part, part))
731 Evas_Object *child = _sub_box_remove(wd, si);
732 if ((clear) && (child)) evas_object_del(child);
735 /* eventually something may not be added with layout, del them as well */
736 edje_object_part_box_remove_all(wd->lay, part, clear);
740 elm_layout_table_pack(Evas_Object *obj, const char *part, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
742 ELM_CHECK_WIDTYPE(obj, widtype);
743 Widget_Data *wd = elm_widget_data_get(obj);
747 if (!edje_object_part_table_pack
748 (wd->lay, part, child, col, row, colspan, rowspan))
749 WRN("child %p could not be packed into box part '%s' col=%uh, row=%hu, "
750 "colspan=%hu, rowspan=%hu", child, part, col, row, colspan, rowspan);
752 elm_widget_sub_object_add(obj, child);
753 evas_object_event_callback_add
754 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
756 si = ELM_NEW(Subinfo);
757 si->type = TABLE_PACK;
758 si->part = eina_stringshare_add(part);
760 si->p.table.col = col;
761 si->p.table.row = row;
762 si->p.table.colspan = colspan;
763 si->p.table.rowspan = rowspan;
764 wd->subs = eina_list_append(wd->subs, si);
765 _request_sizing_eval(wd);
769 elm_layout_table_unpack(Evas_Object *obj, const char *part, Evas_Object *child)
771 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
772 Widget_Data *wd = elm_widget_data_get(obj);
776 if (!wd) return NULL;
778 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
779 EINA_SAFETY_ON_NULL_RETURN_VAL(child, NULL);
780 EINA_LIST_FOREACH(wd->subs, l, si)
782 if (si->type != TABLE_PACK) continue;
783 if ((si->obj == child) && (!strcmp(si->part, part)))
784 return _sub_table_remove(wd, si);
790 elm_layout_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear)
792 ELM_CHECK_WIDTYPE(obj, widtype);
793 Widget_Data *wd = elm_widget_data_get(obj);
798 EINA_SAFETY_ON_NULL_RETURN(part);
800 lst = eina_list_clone(wd->subs);
801 EINA_LIST_FREE(lst, si)
803 if (si->type != TABLE_PACK) continue;
804 if (!strcmp(si->part, part))
806 Evas_Object *child = _sub_table_remove(wd, si);
807 if ((clear) && (child)) evas_object_del(child);
810 /* eventually something may not be added with layout, del them as well */
811 edje_object_part_table_clear(wd->lay, part, clear);
815 elm_layout_edje_get(const Evas_Object *obj)
817 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
818 Widget_Data *wd = elm_widget_data_get(obj);
819 if (!wd) return NULL;
824 elm_layout_data_get(const Evas_Object *obj, const char *key)
826 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
827 Widget_Data *wd = elm_widget_data_get(obj);
828 return edje_object_data_get(wd->lay, key);
832 elm_layout_sizing_eval(Evas_Object *obj)
834 ELM_CHECK_WIDTYPE(obj, widtype);
835 Widget_Data *wd = elm_widget_data_get(obj);
836 EINA_SAFETY_ON_NULL_RETURN(wd);
837 _request_sizing_eval(wd);
841 elm_layout_part_cursor_set(Evas_Object *obj, const char *part_name, const char *cursor)
843 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
844 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
845 Widget_Data *wd = elm_widget_data_get(obj);
846 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE);
847 Evas_Object *part_obj;
850 part_obj = (Evas_Object *)edje_object_part_object_get(wd->lay, part_name);
853 const char *group, *file;
854 edje_object_file_get(wd->lay, &file, &group);
855 WRN("no part '%s' in group '%s' of file '%s'. Cannot set cursor '%s'",
856 part_name, group, file, cursor);
859 if (evas_object_pass_events_get(part_obj))
861 const char *group, *file;
862 edje_object_file_get(wd->lay, &file, &group);
863 WRN("part '%s' in group '%s' of file '%s' has mouse_events: 0. "
864 "Cannot set cursor '%s'",
865 part_name, group, file, cursor);
869 pc = _parts_cursors_find(wd, part_name);
870 if (pc) eina_stringshare_replace(&pc->cursor, cursor);
873 pc = calloc(1, sizeof(*pc));
874 pc->part = eina_stringshare_add(part_name);
875 pc->cursor = eina_stringshare_add(cursor);
876 pc->style = eina_stringshare_add("default");
877 wd->parts_cursors = eina_list_append(wd->parts_cursors, pc);
881 elm_object_sub_cursor_set(part_obj, obj, pc->cursor);
886 elm_layout_part_cursor_get(const Evas_Object *obj, const char *part_name)
888 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
889 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL);
890 Widget_Data *wd = elm_widget_data_get(obj);
891 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
892 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
893 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, NULL);
894 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, NULL);
895 return elm_object_cursor_get(pc->obj);
899 elm_layout_part_cursor_unset(Evas_Object *obj, const char *part_name)
901 ELM_CHECK_WIDTYPE(obj, widtype);
902 EINA_SAFETY_ON_NULL_RETURN(part_name);
903 Widget_Data *wd = elm_widget_data_get(obj);
904 EINA_SAFETY_ON_NULL_RETURN(wd);
908 EINA_LIST_FOREACH(wd->parts_cursors, l, pc)
910 if (!strcmp(part_name, pc->part))
912 if (pc->obj) elm_object_cursor_unset(pc->obj);
913 _part_cursor_free(pc);
914 wd->parts_cursors = eina_list_remove_list(wd->parts_cursors, l);
921 elm_layout_part_cursor_style_set(Evas_Object *obj, const char *part_name, const char *style)
923 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
924 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
925 Widget_Data *wd = elm_widget_data_get(obj);
926 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE);
927 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
928 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
929 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE);
931 eina_stringshare_replace(&pc->style, style);
932 elm_object_cursor_style_set(pc->obj, pc->style);
937 elm_layout_part_cursor_style_get(const Evas_Object *obj, const char *part_name)
939 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
940 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL);
941 Widget_Data *wd = elm_widget_data_get(obj);
942 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
943 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
944 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, NULL);
945 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, NULL);
946 return elm_object_cursor_style_get(pc->obj);
950 elm_layout_part_cursor_engine_only_set(Evas_Object *obj, const char *part_name, Eina_Bool engine_only)
952 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
953 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
954 Widget_Data *wd = elm_widget_data_get(obj);
955 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE);
956 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
957 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
958 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE);
960 pc->engine_only = !!engine_only;
961 elm_object_cursor_theme_search_enabled_set(pc->obj, pc->engine_only);
966 elm_layout_part_cursor_engine_only_get(const Evas_Object *obj, const char *part_name)
968 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
969 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
970 Widget_Data *wd = elm_widget_data_get(obj);
971 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE);
972 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
973 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
974 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE);
975 return elm_object_cursor_theme_search_enabled_get(pc->obj);