lib/ewl_text.c File Reference
#include "ewl_base.h"
#include "ewl_text.h"
#include "ewl_text_context.h"
#include "ewl_text_fmt.h"
#include "ewl_text_trigger.h"
#include "ewl_private.h"
#include "ewl_macros.h"
#include "ewl_debug.h"
#include <Evas.h>

Defines | |
| #define | EWL_TEXT_CHAR_BYTE_LEN(s) (ewl_text_trailing_bytes[((unsigned char)((s)[0])) >> 3]) |
| #define | EWL_TEXT_EXTEND_VAL 4096 |
Functions | |
| void | ewl_text_align_apply (Ewl_Text *t, unsigned int align, unsigned int char_len) |
| This will set the given alignment from the current cursor position for the given length of text. | |
| unsigned int | ewl_text_align_get (Ewl_Text *t, unsigned int char_idx) |
| Retrieves the alignment value from the given index. | |
| void | ewl_text_align_set (Ewl_Text *t, unsigned int align) |
| Set the current alignment value of the text. | |
| void | ewl_text_all_select (Ewl_Text *t) |
| Select the whole text. | |
| void | ewl_text_bg_color_apply (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a, unsigned int char_len) |
| This will set the bg colour of the text from the current cursor position to the given length. | |
| void | ewl_text_bg_color_get (Ewl_Text *t, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a, unsigned int char_idx) |
| Get the text background colour at the given index. | |
| void | ewl_text_bg_color_set (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a) |
| Set the background colour at the cursor. | |
| void | ewl_text_cb_child_add (Ewl_Container *c, Ewl_Widget *w) |
| void | ewl_text_cb_child_remove (Ewl_Container *c, Ewl_Widget *w, int idx __UNUSED__) |
| void | ewl_text_cb_configure (Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) |
| void | ewl_text_cb_destroy (Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) |
| void | ewl_text_cb_hide (Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) |
| void | ewl_text_cb_key_down (Ewl_Widget *w, void *ev, void *data __UNUSED__) |
| void | ewl_text_cb_mouse_down (Ewl_Widget *w, void *ev, void *data __UNUSED__) |
| void | ewl_text_cb_mouse_move (Ewl_Widget *w, void *ev, void *data __UNUSED__) |
| void | ewl_text_cb_mouse_up (Ewl_Widget *w, void *ev, void *data __UNUSED__) |
| void | ewl_text_cb_obscure (Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) |
| void | ewl_text_cb_realize (Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) |
| void | ewl_text_cb_reveal (Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) |
| void | ewl_text_cb_selection_clear (Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) |
| void | ewl_text_cb_show (Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) |
| void | ewl_text_clear (Ewl_Text *t) |
| Clear the text widget. | |
| void | ewl_text_color_apply (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a, unsigned int char_len) |
| This will set the given colour from the current cursor position for the specified length. | |
| void | ewl_text_color_get (Ewl_Text *t, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a, unsigned int char_idx) |
| Retrives the text colour at the given index. | |
| void | ewl_text_color_set (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a) |
| Set the text colour at the cursor. | |
| unsigned int | ewl_text_coord_index_map (Ewl_Text *t, int x, int y) |
| Map the given coordinate into an index into the text widget. | |
| unsigned int | ewl_text_cursor_position_get (Ewl_Text *t) |
| Retrieve the cursor position from the text widget. | |
| unsigned int | ewl_text_cursor_position_line_down_get (Ewl_Text *t) |
| Get the index if we were to move the cursor down one line. | |
| unsigned int | ewl_text_cursor_position_line_end_get (Ewl_Text *t) |
| unsigned int | ewl_text_cursor_position_line_start_get (Ewl_Text *t) |
| unsigned int | ewl_text_cursor_position_line_up_get (Ewl_Text *t) |
| Get the index if we were to move the cursor up one line. | |
| void | ewl_text_cursor_position_set (Ewl_Text *t, unsigned int char_pos) |
| Set the cursor position in the text widget. | |
| unsigned int | ewl_text_cursor_position_word_next_get (Ewl_Text *t) |
| Get the index if we were to move the cursor to the beginning of the next word. | |
| unsigned int | ewl_text_cursor_position_word_previous_get (Ewl_Text *t) |
| Get the index if we were to move the cursor to the beginning of the previous word. | |
| void | ewl_text_double_underline_color_apply (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a, unsigned int char_len) |
| This will set the double_underline colour of the text from the current cursor position to the given length. | |
| void | ewl_text_double_underline_color_get (Ewl_Text *t, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a, unsigned int char_idx) |
| Retrieve the double underline colour at the given index. | |
| void | ewl_text_double_underline_color_set (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a) |
| Set the double underline colour at the cursor. | |
| void | ewl_text_font_apply (Ewl_Text *t, const char *font, unsigned int char_len) |
| This will apply the specfied font from the current cursor position to the length specified. | |
| char * | ewl_text_font_get (Ewl_Text *t, unsigned int char_idx) |
| This will retrive the font used at the specified index in the text. | |
| void | ewl_text_font_set (Ewl_Text *t, const char *font) |
| This will set the current font to be used when we insert more text. | |
| void | ewl_text_font_size_apply (Ewl_Text *t, unsigned int size, unsigned int char_len) |
| This will apply the font size to the text from the current cursor position for the given length. | |
| unsigned int | ewl_text_font_size_get (Ewl_Text *t, unsigned int char_idx) |
| Retrieve the font size at the given index. | |
| void | ewl_text_font_size_set (Ewl_Text *t, unsigned int size) |
| Set the font size to use when inserting new text. | |
| void | ewl_text_font_source_apply (Ewl_Text *t, const char *source, const char *font, unsigned int char_len) |
| This will apply the specfied font from the current cursor position to the length specified. | |
| char * | ewl_text_font_source_get (Ewl_Text *t, unsigned int char_idx) |
| This will retrive the font source used at the specified index in the text. | |
| void | ewl_text_font_source_set (Ewl_Text *t, const char *source, const char *font) |
| This will set the current font to be used when we insert more text. | |
| void | ewl_text_glow_color_apply (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a, unsigned int char_len) |
| This will set the glow colour of the text from the current cursor position to the given length. | |
| void | ewl_text_glow_color_get (Ewl_Text *t, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a, unsigned int char_idx) |
| Get the glow colour at the given index. | |
| void | ewl_text_glow_color_set (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a) |
| Set the glow colour at the cursor. | |
| unsigned int | ewl_text_has_selection (Ewl_Text *t) |
| Check if anything is selected in the text widget. | |
| void | ewl_text_index_geometry_map (Ewl_Text *t, unsigned int char_idx, int *x, int *y, int *w, int *h) |
| Map the given character index into a position in the text widget. | |
| int | ewl_text_init (Ewl_Text *t) |
| Initializes an Ewl_Text widget to default values. | |
| unsigned int | ewl_text_length_get (Ewl_Text *t) |
| Retrieve the character length of the text. | |
| unsigned int | ewl_text_length_maximum_get (Ewl_Text *t) |
| Retrieve if maximum number of characters. | |
| void | ewl_text_length_maximum_set (Ewl_Text *t, unsigned int char_num) |
| Set the maximum number of characters. | |
| const char * | ewl_text_maximum_size_string_get (Ewl_Text *t) |
| Retrieve the maximum size string. | |
| void | ewl_text_maximum_size_string_set (Ewl_Text *t, const char *string) |
| Set a maximum size based on a given string. | |
| const char * | ewl_text_minimum_size_string_get (Ewl_Text *t) |
| Retrieve the minimum size string. | |
| void | ewl_text_minimum_size_string_set (Ewl_Text *t, const char *string) |
| Set a minimum size based on a given string. | |
| Ewl_Widget * | ewl_text_new (void) |
| Creates a new Ewl_Text widget. | |
| const char * | ewl_text_obscure_get (Ewl_Text *t) |
| Retrieves the character used to obscure the text for a password. | |
| void | ewl_text_obscure_set (Ewl_Text *t, const char *o) |
| Sets the character used to obscure the text for a password. Every character will be replaced by this character on the output. | |
| void | ewl_text_offsets_get (Ewl_Text *t, int *x, int *y) |
| Retrieve the current layout offsets of the text. | |
| void | ewl_text_offsets_set (Ewl_Text *t, int x, int y) |
| Set the current layout offsets of the text. | |
| void | ewl_text_outline_color_apply (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a, unsigned int char_len) |
| This will set the outline colour of the text from the current cursor position to the given length. | |
| void | ewl_text_outline_color_get (Ewl_Text *t, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a, unsigned int char_idx) |
| Get the outline colour at the given index. | |
| void | ewl_text_outline_color_set (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a) |
| Set the outline colour at the cursor. | |
| void | ewl_text_select (Ewl_Text *t, unsigned int char_idx, unsigned int char_len) |
| Select the text. | |
| unsigned int | ewl_text_selectable_get (Ewl_Text *t) |
| Get the selectable state of the text. | |
| void | ewl_text_selectable_set (Ewl_Text *t, unsigned int selectable) |
| Set if the text is selectable. | |
| Ewl_Widget * | ewl_text_selection_get (Ewl_Text *t) |
| Get the current text selection. | |
| char * | ewl_text_selection_text_get (Ewl_Text *t) |
| Gets the current text of the selection. | |
| void | ewl_text_shadow_color_apply (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a, unsigned int char_len) |
| This will set the shadow colour of the text from the current cursor position to the given length. | |
| void | ewl_text_shadow_color_get (Ewl_Text *t, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a, unsigned int char_idx) |
| Retrieve the shadow colour at the given index. | |
| void | ewl_text_shadow_color_set (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a) |
| Set the shadow colour at the cursor. | |
| void | ewl_text_strikethrough_color_apply (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a, unsigned int char_len) |
| This will set the strikethrough colour of the text from the current cursor position to the given length. | |
| void | ewl_text_strikethrough_color_get (Ewl_Text *t, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a, unsigned int char_idx) |
| Retrieve the strikethrough colour at the given index. | |
| void | ewl_text_strikethrough_color_set (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a) |
| Set the strikethrough colour at the cursor. | |
| void | ewl_text_style_add (Ewl_Text *t, Ewl_Text_Style style, unsigned int char_len) |
| This will add the given style to the text from the cursor up to length characters. | |
| void | ewl_text_style_del (Ewl_Text *t, Ewl_Text_Style style, unsigned int char_len) |
| This will delete the given style from the text starting at the cursor up to length characters. | |
| unsigned int | ewl_text_style_has (Ewl_Text *t, Ewl_Text_Style style, unsigned int char_idx) |
| Check if the given style is set at the given index in the text. | |
| void | ewl_text_style_invert (Ewl_Text *t, Ewl_Text_Style style, unsigned int char_len) |
| This will invert the given style in the text starting at the cursor up to length characters. | |
| void | ewl_text_styles_apply (Ewl_Text *t, unsigned int styles, unsigned int char_len) |
| This will set the given style from the current cursor position for the given length of text. | |
| unsigned int | ewl_text_styles_get (Ewl_Text *t, unsigned int char_idx) |
| Retrives the styles in use at the given index. | |
| void | ewl_text_styles_set (Ewl_Text *t, unsigned int styles) |
| Sets the given styles into the text at the cursor. | |
| void | ewl_text_text_append (Ewl_Text *t, const char *text) |
| Append the text into the text widget. | |
| void | ewl_text_text_delete (Ewl_Text *t, unsigned int char_len) |
| This will delete the specified length of text from the current cursor position. | |
| char * | ewl_text_text_get (Ewl_Text *t) |
| Retrieve the text from the text widget. | |
| void | ewl_text_text_insert (Ewl_Text *t, const char *text, unsigned int char_idx) |
| Insert the given text into the text widget. | |
| char * | ewl_text_text_next_char (const char *text, unsigned int *idx) |
| void | ewl_text_text_prepend (Ewl_Text *t, const char *text) |
| Prepend the given text into the text widget. | |
| void | ewl_text_text_set (Ewl_Text *t, const char *text) |
| Set the text in the text widget. | |
| void | ewl_text_underline_color_apply (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a, unsigned int char_len) |
| This will set the underline colour of the text from the current cursor position to the given length. | |
| void | ewl_text_underline_color_get (Ewl_Text *t, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a, unsigned int char_idx) |
| Retrieve the underline colour at the given index. | |
| void | ewl_text_underline_color_set (Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a) |
| Set the underline colour at the cursor. | |
| void | ewl_text_wrap_apply (Ewl_Text *t, Ewl_Text_Wrap wrap, unsigned int char_len) |
| This will apply the given wrap value from the current cursor position for the given length of text. | |
| Ewl_Text_Wrap | ewl_text_wrap_get (Ewl_Text *t, unsigned int char_idx) |
| Retrives the text wrap value at the given index. | |
| void | ewl_text_wrap_set (Ewl_Text *t, Ewl_Text_Wrap wrap) |
| Sets the wrap value of the text at the given index. | |
Define Documentation
| #define EWL_TEXT_CHAR_BYTE_LEN | ( | s | ) | (ewl_text_trailing_bytes[((unsigned char)((s)[0])) >> 3]) |
Referenced by ewl_text_obscure_set(), and ewl_text_text_next_char().
| #define EWL_TEXT_EXTEND_VAL 4096 |
Function Documentation
| void ewl_text_cb_configure | ( | Ewl_Widget * | w, | |
| void *ev | __UNUSED__, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, Ewl_Text::dirty, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, EWL_CONTAINER, EWL_TEXT, EWL_TEXT_TYPE, ewl_widget_configure(), REVEALED, and Ewl_Text::textblock.
Referenced by ewl_text_init().
| void ewl_text_cb_destroy | ( | Ewl_Widget * | w, | |
| void *ev | __UNUSED__, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_TEXT, ewl_text_fmt_destroy(), EWL_TEXT_TYPE, Ewl_Text::formatting, IF_FREE, IF_FREE_LIST, IF_RELEASE, Ewl_Text::max, Ewl_Text::min, Ewl_Text::nodes, Ewl_Text::obscure, Ewl_Text::selection, Ewl_Text::size_string, Ewl_Text::text, Ewl_Text::triggers, and Ewl_Text::tx.
Referenced by ewl_text_init().
| void ewl_text_cb_hide | ( | Ewl_Widget * | w, | |
| void *ev | __UNUSED__, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_TEXT, EWL_TEXT_TYPE, and Ewl_Text::textblock.
Referenced by ewl_text_init().
| void ewl_text_cb_key_down | ( | Ewl_Widget * | w, | |
| void * | ev, | |||
| void *data | __UNUSED__ | |||
| ) |
References Ewl_Text::chars, CURRENT_X, CURRENT_Y, Ewl_Text::cursor_position, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, EWL_KEY_MODIFIER_CTRL, EWL_KEY_MODIFIER_SHIFT, EWL_OBJECT, ewl_object_position_request(), EWL_TEXT, ewl_text_cursor_position_get(), ewl_text_cursor_position_line_down_get(), ewl_text_cursor_position_line_end_get(), ewl_text_cursor_position_line_start_get(), ewl_text_cursor_position_line_up_get(), ewl_text_cursor_position_set(), ewl_text_cursor_position_word_next_get(), ewl_text_cursor_position_word_previous_get(), EWL_TEXT_TRIGGER, ewl_text_trigger_base_set(), EWL_TEXT_TYPE, ewl_widget_configure(), Ewl_Event_Key::keyname, Ewl_Text::length, Ewl_Event_Key::modifiers, and Ewl_Text::selection.
Referenced by ewl_text_selectable_set().
| void ewl_text_cb_mouse_down | ( | Ewl_Widget * | w, | |
| void * | ev, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, ewl_callback_append(), EWL_CALLBACK_MOUSE_MOVE, ewl_ev_modifiers_get(), EWL_KEY_MODIFIER_SHIFT, EWL_TEXT, ewl_text_cb_mouse_move(), ewl_text_coord_index_map(), ewl_text_cursor_position_set(), EWL_TEXT_TRIGGER, ewl_text_trigger_areas_cleanup(), ewl_text_trigger_base_set(), ewl_text_trigger_length_set(), ewl_text_trigger_start_pos_set(), EWL_TEXT_TYPE, ewl_widget_hide(), ewl_widget_show(), Ewl_Text::in_select, Ewl_Text::selection, Ewl_Event_Mouse::x, and Ewl_Event_Mouse::y.
Referenced by ewl_text_selectable_set().
| void ewl_text_cb_mouse_move | ( | Ewl_Widget * | w, | |
| void * | ev, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_TEXT, ewl_text_coord_index_map(), EWL_TEXT_TRIGGER, EWL_TEXT_TYPE, Ewl_Text::in_select, Ewl_Text::selection, Ewl_Event_Mouse::x, and Ewl_Event_Mouse::y.
Referenced by ewl_text_cb_mouse_down(), and ewl_text_cb_mouse_up().
| void ewl_text_cb_mouse_up | ( | Ewl_Widget * | w, | |
| void * | ev, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, ewl_callback_del(), EWL_CALLBACK_MOUSE_MOVE, ewl_ev_modifiers_get(), EWL_KEY_MODIFIER_SHIFT, EWL_TEXT, ewl_text_cb_mouse_move(), ewl_text_coord_index_map(), ewl_text_cursor_position_set(), EWL_TEXT_TRIGGER, EWL_TEXT_TYPE, Ewl_Text::in_select, Ewl_Text::selection, Ewl_Event_Mouse::x, and Ewl_Event_Mouse::y.
Referenced by ewl_text_selectable_set().
| void ewl_text_cb_obscure | ( | Ewl_Widget * | w, | |
| void *ev | __UNUSED__, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, ewl_embed_object_cache(), ewl_embed_widget_find(), EWL_TEXT, EWL_TEXT_TYPE, and Ewl_Text::textblock.
Referenced by ewl_text_init().
| void ewl_text_cb_realize | ( | Ewl_Widget * | w, | |
| void *ev | __UNUSED__, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_TEXT, EWL_TEXT_TYPE, Ewl_Text::max, Ewl_Text::min, and Ewl_Text::size_string.
Referenced by ewl_text_init().
| void ewl_text_cb_reveal | ( | Ewl_Widget * | w, | |
| void *ev | __UNUSED__, | |||
| void *data | __UNUSED__ | |||
| ) |
References Ewl_Embed::canvas, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, DWARNING, ewl_embed_object_request(), ewl_embed_widget_find(), EWL_TEXT, ewl_text_context_format_string_create(), ewl_text_context_release(), EWL_TEXT_TYPE, Ewl_Text_Context::format, FREE, NEW, Ewl_Widget::smart_object, and Ewl_Text::textblock.
Referenced by ewl_text_init().
| void ewl_text_cb_selection_clear | ( | Ewl_Widget * | w, | |
| void *ev | __UNUSED__, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_TEXT, EWL_TEXT_TYPE, ewl_widget_destroy(), and Ewl_Text::selection.
Referenced by ewl_text_selectable_set().
| void ewl_text_cb_show | ( | Ewl_Widget * | w, | |
| void *ev | __UNUSED__, | |||
| void *data | __UNUSED__ | |||
| ) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_TEXT, EWL_TEXT_TYPE, and Ewl_Text::textblock.
Referenced by ewl_text_init().