From b7de37773751a6b0c0a0ecf67d7dc508986ebff7 Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Fri, 16 Sep 2011 12:19:11 +0900 Subject: [PATCH] [*]Un-Rollback to 'Merge [elm_multibuttonentry]Changed edc TEXT part to TEXTBLOCK to support ellipsis'. --- data/themes/default.edc | 594 +++++++++++++++-------------------- packaging/elementary.spec | 21 +- src/bin/test_naviframe.c | 24 +- src/lib/Elementary.h.in | 223 +++++++++++--- src/lib/Makefile.am | 1 + src/lib/elc_naviframe.c | 683 +++++++++++++++++++++++------------------ src/lib/elm_button.c | 16 +- src/lib/elm_conform.c | 33 +- src/lib/elm_imageslider.c | 166 +++++----- src/lib/elm_main.c | 64 +++- src/lib/elm_multibuttonentry.c | 17 +- src/lib/elm_tickernoti.c | 31 +- src/lib/elm_widget.c | 206 ++++++++++++- src/lib/elm_widget.h | 112 ++++++- 14 files changed, 1340 insertions(+), 851 deletions(-) diff --git a/data/themes/default.edc b/data/themes/default.edc index 116f98d..185ac30 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -37443,382 +37443,282 @@ collections { } } ///////////////////////////////////////////////////////////////////////// - group { name:"elm/naviframe/base/default"; - images { - image: "frame_1.png" COMP; - image: "frame_2.png" COMP; - image: "dia_grad.png" COMP; - } - parts { - part { name: "base0"; - mouse_events: 0; - description { state: "default" 0.0; - image.normal: "dia_grad.png"; - fill { - smooth: 0; - size { - relative: 0.0 1.0; - offset: 64 0; - } +group { name:"elm/naviframe/base/default"; + images { + image: "frame_1.png" COMP; + image: "frame_2.png" COMP; + image: "dia_grad.png" COMP; + } + parts { + part { name: "base0"; + mouse_events: 0; + description { state: "default" 0.0; + image.normal: "dia_grad.png"; + fill { + smooth: 0; + size { + relative: 0.0 1.0; + offset: 64 0; } } } - part { name: "base1"; - type: IMAGE; - description { state: "default" 0.0; - image { - normal: "frame_2.png"; - border: 5 5 32 26; - middle: 0; - } - fill.smooth : 0; + } + part { name: "base1"; + type: IMAGE; + description { state: "default" 0.0; + image { + normal: "frame_2.png"; + border: 5 5 32 26; + middle: 0; } + fill.smooth : 0; } - part { name: "over"; - mouse_events: 0; - description { state: "default" 0.0; - rel1.offset: 4 4; - rel2.offset: 5 5; - image { - normal: "frame_1.png"; - border: 2 2 28 22; - middle: 0; - } - fill.smooth : 0; + } + part { name: "over"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.offset: 4 4; + rel2.offset: 5 5; + image { + normal: "frame_1.png"; + border: 2 2 28 22; + middle: 0; } + fill.smooth : 0; } } } - group { name:"elm/naviframe/item/basic/default"; - parts { - part { name: "title_clip"; - type: RECT; - mouse_events: 0; - description { state: "default" 0.0; - min: 1 50; - align: 0.0 0.0; - fixed: 0 1; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 0.0; } - } - description { state: "hide" 0.0; - inherit: "default" 0.0; - min: 0 0; - max: 0 0; - fixed: 1 1; - } - } - part { name: "content_clip"; - type: RECT; - mouse_events: 0; - description { state: "default" 0.0; - rel1.to_y: "title_clip"; - } - } - part { name: "elm.swallow.content"; - type: SWALLOW; - scale: 1; - repeat_events: 0; - clip_to: "content_clip"; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1.relative: 1.0 1.0; - rel1.to_y: "title_clip"; - rel2.relative: 2.0 1.0; - } - description { state: "show" 0.0; - inherit: "default" 0.0; - rel1.relative: 0.0 1.0; - rel2.relative: 1.0 1.0; - } - description { state: "pushed" 0.0; - inherit: "default" 0.0; - rel1.relative: -1.0 1.0; - rel2.relative: 0.0 1.0; - } - description { state: "popped" 0.0; - inherit: "default" 0.0; - rel1.relative: 1.0 1.0; - rel2.relative: 2.0 1.0; - } +} +group { name:"elm/naviframe/item/basic/default"; + images { + image: "flip_base.png" COMP; + image: "flip_shad.png" COMP; + } + parts { + part { name: "title_clip"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + min: 1 50; + align: 0.0 0.0; + fixed: 0 1; + rel1 { relative: 0.0 0.0; } + rel2 { relative: 1.0 0.0; } } - part { name: "elm.swallow.title"; - type: SWALLOW; - scale: 1; - repeat_events: 0; - clip_to: "title_clip"; - description { state: "default" 0.0; - min: 1 50; - align: 0.0 0.0; - fixed: 0 1; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 0.0; } - } + description { state: "hide" 0.0; + inherit: "default" 0.0; + min: 0 0; + max: 0 0; + fixed: 1 1; } } - programs { - program { name: "show"; - signal: "elm,state,show"; - source: "elm"; - action: STATE_SET "show" 0.0; - target: "elm.swallow.content"; - transition: DECELERATE 0.5; - after: "show_finished"; - } - program { name: "pushed"; - signal: "elm,state,pushed"; - source: "elm"; - action: STATE_SET "pushed" 0.0; - target: "elm.swallow.content"; - transition: DECELERATE 0.5; - after: "pushed_finished"; - } - program { name: "popped"; - signal: "elm,state,popped"; - source: "elm"; - action: STATE_SET "popped" 0.0; - target: "elm.swallow.content"; - transition: DECELERATE 0.5; - after: "popped_finished"; - } - program { name: "visible"; - signal: "elm,state,visible"; - source: "elm"; - action: STATE_SET "show" 0.0; - target: "elm.swallow.content"; + part { name: "content_clip"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to_y: "title_clip"; + rel1.relative: 0 1; } - program { name: "title_show"; - signal: "elm,state,title,show"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "title_clip"; + } + part { name: "elm.swallow.content"; + type: SWALLOW; + scale: 1; + repeat_events: 0; + clip_to: "content_clip"; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1.relative: 1.0 1.0; + rel1.to_y: "title_clip"; + rel2.relative: 2.0 1.0; } - program { name: "title_hide"; - signal: "elm,state,title,hide"; - source: "elm"; - action: STATE_SET "hide" 0.0; - target: "title_clip"; + description { state: "show" 0.0; + inherit: "default" 0.0; + rel1.relative: 0.0 1.0; + rel2.relative: 1.0 1.0; } - program { name: "show_finished"; - action: SIGNAL_EMIT "elm,action,show,finished" ""; + description { state: "pushed" 0.0; + inherit: "default" 0.0; + rel1.relative: -1.0 1.0; + rel2.relative: 0.0 1.0; } - program { name: "pushed_finished"; - action: SIGNAL_EMIT "elm,action,pushed,finished" ""; + description { state: "popped" 0.0; + inherit: "default" 0.0; + rel1.relative: 1.0 1.0; + rel2.relative: 2.0 1.0; } - program { name: "popped_finished"; - action: SIGNAL_EMIT "elm,action,popped,finished" ""; + } + part { name: "title_base"; + type: IMAGE; + scale: 1; + repeat_events: 0; + clip_to: "title_clip"; + description { state: "default" 0.0; + min: 1 50; + align: 0.0 0.0; + fixed: 0 1; + rel1 { relative: 0.0 0.0; } + rel2 { relative: 1.0 0.0; } + image.normal: "flip_base.png"; + } + } + part { name: "elm.swallow.prev_btn"; + type: SWALLOW; + scale: 1; + clip_to: "title_clip"; + description { state: "default" 0.0; + min: 80 40; + max: 80 40; + align: 0 0; + fixed: 1 1; + rel1.offset: 5 5; + rel1.to: "title_base"; + rel2.offset: -1 -6; + rel2.to: "title_base"; + } + } + part { name: "elm.swallow.next_btn"; + type: SWALLOW; + scale: 1; + clip_to: "title_clip"; + description { state: "default" 0.0; + min: 80 40; + max: 80 40; + align: 1 0; + fixed: 1 1; + rel1.offset: 0 5; + rel1.to: "title_base"; + rel2.offset: -6 -6; + rel2.to: "title_base"; } } - } - group { name:"elm/naviframe/item/instant/default"; - parts { - part { name: "title_clip"; - type: RECT; - mouse_events: 0; - description { state: "default" 0.0; - min: 1 50; - align: 0.0 0.0; - fixed: 0 1; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 0.0; } - } - description { state: "hide" 0.0; - inherit: "default" 0.0; + part { name: "elm.swallow.icon"; + type: SWALLOW; + scale: 1; + clip_to: "title_clip"; + description { state: "default" 0.0; + min: 40 40; + max: 40 40; + align: 1 0.5; + rel1.to: "elm.text.title"; + rel1.relative: 0 0; + rel1.to: "title_base"; + rel2.to: "elm.text.title"; + rel2.relative: 0 1; + rel2.to: "title_base"; + } + } + part { name: "elm.text.title"; + type: TEXT; + scale: 1; + repeat_events: 1; + clip_to: "title_clip"; + description { state: "default" 0.0; + text { font: "Sans,Edje-Vera"; + size: 10; min: 0 0; - max: 0 0; - fixed: 1 1; - } - } - part { name: "content_clip"; - type: RECT; - mouse_events: 0; - description { state: "default" 0.0; - rel1.to_y: "title_clip"; - } - } - part { name: "elm.swallow.content"; - type: SWALLOW; - scale: 1; - repeat_events: 0; - clip_to: "content_clip"; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1.relative: 0.0 1.0; - rel1.to_y: "title_clip"; - rel2.relative: 1.0 1.0; - visible: 0; - } - description { state: "show" 0.0; - inherit: "default" 0.0; - visible: 1; + max: 1 0; + align: 0.5 0.5; } - } - part { name: "elm.swallow.title"; - type: SWALLOW; - scale: 1; - repeat_events: 0; - clip_to: "title_clip"; - description { state: "default" 0.0; - min: 1 50; - align: 0.5 0.0; - fixed: 0 1; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 0.0; } + color: 0 0 0 255; + align: 0.5 0.5; + rel1.to: "title_base"; + rel2.to: "title_base"; + } + } + part { name: "elm.text.subtitle"; + type: TEXT; + scale: 1; + repeat_events: 1; + clip_to: "title_clip"; + description { state: "default" 0.0; + text { font: "Sans,Edje-Vera"; + size: 8; + min: 0 0; + max: 1 0; + align: 0.5 1; } + rel1.to_y: "elm.text.title"; + rel1.relative: 0 1; + rel1.to: "title_base"; + rel2.to: "title_base"; + color: 50 50 50 255; + align: 0.5 0; } } - programs { - program { name: "show"; - signal: "elm,state,show"; - source: "elm"; - action: STATE_SET "show" 0.0; - target: "elm.swallow.content"; - after: "show_finished"; - } - program { name: "pushed"; - signal: "elm,state,pushed"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.swallow.content"; - after: "pushed_finished"; - } - program { name: "popped"; - signal: "elm,state,popped"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.swallow.content"; - after: "popped_finished"; - } - program { name: "visible"; - signal: "elm,state,visible"; - source: "elm"; - action: STATE_SET "show" 0.0; - target: "elm.swallow.content"; - } - program { name: "title_show"; - signal: "elm,state,title,show"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "title_clip"; - } - program { name: "title_hide"; - signal: "elm,state,title,hide"; - source: "elm"; - action: STATE_SET "hide" 0.0; - target: "title_clip"; - } - program { name: "show_finished"; - action: SIGNAL_EMIT "elm,action,show,finished" ""; - } - program { name: "pushed_finished"; - action: SIGNAL_EMIT "elm,action,pushed,finished" ""; - } - program { name: "popped_finished"; - action: SIGNAL_EMIT "elm,action,popped,finished" ""; + part { name: "shade"; + type: IMAGE; + mouse_events: 0; + clip_to: "title_clip"; + description { + align: 0.5 1; + rel1.to_y: "elm.text.title"; + rel1.relative: 0 1; + rel1.offset: 0 0; + rel1.to: "title_base"; + rel2.offset: -1 5; + rel2.to: "title_base"; + image.normal: "flip_shad.png"; } } } - group { name:"elm/naviframe/title/default"; - images { - image: "flip_base.png" COMP; - image: "flip_shad.png" COMP; + programs { + program { name: "show"; + signal: "elm,state,show"; + source: "elm"; + action: STATE_SET "show" 0.0; + target: "elm.swallow.content"; + transition: DECELERATE 0.5; + after: "show_finished"; + } + program { name: "pushed"; + signal: "elm,state,pushed"; + source: "elm"; + action: STATE_SET "pushed" 0.0; + target: "elm.swallow.content"; + transition: DECELERATE 0.5; + after: "pushed_finished"; + } + program { name: "popped"; + signal: "elm,state,popped"; + source: "elm"; + action: STATE_SET "popped" 0.0; + target: "elm.swallow.content"; + transition: DECELERATE 0.5; + after: "popped_finished"; + } + program { name: "visible"; + signal: "elm,state,visible"; + source: "elm"; + action: STATE_SET "show" 0.0; + target: "elm.swallow.content"; + } + program { name: "title_show"; + signal: "elm,state,title,show"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "title_clip"; } - parts { - part { name: "base"; - type: IMAGE; - description { - image.normal: "flip_base.png"; - } - } - part { name: "elm.swallow.prev_btn"; - type: SWALLOW; - scale: 1; - description { state: "default" 0.0; - min: 80 40; - max: 80 40; - align: 0 0; - fixed: 1 1; - rel1.offset: 5 5; - rel2.offset: -1 -6; - } - } - part { name: "elm.swallow.next_btn"; - type: SWALLOW; - scale: 1; - description { state: "default" 0.0; - min: 80 40; - max: 80 40; - align: 1 0; - fixed: 1 1; - rel1.offset: 0 5; - rel2.offset: -6 -6; - } - } - part { name: "elm.swallow.icon"; - type: SWALLOW; - scale: 1; - description { state: "default" 0.0; - min: 40 40; - max: 40 40; - align: 1 0.5; - rel1.to: "elm.text.title"; - rel1.relative: 0 0; - rel2.to: "elm.text.title"; - rel2.relative: 0 1; - } - } - part { name: "elm.text.title"; - type: TEXT; - scale: 1; - repeat_events: 1; - description { state: "default" 0.0; - text { font: "Sans,Edje-Vera"; - size: 10; - min: 0 0; - max: 1 0; - align: 0.5 0.5; - } - color: 0 0 0 255; - align: 0.5 0.5; - } - } - part { name: "elm.text.subtitle"; - type: TEXT; - scale: 1; - repeat_events: 1; - description { state: "default" 0.0; - text { font: "Sans,Edje-Vera"; - size: 8; - min: 0 0; - max: 1 0; - align: 0.5 1; - } - rel1.to_y: "elm.text.title"; - rel1.relative: 0 1; - color: 50 50 50 255; - align: 0.5 0; - } - } - part { name: "shade"; - type: IMAGE; - mouse_events: 0; - description { - align: 0.5 1; - rel1.to_y: "elm.text.title"; - rel1.relative: 0 1; - rel1.offset: 0 0; - rel2.offset: -1 5; - image.normal: "flip_shad.png"; - } - } + program { name: "title_hide"; + signal: "elm,state,title,hide"; + source: "elm"; + action: STATE_SET "hide" 0.0; + target: "title_clip"; } - programs { - program { - name: "title_clicked"; - signal: "mouse,clicked,1"; - source: "base"; - action: SIGNAL_EMIT "elm,action,clicked" "elm"; - } + program { + name: "title_clicked"; + signal: "mouse,clicked,1"; + source: "base"; + action: SIGNAL_EMIT "elm,action,clicked" "elm"; + } + program { name: "show_finished"; + action: SIGNAL_EMIT "elm,action,show,finished" ""; + } + program { name: "pushed_finished"; + action: SIGNAL_EMIT "elm,action,pushed,finished" ""; + } + program { name: "popped_finished"; + action: SIGNAL_EMIT "elm,action,popped,finished" ""; } } } + diff --git a/packaging/elementary.spec b/packaging/elementary.spec index 29abb22..1c65072 100644 --- a/packaging/elementary.spec +++ b/packaging/elementary.spec @@ -1,3 +1,4 @@ +#sbs-git:slp/pkgs/e/elementary elementary_1.0.0+svn.61256slp2+build26 7a9d4e37a3eaef2856850022c0127a6e3738b0f2 Name: elementary Summary: EFL toolkit for small touchscreens Version: 0.7.0.svn61256 @@ -23,9 +24,9 @@ BuildRequires: pkgconfig(ethumb) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(x11) -BuildRequires: edje-bin -BuildRequires: embryo-bin -BuildRequires: eet-bin +BuildRequires: edje-tools +BuildRequires: embryo +BuildRequires: eet-tools BuildRequires: libjpeg-devel BuildRequires: desktop-file-utils @@ -40,13 +41,15 @@ Requires: %{name} = %{version}-%{release} %description devel EFL toolkit for small touchscreens (devel) -%package bin -Summary: EFL toolkit (devel) -Group: Development/Libraries +%package tools +Summary: EFL toolkit (tools) +Group: Development/Tools Requires: %{name} = %{version}-%{release} +Provides: %{name}-bin +Obsoletes: %{name}-bin -%description bin -EFL toolkit for small touchscreens (devel) +%description tools +EFL toolkit for small touchscreens (tools) %prep @@ -94,7 +97,7 @@ desktop-file-install --delete-original \ /usr/lib/libelementary.so /usr/lib/pkgconfig/elementary.pc -%files bin +%files tools %defattr(-,root,root,-) /usr/bin/elementary_* /usr/lib/elementary_testql.so diff --git a/src/bin/test_naviframe.c b/src/bin/test_naviframe.c index 03dcae5..8cc9cd9 100644 --- a/src/bin/test_naviframe.c +++ b/src/bin/test_naviframe.c @@ -28,13 +28,13 @@ _page4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Evas_Object *bt, *bt2, *ic, *nf = data; char buf[PATH_MAX]; - Elm_Naviframe_Item *it; + Elm_Object_Item *it; bt = elm_button_add(nf); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); ic = elm_icon_add(nf); - snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", PACKAGE_DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", elm_app_data_dir_get()); elm_icon_file_set(ic, buf, NULL); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_button_icon_set(bt, ic); @@ -44,7 +44,7 @@ _page4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) elm_object_text_set(bt2, "Naviframe Test"); ic = elm_icon_add(nf); - snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); elm_icon_file_set(ic, buf, NULL); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); @@ -54,8 +54,8 @@ _page4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) bt, bt2, NULL); - elm_naviframe_item_subtitle_label_set(it, "Here is sub-title part!"); - elm_naviframe_item_icon_set(it, ic); + elm_object_item_text_part_set(it, "elm.text.subtitle", "Here is sub-title part!"); + elm_object_item_content_part_set(it, "elm.swallow.icon", ic); elm_naviframe_item_title_visible_set(it, EINA_FALSE); evas_object_smart_callback_add(bt2, "clicked", _title_visible, it); } @@ -65,7 +65,7 @@ _page3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Evas_Object *bt, *bt2, *bt3, *ic, *nf = data; char buf[PATH_MAX]; - Elm_Naviframe_Item *it; + Elm_Object_Item *it; bt = elm_button_add(nf); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -82,7 +82,7 @@ _page3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) elm_object_text_set(bt3, "Naviframe Test"); ic = elm_icon_add(nf); - snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); elm_icon_file_set(ic, buf, NULL); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); @@ -92,8 +92,8 @@ _page3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) bt2, bt3, NULL); - elm_naviframe_item_subtitle_label_set(it, "Here is sub-title part!"); - elm_naviframe_item_icon_set(it, ic); + elm_object_item_text_part_set(it, "elm.text.subtitle", "Here is sub-title part!"); + elm_object_item_content_part_set(it, "elm.swallow.icon", ic); } void @@ -101,7 +101,7 @@ _page2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Evas_Object *bt, *bt2, *ic, *nf = data; char buf[PATH_MAX]; - Elm_Naviframe_Item *it; + Elm_Object_Item *it; bt = elm_button_add(nf); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -112,7 +112,7 @@ _page2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) elm_object_text_set(bt2, "Naviframe Test"); ic = elm_icon_add(nf); - snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", PACKAGE_DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", elm_app_data_dir_get()); elm_icon_file_set(ic, buf, NULL); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_button_icon_set(bt, ic); @@ -123,7 +123,7 @@ _page2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) bt, bt2, NULL); - elm_naviframe_item_subtitle_label_set(it, "Here is sub-title part!"); + elm_object_item_text_part_set(it, "elm.text.subtitle", "Here is sub-title part!"); } void diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index e2738f8..84b6746 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -329,6 +329,14 @@ extern "C" { /** + * @typedef Elm_Object_Item + * An Elementary Object item handle. + * @ingroup General + */ + typedef struct _Elm_Object_Item Elm_Object_Item; + + + /** * Called back when a widget's tooltip is activated and needs content. * @param data user-data given to elm_object_tooltip_content_cb_set() * @param obj owner widget. @@ -680,14 +688,14 @@ extern "C" { * Set a label of an object * * @param obj The Elementary object - * @param item The label id to set (NULL for the default label) + * @param part The text part name to set (NULL for the default label) * @param label The new text of the label * * @note Elementary objects may have many labels (e.g. Action Slider) * * @ingroup General */ - EAPI void elm_object_text_part_set(Evas_Object *obj, const char *item, const char *label); + EAPI void elm_object_text_part_set(Evas_Object *obj, const char *part, const char *label); #define elm_object_text_set(obj, label) elm_object_text_part_set((obj), NULL, (label)) @@ -695,19 +703,175 @@ extern "C" { * Get a label of an object * * @param obj The Elementary object - * @param item The label id to get (NULL for the default label) - * @return text of the label or - * NULL for any error + * @param part The text part name to get (NULL for the default label) + * @return text of the label or NULL for any error * * @note Elementary objects may have many labels (e.g. Action Slider) * * @ingroup General */ - EAPI const char *elm_object_text_part_get(const Evas_Object *obj, const char *item); + EAPI const char *elm_object_text_part_get(const Evas_Object *obj, const char *part); #define elm_object_text_get(obj) elm_object_text_part_get((obj), NULL) /** + * Set a content of an object + * + * @param obj The Elementary object + * @param part The content part name to set (NULL for the default content) + * @param content The new content of the object + * + * @note Elementary objects may have many contents + * + * @ingroup General + */ + EAPI void elm_object_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content); + +#define elm_object_content_set(obj, content) elm_object_content_part_set((obj), NULL, (content)) + + /** + * Get a content of an object + * + * @param obj The Elementary object + * @param item The content part name to get (NULL for the default content) + * @return content of the object or NULL for any error + * + * @note Elementary objects may have many contents + * + * @ingroup General + */ + EAPI Evas_Object *elm_object_content_part_get(const Evas_Object *obj, const char *part); + +#define elm_object_content_get(obj) elm_object_content_part_get((obj), NULL) + + /** + * Unset a content of an object + * + * @param obj The Elementary object + * @param item The content part name to unset (NULL for the default content) + * + * @note Elementary objects may have many contents + * + * @ingroup General + */ + EAPI Evas_Object *elm_object_content_part_unset(Evas_Object *obj, const char *part); + +#define elm_object_content_unset(obj) elm_object_content_part_unset((obj), NULL) + + /** + * Set a content of an object item + * + * @param it The Elementary object item + * @param part The content part name to set (NULL for the default content) + * @param content The new content of the object item + * + * @note Elementary object items may have many contents + * + * @ingroup General + */ + EAPI void elm_object_item_content_part_set(Elm_Object_Item *it, const char *part, Evas_Object *content); + +#define elm_object_item_content_set(it, content) elm_object_item_content_part_set((it), NULL, (content)) + + /** + * Get a content of an object item + * + * @param it The Elementary object item + * @param part The content part name to unset (NULL for the default content) + * @return content of the object item or NULL for any error + * + * @note Elementary object items may have many contents + * + * @ingroup General + */ + EAPI Evas_Object *elm_object_item_content_part_get(const Elm_Object_Item *it, const char *item); + +#define elm_object_item_content_get(it) elm_object_item_content_part_get((it), NULL) + + /** + * Unset a content of an object item + * + * @param it The Elementary object item + * @param part The content part name to unset (NULL for the default content) + * + * @note Elementary object items may have many contents + * + * @ingroup General + */ + EAPI Evas_Object *elm_object_item_content_part_unset(Elm_Object_Item *it, const char *part); + +#define elm_object_item_content_unset(it, content) elm_object_item_content_part_unset((it), (content)) + + /** + * Set a label of an objec itemt + * + * @param it The Elementary object item + * @param part The text part name to set (NULL for the default label) + * @param label The new text of the label + * + * @note Elementary object items may have many labels + * + * @ingroup General + */ + EAPI void elm_object_item_text_part_set(Elm_Object_Item *it, const char *part, const char *label); + +#define elm_object_item_text_set(it, label) elm_object_item_text_part_set((it), NULL, (label)) + + /** + * Get a label of an object + * + * @param it The Elementary object item + * @param part The text part name to get (NULL for the default label) + * @return text of the label or NULL for any error + * + * @note Elementary object items may have many labels + * + * @ingroup General + */ + EAPI const char *elm_object_item_text_part_get(const Elm_Object_Item *it, const char *part); + + /** + * Set the text to read out when in accessibility mode + * + * @param obj The object which is to be described + * @param txt The text that describes the widget to people with poor or no vision + * + * @ingroup General + */ + EAPI void elm_object_access_info_set(Evas_Object *obj, const char *txt); + + /** + * Set the text to read out when in accessibility mode + * + * @param it The object item which is to be described + * @param txt The text that describes the widget to people with poor or no vision + * + * @ingroup General + */ + EAPI void elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt); + + +#define elm_object_item_text_get(it) elm_object_item_text_part_get((it), NULL) + + /** + * Get the data associated with an object item + * @param it The object item + * @return The data associated with @p it + * + * @ingroup General + */ + EAPI void *elm_object_item_data_get(const Elm_Object_Item *it); + + /** + * Set the data associated with an object item + * @param it The object item + * @param data The data to be associated with @p it + * + * @ingroup General + */ + EAPI void elm_object_item_data_set(Elm_Object_Item *it, void *data); + + /** * @} */ @@ -8070,41 +8234,22 @@ extern "C" { Eina_Bool elm_navigationbar_ex_title_object_visible_get(Elm_Navigationbar_ex_Item* item); /* naviframe */ - #define NAVIFRAME_OPTIONHEADER "elm.swallow.optionheader" - - typedef struct _Elm_Naviframe_Item Elm_Naviframe_Item; - - typedef enum - { - ELM_NAVIFRAME_PREV_BUTTON, - ELM_NAVIFRAME_NEXT_BUTTON - } Elm_Naviframe_Button_Type; + #define ELM_NAVIFRAME_ITEM_ICON "elm.swallow.icon" + #define ELM_NAVIFRAME_ITEM_OPTIONHEADER "elm.swallow.optionheader" + #define ELM_NAVIFRAME_ITEM_TITLE_LABEL "elm.text.title" + #define ELM_NAVIFRAME_ITEM_PREV_BTN "elm.swallow.prev_btn" EAPI Evas_Object *elm_naviframe_add(Evas_Object *parent) EINA_ARG_NONNULL(1); - EAPI Elm_Naviframe_Item *elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style) EINA_ARG_NONNULL(1, 5); + EAPI Elm_Object_Item *elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style) EINA_ARG_NONNULL(1, 5); EAPI Evas_Object *elm_naviframe_item_pop(Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve) EINA_ARG_NONNULL(1); EAPI Eina_Bool elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); - EAPI void elm_naviframe_item_content_set(Elm_Naviframe_Item *item, Evas_Object *content) EINA_ARG_NONNULL(1, 2); - EAPI Evas_Object *elm_naviframe_item_content_get(const Elm_Naviframe_Item *item) EINA_ARG_NONNULL(1); - EAPI Evas_Object *elm_naviframe_item_content_unset(Elm_Naviframe_Item *it) EINA_ARG_NONNULL(1); - EAPI void elm_naviframe_item_title_label_set(Elm_Naviframe_Item *it, const char *label) EINA_ARG_NONNULL(1); - EAPI const char *elm_naviframe_item_title_label_get(const Elm_Naviframe_Item *it) EINA_ARG_NONNULL(1); - EAPI void elm_naviframe_item_subtitle_label_set(Elm_Naviframe_Item *it, const char *label) EINA_ARG_NONNULL(1); - EAPI const char *elm_naviframe_item_subtitle_label_get(const Elm_Naviframe_Item *it) EINA_ARG_NONNULL(1); - EAPI Elm_Naviframe_Item *elm_naviframe_top_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); - EAPI Elm_Naviframe_Item *elm_naviframe_bottom_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); - EAPI void elm_naviframe_item_button_set(Elm_Naviframe_Item *it, Evas_Object *btn, Elm_Naviframe_Button_Type btn_type) EINA_ARG_NONNULL(1); - EAPI Evas_Object *elm_naviframe_item_button_get(const Elm_Naviframe_Item *it, Elm_Naviframe_Button_Type btn_type) EINA_ARG_NONNULL(1); - EAPI void elm_naviframe_item_icon_set(Elm_Naviframe_Item *it, Evas_Object *icon) EINA_ARG_NONNULL(1); - EAPI Evas_Object *elm_naviframe_item_icon_get(const Elm_Naviframe_Item *it) EINA_ARG_NONNULL(1); - EAPI void elm_naviframe_item_style_set(Elm_Naviframe_Item *it, const char *item_style) EINA_ARG_NONNULL(1); - EAPI const char *elm_naviframe_item_style_get(const Elm_Naviframe_Item *it) EINA_ARG_NONNULL(1); - EAPI void elm_naviframe_item_title_visible_set(Elm_Naviframe_Item *it, Eina_Bool visible) EINA_ARG_NONNULL(1); - EAPI Eina_Bool elm_naviframe_item_title_visible_get(const Elm_Naviframe_Item *it) EINA_ARG_NONNULL(1); - EAPI void elm_naviframe_item_extension_set(Elm_Naviframe_Item *it, const char *swallow, Evas_Object *extension) EINA_ARG_NONNULL(1, 2); - EAPI Evas_Object *elm_naviframe_item_extension_unset(Elm_Naviframe_Item *it, const char *swallow) EINA_ARG_NONNULL(1); - EAPI Evas_Object *elm_naviframe_item_extension_get(const Elm_Naviframe_Item *it, const char *swallow) EINA_ARG_NONNULL(1); + EAPI Elm_Object_Item *elm_naviframe_top_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI Elm_Object_Item *elm_naviframe_bottom_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style) EINA_ARG_NONNULL(1); + EAPI const char *elm_naviframe_item_style_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1); + EAPI void elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible) EINA_ARG_NONNULL(1); + EAPI Eina_Bool elm_naviframe_item_title_visible_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1); /* Control Bar */ #define CONTROLBAR_SYSTEM_ICON_ALBUMS "controlbar_albums" @@ -8227,6 +8372,12 @@ typedef enum EAPI void elm_tickernoti_mode_set (Evas_Object *obj, Elm_Tickernoti_Mode mode) EINA_ARG_NONNULL(1); EAPI Elm_Tickernoti_Mode elm_tickernoti_mode_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); /* ############################################################################### */ + /* smart callbacks called: + * @li "clicked" - emitted when tickernoti is clicked, except at the + * swallow/button region, if any. + * @li "hide" - emitted when the tickernoti is completelyhidden. In case of + * any hide animation, this signal is raised after the animation. + */ /* colorpalette */ typedef struct _Colorpalette_Color Elm_Colorpalette_Color; diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 43014c9..2fe5027 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -77,6 +77,7 @@ elm_dialoguegroup.c \ elm_diskselector.c \ elm_editfield.c \ elm_entry.c \ +elm_factory.c \ elm_flip.c \ elm_flipselector.c \ elm_font.c \ diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c index 0c5435b..cb04706 100644 --- a/src/lib/elc_naviframe.c +++ b/src/lib/elc_naviframe.c @@ -2,6 +2,9 @@ #include "elm_priv.h" typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Naviframe_Item Elm_Naviframe_Item; +typedef struct _Elm_Naviframe_Content_Item_Pair Elm_Naviframe_Content_Item_Pair; +typedef struct _Elm_Naviframe_Text_Item_Pair Elm_Naviframe_Text_Item_Pair; struct _Widget_Data { @@ -11,17 +14,27 @@ struct _Widget_Data Eina_Bool pass_events: 1; }; +struct _Elm_Naviframe_Content_Item_Pair +{ + const char *part; + Evas_Object *content; + Elm_Naviframe_Item *it; +}; + +struct _Elm_Naviframe_Text_Item_Pair +{ + const char *part; + const char *text; +}; + struct _Elm_Naviframe_Item { Elm_Widget_Item base; - Evas_Object *title; + Eina_List *content_list; + Eina_List *text_list; Evas_Object *content; - const char *title_label; - const char *title_sublabel; Evas_Object *title_prev_btn; Evas_Object *title_next_btn; - Evas_Object *title_icon; - Evas_Object *extension; const char *style; Eina_Bool back_btn: 1; Eina_Bool title_visible: 1; @@ -38,13 +51,21 @@ static const Evas_Smart_Cb_Description _signals[] = { {NULL, NULL} }; -#define ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, ...) \ - ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *) it, __VA_ARGS__); \ - ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__; - static void _del_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); static void _disable_hook(Evas_Object *obj); +static void _text_set_hook(Elm_Object_Item *it, + const char *part, + const char *label); +static const char *_text_get_hook(const Elm_Object_Item *it, + const char *part); +static void _content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content); +static Evas_Object *_content_get_hook(const Elm_Object_Item *it, + const char *part); +static Evas_Object *_content_unset_hook(Elm_Object_Item *it, + const char *part); static void _sizing_eval(Evas_Object *obj); static void _item_sizing_eval(Elm_Naviframe_Item *it); static void _move(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -59,6 +80,14 @@ static void _back_btn_clicked(void *data, Evas_Object *obj, void *event_info); static Evas_Object *_back_btn_new(Evas_Object *obj); +static void _item_content_del(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _title_content_del(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); static void _title_prev_btn_del(void *data, Evas *e, Evas_Object *obj, @@ -67,18 +96,10 @@ static void _title_next_btn_del(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _title_icon_del(void *data, - Evas *e, - Evas_Object *obj, - void *event_info); -static void _content_del(void *data, - Evas *e, - Evas_Object *obj, - void *event_info); -static void _extension_del(void *data, - Evas *e, - Evas_Object *obj, - void *event_info); +static void _title_content_set(Elm_Naviframe_Item *it, + Elm_Naviframe_Content_Item_Pair *pair, + const char *part, + Evas_Object *content); static void _title_prev_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn, Eina_Bool back_btn); @@ -96,6 +117,8 @@ static void _show_finished(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _item_content_set(Elm_Naviframe_Item *navi_it, + Evas_Object *content); static void _del_hook(Evas_Object *obj) @@ -126,6 +149,191 @@ _disable_hook(Evas_Object *obj __UNUSED__) } static void +_text_set_hook(Elm_Object_Item *it, const char *part, const char *label) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + + Eina_List *l = NULL; + Elm_Naviframe_Text_Item_Pair *pair = NULL; + Elm_Naviframe_Item *navi_it = ELM_CAST(it); + char buf[1024]; + + if (!part) + snprintf(buf, sizeof(buf), "elm.text.title"); + else + snprintf(buf, sizeof(buf), "%s", part); + + EINA_LIST_FOREACH(navi_it->text_list, l, pair) + { + if (!strcmp(buf, pair->part)) + { + if (pair->text) + { + if (!strcmp(pair->text, label)) + return; + } + break; + } + } + + if (!pair) + { + pair = ELM_NEW(Elm_Naviframe_Text_Item_Pair); + if (!pair) + { + ERR("Failed to allocate new text part of the item! : naviframe=%p", navi_it->base.widget); + return; + } + eina_stringshare_replace(&pair->part, buf); + navi_it->text_list = eina_list_append(navi_it->text_list, pair); + } + + eina_stringshare_replace(&pair->text, label); + edje_object_part_text_set(navi_it->base.view, buf, label); + + snprintf(buf, sizeof(buf), "elm,state,%s,show", buf); + + if (label) + edje_object_signal_emit(navi_it->base.view, buf, "elm"); + else + edje_object_signal_emit(navi_it->base.view, buf, "elm"); + + _item_sizing_eval(navi_it); +} + +static const char * +_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Eina_List *l = NULL; + Elm_Naviframe_Text_Item_Pair *pair = NULL; + Elm_Naviframe_Item *navi_it = ELM_CAST(it); + char buf[1024]; + + if (!part) + snprintf(buf, sizeof(buf), "elm.text.title"); + else + snprintf(buf, sizeof(buf), "%s", part); + + EINA_LIST_FOREACH(navi_it->text_list, l, pair) + { + if (!strcmp(buf, pair->part)) + return pair->text; + } + return NULL; +} + +static void +_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + + Elm_Naviframe_Content_Item_Pair *pair = NULL; + Elm_Naviframe_Item *navi_it = ELM_CAST(it); + + //specified parts + if ((!part) || (!strcmp(part, "elm.swallow.content"))) + { + _item_content_set(navi_it, content); + return; + } + else if (!strcmp(part, "elm.swallow.prev_btn")) + { + _title_prev_btn_set(navi_it, content, EINA_FALSE); + return; + } + else if(!strcmp(part, "elm.swallow.next_btn")) + { + _title_next_btn_set(navi_it, content); + return; + } + + //common part + _title_content_set(navi_it, pair, part, content); +} + +/* + */ +static Evas_Object * +_content_get_hook(const Elm_Object_Item *it, + const char *part) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Eina_List *l = NULL; + Elm_Naviframe_Content_Item_Pair *pair = NULL; + Elm_Naviframe_Item *navi_it = ELM_CAST(it); + + //specified parts + if ((!part) || (!strcmp(part, "elm.swallow.content"))) + return navi_it->content; + else if (!strcmp(part, "elm.swallow.prev_btn")) + return navi_it->title_prev_btn; + else if(!strcmp(part, "elm.swallow.next_btn")) + return navi_it->title_next_btn; + + //common parts + EINA_LIST_FOREACH(navi_it->content_list, l, pair) + { + if (!strcmp(part, pair->part)) + return pair->content; + } + return NULL; +} + +static Evas_Object * +_content_unset_hook(Elm_Object_Item *it __UNUSED__, + const char *part __UNUSED__) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Eina_List *l = NULL; + Elm_Naviframe_Content_Item_Pair *pair = NULL; + Elm_Naviframe_Item *navi_it = ELM_CAST(it); + Evas_Object *content = NULL; + char buf[1028]; + + //specified parts + //FIXME: could be unset the below specified contents also. + if (!part || + !strcmp(part, "elm.swallow.content") || + !strcmp(part, "elm.swallow.prev_btn") || + !strcmp(part, "elm.swallow.next_btn")) + { + WRN("You can not unset the content! : naviframe=%p", + navi_it->base.widget); + return NULL; + } + + //common parts + EINA_LIST_FOREACH(navi_it->content_list, l, pair) + { + if (!strcmp(part, pair->part)) + { + content = pair->content; + eina_stringshare_del(pair->part); + navi_it->content_list = eina_list_remove(navi_it->content_list, + pair); + free(pair); + break; + } + } + + if (!content) return NULL; + + elm_widget_sub_object_del(navi_it->base.widget, content); + edje_object_part_unswallow(navi_it->base.view, content); + snprintf(buf, sizeof(buf), "elm,state,%s,hide", part); + edje_object_signal_emit(navi_it->base.view, buf, "elm"); + evas_object_event_callback_del(content, + EVAS_CALLBACK_DEL, + _title_content_del); + _item_sizing_eval(navi_it); + + return content; +} + +static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd; @@ -196,7 +404,7 @@ static Evas_Object * _back_btn_new(Evas_Object *obj) { Evas_Object *btn; - char buf[256]; //FIXME: How to guarantee the size of style name? + char buf[1024]; btn = elm_button_add(obj); if (!btn) return NULL; evas_object_smart_callback_add(btn, "clicked", _back_btn_clicked, obj); @@ -206,6 +414,22 @@ _back_btn_new(Evas_Object *obj) } static void +_title_content_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + char buf[1024]; + Elm_Naviframe_Content_Item_Pair *pair = data; + Elm_Naviframe_Item *it = pair->it; + snprintf(buf, sizeof(buf), "elm,state,%s,hide", pair->part); + edje_object_signal_emit(it->base.view, buf, "elm"); + it->content_list = eina_list_remove(it->content_list, pair); + eina_stringshare_del(pair->part); + free(pair); +} + +static void _title_prev_btn_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, @@ -227,21 +451,10 @@ _title_next_btn_del(void *data, } static void -_title_icon_del(void *data, - Evas *e __UNUSED__, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - Elm_Naviframe_Item *it = data; - it->title_icon = NULL; - edje_object_signal_emit(it->base.view, "elm,state,icon,hide", "elm"); -} - -static void -_content_del(void *data, - Evas *e __UNUSED__, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) +_item_content_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { Elm_Naviframe_Item *it = data; it->content = NULL; @@ -249,20 +462,60 @@ _content_del(void *data, } static void -_extension_del(void *data, - Evas *e, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) +_title_content_set(Elm_Naviframe_Item *it, + Elm_Naviframe_Content_Item_Pair *pair, + const char *part, + Evas_Object *content) { - Elm_Naviframe_Item *it = data; - it->extension = NULL; + Eina_List *l = NULL; + char buf[1024]; + + EINA_LIST_FOREACH(it->content_list, l, pair) + { + if (!strcmp(part, pair->part)) + { + if (pair->content == content) return; + break; + } + } + + if (!pair) + { + pair = ELM_NEW(Elm_Naviframe_Content_Item_Pair); + if (!pair) + { + ERR("Failed to allocate new content part of the item! : naviframe=%p", it->base.widget); + return; + } + pair->it = it; + eina_stringshare_replace(&pair->part, part); + it->content_list = eina_list_append(it->content_list, pair); + } + + if (pair->content) evas_object_del(pair->content); + pair->content = content; + + if (!content) + { + snprintf(buf, sizeof(buf), "elm,state,%s,hide", part); + edje_object_signal_emit(it->base.view, buf, "elm"); + return; + } + + elm_widget_sub_object_add(it->base.widget, content); + edje_object_part_swallow(it->base.view, part, content); + snprintf(buf, sizeof(buf), "elm,state,%s,show", part); + edje_object_signal_emit(it->base.view, buf, "elm"); + evas_object_event_callback_add(content, + EVAS_CALLBACK_DEL, + _title_content_del, + pair); + _item_sizing_eval(it); } static void _title_prev_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn, Eina_Bool back_btn) { - char buf[256]; //FIXME: How to guarantee the size of style name? - if (it->title_prev_btn == btn) return; if (it->title_prev_btn) @@ -272,28 +525,20 @@ _title_prev_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn, Eina_Bool back_btn if (!btn) return; - if (!back_btn) - { - snprintf(buf, - sizeof(buf), - "naviframe/prev_btn/%s", - elm_widget_style_get(it->base.widget)); - elm_object_style_set(btn, buf); - } elm_widget_sub_object_add(it->base.widget, btn); evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, _title_prev_btn_del, it); - edje_object_part_swallow(it->title, "elm.swallow.prev_btn", btn); + edje_object_part_swallow(it->base.view, "elm.swallow.prev_btn", btn); it->back_btn = back_btn; + + _item_sizing_eval(it); } static void _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn) { - char buf[256]; //FIXME: How to guarantee the size of style name? - if (it->title_next_btn == btn) return; if (it->title_next_btn) @@ -303,23 +548,23 @@ _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn) if (!btn) return; - snprintf(buf, - sizeof(buf), - "naviframe/next_btn/%s", - elm_widget_style_get(it->base.widget)); - elm_object_style_set(btn, buf); elm_widget_sub_object_add(it->base.widget, btn); evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, _title_next_btn_del, it); - edje_object_part_swallow(it->title, "elm.swallow.next_btn", btn); + edje_object_part_swallow(it->base.view, "elm.swallow.next_btn", btn); + + _item_sizing_eval(it); } static void _item_del(Elm_Naviframe_Item *it) { Widget_Data *wd; + Eina_List *l; + Elm_Naviframe_Content_Item_Pair *content_pair; + Elm_Naviframe_Text_Item_Pair *text_pair; if (!it) return; @@ -330,14 +575,21 @@ _item_del(Elm_Naviframe_Item *it) evas_object_del(it->title_prev_btn); if (it->title_next_btn) evas_object_del(it->title_next_btn); - if (it->title_icon) - evas_object_del(it->title_icon); - if ((it->content) && (!wd->preserve)) + if ((it->content) && (!wd->preserve)) evas_object_del(it->content); - if (it->extension) - evas_object_del(it->extension); - evas_object_del(it->title); + EINA_LIST_FOREACH(it->content_list, l, content_pair) + evas_object_del(content_pair->content); + + EINA_LIST_FOREACH(it->text_list, l, text_pair) + { + eina_stringshare_del(text_pair->part); + eina_stringshare_del(text_pair->text); + } + + eina_list_free(it->content_list); + eina_list_free(it->text_list); + evas_object_del(it->base.view); wd->stack = eina_list_remove(wd->stack, it); @@ -386,6 +638,29 @@ _show_finished(void *data, evas_object_pass_events_set(wd->base, EINA_FALSE); } +static void +_item_content_set(Elm_Naviframe_Item *navi_it, Evas_Object *content) +{ + if (navi_it->content == content) return; + if (navi_it->content) evas_object_del(navi_it->content); + elm_widget_sub_object_add(navi_it->base.widget, content); + edje_object_part_swallow(navi_it->base.view, "elm.swallow.content", content); + if (content) + edje_object_signal_emit(navi_it->base.view, + "elm,state,content,show", + "elm"); + else + edje_object_signal_emit(navi_it->base.view, + "elm,state,content,hide", + "elm"); + evas_object_event_callback_add(content, + EVAS_CALLBACK_DEL, + _item_content_del, + navi_it); + navi_it->content = content; + _item_sizing_eval(navi_it); +} + EAPI Evas_Object * elm_naviframe_add(Evas_Object *parent) { @@ -416,7 +691,7 @@ elm_naviframe_add(Evas_Object *parent) return obj; } -EAPI Elm_Naviframe_Item * +EAPI Elm_Object_Item * elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; @@ -433,6 +708,13 @@ elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object * ERR("Failed to allocate new item! : naviframe=%p", obj); return NULL; } + + elm_widget_item_text_set_hook_set(it, _text_set_hook); + elm_widget_item_text_get_hook_set(it, _text_get_hook); + elm_widget_item_content_set_hook_set(it, _content_set_hook); + elm_widget_item_content_get_hook_set(it, _content_get_hook); + elm_widget_item_content_unset_hook_set(it, _content_unset_hook); + //item base layout it->base.view = edje_object_add(evas_object_evas_get(obj)); evas_object_smart_member_add(it->base.view, wd->base); @@ -449,21 +731,15 @@ elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object * "elm,action,popped,finished", "", _popped_finished, it); - elm_naviframe_item_style_set(it, item_style); + elm_naviframe_item_style_set(ELM_CAST(it), item_style); //title - it->title = edje_object_add(evas_object_evas_get(obj)); - elm_widget_sub_object_add(obj, it->title); - _elm_theme_object_set(obj, - it->title, "naviframe", - "title", - elm_widget_style_get(obj)); - edje_object_signal_callback_add(it->title, - "elm,action,clicked", + edje_object_signal_callback_add(it->base.view, + "elm,title,clicked", "elm", _title_clicked, it); - elm_naviframe_item_title_label_set(it, title_label); + _text_set_hook(ELM_CAST(it), "elm.text.title", title_label); //title buttons if ((!prev_btn) && (eina_list_count(wd->stack))) @@ -475,14 +751,13 @@ elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object * _title_prev_btn_set(it, prev_btn, EINA_FALSE); _title_next_btn_set(it, next_btn); - edje_object_part_swallow(it->base.view, "elm.swallow.title", it->title); - elm_naviframe_item_content_set(it, content); + _item_content_set(it, content); _item_sizing_eval(it); evas_object_show(it->base.view); - prev_it = elm_naviframe_top_item_get(obj); + prev_it = ELM_CAST(elm_naviframe_top_item_get(obj)); if (prev_it) { if (wd->pass_events) @@ -498,7 +773,7 @@ elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object * edje_object_signal_emit(it->base.view, "elm,state,visible", "elm"); it->title_visible = EINA_TRUE; wd->stack = eina_list_append(wd->stack, it); - return it; + return ELM_CAST(it); } EAPI Evas_Object * @@ -512,14 +787,14 @@ elm_naviframe_item_pop(Evas_Object *obj) wd = elm_widget_data_get(obj); if (!wd) return NULL; - it = elm_naviframe_top_item_get(obj); + it = ELM_CAST(elm_naviframe_top_item_get(obj)); if (!it) return NULL; wd->stack = eina_list_remove(wd->stack, it); if (wd->preserve) content = it->content; - prev_it = elm_naviframe_top_item_get(obj); + prev_it = ELM_CAST(elm_naviframe_top_item_get(obj)); if (prev_it) { if (wd->pass_events) @@ -555,83 +830,7 @@ elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj) return wd->preserve; } -EAPI void -elm_naviframe_item_content_set(Elm_Naviframe_Item *it, Evas_Object *content) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it); - - if (it->content == content) return; - if (it->content) evas_object_del(it->content); - elm_widget_sub_object_add(it->base.widget, content); - edje_object_part_swallow(it->base.view, "elm.swallow.content", content); - if (content) - edje_object_signal_emit(it->base.view, - "elm,state,content,show", - "elm"); - else - edje_object_signal_emit(it->base.view, - "elm,state,content,hide", - "elm"); - evas_object_event_callback_add(content, - EVAS_CALLBACK_DEL, - _content_del, - it); - it->content = content; - _item_sizing_eval(it); -} - -EAPI Evas_Object * -elm_naviframe_item_content_get(const Elm_Naviframe_Item *it) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, NULL); - return it->content; -} - -EAPI void -elm_naviframe_item_title_label_set(Elm_Naviframe_Item *it, const char *label) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it); - - edje_object_part_text_set(it->title, "elm.text.title", label); - if (label) - edje_object_signal_emit(it->title, "elm,state,title,show", "elm"); - else - edje_object_signal_emit(it->title, "elm,state,title,hidew", "elm"); - - eina_stringshare_replace(&it->title_label, label); - _item_sizing_eval(it); -} - -EAPI const char * -elm_naviframe_item_title_label_get(const Elm_Naviframe_Item *it) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, NULL); - return it->title_label; -} - -EAPI void -elm_naviframe_item_subtitle_label_set(Elm_Naviframe_Item *it, const char *label) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it); - - edje_object_part_text_set(it->title, "elm.text.subtitle", label); - if (label) - edje_object_signal_emit(it->title, "elm,state,subtitle,show", "elm"); - else - edje_object_signal_emit(it->title, "elm,state,subtitle,hide", "elm"); - - eina_stringshare_replace(&it->title_sublabel, label); - _item_sizing_eval(it); -} - -EAPI const char * -elm_naviframe_item_subtitle_label_get(const Elm_Naviframe_Item *it) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, NULL); - return it->title_sublabel; -} - -EAPI Elm_Naviframe_Item* +EAPI Elm_Object_Item* elm_naviframe_top_item_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; @@ -640,7 +839,7 @@ elm_naviframe_top_item_get(const Evas_Object *obj) return eina_list_last(wd->stack)->data; } -EAPI Elm_Naviframe_Item* +EAPI Elm_Object_Item* elm_naviframe_bottom_item_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; @@ -650,80 +849,10 @@ elm_naviframe_bottom_item_get(const Evas_Object *obj) } EAPI void -elm_naviframe_item_button_set(Elm_Naviframe_Item *it, Evas_Object *btn, Elm_Naviframe_Button_Type btn_type) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it); - - switch(btn_type) - { - case ELM_NAVIFRAME_PREV_BUTTON: - _title_prev_btn_set(it, btn, EINA_FALSE); - break; - case ELM_NAVIFRAME_NEXT_BUTTON: - _title_next_btn_set(it, btn); - break; - default: - WRN("Button type is invalid! : naviframe=%p", it->base.widget); - break; - } - _item_sizing_eval(it); -} - -EAPI Evas_Object * -elm_naviframe_item_button_get(const Elm_Naviframe_Item *it, Elm_Naviframe_Button_Type btn_type) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, NULL); - - switch(btn_type) - { - case ELM_NAVIFRAME_PREV_BUTTON: - return it->title_prev_btn; - case ELM_NAVIFRAME_NEXT_BUTTON: - return it->title_next_btn; - default: - WRN("Button type is invalid! : naviframe=%p", it->base.widget); - break; - } - return NULL; -} - -EAPI void -elm_naviframe_item_icon_set(Elm_Naviframe_Item *it, Evas_Object *icon) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it); - - Widget_Data *wd = elm_widget_data_get(it->base.widget); - if (!wd) return; - - if (it->title_icon == icon) return; - if (it->title_icon) evas_object_del(it->title_icon); - it->title_icon = icon; - if (!icon) - { - edje_object_signal_emit(it->title, - "elm,state,icon,hide", - "elm"); - return; - } - elm_widget_sub_object_add(it->base.widget, icon); - edje_object_part_swallow(it->title, "elm.swallow.icon", icon); - edje_object_signal_emit(it->title, "elm,state,icon,show", "elm"); - - evas_object_event_callback_add(icon, EVAS_CALLBACK_DEL, _title_icon_del, it); - _item_sizing_eval(it); -} - -EAPI Evas_Object * -elm_naviframe_item_icon_get(const Elm_Naviframe_Item *it) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, NULL); - return it->title_icon; -} - -EAPI void -elm_naviframe_item_style_set(Elm_Naviframe_Item *it, const char *item_style) +elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style) { - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it); + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Naviframe_Item *navi_it = ELM_CAST(it); char buf[256]; @@ -731,91 +860,47 @@ elm_naviframe_item_style_set(Elm_Naviframe_Item *it, const char *item_style) else { if (strlen(item_style) > sizeof(buf)) - WRN("too much long style name! : naviframe=%p", it->base.widget); + WRN("too much long style name! : naviframe=%p", navi_it->base.widget); else sprintf(buf, "item/%s", item_style); } - _elm_theme_object_set(it->base.widget, - it->base.view, + _elm_theme_object_set(navi_it->base.widget, + navi_it->base.view, "naviframe", buf, - elm_widget_style_get(it->base.widget)); + elm_widget_style_get(navi_it->base.widget)); } EAPI const char * -elm_naviframe_item_style_get(const Elm_Naviframe_Item *it) +elm_naviframe_item_style_get(const Elm_Object_Item *it) { - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, NULL); - return it->style; + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Naviframe_Item *navi_it = ELM_CAST(it); + return navi_it->style; } EAPI void -elm_naviframe_item_title_visible_set(Elm_Naviframe_Item *it, Eina_Bool visible) +elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible) { - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it); + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Naviframe_Item *navi_it = ELM_CAST(it); visible = !!visible; - if (it->title_visible == visible) return; + if (navi_it->title_visible == visible) return; if (visible) - edje_object_signal_emit(it->base.view, "elm,state,title,show", "elm"); + edje_object_signal_emit(navi_it->base.view, "elm,state,title,show", "elm"); else - edje_object_signal_emit(it->base.view, "elm,state,title,hide", "elm"); + edje_object_signal_emit(navi_it->base.view, "elm,state,title,hide", "elm"); - it->title_visible = visible; + navi_it->title_visible = visible; } EAPI Eina_Bool -elm_naviframe_item_title_visible_get(const Elm_Naviframe_Item *it) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, EINA_FALSE); - return it->title_visible; -} - -EAPI void -elm_naviframe_item_extension_set(Elm_Naviframe_Item *it, const char *swallow, Evas_Object *extension) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it); - Evas_Object *prev; - if (!swallow) - { - WRN("swallow part should not be NULL! : naviframe=%p", it->base.widget); - return; - } - if (it->extension) evas_object_del(it->extension); - it->extension = extension; - if (!extension) return; - evas_object_event_callback_add(extension, EVAS_CALLBACK_DEL, _extension_del, it); - if (!edje_object_part_swallow(it->base.view, swallow, extension)) - return; - elm_widget_sub_object_add(it->base.widget, extension); - edje_object_signal_emit(it->base.view, - "elm,state,extension,show", - "elm"); - _sizing_eval(it->base.view); -} - -EAPI Evas_Object * -elm_naviframe_item_extension_unset(Elm_Naviframe_Item *it, const char *swallow) +elm_naviframe_item_title_visible_get(const Elm_Object_Item *it) { - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, NULL); - - Evas_Object *extension = it->extension; - if (!extension) return NULL; - edje_object_part_unswallow(it->base.view, extension); - elm_widget_sub_object_del(it->base.widget, extension); - evas_object_event_callback_del(extension, EVAS_CALLBACK_DEL, _extension_del); - edje_object_signal_emit(it->base.view, - "elm,state,extension,hide", - "elm"); - _sizing_eval(it->base.widget); - it->extension = NULL; - return extension; + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + Elm_Naviframe_Item *navi_it = ELM_CAST(it); + return navi_it->title_visible; } -EAPI Evas_Object * -elm_naviframe_item_extension_get(const Elm_Naviframe_Item *it, const char *swallow) -{ - ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, NULL); - return edje_object_part_swallow_get(it->base.view, swallow); -} diff --git a/src/lib/elm_button.c b/src/lib/elm_button.c index c0e348e..33ed125 100644 --- a/src/lib/elm_button.c +++ b/src/lib/elm_button.c @@ -19,17 +19,19 @@ struct _Widget_Data { Evas_Object *btn, *icon; const char *label; - Eina_Bool autorepeat; - Eina_Bool repeating; double ar_threshold; double ar_interval; Ecore_Timer *timer; const char *statelabel[4]; int statetype[4]; + Eina_Bool autorepeat : 1; + Eina_Bool repeating : 1; + Eina_Bool delete_me : 1; }; static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _del_pre_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); static void _disable_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); @@ -79,6 +81,14 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty } static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->delete_me = EINA_TRUE; +} + +static void _del_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -207,6 +217,7 @@ _sizing_eval(Evas_Object *obj) Evas_Coord w, h; if (!wd) return; + if (wd->delete_me) return; elm_coords_finger_size_adjust(1, &minw, 1, &minh); edje_object_size_min_restricted_calc(wd->btn, &minw, &minh, minw, minh); elm_coords_finger_size_adjust(1, &minw, 1, &minh); @@ -386,6 +397,7 @@ elm_button_add(Evas_Object *parent) elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); elm_widget_data_set(obj, wd); elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); elm_widget_theme_hook_set(obj, _theme_hook); elm_widget_disable_hook_set(obj, _disable_hook); elm_widget_can_focus_set(obj, EINA_TRUE); diff --git a/src/lib/elm_conform.c b/src/lib/elm_conform.c index 420469e..d5faa27 100644 --- a/src/lib/elm_conform.c +++ b/src/lib/elm_conform.c @@ -25,6 +25,7 @@ struct _Widget_Data Evas_Object *shelf, *panel, *virtualkeypad; Evas_Object *content; Evas_Object *scroller; + Evas_Object *layout; #ifdef HAVE_ELEMENTARY_X Ecore_Event_Handler *prop_hdl; Ecore_X_Virtual_Keyboard_State vkb_state; @@ -112,10 +113,7 @@ _theme_hook(Evas_Object *obj) _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->base, "conformant", "base", elm_widget_style_get(obj)); - _swallow_conformant_parts(obj); - if (wd->content) - edje_object_part_swallow(wd->base, "elm.swallow.content", wd->content); edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); @@ -252,9 +250,9 @@ _changed_size_hints(void *data, Evas *e __UNUSED__, } static void -_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +_sub_del(void *data, Evas_Object *obj __UNUSED__, void *event_info) { - Widget_Data *wd = elm_widget_data_get(obj); + Widget_Data *wd = elm_widget_data_get(data); Evas_Object *sub = event_info; if (!wd) return; @@ -262,12 +260,13 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) { evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _changed_size_hints, obj); + _changed_size_hints, data); wd->content = NULL; - _sizing_eval(obj); + _sizing_eval(data); } } + /* unused now - but meant to be for making sure the focused widget is always * visible when the vkbd comes and goes by moving the conformant obj (and thus * its children) to show the focused widget (and if focus changes follow) @@ -479,6 +478,12 @@ elm_conformant_add(Evas_Object *parent) _elm_theme_object_set(obj, wd->base, "conformant", "base", "default"); elm_widget_resize_object_set(obj, wd->base); + wd->layout = elm_layout_add(obj); + edje_object_part_swallow(wd->base, "elm.swallow.content", wd->layout); + elm_layout_theme_set(wd->layout, "conformant", "layout", "content"); + + _swallow_conformant_parts(obj); + #ifdef HAVE_ELEMENTARY_X Evas_Object *top = elm_widget_top_get(obj); Ecore_X_Window xwin = elm_win_xwindow_get(top); @@ -497,7 +502,7 @@ elm_conformant_add(Evas_Object *parent) evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _conformant_move_resize_event_cb, obj); #endif - evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_smart_callback_add(wd->layout, "sub-object-del", _sub_del, obj); _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); @@ -526,13 +531,12 @@ elm_conformant_content_set(Evas_Object *obj, Evas_Object *content) if (wd->content == content) return; if (wd->content) evas_object_del(wd->content); wd->content = content; - if (content) + if (wd->content) { - elm_widget_sub_object_add(obj, content); - evas_object_event_callback_add(content, + elm_layout_content_set(wd->layout, "elm.swallow.content", wd->content); + evas_object_event_callback_add( wd->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); - edje_object_part_swallow(wd->base, "elm.swallow.content", content); } _sizing_eval(obj); } @@ -577,8 +581,7 @@ elm_conformant_content_unset(Evas_Object *obj) if (!wd) return NULL; if (!wd->content) return NULL; content = wd->content; - elm_widget_sub_object_del(obj, wd->content); - edje_object_part_unswallow(wd->base, wd->content); + elm_layout_content_unset(wd->layout, "elm.swallow.content"); wd->content = NULL; return content; } @@ -602,6 +605,6 @@ elm_conformant_content_area_get(const Evas_Object *obj) /*Finger waggle warning*/ _elm_dangerous_call_check(__FUNCTION__); - return (Evas_Object *)edje_object_part_object_get(wd->base, "elm.swallow.content"); + return wd->layout; } diff --git a/src/lib/elm_imageslider.c b/src/lib/elm_imageslider.c index 71c9c92..d3c112c 100644 --- a/src/lib/elm_imageslider.c +++ b/src/lib/elm_imageslider.c @@ -49,9 +49,9 @@ struct _Imageslider_Item const char *photo_file; void (*func) (void *data, Evas_Object *obj, void *event_info); void *data; - Evas_Coord x, y, w, h; - Evas_Coord ox, oy, ow, oh; - int moving:1; + //Evas_Coord x, y, w, h; + //Evas_Coord ox, oy, ow, oh; + //int moving:1; }; // Image Slider Widget Data. @@ -78,7 +78,6 @@ struct _Widget_Data int moving:1; Eina_Bool on_zoom:1; - Eina_Bool on_hold:1; int dx, dy, mx, my; int mdx, mdy, mmx, mmy; int dratio; @@ -179,7 +178,7 @@ _theme_hook(Evas_Object *obj) for (i = 0; i < BLOCK_MAX; i++) { if (wd->ly[i]) - _elm_theme_object_set(obj, wd->ly[i], "imageslider", "base", + elm_layout_theme_set(wd->ly[i], "imageslider", "base", elm_object_style_get(obj)); evas_object_show(wd->ly[i]); } @@ -359,9 +358,9 @@ _imageslider_obj_move(Widget_Data * wd, Evas_Coord step) { wd->step = -ANI_STEP; wd->move_x += wd->w; - _imageslider_obj_shift(wd, 0); + _imageslider_obj_shift(wd, EINA_FALSE); } - wd->moving = 1; + wd->moving = EINA_TRUE; } else if (step < 0) { @@ -375,9 +374,9 @@ _imageslider_obj_move(Widget_Data * wd, Evas_Coord step) { wd->step = ANI_STEP; wd->move_x -= wd->w; - _imageslider_obj_shift(wd, 1); + _imageslider_obj_shift(wd, EINA_TRUE); } - wd->moving = 1; + wd->moving = EINA_TRUE; } else { @@ -385,7 +384,7 @@ _imageslider_obj_move(Widget_Data * wd, Evas_Coord step) wd->step = ANI_STEP; else wd->step = -ANI_STEP; - wd->moving = 0; + wd->moving = EINA_FALSE; } _imageslider_update(wd); @@ -407,7 +406,7 @@ _ev_imageslider_down_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj, void wd->timestamp = ev->timestamp; wd->move_cnt = MOVE_STEP; - wd->dx = ev->canvas.x; + /*wd->dx = ev->canvas.x; wd->dy = ev->canvas.y; wd->mx = ev->canvas.x; wd->my = ev->canvas.y; @@ -421,10 +420,10 @@ _ev_imageslider_down_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj, void if (iw != wd->w) { + printf("Zooming\n"); wd->on_zoom = EINA_TRUE; edje_object_signal_emit(elm_layout_edje_get(obj), "block.off", "block"); - } - + }*/ } // Whenever MOUSE UP event occurs, Call this function. @@ -502,7 +501,7 @@ _ev_imageslider_up_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED } -// Whenever MOUSE MOVE event occurs, Call this API. +// Whenever MOUSE MOVE event occurs, Call this static void _ev_imageslider_move_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj, void *event_info) { @@ -523,51 +522,27 @@ _ev_imageslider_move_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj, void if (wd->move_cnt == MOVE_STEP) { - if (wd->on_hold == EINA_FALSE) - { - wd->move_cnt = 0; + wd->move_cnt = 0; - if (ev->buttons) - { - step = ev->cur.canvas.x - wd->down_pos.x; - if (step > 0) - idx = BLOCK_LEFT; - else - idx = BLOCK_RIGHT; - - wd->move_x = wd->x + ((ev->cur.canvas.x - wd->down_pos.x)); - wd->move_y = wd->y + ((ev->cur.canvas.y - wd->down_pos.y)); - - if (wd->on_zoom) - { - _imageslider_update_center_pos(wd, wd->move_x, wd->move_y, wd->y, wd->w); - } - else - { - _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w); - } - } - } - else + if (ev->buttons) { - wd->mx = ev->cur.canvas.x; - wd->my = ev->cur.canvas.y; + step = ev->cur.canvas.x - wd->down_pos.x; + if (step > 0) + idx = BLOCK_LEFT; + else + idx = BLOCK_RIGHT; - wd->ratio = - sqrt((wd->mx - wd->mmx) * (wd->mx - wd->mmx) + (wd->my - wd->mmy) * (wd->my - wd->mmy)); + wd->move_x = wd->x + ((ev->cur.canvas.x - wd->down_pos.x)); + wd->move_y = wd->y + ((ev->cur.canvas.y - wd->down_pos.y)); - eo = (Evas_Object*)elm_layout_content_get((const Evas_Object*)obj, "swl.photo"); - if (eo) + /*if (wd->on_zoom) { - it = eina_list_data_get(wd->cur); - if (((it->w * wd->ratio / wd->dratio) / it->ow) < MAX_ZOOM_SIZE) - { - edje_object_part_unswallow(elm_layout_edje_get(obj), eo); - evas_object_resize(eo, it->w * wd->ratio / wd->dratio, it->h * wd->ratio / wd->dratio); - evas_object_size_hint_min_set(eo, it->w * wd->ratio / wd->dratio, it->h * wd->ratio / wd->dratio); - elm_layout_content_set(obj, "swl.photo", eo); - } + _imageslider_update_center_pos(wd, wd->move_x, wd->move_y, wd->y, wd->w); } + else + {*/ + _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w); + //} } } wd->move_cnt++; @@ -673,7 +648,7 @@ _check_zoom(void *data) if ((iw != wd->w) || ((dx != 0) || (dy != 0))) { wd->on_zoom = EINA_TRUE; - edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "block.off", "block"); + //edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "block.off", "block"); } else { @@ -696,8 +671,8 @@ _timer_cb(void *data) int ret; wd = data; - if (wd->ani_lock == 0) - return 0; + if (wd->ani_lock == EINA_FALSE) + return EINA_FALSE; gettimeofday(&tv, NULL); @@ -721,7 +696,7 @@ _timer_cb(void *data) if (wd->move_x == wd->x) { - wd->ani_lock = 0; + wd->ani_lock = EINA_FALSE; if (wd->cur) { it = eina_list_data_get(wd->cur); @@ -736,7 +711,7 @@ _timer_cb(void *data) ret = _check_drag(BLOCK_LEFT, wd); ret = _check_drag(BLOCK_RIGHT, wd); - _check_zoom(wd); + //_check_zoom(wd); if (!wd->queue_idler) wd->queue_idler = ecore_idler_add(_icon_to_image, wd); @@ -764,7 +739,7 @@ _anim(Widget_Data * wd) return; } - wd->ani_lock = 1; + wd->ani_lock = EINA_TRUE; w = wd->move_x; gettimeofday(&wd->tv, NULL); @@ -810,17 +785,15 @@ _imageslider_update(Widget_Data * wd) if (!eo) { eo = elm_image_add(wd->obj); - elm_layout_content_set(wd->ly[i], "swl.photo", eo); //elm_image_prescale_set(eo, wd->w); elm_image_file_set(eo, it->photo_file, NULL); - elm_image_object_size_get(eo, &it->w, &it->h); - evas_object_geometry_get(eo, &it->ox, &it->oy, &it->ow, &it->oh); - it->ow = it->w; - it->oh = it->h; elm_layout_content_set(wd->ly[i], "swl.photo", eo); + //elm_image_object_size_get(eo, &it->w, &it->h); + //evas_object_geometry_get(eo, &it->ox, &it->oy, &it->ow, &it->oh); + //it->ow = it->w; + //it->oh = it->h; } - - if (wd->moving != it->moving) + /*if (wd->moving != it->moving) { it->moving = wd->moving; if (wd->moving) @@ -831,7 +804,7 @@ _imageslider_update(Widget_Data * wd) { //elm_image_prescale_set(eo, it->w > it->h ? it->w : it->h); } - } + }*/ } } @@ -841,8 +814,8 @@ _imageslider_update(Widget_Data * wd) /** * Add an Image Slider widget * -* @param parent The parent object -* @return The new Image slider object or NULL if it cannot be created +* @param parent The parent object +* @return The new Image slider object or NULL if it cannot be created * * @ingroup Imageslider */ @@ -865,6 +838,7 @@ elm_imageslider_add(Evas_Object *parent) elm_widget_theme_hook_set(obj, _theme_hook); wd->clip = evas_object_rectangle_add(e); + elm_widget_sub_object_add(obj, wd->clip); elm_widget_resize_object_set(obj, wd->clip); for (i = 0; i < BLOCK_MAX; i++) @@ -897,11 +871,11 @@ elm_imageslider_add(Evas_Object *parent) /** * Append an Image Slider item * -* @param obj The Image Slider object -* @param photo_file photo file path -* @param func callback function -* @param data callback data -* @return The Image Slider item handle or NULL +* @param obj The Image Slider object +* @param photo_file photo file path +* @param func callback function +* @param data callback data +* @return The Image Slider item handle or NULL * * @ingroup Imageslider */ @@ -936,14 +910,14 @@ elm_imageslider_item_append(Evas_Object *obj, const char *photo_file, Elm_Images /** * Insert an Image Slider item into the Image Slider Widget by using the given index. * -* @param obj The Image Slider object -* @param photo_file photo file path -* @param func callback function -* @param index required position -* @param data callback data -* @return The Image Slider item handle or NULL +* @param obj The Image Slider object +* @param photo_file photo file path +* @param func callback function +* @param index required position +* @param data callback data +* @return The Image Slider item handle or NULL * -* @ingroup Imageslider +* @ingroup Imageslider */ EAPI Elm_Imageslider_Item * elm_imageslider_item_append_relative(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, unsigned int index, void *data) @@ -981,11 +955,11 @@ elm_imageslider_item_append_relative(Evas_Object *obj, const char *photo_file, E /** * Prepend Image Slider item * -* @param obj The Image Slider object -* @param photo_file photo file path -* @param func callback function -* @param data callback data -* @return The imageslider item handle or NULL +* @param obj The Image Slider object +* @param photo_file photo file path +* @param func callback function +* @param data callback data +* @return The imageslider item handle or NULL * * @ingroup Imageslider */ @@ -1018,7 +992,7 @@ elm_imageslider_item_prepend(Evas_Object *obj, const char *photo_file, Elm_Image /** * Delete the selected Image Slider item * -* @param it The selected Image Slider item handle +* @param it The selected Image Slider item handle * * @ingroup Imageslider */ @@ -1054,7 +1028,7 @@ elm_imageslider_item_del(Elm_Imageslider_Item * it) /** * Get the selected Image Slider item * -* @param obj The Image Slider object +* @param obj The Image Slider object * @return The selected Image Slider item or NULL * * @ingroup Imageslider @@ -1077,7 +1051,7 @@ elm_imageslider_selected_item_get(Evas_Object *obj) /** * Get whether an Image Slider item is selected or not * -* @param it the selected Image Slider item +* @param it the selected Image Slider item * @return EINA_TRUE or EINA_FALSE * * @ingroup Imageslider @@ -1103,7 +1077,7 @@ elm_imageslider_item_selected_get(Elm_Imageslider_Item * it) /** * Set the selected Image Slider item * -* @param it The Imaga Slider item +* @param it The Imaga Slider item * * @ingroup Imageslider */ @@ -1145,7 +1119,7 @@ elm_imageslider_item_selected_set(Elm_Imageslider_Item * it) /** * Get the photo file path of given Image Slider item * -* @param it The Image Slider item +* @param it The Image Slider item * @return The photo file path or NULL; * * @ingroup Imageslider @@ -1182,7 +1156,7 @@ elm_imageslider_item_photo_file_set(Elm_Imageslider_Item *it, const char *photo_ /** * Get the previous Image Slider item * -* @param it The Image Slider item +* @param it The Image Slider item * @return The previous Image Slider item or NULL * * @ingroup Imageslider @@ -1216,7 +1190,7 @@ elm_imageslider_item_prev(Elm_Imageslider_Item * it) /** * Get the next Image Slider item * -* @param it The Image Slider item +* @param it The Image Slider item * @return The next Image Slider item or NULL * * @ingroup Imageslider @@ -1250,7 +1224,7 @@ elm_imageslider_item_next(Elm_Imageslider_Item * it) /** * Move to the previous Image Slider item * -* @param obj The Image Slider object +* @param obj The Image Slider object * * @ingroup Imageslider */ @@ -1307,12 +1281,12 @@ elm_imageslider_item_update(Elm_Imageslider_Item *it) if (!it || (!(wd = elm_widget_data_get(it->obj)))) return; ELM_CHECK_WIDTYPE(it->obj, widtype); + if (wd->ani_lock == EINA_TRUE) return; if (it == eina_list_data_get(eina_list_prev(wd->cur))) elm_layout_content_set(wd->ly[BLOCK_LEFT], "swl.photo", NULL); else if (it == eina_list_data_get(wd->cur)) elm_layout_content_set(wd->ly[BLOCK_CENTER], "swl.photo", NULL); - else if (it == eina_list_data_get(eina_list_prev(wd->cur))) + else if (it == eina_list_data_get(eina_list_next(wd->cur))) elm_layout_content_set(wd->ly[BLOCK_RIGHT], "swl.photo", NULL); - _imageslider_update(wd); } diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c index c404a7e..669a093 100644 --- a/src/lib/elm_main.c +++ b/src/lib/elm_main.c @@ -1205,17 +1205,38 @@ elm_object_scale_get(const Evas_Object *obj) } EAPI void -elm_object_text_part_set(Evas_Object *obj, const char *item, const char *label) +elm_object_text_part_set(Evas_Object *obj, const char *part, const char *label) { EINA_SAFETY_ON_NULL_RETURN(obj); - elm_widget_text_part_set(obj, item, label); + elm_widget_text_part_set(obj, part, label); } EAPI const char * -elm_object_text_part_get(const Evas_Object *obj, const char *item) +elm_object_text_part_get(const Evas_Object *obj, const char *part) { EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); - return elm_widget_text_part_get(obj, item); + return elm_widget_text_part_get(obj, part); +} + +EAPI void +elm_object_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_content_part_set(obj, part, content); +} + +EAPI Evas_Object * +elm_object_content_part_get(const Evas_Object *obj, const char *part) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_content_part_get(obj, part); +} + +EAPI Evas_Object * +elm_object_content_part_unset(Evas_Object *obj, const char *part) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_content_part_unset(obj, part); } /** @@ -3495,3 +3516,38 @@ elm_longpress_timeout_get(void) { return _elm_config->longpress_timeout; } + +EAPI void +elm_object_item_content_part_set(Elm_Object_Item *it, + const char *part, + Evas_Object *content) +{ + elm_widget_item_content_part_set(it, part, content); +} + +EAPI Evas_Object * +elm_object_item_content_part_get(const Elm_Object_Item *it, + const char *part) +{ + return elm_widget_item_content_part_get(it, part); +} + +EAPI Evas_Object * +elm_object_item_content_part_unset(Elm_Object_Item *it, const char *part) +{ + return elm_widget_item_content_part_unset(it, part); +} + +EAPI void +elm_object_item_text_part_set(Elm_Object_Item *it, + const char *part, + const char *label) +{ + elm_widget_item_text_part_set(it, part, label); +} + +EAPI const char * +elm_object_item_text_part_get(const Elm_Object_Item *it, const char *part) +{ + return elm_widget_item_text_part_get(it, part); +} diff --git a/src/lib/elm_multibuttonentry.c b/src/lib/elm_multibuttonentry.c index c34c522..0c1b989 100644 --- a/src/lib/elm_multibuttonentry.c +++ b/src/lib/elm_multibuttonentry.c @@ -168,10 +168,10 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) ecore_imf_context_input_panel_show(imf_context); evas_object_focus_set(obj, EINA_TRUE); } - else if ((imf_context) && (!wd->current)) + else if ((imf_context) && (!wd->current) || (!eina_list_count(wd->items))) { + _view_update(obj); ecore_imf_context_input_panel_show(imf_context); - elm_object_focus(wd->entry); } } else @@ -737,10 +737,13 @@ _resize_button(Evas_Object *btn, Evas_Coord *realw, Evas_Coord *vieww) Evas_Coord w_text, h_btn, padding_outer, padding_inner; Evas_Coord w_btn = 0, button_max_width = 0; const char *size_str; + const char *ellipsis = ""; size_str = edje_object_data_get(btn, "button_max_size"); if (size_str) button_max_width = (Evas_Coord)atoi(size_str); + const char *button_text = edje_object_part_text_get(btn, "elm.btn.text"); + // decide the size of button edje_object_part_geometry_get(btn, "elm.base", NULL, NULL, NULL, &h_btn); edje_object_part_geometry_get(btn, "elm.btn.text", NULL, NULL, &w_text, NULL); @@ -749,7 +752,15 @@ _resize_button(Evas_Object *btn, Evas_Coord *realw, Evas_Coord *vieww) w_btn = w_text + 2*padding_outer + 2*padding_inner; rw = w_btn; - vw = (button_max_width < w_btn) ? button_max_width : w_btn; + + if (button_max_width < w_btn) + { + vw = button_max_width; + edje_object_part_text_set(btn, "elm.btn.text", ellipsis); + edje_object_part_text_append(btn, "elm.btn.text", button_text); + } + else + vw = w_btn; //resize btn evas_object_resize(btn, vw, h_btn); diff --git a/src/lib/elm_tickernoti.c b/src/lib/elm_tickernoti.c index 4476c2b..a69995b 100644 --- a/src/lib/elm_tickernoti.c +++ b/src/lib/elm_tickernoti.c @@ -31,6 +31,13 @@ static void _del_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_HIDDEN[] = "hide"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {SIG_HIDDEN, ""}, + {NULL, NULL} +}; static void _del_job(void *data) { @@ -103,11 +110,12 @@ static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + Evas_Coord minw = -1, minh = -1; if (!wd) return; - edje_object_size_min_calc(wd->win, &minw, &minh); -//TODO: + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->edje_obj, &minw, &minh, minw, minh); + evas_object_size_hint_min_set(obj, minw, minh); } #ifdef HAVE_ELEMENTARY_X @@ -142,7 +150,17 @@ static void _hide_cb (void *data, Evas_Object *obj __UNUSED__, if (!wd) return; evas_object_hide (wd->win); - evas_object_smart_callback_call (data, "hide", NULL); + evas_object_smart_callback_call (data, SIG_HIDDEN, NULL); +} + +static void _clicked_cb (void *data, Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd) return; + evas_object_smart_callback_call (data, SIG_CLICKED, NULL); } static Evas_Object @@ -193,6 +211,7 @@ _create_tickernoti (Evas_Object *obj) #endif edje_object_signal_callback_add(wd->edje_obj, "request,hide", "", _hide_cb, obj); + edje_object_signal_callback_add(wd->edje_obj, "clicked", "", _clicked_cb, obj); evas_object_show (wd->edje_obj); } @@ -278,7 +297,7 @@ elm_tickernoti_add(Evas_Object *parent) evas_object_event_callback_add (obj, EVAS_CALLBACK_SHOW, _show, NULL); evas_object_event_callback_add (obj, EVAS_CALLBACK_HIDE, _hide, NULL); - + evas_object_smart_callbacks_descriptions_set(obj, _signals); return obj; } @@ -431,7 +450,7 @@ elm_tickernoti_rotation_set (Evas_Object *obj, int angle) /* * manual calculate win_tickernoti_indi window position & size - * - win_indi is not full size window (480 x 27) + * - win_indi is not full size window */ ecore_x_window_size_get (ecore_x_window_root_first_get(), &root_w, &root_h); diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index e73ddbc..0a61b9c 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -10,6 +10,12 @@ static const char SMART_NAME[] = "elm_widget"; Smart_Data * sd = evas_object_smart_data_get(obj); \ if (!sd) return; +#undef elm_widget_text_set_hook_set +#undef elm_widget_text_get_hook_set +#undef elm_widget_content_set_hook_set +#undef elm_widget_content_get_hook_set +#undef elm_widget_content_unset_hook_set + typedef struct _Smart_Data Smart_Data; typedef struct _Edje_Signal_Data Edje_Signal_Data; typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data; @@ -70,11 +76,11 @@ struct _Smart_Data Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); - void (*on_text_set_func)(Evas_Object *obj, - const char *item, - const char *text); - const char *(*on_text_get_func)(const Evas_Object *obj, - const char *item); + Elm_Widget_On_Text_Set_Cb on_text_set_func; + Elm_Widget_On_Text_Get_Cb on_text_get_func; + Elm_Widget_On_Content_Set_Cb on_content_set_func; + Elm_Widget_On_Content_Get_Cb on_content_get_func; + Elm_Widget_On_Content_Unset_Cb on_content_unset_func; void *data; Evas_Coord rx, ry, rw, rh; int scroll_hold; @@ -96,6 +102,7 @@ struct _Smart_Data Eina_Bool can_focus : 1; Eina_Bool child_can_focus : 1; Eina_Bool focused : 1; + Eina_Bool top_win_focused : 1; Eina_Bool tree_unfocusable : 1; Eina_Bool highlight_ignore : 1; Eina_Bool highlight_in_theme : 1; @@ -323,12 +330,13 @@ _parent_focus(Evas_Object *obj) focus_order++; sd->focus_order = focus_order; - sd->focused = EINA_TRUE; - if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj); - if (sd->focus_func) sd->focus_func(obj); - - _elm_widget_focus_region_show(obj); - + if (sd->top_win_focused) + { + sd->focused = EINA_TRUE; + if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj); + if (sd->focus_func) sd->focus_func(obj); + _elm_widget_focus_region_show(obj); + } sd->focus_order_on_calc = EINA_FALSE; } @@ -497,9 +505,7 @@ elm_widget_event_hook_set(Evas_Object *obj, EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, - void (*func)(Evas_Object *obj, - const char *item, - const char *text)) + Elm_Widget_On_Text_Set_Cb func) { API_ENTRY return; sd->on_text_set_func = func; @@ -507,14 +513,37 @@ elm_widget_text_set_hook_set(Evas_Object *obj, EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, - const char *(*func)(const Evas_Object *obj, - const char *item)) + Elm_Widget_On_Text_Get_Cb func) { API_ENTRY return; sd->on_text_get_func = func; } EAPI void +elm_widget_content_set_hook_set(Evas_Object *obj, + Elm_Widget_On_Content_Set_Cb func) +{ + API_ENTRY return; + sd->on_content_set_func = func; +} + +EAPI void +elm_widget_content_get_hook_set(Evas_Object *obj, + Elm_Widget_On_Content_Get_Cb func) +{ + API_ENTRY return; + sd->on_content_get_func = func; +} + +EAPI void +elm_widget_content_unset_hook_set(Evas_Object *obj, + Elm_Widget_On_Content_Unset_Cb func) +{ + API_ENTRY return; + sd->on_content_unset_func = func; +} + +EAPI void elm_widget_changed_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)) { @@ -842,6 +871,7 @@ elm_widget_sub_object_add(Evas_Object *obj, if (sd2->parent_obj) elm_widget_sub_object_del(sd2->parent_obj, sobj); sd2->parent_obj = obj; + sd2->top_win_focused = sd->top_win_focused; if (!sd->child_can_focus && (_is_focusable(sobj))) sd->child_can_focus = EINA_TRUE; } @@ -986,7 +1016,11 @@ elm_widget_resize_object_set(Evas_Object *obj, if (_elm_widget_is(sd->resize_obj)) { Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj); - if (sd2) sd2->parent_obj = obj; + if (sd2) + { + sd2->parent_obj = obj; + sd2->top_win_focused = sd->top_win_focused; + } evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE, _sub_obj_hide, sd); } @@ -1856,6 +1890,30 @@ elm_widget_focus_restore(Evas_Object *obj) } } +void +_elm_widget_top_win_focused_set(Evas_Object *obj, Eina_Bool top_win_focused) +{ + const Eina_List *l; + Evas_Object *child; + API_ENTRY return; + + if (sd->top_win_focused == top_win_focused) return; + if (sd->resize_obj) + _elm_widget_top_win_focused_set(sd->resize_obj, top_win_focused); + EINA_LIST_FOREACH(sd->subobjs, l, child) + { + _elm_widget_top_win_focused_set(child, top_win_focused); + } + sd->top_win_focused = top_win_focused; +} + +Eina_Bool +_elm_widget_top_win_focused_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->top_win_focused; +} + EAPI void elm_widget_activate(Evas_Object *obj) { @@ -2116,6 +2174,33 @@ elm_widget_text_part_get(const Evas_Object *obj, const char *item) return sd->on_text_get_func(obj, item); } +EAPI void +elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content) +{ + API_ENTRY return; + + if (!sd->on_content_set_func) return; + sd->on_content_set_func(obj, part, content); +} + +EAPI Evas_Object * +elm_widget_content_part_get(const Evas_Object *obj, const char *part) +{ + API_ENTRY return NULL; + + if (!sd->on_content_get_func) return NULL; + return sd->on_content_get_func(obj, part); +} + +EAPI Evas_Object * +elm_widget_content_part_unset(Evas_Object *obj, const char *part) +{ + API_ENTRY return NULL; + + if (!sd->on_content_unset_func) return NULL; + return sd->on_content_unset_func(obj, part); +} + EAPI Elm_Theme * elm_widget_theme_get(const Evas_Object *obj) { @@ -2845,6 +2930,93 @@ _smart_reconfigure(Smart_Data *sd) } } +EAPI void +_elm_widget_item_content_part_set(Elm_Widget_Item *item, + const char *part, + Evas_Object *content) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + if (!item->on_content_set_func) return; + item->on_content_set_func((Elm_Object_Item *) item, part, content); +} + +EAPI Evas_Object * +_elm_widget_item_content_part_get(const Elm_Widget_Item *item, + const char *part) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + if (!item->on_content_get_func) return NULL; + return item->on_content_get_func((Elm_Object_Item *) item, part); +} + +EAPI Evas_Object * +_elm_widget_item_content_part_unset(Elm_Widget_Item *item, + const char *part) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + if (!item->on_content_unset_func) return NULL; + return item->on_content_unset_func((Elm_Object_Item *) item, part); +} + +EAPI void +_elm_widget_item_text_part_set(Elm_Widget_Item *item, + const char *part, + const char *label) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + if (!item->on_text_set_func) return; + item->on_text_set_func((Elm_Object_Item *) item, part, label); +} + +EAPI const char * +_elm_widget_item_text_part_get(const Elm_Widget_Item *item, + const char *part) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + if (!item->on_text_get_func) return NULL; + return item->on_text_get_func((Elm_Object_Item *) item, part); +} + +EAPI void +_elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, + Elm_Widget_On_Content_Set_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->on_content_set_func = func; +} + +EAPI void +_elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, + Elm_Widget_On_Content_Get_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->on_content_get_func = func; +} + +EAPI void +_elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, + Elm_Widget_On_Content_Unset_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->on_content_unset_func = func; +} + +EAPI void +_elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, + Elm_Widget_On_Text_Set_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->on_text_set_func = func; +} + +EAPI void +_elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, + Elm_Widget_On_Text_Get_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->on_text_get_func = func; +} + static void _smart_add(Evas_Object *obj) { diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 0580506..3f19026 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -192,6 +192,12 @@ typedef struct _Elm_Tooltip Elm_Tooltip; typedef struct _Elm_Cursor Elm_Cursor; typedef struct _Elm_Widget_Item Elm_Widget_Item; /**< base structure for all widget items that are not Elm_Widget themselves */ +typedef void (*Elm_Widget_On_Text_Set_Cb)(void *data, const char *part, const char *text); +typedef void (*Elm_Widget_On_Content_Set_Cb)(void *data, const char *part, Evas_Object *content); +typedef const char *(*Elm_Widget_On_Text_Get_Cb)(const void *data, const char *part); +typedef Evas_Object *(*Elm_Widget_On_Content_Get_Cb)(const void *data, const char *part); +typedef Evas_Object *(*Elm_Widget_On_Content_Unset_Cb)(const void *data, const char *part); + struct _Elm_Widget_Item { /* ef1 ~~ efl, el3 ~~ elm */ @@ -202,12 +208,28 @@ struct _Elm_Widget_Item Evas_Object *view; /**< the base view object */ const void *data; /**< item specific data */ Evas_Smart_Cb del_cb; /**< used to notify the item is being deleted */ + Elm_Widget_On_Content_Set_Cb on_content_set_func; + Elm_Widget_On_Content_Get_Cb on_content_get_func; + Elm_Widget_On_Content_Unset_Cb on_content_unset_func; + Elm_Widget_On_Text_Set_Cb on_text_set_func; + Elm_Widget_On_Text_Get_Cb on_text_get_func; /* widget variations should have data from here and on */ /* @todo: TODO check if this is enough for 1.0 release, maybe add padding! */ }; +struct _Elm_Object_Item +{ + Elm_Widget_Item it; +}; + #define ELM_NEW(t) calloc(1, sizeof(t)) +#define ELM_CAST(p) ((void *)(p)) + +#define ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ...) \ + ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *) (it), __VA_ARGS__); \ + ELM_CHECK_WIDTYPE(it->it.widget, widtype) __VA_ARGS__; + EAPI Eina_Bool elm_widget_api_check(int ver); EAPI Evas_Object *elm_widget_add(Evas *evas); EAPI void elm_widget_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj)); @@ -228,8 +250,16 @@ EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func EAPI void elm_widget_on_change_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data); EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data); EAPI void elm_widget_focus_region_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)); -EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *item, const char *text)); -EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, const char *(*func)(const Evas_Object *obj, const char *item)); +EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, Elm_Widget_On_Text_Set_Cb func); +#define elm_widget_text_set_hook_set(obj, func) elm_widget_text_set_hook_set(obj, (Elm_Widget_On_Text_Set_Cb)(func)) +EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, Elm_Widget_On_Text_Get_Cb func); +#define elm_widget_text_get_hook_set(obj, func) elm_widget_text_get_hook_set(obj, (Elm_Widget_On_Text_Get_Cb)(func)) +EAPI void elm_widget_content_set_hook_set(Evas_Object *obj, Elm_Widget_On_Content_Set_Cb func); +#define elm_widget_content_set_hook_set(obj, func) elm_widget_content_set_hook_set(obj, (Elm_Widget_On_Content_Set_Cb)(func)) +EAPI void elm_widget_content_get_hook_set(Evas_Object *obj, Elm_Widget_On_Content_Get_Cb func); +#define elm_widget_content_get_hook_set(obj, func) elm_widget_content_get_hook_set(obj, (Elm_Widget_On_Content_Get_Cb)(func)) +EAPI void elm_widget_content_unset_hook_set(Evas_Object *obj, Elm_Widget_On_Content_Unset_Cb func); +#define elm_widget_content_unset_hook_set(obj, func) elm_widget_content_unset_hook_set(obj, (Elm_Widget_On_Content_Unset_Cb)(func)) EAPI void elm_widget_on_focus_region_hook_set(Evas_Object *obj, void (*func) (const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)); EAPI void elm_widget_data_set(Evas_Object *obj, void *data); EAPI void *elm_widget_data_get(const Evas_Object *obj); @@ -331,9 +361,11 @@ EAPI void elm_widget_focus_hide_handle(Evas_Object *obj); EAPI void elm_widget_focus_mouse_down_handle(Evas_Object *obj); EAPI void elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj); EAPI void elm_widget_focus_disabled_handle(Evas_Object *obj); -EAPI void elm_widget_text_part_set(Evas_Object *obj, const char *item, const char *label); -EAPI const char *elm_widget_text_part_get(const Evas_Object *obj, const char *item); - +EAPI void elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label); +EAPI const char *elm_widget_text_part_get(const Evas_Object *obj, const char *part); +EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content); +EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *part); +EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part); EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size); EAPI void _elm_widget_item_del(Elm_Widget_Item *item); EAPI void _elm_widget_item_pre_notify_del(Elm_Widget_Item *item); @@ -352,6 +384,16 @@ EAPI void _elm_widget_item_cursor_style_set(Elm_Widget_Item *item, c EAPI const char *_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item); EAPI void _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, Eina_Bool engine_only); EAPI Eina_Bool _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item); +EAPI void _elm_widget_item_content_part_set(Elm_Widget_Item *item, const char *part, Evas_Object *content); +EAPI Evas_Object *_elm_widget_item_content_part_get(const Elm_Widget_Item *item, const char *part); +EAPI Evas_Object *_elm_widget_item_content_part_unset(Elm_Widget_Item *item, const char *part); +EAPI void _elm_widget_item_text_part_set(Elm_Widget_Item *item, const char *part, const char *label); +EAPI const char *_elm_widget_item_text_part_get(const Elm_Widget_Item *item, const char *part); +EAPI void _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Set_Cb func); +EAPI void _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Get_Cb func); +EAPI void _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Unset_Cb func); +EAPI void _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Text_Set_Cb func); +EAPI void _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Text_Get_Cb func); /* debug function. don't use it unless you are tracking parenting issues */ EAPI void elm_widget_tree_dump(const Evas_Object *top); @@ -471,6 +513,66 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out */ #define elm_widget_item_cursor_engine_only_get(item) \ _elm_widget_item_cursor_engine_only_get((const Elm_Widget_Item *)item) +/** + * Convenience function to query item's content part set. + * @see _elm_widget_item_content_part_set() + */ +#define elm_widget_item_content_part_set(item, part, content) \ + _elm_widget_item_content_part_set((Elm_Widget_Item *)item, part, content) +/** + * Convenience function to query item's content part get. + * @see _elm_widget_item_content_part_get() + */ +#define elm_widget_item_content_part_get(item, part) \ + _elm_widget_item_content_part_get((const Elm_Widget_Item *)item, part) +/** + * Convenience function to query item's content part unset. + * @see _elm_widget_item_content_part_unset() + */ +#define elm_widget_item_content_part_unset(item, part) \ + _elm_widget_item_content_part_unset((Elm_Widget_Item *)item, part) +/** + * Convenience function to query item's text part set. + * @see _elm_widget_item_text_part_set() + */ +#define elm_widget_item_text_part_set(item, part, label) \ + _elm_widget_item_text_part_set((Elm_Widget_Item *)item, part, label) +/** + * Convenience function to query item's text part get. + * @see _elm_widget_item_text_part_get() + */ +#define elm_widget_item_text_part_get(item, part) \ + _elm_widget_item_text_part_get((const Elm_Widget_Item *)item, part) +/** + * Convenience function to query item's content set hook. + * @see _elm_widget_item_content_set_hook_set() + */ +#define elm_widget_item_content_set_hook_set(item, func) \ + _elm_widget_item_content_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Content_Set_Cb)func) +/** + * Convenience function to query item's content get hook. + * @see _elm_widget_item_content_get_hook_set() + */ +#define elm_widget_item_content_get_hook_set(item, func) \ + _elm_widget_item_content_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Content_Get_Cb)func) +/** + * Convenience function to query item's content unset hook. + * @see _elm_widget_item_content_unset_hook_set() + */ +#define elm_widget_item_content_unset_hook_set(item, func) \ + _elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Content_Unset_Cb)func) +/** + * Convenience function to query item's text set hook. + * @see _elm_widget_item_text_set_hook_set() + */ +#define elm_widget_item_text_set_hook_set(item, func) \ + _elm_widget_item_text_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Text_Set_Cb)func) +/** + * Convenience function to query item's text get hook. + * @see _elm_widget_item_text_get_hook_set() + */ +#define elm_widget_item_text_get_hook_set(item, func) \ + _elm_widget_item_text_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Text_Get_Cb)func) /** * Cast and ensure the given pointer is an Elm_Widget_Item or return NULL. -- 2.7.4