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;
36 const Evas_Object *reference;
41 unsigned short col, row, colspan, rowspan;
56 Eina_Bool engine_only:1;
59 static const char *widtype = NULL;
60 static void _del_hook(Evas_Object *obj);
61 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
62 static void _theme_hook(Evas_Object *obj);
63 static void _sizing_eval(Widget_Data *wd);
64 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
65 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
66 static void _part_cursor_free(Part_Cursor *pc);
68 static const char SIG_THEME_CHANGED[] = "theme,changed";
70 static const Evas_Smart_Cb_Description _signals[] = {
71 {SIG_THEME_CHANGED, ""},
76 _del_hook(Evas_Object *obj)
78 Widget_Data *wd = elm_widget_data_get(obj);
83 EINA_LIST_FREE(wd->subs, si)
85 eina_stringshare_del(si->part);
87 eina_stringshare_del(si->p.text.text);
90 EINA_LIST_FREE(wd->parts_cursors, pc) _part_cursor_free(pc);
95 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
97 Widget_Data *wd = elm_widget_data_get(obj);
99 edje_object_mirrored_set(wd->lay, rtl);
103 _theme_hook(Evas_Object *obj)
105 Widget_Data *wd = elm_widget_data_get(obj);
107 _elm_widget_mirrored_reload(obj);
108 _mirrored_set(obj, elm_widget_mirrored_get(obj));
109 _elm_theme_object_set(obj, wd->lay, wd->clas, wd->group, wd->style);
110 edje_object_scale_set(wd->lay, elm_widget_scale_get(obj) *
112 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
117 _changed_hook(Evas_Object *obj)
119 Widget_Data *wd = elm_widget_data_get(obj);
121 if (wd->needs_size_calc)
124 wd->needs_size_calc = 0;
129 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
131 Widget_Data *wd = elm_widget_data_get(obj);
132 edje_object_signal_emit(wd->lay, emission, source);
136 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
138 Widget_Data *wd = elm_widget_data_get(obj);
139 edje_object_signal_callback_add(wd->lay, emission, source, func_cb, data);
143 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
145 Widget_Data *wd = elm_widget_data_get(obj);
146 edje_object_signal_callback_del_full(wd->lay, emission, source, func_cb,
152 _elm_layout_list_data_get(const Eina_List *list)
154 Subinfo *si = eina_list_data_get(list);
159 _elm_layout_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
161 Widget_Data *wd = elm_widget_data_get(obj);
162 const Eina_List *items;
163 void *(*list_data_get) (const Eina_List *list);
165 if ((!wd) || (!wd->subs))
168 /* Focus chain (This block is diferent of elm_win cycle)*/
169 if ((items = elm_widget_focus_custom_chain_get(obj)))
170 list_data_get = eina_list_data_get;
174 list_data_get = _elm_layout_list_data_get;
176 if (!items) return EINA_FALSE;
179 return elm_widget_focus_list_next_get(obj, items, list_data_get, dir,
184 _sizing_eval(Widget_Data *wd)
186 Evas_Coord minw = -1, minh = -1;
187 edje_object_size_min_calc(wd->lay, &minw, &minh);
188 evas_object_size_hint_min_set(wd->obj, minw, minh);
189 evas_object_size_hint_max_set(wd->obj, -1, -1);
193 _request_sizing_eval(Widget_Data *wd)
195 if (wd->needs_size_calc) return;
196 wd->needs_size_calc = 1;
197 evas_object_smart_changed(wd->obj);
201 _part_cursor_free(Part_Cursor *pc)
203 eina_stringshare_del(pc->part);
204 eina_stringshare_del(pc->style);
205 eina_stringshare_del(pc->cursor);
210 _part_cursor_part_apply(const Part_Cursor *pc)
212 elm_object_cursor_set(pc->obj, pc->cursor);
213 elm_object_cursor_style_set(pc->obj, pc->style);
214 elm_object_cursor_theme_search_enabled_set(pc->obj, pc->engine_only);
218 _parts_cursors_find(Widget_Data *wd, const char *part)
222 EINA_LIST_FOREACH(wd->parts_cursors, l, pc)
224 if (!strcmp(pc->part, part))
231 _parts_cursors_apply(Widget_Data *wd)
233 const char *file, *group;
237 edje_object_file_get(wd->lay, &file, &group);
239 EINA_LIST_FOREACH(wd->parts_cursors, l, pc)
241 Evas_Object *obj = (Evas_Object *)edje_object_part_object_get
247 WRN("no part '%s' in group '%s' of file '%s'. "
248 "Cannot set cursor '%s'",
249 pc->part, group, file, pc->cursor);
252 else if (evas_object_pass_events_get(obj))
255 WRN("part '%s' in group '%s' of file '%s' has mouse_events: 0. "
256 "Cannot set cursor '%s'",
257 pc->part, group, file, pc->cursor);
262 _part_cursor_part_apply(pc);
267 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
269 _request_sizing_eval(data);
273 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
275 Widget_Data *wd = elm_widget_data_get(obj);
276 Evas_Object *sub = event_info;
280 EINA_LIST_FOREACH(wd->subs, l, si)
284 evas_object_event_callback_del_full(sub,
285 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
288 wd->subs = eina_list_remove_list(wd->subs, l);
289 eina_stringshare_del(si->part);
297 _signal_size_eval(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
299 _request_sizing_eval(data);
303 _parts_text_fix(Widget_Data *wd)
308 EINA_LIST_FOREACH(wd->subs, l, si)
310 if (si->type == TEXT)
311 edje_object_part_text_set(wd->lay, si->part, si->p.text.text);
316 _elm_layout_label_set(Evas_Object *obj, const char *part, const char *text)
318 Widget_Data *wd = elm_widget_data_get(obj);
321 ELM_CHECK_WIDTYPE(obj, widtype);
322 if (!part) part = "elm.text";
324 EINA_LIST_FOREACH(wd->subs, l, si)
326 if ((si->type == TEXT) && (!strcmp(part, si->part)))
330 eina_stringshare_del(si->part);
331 eina_stringshare_del(si->p.text.text);
333 edje_object_part_text_set(wd->lay, part, NULL);
334 wd->subs = eina_list_remove_list(wd->subs, l);
345 si = ELM_NEW(Subinfo);
348 si->part = eina_stringshare_add(part);
349 wd->subs = eina_list_append(wd->subs, si);
352 eina_stringshare_replace(&si->p.text.text, text);
353 edje_object_part_text_set(wd->lay, part, text);
354 _request_sizing_eval(wd);
358 _elm_layout_label_get(const Evas_Object *obj, const char *part)
360 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
361 Widget_Data *wd = elm_widget_data_get(obj);
362 if (!part) part = "elm.text";
363 return edje_object_part_text_get(wd->lay, part);
367 _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
369 ELM_CHECK_WIDTYPE(obj, widtype);
370 Widget_Data *wd = elm_widget_data_get(obj);
374 EINA_SAFETY_ON_NULL_RETURN(part);
375 EINA_LIST_FOREACH(wd->subs, l, si)
377 if ((si->type == SWALLOW) && (!strcmp(part, si->part)))
379 if (content == si->obj) return;
380 evas_object_del(si->obj);
386 elm_widget_sub_object_add(obj, content);
387 evas_object_event_callback_add(content,
388 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
389 _changed_size_hints, wd);
390 if (!edje_object_part_swallow(wd->lay, part, content))
391 WRN("could not swallow %p into part '%s'", content, part);
392 si = ELM_NEW(Subinfo);
394 si->part = eina_stringshare_add(part);
396 wd->subs = eina_list_append(wd->subs, si);
398 _request_sizing_eval(wd);
402 _content_get_hook(const Evas_Object *obj, const char *part)
404 Widget_Data *wd = elm_widget_data_get(obj);
407 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
409 EINA_LIST_FOREACH(wd->subs, l, si)
411 if ((si->type == SWALLOW) && !strcmp(part, si->part))
418 _content_unset_hook(Evas_Object *obj, const char *part)
420 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
421 Widget_Data *wd = elm_widget_data_get(obj);
424 if (!wd) return NULL;
425 EINA_LIST_FOREACH(wd->subs, l, si)
427 if ((si->type == SWALLOW) && (!strcmp(part, si->part)))
429 Evas_Object *content;
430 if (!si->obj) return NULL;
431 content = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */
432 elm_widget_sub_object_del(obj, content);
433 evas_object_event_callback_del_full(content,
434 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
435 _changed_size_hints, wd);
436 edje_object_part_unswallow(wd->lay, content);
444 elm_layout_add(Evas_Object *parent)
450 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
452 ELM_SET_WIDTYPE(widtype, "layout");
453 elm_widget_type_set(obj, "layout");
454 elm_widget_sub_object_add(parent, obj);
455 elm_widget_data_set(obj, wd);
456 elm_widget_del_hook_set(obj, _del_hook);
457 elm_widget_theme_hook_set(obj, _theme_hook);
458 elm_widget_changed_hook_set(obj, _changed_hook);
459 elm_widget_can_focus_set(obj, EINA_FALSE);
460 elm_widget_focus_next_hook_set(obj, _elm_layout_focus_next_hook);
461 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
462 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
463 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
464 elm_widget_text_set_hook_set(obj, _elm_layout_label_set);
465 elm_widget_text_get_hook_set(obj, _elm_layout_label_get);
466 elm_widget_content_set_hook_set(obj, _content_set_hook);
467 elm_widget_content_get_hook_set(obj, _content_get_hook);
468 elm_widget_content_unset_hook_set(obj, _content_unset_hook);
471 wd->lay = edje_object_add(e);
472 elm_widget_resize_object_set(obj, wd->lay);
473 edje_object_signal_callback_add(wd->lay, "size,eval", "elm",
474 _signal_size_eval, wd);
476 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
477 evas_object_smart_callbacks_descriptions_set(obj, _signals);
479 _mirrored_set(obj, elm_widget_mirrored_get(obj));
480 _request_sizing_eval(wd);
485 elm_layout_file_set(Evas_Object *obj, const char *file, const char *group)
487 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
488 Widget_Data *wd = elm_widget_data_get(obj);
489 if (!wd) return EINA_FALSE;
490 Eina_Bool ret = edje_object_file_set(wd->lay, file, group);
494 _request_sizing_eval(wd);
495 _parts_cursors_apply(wd);
497 else DBG("failed to set edje file '%s', group '%s': %s",
499 edje_load_error_str(edje_object_load_error_get(wd->lay)));
504 elm_layout_theme_set(Evas_Object *obj, const char *clas, const char *group, const char *style)
506 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
507 Widget_Data *wd = elm_widget_data_get(obj);
508 if (!wd) return EINA_FALSE;
509 Eina_Bool ret = _elm_theme_object_set(obj, wd->lay, clas, group, style);
516 _request_sizing_eval(wd);
517 _parts_cursors_apply(wd);
523 elm_layout_box_append(Evas_Object *obj, const char *part, Evas_Object *child)
525 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
526 Widget_Data *wd = elm_widget_data_get(obj);
528 if (!wd) return EINA_FALSE;
530 if (!edje_object_part_box_append(wd->lay, part, child))
531 WRN("child %p could not be appended to box part '%s'", child, part);
532 elm_widget_sub_object_add(obj, child);
533 evas_object_event_callback_add
534 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
536 si = ELM_NEW(Subinfo);
537 si->type = BOX_APPEND;
538 si->part = eina_stringshare_add(part);
540 wd->subs = eina_list_append(wd->subs, si);
541 _request_sizing_eval(wd);
547 elm_layout_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child)
549 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
550 Widget_Data *wd = elm_widget_data_get(obj);
552 if (!wd) return EINA_FALSE;
554 if (!edje_object_part_box_prepend(wd->lay, part, child))
555 WRN("child %p could not be prepended to box part '%s'", child, part);
556 elm_widget_sub_object_add(obj, child);
557 evas_object_event_callback_add
558 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
560 si = ELM_NEW(Subinfo);
561 si->type = BOX_PREPEND;
562 si->part = eina_stringshare_add(part);
564 wd->subs = eina_list_prepend(wd->subs, si);
565 _request_sizing_eval(wd);
571 _box_reference_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
574 si->p.box.reference = NULL;
578 elm_layout_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference)
580 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
581 Widget_Data *wd = elm_widget_data_get(obj);
583 if (!wd) return EINA_FALSE;
585 if (!edje_object_part_box_insert_before(wd->lay, part, child, reference))
586 WRN("child %p could not be inserted before %p inf box part '%s'",
587 child, reference, part);
589 si = ELM_NEW(Subinfo);
590 si->type = BOX_INSERT_BEFORE;
591 si->part = eina_stringshare_add(part);
593 si->p.box.reference = reference;
595 elm_widget_sub_object_add(obj, child);
596 evas_object_event_callback_add
597 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
598 evas_object_event_callback_add
599 ((Evas_Object *)reference, EVAS_CALLBACK_DEL, _box_reference_del, si);
601 wd->subs = eina_list_append(wd->subs, si);
602 _request_sizing_eval(wd);
608 elm_layout_box_insert_at(Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos)
610 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
611 Widget_Data *wd = elm_widget_data_get(obj);
613 if (!wd) return EINA_FALSE;
615 if (!edje_object_part_box_insert_at(wd->lay, part, child, pos))
616 WRN("child %p could not be inserted at %u to box part '%s'",
619 elm_widget_sub_object_add(obj, child);
620 evas_object_event_callback_add
621 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
623 si = ELM_NEW(Subinfo);
624 si->type = BOX_INSERT_AT;
625 si->part = eina_stringshare_add(part);
628 wd->subs = eina_list_append(wd->subs, si);
629 _request_sizing_eval(wd);
635 _sub_box_remove(Widget_Data *wd, Subinfo *si)
639 if (si->type == BOX_INSERT_BEFORE)
640 evas_object_event_callback_del_full
641 ((Evas_Object *)si->p.box.reference,
642 EVAS_CALLBACK_DEL, _box_reference_del, si);
644 child = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */
645 edje_object_part_box_remove(wd->lay, si->part, child);
646 elm_widget_sub_object_del(wd->obj, child);
651 _sub_table_remove(Widget_Data *wd, Subinfo *si)
655 child = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */
656 edje_object_part_table_unpack(wd->lay, si->part, child);
657 elm_widget_sub_object_del(wd->obj, child);
662 _sub_box_is(const Subinfo *si)
668 case BOX_INSERT_BEFORE:
677 elm_layout_box_remove(Evas_Object *obj, const char *part, Evas_Object *child)
679 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
680 Widget_Data *wd = elm_widget_data_get(obj);
684 if (!wd) return NULL;
686 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
687 EINA_SAFETY_ON_NULL_RETURN_VAL(child, NULL);
688 EINA_LIST_FOREACH(wd->subs, l, si)
690 if (!_sub_box_is(si)) continue;
691 if ((si->obj == child) && (!strcmp(si->part, part)))
692 return _sub_box_remove(wd, si);
698 elm_layout_box_remove_all(Evas_Object *obj, const char *part, Eina_Bool clear)
700 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
701 Widget_Data *wd = elm_widget_data_get(obj);
705 if (!wd) return EINA_FALSE;
706 EINA_SAFETY_ON_NULL_RETURN_VAL(part, EINA_FALSE);
708 lst = eina_list_clone(wd->subs);
709 EINA_LIST_FREE(lst, si)
711 if (!_sub_box_is(si)) continue;
712 if (!strcmp(si->part, part))
714 Evas_Object *child = _sub_box_remove(wd, si);
715 if ((clear) && (child)) evas_object_del(child);
718 /* eventually something may not be added with layout, del them as well */
719 edje_object_part_box_remove_all(wd->lay, part, clear);
725 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)
727 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
728 Widget_Data *wd = elm_widget_data_get(obj);
730 if (!wd) return EINA_FALSE;
732 if (!edje_object_part_table_pack
733 (wd->lay, part, child, col, row, colspan, rowspan))
734 WRN("child %p could not be packed into box part '%s' col=%uh, row=%hu, "
735 "colspan=%hu, rowspan=%hu", child, part, col, row, colspan, rowspan);
737 elm_widget_sub_object_add(obj, child);
738 evas_object_event_callback_add
739 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd);
741 si = ELM_NEW(Subinfo);
742 si->type = TABLE_PACK;
743 si->part = eina_stringshare_add(part);
745 si->p.table.col = col;
746 si->p.table.row = row;
747 si->p.table.colspan = colspan;
748 si->p.table.rowspan = rowspan;
749 wd->subs = eina_list_append(wd->subs, si);
750 _request_sizing_eval(wd);
756 elm_layout_table_unpack(Evas_Object *obj, const char *part, Evas_Object *child)
758 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
759 Widget_Data *wd = elm_widget_data_get(obj);
763 if (!wd) return NULL;
765 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
766 EINA_SAFETY_ON_NULL_RETURN_VAL(child, NULL);
767 EINA_LIST_FOREACH(wd->subs, l, si)
769 if (si->type != TABLE_PACK) continue;
770 if ((si->obj == child) && (!strcmp(si->part, part)))
771 return _sub_table_remove(wd, si);
777 elm_layout_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear)
779 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
780 Widget_Data *wd = elm_widget_data_get(obj);
784 if (!wd) return EINA_FALSE;
785 EINA_SAFETY_ON_NULL_RETURN_VAL(part, EINA_FALSE);
787 lst = eina_list_clone(wd->subs);
788 EINA_LIST_FREE(lst, si)
790 if (si->type != TABLE_PACK) continue;
791 if (!strcmp(si->part, part))
793 Evas_Object *child = _sub_table_remove(wd, si);
794 if ((clear) && (child)) evas_object_del(child);
797 /* eventually something may not be added with layout, del them as well */
798 edje_object_part_table_clear(wd->lay, part, clear);
804 elm_layout_edje_get(const Evas_Object *obj)
806 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
807 Widget_Data *wd = elm_widget_data_get(obj);
808 if (!wd) return NULL;
813 elm_layout_data_get(const Evas_Object *obj, const char *key)
815 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
816 Widget_Data *wd = elm_widget_data_get(obj);
817 return edje_object_data_get(wd->lay, key);
821 elm_layout_sizing_eval(Evas_Object *obj)
823 ELM_CHECK_WIDTYPE(obj, widtype);
824 Widget_Data *wd = elm_widget_data_get(obj);
825 EINA_SAFETY_ON_NULL_RETURN(wd);
826 _request_sizing_eval(wd);
830 elm_layout_part_cursor_set(Evas_Object *obj, const char *part_name, const char *cursor)
832 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
833 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
834 Widget_Data *wd = elm_widget_data_get(obj);
835 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE);
836 Evas_Object *part_obj;
839 part_obj = (Evas_Object *)edje_object_part_object_get(wd->lay, part_name);
842 const char *group, *file;
843 edje_object_file_get(wd->lay, &file, &group);
844 WRN("no part '%s' in group '%s' of file '%s'. Cannot set cursor '%s'",
845 part_name, group, file, cursor);
848 if (evas_object_pass_events_get(part_obj))
850 const char *group, *file;
851 edje_object_file_get(wd->lay, &file, &group);
852 WRN("part '%s' in group '%s' of file '%s' has mouse_events: 0. "
853 "Cannot set cursor '%s'",
854 part_name, group, file, cursor);
858 pc = _parts_cursors_find(wd, part_name);
859 if (pc) eina_stringshare_replace(&pc->cursor, cursor);
862 pc = calloc(1, sizeof(*pc));
863 pc->part = eina_stringshare_add(part_name);
864 pc->cursor = eina_stringshare_add(cursor);
865 pc->style = eina_stringshare_add("default");
866 wd->parts_cursors = eina_list_append(wd->parts_cursors, pc);
870 elm_object_sub_cursor_set(part_obj, obj, pc->cursor);
875 elm_layout_part_cursor_get(const Evas_Object *obj, const char *part_name)
877 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
878 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL);
879 Widget_Data *wd = elm_widget_data_get(obj);
880 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
881 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
882 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, NULL);
883 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, NULL);
884 return elm_object_cursor_get(pc->obj);
888 elm_layout_part_cursor_unset(Evas_Object *obj, const char *part_name)
890 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
891 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
892 Widget_Data *wd = elm_widget_data_get(obj);
893 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE);
897 EINA_LIST_FOREACH(wd->parts_cursors, l, pc)
899 if (!strcmp(part_name, pc->part))
901 if (pc->obj) elm_object_cursor_unset(pc->obj);
902 _part_cursor_free(pc);
903 wd->parts_cursors = eina_list_remove_list(wd->parts_cursors, l);
912 elm_layout_part_cursor_style_set(Evas_Object *obj, const char *part_name, const char *style)
914 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
915 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
916 Widget_Data *wd = elm_widget_data_get(obj);
917 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE);
918 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
919 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
920 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE);
922 eina_stringshare_replace(&pc->style, style);
923 elm_object_cursor_style_set(pc->obj, pc->style);
928 elm_layout_part_cursor_style_get(const Evas_Object *obj, const char *part_name)
930 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
931 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL);
932 Widget_Data *wd = elm_widget_data_get(obj);
933 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
934 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
935 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, NULL);
936 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, NULL);
937 return elm_object_cursor_style_get(pc->obj);
941 elm_layout_part_cursor_engine_only_set(Evas_Object *obj, const char *part_name, Eina_Bool engine_only)
943 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
944 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
945 Widget_Data *wd = elm_widget_data_get(obj);
946 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE);
947 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
948 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
949 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE);
951 pc->engine_only = !!engine_only;
952 elm_object_cursor_theme_search_enabled_set(pc->obj, pc->engine_only);
957 elm_layout_part_cursor_engine_only_get(const Evas_Object *obj, const char *part_name)
959 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
960 EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
961 Widget_Data *wd = elm_widget_data_get(obj);
962 EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE);
963 Part_Cursor *pc = _parts_cursors_find(wd, part_name);
964 EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
965 EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE);
966 return elm_object_cursor_theme_search_enabled_get(pc->obj);