From: Daniel Hirt Date: Mon, 12 Nov 2018 16:57:24 +0000 (+0200) Subject: Ui text: implement efl_part and part_text API to text_set X-Git-Tag: submit/tizen/20181205.064917~80 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b26f80675adc2b7df7282c5ed215cd9e51e98db3;p=platform%2Fupstream%2Fefl.git Ui text: implement efl_part and part_text API to text_set --- diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 789de3a..7e525ed 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -132,6 +132,7 @@ elm_public_eolian_files = \ lib/elementary/efl_ui_tab_page.eo \ lib/elementary/efl_ui_tab_page_part_tab.eo \ lib/elementary/efl_ui_widget_focus_manager.eo \ + lib/elementary/efl_ui_text_part.eo \ $(NULL) # More public files -- FIXME diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 6cded21..9c0d292 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -6,6 +6,7 @@ #define EFL_ACCESS_TEXT_PROTECTED #define EFL_ACCESS_EDITABLE_TEXT_PROTECTED #define ELM_LAYOUT_PROTECTED +#define EFL_PART_PROTECTED #include #include @@ -15,6 +16,8 @@ #include "elm_widget_entry.h" #include "efl_ui_text.eo.h" #include "elm_hoversel.eo.h" +#include "efl_ui_text_part.eo.h" +#include "elm_part_helper.h" typedef struct _Efl_Ui_Text_Data Efl_Ui_Text_Data; typedef struct _Efl_Ui_Text_Rectangle Efl_Ui_Text_Rectangle; @@ -4002,16 +4005,52 @@ _efl_ui_text_item_factory_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *pd) return pd->item_factory; } -#if 0 /* Efl.Part begin */ -ELM_PART_OVERRIDE(elm_entry, EFL_UI_TEXT, Efl_Ui_Text_Data) -ELM_PART_OVERRIDE_CONTENT_SET(elm_entry, EFL_UI_TEXT, Efl_Ui_Text_Data) -ELM_PART_OVERRIDE_CONTENT_UNSET(elm_entry, EFL_UI_TEXT, Efl_Ui_Text_Data) -#include "elm_entry_part.eo.c" +#define STRCMP(X, Y) strncmp((X), (Y), strlen(X)) + +EOLIAN static Eina_Bool +_efl_ui_text_text_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *pd, + const char *part, const char *text) +{ + if (!STRCMP("efl.text_guide", part)) + { + efl_text_set(pd->text_guide_obj, text); + return EINA_TRUE; + } + else if (!STRCMP("efl.text", part)) + { + efl_text_set(pd->text_obj, text); + return EINA_TRUE; + } + + return EINA_FALSE; +} + +EOLIAN static const char * +_efl_ui_text_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *pd, + const char *part) +{ + if (!STRCMP("efl.text_guide", part)) + { + return efl_text_get(pd->text_guide_obj); + } + else if (!STRCMP("efl.text", part)) + { + return efl_text_get(pd->text_obj); + } + + return NULL; +} + +#undef STRCMP + +ELM_PART_OVERRIDE(efl_ui_text, EFL_UI_TEXT, Efl_Ui_Text_Data) +ELM_PART_OVERRIDE_TEXT_SET(efl_ui_text, EFL_UI_TEXT, Efl_Ui_Text_Data) +ELM_PART_OVERRIDE_TEXT_GET(efl_ui_text, EFL_UI_TEXT, Efl_Ui_Text_Data) +#include "efl_ui_text_part.eo.c" /* Efl.Part end */ -#endif /* Internal EO APIs and hidden overrides */ diff --git a/src/lib/elementary/efl_ui_text.eo b/src/lib/elementary/efl_ui_text.eo index 0f4ab33..6b199e8 100644 --- a/src/lib/elementary/efl_ui_text.eo +++ b/src/lib/elementary/efl_ui_text.eo @@ -364,6 +364,7 @@ class Efl.Ui.Text (Efl.Ui.Layout, Efl.Ui.Clickable, Efl.Access.Editable.Text.paste; Efl.File.file { get; set; } Efl.Text_Interactive.editable { set; } + Efl.Part.part_get; } events { changed: void; [[Called when entry changes]] diff --git a/src/lib/elementary/efl_ui_text_part.eo b/src/lib/elementary/efl_ui_text_part.eo new file mode 100644 index 0000000..a0a4b13 --- /dev/null +++ b/src/lib/elementary/efl_ui_text_part.eo @@ -0,0 +1,8 @@ +class Efl.Ui.Text_Part (Efl.Ui.Layout_Part_Text) +{ + [[Efl UI Text internal part class]] + data: null; + implements { + Efl.Text.text { set; get; } + } +} diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index daf89bb..e2bed07 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -278,7 +278,8 @@ pub_eo_files = [ 'elm_view_list.eo', 'elm_view_form.eo', 'elm_web.eo', - 'elm_widget_item.eo' + 'elm_widget_item.eo', + 'efl_ui_text_part.eo' ] foreach eo_file : pub_eo_files