diff options
-rw-r--r-- | src/lib/elementary/Elementary.h.in | 2 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_text.c | 194 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_text.h | 152 |
3 files changed, 174 insertions, 174 deletions
diff --git a/src/lib/elementary/Elementary.h.in b/src/lib/elementary/Elementary.h.in index 3ec0a2c8d7..ab8f5c9329 100644 --- a/src/lib/elementary/Elementary.h.in +++ b/src/lib/elementary/Elementary.h.in @@ -272,7 +272,7 @@ EAPI extern Elm_Version *elm_version; # include <efl_ui_box_flow.eo.h> # include <efl_ui_grid.eo.h> # include <efl_ui_image.eo.h> -# include <efl_ui_text.h> +# include <efl_ui_text.eo.h> #endif /* include deprecated calls last of all */ diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 51ec6e4b5a..6e6b24483d 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -15,7 +15,132 @@ //#include "elm_entry_internal_part.eo.h" //#include "elm_part_helper.h" // -#include "efl_ui_text.h" +#include "elm_interface_scrollable.h" +#include "elm_widget_layout.h" +#include "elm_entry_common.h" +#include "elm_widget_entry.h" +#include "efl_ui_text.eo.h" + +typedef struct _Mod_Api Mod_Api; + +/** + * Base widget smart data extended with entry instance data. + */ +typedef struct _Efl_Ui_Text_Data Efl_Ui_Text_Data; +struct _Efl_Ui_Text_Data +{ + Evas_Object *hit_rect, *entry_edje, *scr_edje; + + Evas_Object *hoversel; + Evas_Object *mgf_bg; + Evas_Object *mgf_clip; + Evas_Object *mgf_proxy; + Efl_Canvas_Text_Cursor *cursor; + Efl_Canvas_Text_Cursor *cursor_bidi; + Evas_Object *start_handler; + Evas_Object *end_handler; + Ecore_Job *deferred_recalc_job; + Ecore_Timer *longpress_timer; + Ecore_Timer *delay_write; + /* for deferred appending */ + Ecore_Idler *append_text_idler; + char *append_text_left; + int append_text_position; + int append_text_len; + /* Only for clipboard */ + const char *cut_sel; + const char *text; + const char *file; + Elm_Text_Format format; + Evas_Coord last_w, ent_mw, ent_mh; + Evas_Coord downx, downy; + Evas_Coord ox, oy; + Eina_List *items; /** context menu item list */ + Eina_List *item_providers; + Eina_List *markup_filters; + Ecore_Job *hov_deljob; + Mod_Api *api; // module api if supplied + int cursor_pos; + Elm_Scroller_Policy policy_h, policy_v; + Elm_Wrap_Type line_wrap; + Elm_Input_Panel_Layout input_panel_layout; + Elm_Autocapital_Type autocapital_type; + Elm_Input_Panel_Lang input_panel_lang; + Elm_Input_Panel_Return_Key_Type input_panel_return_key_type; + Elm_Input_Hints input_hints; + Edje_Cursor sel_handler_cursor; + void *input_panel_imdata; + int input_panel_imdata_len; + int input_panel_layout_variation; + int validators; + struct + { + Evas_Object *hover_parent; /**< hover parent object. entry is a hover parent object by default */ + Evas_Object *pop; /**< hidden icon for hover target */ + Evas_Object *hover; /**< hover object */ + const char *hover_style; /**< style of a hover object */ + } anchor_hover; + + Elm_Cnp_Mode cnp_mode; + Elm_Sel_Format drop_format; + + Eina_Bool input_panel_return_key_disabled : 1; + Eina_Bool drag_selection_asked : 1; + Eina_Bool sel_handler_disabled : 1; + Eina_Bool start_handler_down : 1; + Eina_Bool start_handler_shown : 1; + Eina_Bool end_handler_down : 1; + Eina_Bool end_handler_shown : 1; + Eina_Bool input_panel_enable : 1; + Eina_Bool prediction_allow : 1; + Eina_Bool selection_asked : 1; + Eina_Bool auto_return_key : 1; + Eina_Bool have_selection : 1; + Eina_Bool deferred_cur : 1; + Eina_Bool context_menu : 1; + Eina_Bool long_pressed : 1; + Eina_Bool cur_changed : 1; + Eina_Bool single_line : 1; + Eina_Bool can_write : 1; + Eina_Bool auto_save : 1; + Eina_Bool password : 1; + Eina_Bool editable : 1; + Eina_Bool disabled : 1; + Eina_Bool h_bounce : 1; + Eina_Bool v_bounce : 1; + Eina_Bool has_text : 1; + Eina_Bool use_down : 1; + Eina_Bool sel_mode : 1; + Eina_Bool sel_allow : 1; + Eina_Bool changed : 1; + Eina_Bool scroll : 1; + Eina_Bool input_panel_show_on_demand : 1; +}; + +#define EFL_UI_TEXT_DATA_GET(o, sd) \ + Efl_Ui_Text_Data * sd = eo_data_scope_get(o, EFL_UI_TEXT_CLASS) + +#define EFL_UI_TEXT_DATA_GET_OR_RETURN(o, ptr) \ + EFL_UI_TEXT_DATA_GET(o, ptr); \ + if (EINA_UNLIKELY(!ptr)) \ + { \ + CRI("No widget data for object %p (%s)", \ + o, evas_object_type_get(o)); \ + return; \ + } + +#define EFL_UI_TEXT_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ + EFL_UI_TEXT_DATA_GET(o, ptr); \ + if (EINA_UNLIKELY(!ptr)) \ + { \ + CRI("No widget data for object %p (%s)", \ + o, evas_object_type_get(o)); \ + return val; \ + } + +#define EFL_UI_TEXT_CHECK(obj) \ + if (EINA_UNLIKELY(!eo_isa((obj), EFL_UI_TEXT_CLASS))) \ + return #define MY_CLASS EFL_UI_TEXT_CLASS @@ -167,6 +292,9 @@ _plain_load(const char *file) } return NULL; +#else + (void) file; + return NULL; #endif } @@ -250,6 +378,9 @@ _utf8_plain_save(const char *file, _utf8_markup_save(file, text2); free(text2); +#else + (void) file; + (void) text; #endif } @@ -1003,22 +1134,6 @@ _cursor_geometry_recalc(Evas_Object *obj) } static void -_size_recalc(Efl_Ui_Text_Data *sd) -{ - Evas_Coord minh = -1, resw = -1, resh = -1, minw = -1; - Eo *sw; - - sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); - evas_object_geometry_get(sd->entry_edje, NULL, NULL, &resw, &resh); - //FIXME: will not work with complex themes. - evas_object_resize(sw, resw, resh); - efl_canvas_text_size_formatted_get(sw, &minw, &minh); - evas_object_size_hint_min_set(sw, minw, -1); - edje_object_size_min_restricted_calc(sd->entry_edje, &minw, &minh, resw, 0); - elm_coords_finger_size_adjust(1, &minw, 1, &minh); -} - -static void _deferred_recalc_job(void *data) { Evas_Coord minh = -1, resw = -1, resh = -1, minw = -1, fw = 0, fh = 0; @@ -2821,6 +2936,8 @@ _entry_new_line_filter_init(Evas_Object *obj) efl_ui_text_entry_set(obj, text2); free(text2); } +#else + (void) obj; #endif } @@ -2954,13 +3071,13 @@ _text_append_idler(void *data) } } +#if 0 static void _chars_add_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit) { -#if 0 int i = 0, current_len = 0; char *new_text; @@ -3032,8 +3149,8 @@ _chars_add_till_limit(Evas_Object *obj, } eo_event_callback_call(obj, EFL_UI_TEXT_EVENT_MAXLENGTH_REACHED, NULL); -#endif } +#endif EOLIAN static void _efl_ui_text_elm_layout_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source) @@ -3101,6 +3218,7 @@ _efl_ui_text_elm_layout_signal_callback_del(Eo *obj, Efl_Ui_Text_Data *sd, const return data; } +#if 0 static Eina_Bool _efl_ui_text_content_set(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, const char *part, Evas_Object *content) { @@ -3119,6 +3237,7 @@ _efl_ui_text_content_set(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, const char return EINA_TRUE; } + static Evas_Object* _efl_ui_text_content_unset(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, const char *part) { @@ -3136,6 +3255,7 @@ _efl_ui_text_content_unset(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, const cha return ret; } +#endif static void _entry_text_append(Evas_Object* obj, const char* entry, Eina_Bool set) @@ -3316,6 +3436,8 @@ _access_info_cb(void *data EINA_UNUSED, Evas_Object *obj) return _elm_util_mkup_to_text(efl_ui_text_entry_get(obj)); else return strdup(txt); #else + (void) data; + (void) obj; return NULL; #endif } @@ -4581,11 +4703,13 @@ _efl_ui_text_markup_filter_remove(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Elm } } +#if 0 static const char * _text_get(const Evas_Object *obj) { return elm_object_text_get(obj); } +#endif EOLIAN static void _efl_ui_text_file_text_format_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Elm_Text_Format format) @@ -5129,6 +5253,9 @@ _efl_ui_text_elm_interface_atspi_text_character_get(Eo *obj, Efl_Ui_Text_Data *_ return ret; #else + (void) obj; + (void) _pd; + (void) offset; return 0; #endif } @@ -5148,6 +5275,8 @@ _efl_ui_text_elm_interface_atspi_text_character_count_get(Eo *obj, Efl_Ui_Text_D return ret; #else + (void) obj; + (void) _pd; return 0; #endif } @@ -5602,6 +5731,9 @@ _efl_ui_text_elm_interface_atspi_text_editable_content_set(Eo *obj, Efl_Ui_Text_ efl_ui_text_entry_set(obj, content); return EINA_TRUE; #else + (void) obj; + (void) _pd; + (void) content; return EINA_TRUE; #endif } @@ -5694,10 +5826,30 @@ _efl_ui_text_elm_interface_atspi_accessible_name_get(Eo *obj, Efl_Ui_Text_Data * return ret ? strdup(ret) : NULL; } +static inline Eo * +_cursor_create(Eo *obj) +{ +#if 0 + Eo *ret = edje_object_add(ed->base->evas); + edje_object_file_set(ret, ed->path, rp->part->source4); + evas_object_smart_member_add(ret ed->obj); + evas_object_stack_above(ret, rp->object); + evas_object_clip_set(ret, evas_object_clip_get(obj)); + evas_object_pass_events_set(ret, EINA_TRUE); + _edje_subobj_register(ed, ret); +#else + (void) obj; + return NULL; +#endif +} + +/** + * Creates the cursors, if not created. + */ static void _create_text_cursors(Efl_Ui_Text_Data *sd) { - + Eo *text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); } /** @@ -5708,7 +5860,7 @@ static void _update_text_cursors(Efl_Ui_Text_Data *sd) { Evas_Coord x, y, w, h, xx, yy, ww, hh; - Evas_Coord xx2, yy2, ww2, hh2; + Evas_Coord xx2, yy2; Eo *text_obj; Eina_Bool bidi_cursor; diff --git a/src/lib/elementary/efl_ui_text.h b/src/lib/elementary/efl_ui_text.h deleted file mode 100644 index c2ed3e70e1..0000000000 --- a/src/lib/elementary/efl_ui_text.h +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef ELM_UI_TEXT_H_ -#define ELM_UI_TEXT_H_ - -#include "elm_interface_scrollable.h" -#include "elm_widget_layout.h" -#include "elm_entry_common.h" -#include "elm_widget_entry.h" -#include "efl_ui_text.eo.h" - -/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR - * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT - * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK - * IT AT RUNTIME. - */ - -/** - * @addtogroup Widget - * @{ - * - * @section elm-entry-class The Elementary Entry Class - * - * Elementary, besides having the @ref Entry widget, exposes its - * foundation -- the Elementary Entry Class -- in order to create - * other widgets which are a entry with some more logic on top. - */ - -typedef struct _Mod_Api Mod_Api; - -/** - * Base widget smart data extended with entry instance data. - */ -typedef struct _Efl_Ui_Text_Data Efl_Ui_Text_Data; -struct _Efl_Ui_Text_Data -{ - Evas_Object *hit_rect, *entry_edje, *scr_edje; - - Evas_Object *hoversel; - Evas_Object *mgf_bg; - Evas_Object *mgf_clip; - Evas_Object *mgf_proxy; - Efl_Canvas_Text_Cursor *cursor; - Efl_Canvas_Text_Cursor *cursor_bidi; - Evas_Object *start_handler; - Evas_Object *end_handler; - Ecore_Job *deferred_recalc_job; - Ecore_Timer *longpress_timer; - Ecore_Timer *delay_write; - /* for deferred appending */ - Ecore_Idler *append_text_idler; - char *append_text_left; - int append_text_position; - int append_text_len; - /* Only for clipboard */ - const char *cut_sel; - const char *text; - const char *file; - Elm_Text_Format format; - Evas_Coord last_w, ent_mw, ent_mh; - Evas_Coord downx, downy; - Evas_Coord ox, oy; - Eina_List *items; /** context menu item list */ - Eina_List *item_providers; - Eina_List *markup_filters; - Ecore_Job *hov_deljob; - Mod_Api *api; // module api if supplied - int cursor_pos; - Elm_Scroller_Policy policy_h, policy_v; - Elm_Wrap_Type line_wrap; - Elm_Input_Panel_Layout input_panel_layout; - Elm_Autocapital_Type autocapital_type; - Elm_Input_Panel_Lang input_panel_lang; - Elm_Input_Panel_Return_Key_Type input_panel_return_key_type; - Elm_Input_Hints input_hints; - Edje_Cursor sel_handler_cursor; - void *input_panel_imdata; - int input_panel_imdata_len; - int input_panel_layout_variation; - int validators; - struct - { - Evas_Object *hover_parent; /**< hover parent object. entry is a hover parent object by default */ - Evas_Object *pop; /**< hidden icon for hover target */ - Evas_Object *hover; /**< hover object */ - const char *hover_style; /**< style of a hover object */ - } anchor_hover; - - Elm_Cnp_Mode cnp_mode; - Elm_Sel_Format drop_format; - - Eina_Bool input_panel_return_key_disabled : 1; - Eina_Bool drag_selection_asked : 1; - Eina_Bool sel_handler_disabled : 1; - Eina_Bool start_handler_down : 1; - Eina_Bool start_handler_shown : 1; - Eina_Bool end_handler_down : 1; - Eina_Bool end_handler_shown : 1; - Eina_Bool input_panel_enable : 1; - Eina_Bool prediction_allow : 1; - Eina_Bool selection_asked : 1; - Eina_Bool auto_return_key : 1; - Eina_Bool have_selection : 1; - Eina_Bool deferred_cur : 1; - Eina_Bool context_menu : 1; - Eina_Bool long_pressed : 1; - Eina_Bool cur_changed : 1; - Eina_Bool single_line : 1; - Eina_Bool can_write : 1; - Eina_Bool auto_save : 1; - Eina_Bool password : 1; - Eina_Bool editable : 1; - Eina_Bool disabled : 1; - Eina_Bool h_bounce : 1; - Eina_Bool v_bounce : 1; - Eina_Bool has_text : 1; - Eina_Bool use_down : 1; - Eina_Bool sel_mode : 1; - Eina_Bool sel_allow : 1; - Eina_Bool changed : 1; - Eina_Bool scroll : 1; - Eina_Bool input_panel_show_on_demand : 1; -}; - -/** - * @} - */ - -#define EFL_UI_TEXT_DATA_GET(o, sd) \ - Efl_Ui_Text_Data * sd = eo_data_scope_get(o, EFL_UI_TEXT_CLASS) - -#define EFL_UI_TEXT_DATA_GET_OR_RETURN(o, ptr) \ - EFL_UI_TEXT_DATA_GET(o, ptr); \ - if (EINA_UNLIKELY(!ptr)) \ - { \ - CRI("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return; \ - } - -#define EFL_UI_TEXT_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ - EFL_UI_TEXT_DATA_GET(o, ptr); \ - if (EINA_UNLIKELY(!ptr)) \ - { \ - CRI("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return val; \ - } - -#define EFL_UI_TEXT_CHECK(obj) \ - if (EINA_UNLIKELY(!eo_isa((obj), EFL_UI_TEXT_CLASS))) \ - return - -#endif |