summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-11-14 18:42:48 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-06 17:35:21 +0900
commite8bd6584f5d8a13d9f804eb7ecc62ee41cad6b98 (patch)
tree08b08bdfcccd0aeeb2edf0afae7df1d73d65cedf
parent763c634dced12e5973f05b0a1958e8e51b6fbff8 (diff)
efl_ui_widget: add new internal EAPI for new group name
theme_klass: set/get klass name used for resize_obj theme_element: set/get group name used for resize_obj theme_style: set/get style name used for resize_obj element_update: automatically sets and apply theme for sub object of widget.
-rw-r--r--src/lib/elementary/efl_ui_layout.c29
-rw-r--r--src/lib/elementary/efl_ui_panes.c5
-rw-r--r--src/lib/elementary/efl_ui_progressbar.c5
-rw-r--r--src/lib/elementary/efl_ui_slider.c9
-rw-r--r--src/lib/elementary/elc_hoversel.c4
-rw-r--r--src/lib/elementary/elm_bubble.c5
-rw-r--r--src/lib/elementary/elm_index.c5
-rw-r--r--src/lib/elementary/elm_scroller.c8
-rw-r--r--src/lib/elementary/elm_separator.c5
-rw-r--r--src/lib/elementary/elm_widget.c133
-rw-r--r--src/lib/elementary/elm_widget.h10
-rw-r--r--src/lib/elementary/elm_widget_layout.h2
12 files changed, 177 insertions, 43 deletions
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index a0365f8749..37ae263d69 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -362,8 +362,10 @@ _efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd)
362 if (!sd->file_set) 362 if (!sd->file_set)
363 { 363 {
364 ret = elm_widget_theme_object_set 364 ret = elm_widget_theme_object_set
365 (obj, wd->resize_obj, sd->klass, sd->group, 365 (obj, wd->resize_obj,
366 elm_widget_style_get(obj)); 366 elm_widget_theme_klass_get(obj),
367 elm_widget_theme_element_get(obj),
368 elm_widget_theme_style_get(obj));
367 } 369 }
368 370
369 if (ret) 371 if (ret)
@@ -682,9 +684,6 @@ _efl_ui_layout_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_Data *sd)
682 eina_hash_free(sd->factories); 684 eina_hash_free(sd->factories);
683 sd->factories = NULL; 685 sd->factories = NULL;
684 686
685 eina_stringshare_del(sd->klass);
686 eina_stringshare_del(sd->group);
687
688 /* let's make our Edje object the *last* to be processed, since it 687 /* let's make our Edje object the *last* to be processed, since it
689 * may (smart) parent other sub objects here */ 688 * may (smart) parent other sub objects here */
690 EINA_LIST_FOREACH(wd->subobjs, l, child) 689 EINA_LIST_FOREACH(wd->subobjs, l, child)
@@ -799,6 +798,7 @@ _efl_ui_layout_efl_file_mmap_get(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, co
799EOLIAN static Efl_Ui_Theme_Apply 798EOLIAN static Efl_Ui_Theme_Apply
800_efl_ui_layout_theme_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *klass, const char *group, const char *style) 799_efl_ui_layout_theme_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *klass, const char *group, const char *style)
801{ 800{
801 Eina_Bool changed = EINA_FALSE;
802 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 802 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
803 803
804 if (!wd->legacy && efl_finalized_get(obj)) 804 if (!wd->legacy && efl_finalized_get(obj))
@@ -808,11 +808,14 @@ _efl_ui_layout_theme_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *klass, con
808 } 808 }
809 809
810 if (sd->file_set) sd->file_set = EINA_FALSE; 810 if (sd->file_set) sd->file_set = EINA_FALSE;
811 eina_stringshare_replace(&(sd->klass), klass);
812 eina_stringshare_replace(&(sd->group), group);
813 eina_stringshare_replace(&(wd->style), style);
814 811
815 return _efl_ui_layout_theme_internal(obj, sd); 812 changed |= elm_widget_theme_klass_set(obj, klass);
813 changed |= elm_widget_theme_element_set(obj, group);
814 changed |= elm_widget_theme_style_set(obj, style);
815
816 if (changed)
817 return efl_ui_widget_theme_apply(obj);
818 return EFL_UI_THEME_APPLY_SUCCESS;
816} 819}
817 820
818EOLIAN static void 821EOLIAN static void
@@ -2376,7 +2379,7 @@ elm_layout_theme_set(Evas_Object *obj, const char *klass, const char *group, con
2376/* Efl.Part implementation */ 2379/* Efl.Part implementation */
2377 2380
2378EOLIAN static Eo * 2381EOLIAN static Eo *
2379_efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd, const char *part) 2382_efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char *part)
2380{ 2383{
2381 Efl_Canvas_Layout_Part_Type type; 2384 Efl_Canvas_Layout_Part_Type type;
2382 2385
@@ -2397,7 +2400,7 @@ _efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd, const char *
2397 const char *file = NULL, *key = NULL; 2400 const char *file = NULL, *key = NULL;
2398 efl_file_get(wd->resize_obj, &file, &key); 2401 efl_file_get(wd->resize_obj, &file, &key);
2399 WRN("Layout has a background but it's not a swallow: '%s'", 2402 WRN("Layout has a background but it's not a swallow: '%s'",
2400 sd->group); 2403 elm_widget_theme_element_get(obj));
2401 } 2404 }
2402 return efl_part(efl_super(obj, MY_CLASS), part); 2405 return efl_part(efl_super(obj, MY_CLASS), part);
2403 } 2406 }
@@ -2407,7 +2410,7 @@ _efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd, const char *
2407 2410
2408 if (type >= EFL_CANVAS_LAYOUT_PART_TYPE_LAST) 2411 if (type >= EFL_CANVAS_LAYOUT_PART_TYPE_LAST)
2409 { 2412 {
2410 ERR("Invalid type found for part '%s' in group '%s'", part, sd->group); 2413 ERR("Invalid type found for part '%s' in group '%s'", part, elm_widget_theme_element_get(obj));
2411 return NULL; 2414 return NULL;
2412 } 2415 }
2413 2416
@@ -2422,7 +2425,7 @@ _efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd, const char *
2422 case EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW: 2425 case EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW:
2423 return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_CONTENT_CLASS, obj, part); 2426 return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_CONTENT_CLASS, obj, part);
2424 case EFL_CANVAS_LAYOUT_PART_TYPE_NONE: 2427 case EFL_CANVAS_LAYOUT_PART_TYPE_NONE:
2425 WRN("No such part '%s' in group '%s'", part, sd->group); 2428 WRN("No such part '%s' in group '%s'", part, elm_widget_theme_element_get(obj));
2426 return NULL; 2429 return NULL;
2427 default: 2430 default:
2428 return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_CLASS, obj, part); 2431 return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_CLASS, obj, part);
diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c
index 9c46cab040..1d70fd23d5 100644
--- a/src/lib/elementary/efl_ui_panes.c
+++ b/src/lib/elementary/efl_ui_panes.c
@@ -60,12 +60,11 @@ _efl_ui_panes_elm_widget_theme_apply(Eo *obj, Efl_Ui_Panes_Data *sd)
60 Evas_Coord minw = 0, minh = 0; 60 Evas_Coord minw = 0, minh = 0;
61 61
62 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED; 62 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
63 EFL_UI_LAYOUT_DATA_GET(obj, ld);
64 63
65 if (sd->dir == EFL_UI_DIR_HORIZONTAL) 64 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
66 eina_stringshare_replace(&ld->group, "horizontal"); 65 elm_widget_theme_element_set(obj, "horizontal");
67 else 66 else
68 eina_stringshare_replace(&ld->group, "vertical"); 67 elm_widget_theme_element_set(obj, "vertical");
69 68
70 evas_object_hide(sd->event); 69 evas_object_hide(sd->event);
71 elm_coords_finger_size_adjust(1, &minw, 1, &minh); 70 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c
index b103c44829..697c727d6e 100644
--- a/src/lib/elementary/efl_ui_progressbar.c
+++ b/src/lib/elementary/efl_ui_progressbar.c
@@ -202,12 +202,11 @@ EOLIAN static Efl_Ui_Theme_Apply
202_efl_ui_progressbar_elm_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *sd) 202_efl_ui_progressbar_elm_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *sd)
203{ 203{
204 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED; 204 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
205 EFL_UI_LAYOUT_DATA_GET(obj, ld);
206 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED); 205 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
207 206
208 if (_is_horizontal(sd->dir)) 207 if (_is_horizontal(sd->dir))
209 eina_stringshare_replace(&ld->group, "horizontal"); 208 elm_widget_theme_element_set(obj, "horizontal");
210 else eina_stringshare_replace(&ld->group, "vertical"); 209 else elm_widget_theme_element_set(obj, "vertical");
211 210
212 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); 211 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
213 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; 212 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c
index 59a86c149b..e445385d65 100644
--- a/src/lib/elementary/efl_ui_slider.c
+++ b/src/lib/elementary/efl_ui_slider.c
@@ -699,15 +699,14 @@ EOLIAN static Efl_Ui_Theme_Apply
699_efl_ui_slider_elm_widget_theme_apply(Eo *obj, Efl_Ui_Slider_Data *sd) 699_efl_ui_slider_elm_widget_theme_apply(Eo *obj, Efl_Ui_Slider_Data *sd)
700{ 700{
701 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED; 701 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
702 EFL_UI_LAYOUT_DATA_GET(obj, ld);
703 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED); 702 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
704 703
705 if (_is_horizontal(sd->dir)) 704 if (_is_horizontal(sd->dir))
706 { 705 {
707 if (!sd->intvl_enable) 706 if (!sd->intvl_enable)
708 eina_stringshare_replace(&ld->group, "horizontal"); 707 elm_widget_theme_element_set(obj, "horizontal");
709 else 708 else
710 eina_stringshare_replace(&ld->group, "range/horizontal"); 709 elm_widget_theme_element_set(obj, "range/horizontal");
711 if (sd->popup) 710 if (sd->popup)
712 _elm_theme_set(elm_widget_theme_get(obj), sd->popup, 711 _elm_theme_set(elm_widget_theme_get(obj), sd->popup,
713 "slider", "horizontal/popup", 712 "slider", "horizontal/popup",
@@ -720,9 +719,9 @@ _efl_ui_slider_elm_widget_theme_apply(Eo *obj, Efl_Ui_Slider_Data *sd)
720 else 719 else
721 { 720 {
722 if (!sd->intvl_enable) 721 if (!sd->intvl_enable)
723 eina_stringshare_replace(&ld->group, "vertical"); 722 elm_widget_theme_element_set(obj, "vertical");
724 else 723 else
725 eina_stringshare_replace(&ld->group, "range/vertical"); 724 elm_widget_theme_element_set(obj, "range/vertical");
726 725
727 if (sd->popup) 726 if (sd->popup)
728 _elm_theme_set(elm_widget_theme_get(obj), sd->popup, 727 _elm_theme_set(elm_widget_theme_get(obj), sd->popup,
diff --git a/src/lib/elementary/elc_hoversel.c b/src/lib/elementary/elc_hoversel.c
index 64f13b5797..960458f70b 100644
--- a/src/lib/elementary/elc_hoversel.c
+++ b/src/lib/elementary/elc_hoversel.c
@@ -81,12 +81,12 @@ _elm_hoversel_elm_widget_theme_apply(Eo *obj, Elm_Hoversel_Data *sd)
81 snprintf(buf, sizeof(buf), "hoversel_vertical/%s", style); 81 snprintf(buf, sizeof(buf), "hoversel_vertical/%s", style);
82 82
83 /* hoversel's style has an extra bit: orientation */ 83 /* hoversel's style has an extra bit: orientation */
84 eina_stringshare_replace(&(wd->style), buf); 84 elm_widget_theme_style_set(obj, buf);
85 85
86 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); 86 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
87 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; 87 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
88 88
89 eina_stringshare_replace(&(wd->style), style); 89 elm_widget_theme_style_set(obj, style);
90 90
91 if (sd->hover) 91 if (sd->hover)
92 efl_ui_mirrored_set(sd->hover, efl_ui_mirrored_get(obj)); 92 efl_ui_mirrored_set(sd->hover, efl_ui_mirrored_get(obj));
diff --git a/src/lib/elementary/elm_bubble.c b/src/lib/elementary/elm_bubble.c
index b46018a47b..7747809f70 100644
--- a/src/lib/elementary/elm_bubble.c
+++ b/src/lib/elementary/elm_bubble.c
@@ -205,15 +205,12 @@ EOLIAN static void
205_elm_bubble_pos_set(Eo *obj, Elm_Bubble_Data *sd, Elm_Bubble_Pos pos) 205_elm_bubble_pos_set(Eo *obj, Elm_Bubble_Data *sd, Elm_Bubble_Pos pos)
206{ 206{
207 /* FIXME: Why is this dealing with layout data directly? */ 207 /* FIXME: Why is this dealing with layout data directly? */
208 EFL_UI_LAYOUT_DATA_GET(obj, ld);
209
210 if (pos < ELM_BUBBLE_POS_TOP_LEFT || pos > ELM_BUBBLE_POS_BOTTOM_RIGHT) 208 if (pos < ELM_BUBBLE_POS_TOP_LEFT || pos > ELM_BUBBLE_POS_BOTTOM_RIGHT)
211 return; 209 return;
212 210
213 sd->pos = pos; 211 sd->pos = pos;
214 212
215 eina_stringshare_replace 213 elm_widget_theme_element_set(obj, corner_string[sd->pos]);
216 (&ld->group, corner_string[sd->pos]);
217 214
218 efl_ui_widget_theme_apply(obj); 215 efl_ui_widget_theme_apply(obj);
219} 216}
diff --git a/src/lib/elementary/elm_index.c b/src/lib/elementary/elm_index.c
index ccc08a1a18..bb33e027ab 100644
--- a/src/lib/elementary/elm_index.c
+++ b/src/lib/elementary/elm_index.c
@@ -441,15 +441,14 @@ _elm_index_elm_widget_theme_apply(Eo *obj, Elm_Index_Data *sd)
441 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED; 441 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
442 442
443 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 443 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
444 EFL_UI_LAYOUT_DATA_GET(obj, ld);
445 444
446 _index_box_clear(obj, 0); 445 _index_box_clear(obj, 0);
447 _index_box_clear(obj, 1); 446 _index_box_clear(obj, 1);
448 447
449 if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE)) 448 if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE))
450 eina_stringshare_replace(&ld->group, "base/horizontal"); 449 elm_widget_theme_element_set(obj, "base/horizontal");
451 else 450 else
452 eina_stringshare_replace(&ld->group, "base/vertical"); 451 elm_widget_theme_element_set(obj, "base/vertical");
453 452
454 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); 453 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
455 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; 454 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
diff --git a/src/lib/elementary/elm_scroller.c b/src/lib/elementary/elm_scroller.c
index f06ad69165..593e1d530b 100644
--- a/src/lib/elementary/elm_scroller.c
+++ b/src/lib/elementary/elm_scroller.c
@@ -895,14 +895,12 @@ _elm_scroller_efl_object_constructor(Eo *obj, Elm_Scroller_Data *_pd EINA_UNUSED
895EOLIAN static void 895EOLIAN static void
896_elm_scroller_custom_widget_base_theme_set(Eo *obj, Elm_Scroller_Data *_pd EINA_UNUSED, const char *klass, const char *group) 896_elm_scroller_custom_widget_base_theme_set(Eo *obj, Elm_Scroller_Data *_pd EINA_UNUSED, const char *klass, const char *group)
897{ 897{
898 EFL_UI_LAYOUT_DATA_GET(obj, ld);
899
900 EINA_SAFETY_ON_NULL_RETURN(klass); 898 EINA_SAFETY_ON_NULL_RETURN(klass);
901 EINA_SAFETY_ON_NULL_RETURN(group); 899 EINA_SAFETY_ON_NULL_RETURN(group);
902 900
903 if (eina_stringshare_replace(&(ld->klass), klass) || 901 if (elm_widget_theme_klass_set(obj, klass) ||
904 eina_stringshare_replace(&(ld->group), group)) 902 elm_widget_theme_element_set(obj, group))
905 efl_ui_widget_theme_apply(obj); 903 efl_ui_widget_theme_apply(obj);
906} 904}
907 905
908EAPI void 906EAPI void
diff --git a/src/lib/elementary/elm_separator.c b/src/lib/elementary/elm_separator.c
index e720f4e410..2f25d53ea6 100644
--- a/src/lib/elementary/elm_separator.c
+++ b/src/lib/elementary/elm_separator.c
@@ -20,12 +20,11 @@ EOLIAN static Efl_Ui_Theme_Apply
20_elm_separator_elm_widget_theme_apply(Eo *obj, Elm_Separator_Data *sd EINA_UNUSED) 20_elm_separator_elm_widget_theme_apply(Eo *obj, Elm_Separator_Data *sd EINA_UNUSED)
21{ 21{
22 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED; 22 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
23 EFL_UI_LAYOUT_DATA_GET(obj, ld);
24 23
25 if (sd->horizontal) 24 if (sd->horizontal)
26 eina_stringshare_replace(&ld->group, "horizontal"); 25 elm_widget_theme_element_set(obj, "horizontal");
27 else 26 else
28 eina_stringshare_replace(&ld->group, "vertical"); 27 elm_widget_theme_element_set(obj, "vertical");
29 28
30 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); 29 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
31 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; 30 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c
index a059c32457..89386b22c6 100644
--- a/src/lib/elementary/elm_widget.c
+++ b/src/lib/elementary/elm_widget.c
@@ -767,6 +767,8 @@ _elm_widget_efl_canvas_group_group_del(Eo *obj, Elm_Widget_Smart_Data *sd)
767 EINA_LIST_FREE(sd->event_cb, ecb) 767 EINA_LIST_FREE(sd->event_cb, ecb)
768 free(ecb); 768 free(ecb);
769 769
770 eina_stringshare_del(sd->klass);
771 eina_stringshare_del(sd->group);
770 eina_stringshare_del(sd->style); 772 eina_stringshare_del(sd->style);
771 if (sd->theme) elm_theme_free(sd->theme); 773 if (sd->theme) elm_theme_free(sd->theme);
772 eina_stringshare_del(sd->access_info); 774 eina_stringshare_del(sd->access_info);
@@ -3569,6 +3571,137 @@ _elm_widget_focus_move_policy_automatic_set(Eo *obj, Elm_Widget_Smart_Data *sd,
3569 } 3571 }
3570} 3572}
3571 3573
3574/**
3575 * @internal
3576 *
3577 * Sets the klass name of a widget.
3578 * @param obj The widget.
3579 * @param name Name of the klass to use.
3580 * @return Whether the name was different and thus replaced.
3581 */
3582EAPI Eina_Bool
3583elm_widget_theme_klass_set(Evas_Object *obj, const char *name)
3584{
3585 ELM_WIDGET_DATA_GET_OR_RETURN(obj, pd, EINA_FALSE);
3586 return eina_stringshare_replace(&(pd->klass), name);
3587}
3588
3589/**
3590 * @internal
3591 *
3592 * Gets the klass name of a widget.
3593 * @param obj The widget.
3594 * @return The current klass name of internal canvas object.
3595 */
3596EAPI const char *
3597elm_widget_theme_klass_get(const Evas_Object *obj)
3598{
3599 ELM_WIDGET_DATA_GET_OR_RETURN(obj, pd, NULL);
3600 return (const char *)pd->klass;
3601}
3602
3603/**
3604 * @internal
3605 *
3606 * Sets the element name of a widget.
3607 *
3608 * @param obj The widget.
3609 * @param name Name of the element to use.
3610 * @return Whether the name was different and thus replaced.
3611 */
3612EAPI Eina_Bool
3613elm_widget_theme_element_set(Evas_Object *obj, const char *name)
3614{
3615 ELM_WIDGET_DATA_GET_OR_RETURN(obj, pd, EINA_FALSE);
3616 return eina_stringshare_replace(&(pd->group), name);
3617}
3618
3619/**
3620 * @internal
3621 *
3622 * Gets the element name of a widget.
3623 * @param obj The widget.
3624 * @return The current element name of internal canvas object.
3625 */
3626EAPI const char *
3627elm_widget_theme_element_get(const Evas_Object *obj)
3628{
3629 ELM_WIDGET_DATA_GET_OR_RETURN(obj, pd, NULL);
3630 return (const char *)pd->group;
3631}
3632
3633/**
3634 * @internal
3635 *
3636 * Sets the style name of a widget.
3637 *
3638 * @param obj The widget.
3639 * @param name Name of the style to use.
3640 * @return Whether the name was different and thus replaced.
3641 */
3642EAPI Eina_Bool
3643elm_widget_theme_style_set(Evas_Object *obj, const char *name)
3644{
3645 ELM_WIDGET_DATA_GET_OR_RETURN(obj, pd, EINA_FALSE);
3646 return eina_stringshare_replace(&(pd->style), name);
3647}
3648
3649/**
3650 * @internal
3651 *
3652 * Gets the style name of a widget.
3653 * @param obj The widget.
3654 * @return The current style name of internal canvas object.
3655 */
3656EAPI const char *
3657elm_widget_theme_style_get(const Evas_Object *obj)
3658{
3659 ELM_WIDGET_DATA_GET_OR_RETURN(obj, pd, NULL);
3660 return (const char *)pd->style;
3661}
3662
3663/**
3664 * @internal
3665 *
3666 * Register sub object as a group of a widget and re-apply its theme.
3667 * @param obj The widget.
3668 * @param component A sub object to be added as an element of the widget.
3669 * @param name An element name of sub object.
3670 * @return Whether the style was successfully applied or not.
3671 */
3672EAPI Efl_Ui_Theme_Apply
3673elm_widget_element_update(Evas_Object *obj, Evas_Object *component, const char *name)
3674{
3675 Efl_Ui_Theme_Apply ret = EFL_UI_THEME_APPLY_SUCCESS;
3676 Eina_Bool changed = EINA_FALSE;
3677 const char *obj_group;
3678 Eina_Stringshare *group;
3679
3680 obj_group = elm_widget_theme_element_get(obj);
3681 if (!obj_group)
3682 group = eina_stringshare_add(name);
3683 else
3684 group = eina_stringshare_printf("%s/%s", elm_widget_theme_element_get(obj), name);
3685 if (efl_isa(component, ELM_WIDGET_CLASS))
3686 {
3687 changed |= elm_widget_theme_klass_set(component, elm_widget_theme_klass_get(obj));
3688 changed |= elm_widget_theme_element_set(component, (const char *)group);
3689 changed |= elm_widget_theme_style_set(component, elm_widget_theme_style_get(obj));
3690 if (changed)
3691 ret = efl_ui_widget_theme_apply(component);
3692 }
3693 else
3694 {
3695 ret = efl_ui_widget_theme_object_set(obj, component,
3696 elm_widget_theme_klass_get(obj),
3697 (const char *)group,
3698 elm_widget_theme_style_get(obj));
3699 }
3700 eina_stringshare_del(group);
3701
3702 return ret;
3703}
3704
3572static void 3705static void
3573_track_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info); 3706_track_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
3574 3707
diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h
index 6f28a6997f..9fb43906a8 100644
--- a/src/lib/elementary/elm_widget.h
+++ b/src/lib/elementary/elm_widget.h
@@ -407,6 +407,8 @@ typedef struct _Elm_Widget_Smart_Data
407 407
408 double scale; 408 double scale;
409 Elm_Theme *theme; 409 Elm_Theme *theme;
410 const char *klass; /**< 1st identifier of an edje object group which is used in theme_set. klass and group are used together. */
411 const char *group; /**< 2nd identifier of an edje object group which is used in theme_set. klass and group are used together. */
410 const char *style; 412 const char *style;
411 const char *access_info; 413 const char *access_info;
412 const char *accessible_name; 414 const char *accessible_name;
@@ -742,6 +744,14 @@ EAPI Elm_Focus_Region_Show_Mode elm_widget_focus_region_show_mode_get(const Evas
742const char *elm_widget_part_translatable_text_get(const Eo *obj, const char *part, const char **domain); 744const char *elm_widget_part_translatable_text_get(const Eo *obj, const char *part, const char **domain);
743void elm_widget_part_translatable_text_set(Eo *obj, const char *part, const char *label, const char *domain); 745void elm_widget_part_translatable_text_set(Eo *obj, const char *part, const char *label, const char *domain);
744 746
747EAPI Eina_Bool elm_widget_theme_klass_set(Evas_Object *obj, const char *name);
748EAPI const char *elm_widget_theme_klass_get(const Evas_Object *obj);
749EAPI Eina_Bool elm_widget_theme_element_set(Evas_Object *obj, const char *name);
750EAPI const char *elm_widget_theme_element_get(const Evas_Object *obj);
751EAPI Eina_Bool elm_widget_theme_style_set(Evas_Object *obj, const char *name);
752EAPI const char *elm_widget_theme_style_get(const Evas_Object *obj);
753EAPI Efl_Ui_Theme_Apply elm_widget_element_update(Evas_Object *obj, Evas_Object *component, const char *name);
754
745/* debug function. don't use it unless you are tracking parenting issues */ 755/* debug function. don't use it unless you are tracking parenting issues */
746EAPI void elm_widget_tree_dump(const Evas_Object *top); 756EAPI void elm_widget_tree_dump(const Evas_Object *top);
747EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output); 757EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output);
diff --git a/src/lib/elementary/elm_widget_layout.h b/src/lib/elementary/elm_widget_layout.h
index ab4058fec7..1a3cf2a394 100644
--- a/src/lib/elementary/elm_widget_layout.h
+++ b/src/lib/elementary/elm_widget_layout.h
@@ -56,8 +56,6 @@ typedef struct _Elm_Layout_Smart_Data
56 Eina_List *prop_connect; /**< The hash of properties connected to layout parts. */ 56 Eina_List *prop_connect; /**< The hash of properties connected to layout parts. */
57 Eina_Hash *factories; /**< The hash with parts connected to factories. */ 57 Eina_Hash *factories; /**< The hash with parts connected to factories. */
58 Efl_Model *model; /**< The model */ 58 Efl_Model *model; /**< The model */
59 const char *klass; /**< 1st identifier of an edje object group which is used in theme_set. klass and group are used together. */
60 const char *group; /**< 2nd identifier of an edje object group which is used in theme_set. klass and group are used together. */
61 int frozen; /**< Layout freeze counter */ 59 int frozen; /**< Layout freeze counter */
62 60
63 Eina_Bool needs_size_calc : 1; /**< This flas is set true when the layout sizing eval is already requested. This defers sizing evaluation until smart calculation to avoid unnecessary calculation. */ 61 Eina_Bool needs_size_calc : 1; /**< This flas is set true when the layout sizing eval is already requested. This defers sizing evaluation until smart calculation to avoid unnecessary calculation. */