Download

Support

Ewl_Text: A text layout widget


Detailed Description

Defines a class for text layout and formatting.

Remarks:
Inherits from Ewl_Container.

Tutorial

The Ewl_Text widget provides for a multi-line text layout widget. It can be utilized whenever the display of text is required in an application. It works well with the Ewl_Scrollpane to provide a scrollable text area.

 Ewl_Widget *text;
 text = ewl_text_new();
 ewl_text_text_set(EWL_TEXT(text), "set the text here");
 ewl_widget_show(text);

Once the text object is created you can change the text, retrieve the current text contents or get the text length. These things can be done with:

 void ewl_text_text_set(Ewl_Text *t, const char *txt);
 void ewl_text_text_prepend(Ewl_Text *t, const char *txt);
 void ewl_text_text_append(Ewl_Text *t, const char *txt);
 void ewl_text_text_insert(Ewl_Text *t, const char *txt, int len);
 char *ewl_text_text_get(Ewl_Text *t);
 int ewl_text_length_get(Ewl_Text *t);
 void ewl_text_clear(Ewl_Text *t);
 void ewl_text_text_delete(Ewl_Text *t, unsigned int len);

The Ewl_Text widget allows you to perform style changes to the text in the widget. Different portions of the text can be different colours, fonts or styles. You can either set the styling, colours or fonts before the text is set, or you can apply the settings to the text afterwards.

The colour settings of the text can be manipulated with the following:

 void ewl_text_color_set(Ewl_Text *t, int r, int g, int b, int a);
 void ewl_text_color_get(Ewl_Text *t, int *r, int *g, int *b, int *a);
 void ewl_text_color_apply(Ewl_Text *t, int r, int g, int b, int a, unsigned int len);

There are similar calls to mainipluate the font, font size, font colour, background colour, glow colour, outline colour, strikethrough colour, underline colour, double underline colour, alignment, wrap and style information.

Styles have a few extra calls to make them easier to use. These include:

 void ewl_text_style_add(Ewl_Text *t, Ewl_Text_Style style, unsigned int len);
 void ewl_text_style_del(Ewl_Text *t, Ewl_Text_Style style, unsigned int len);
 void ewl_text_style_invert(Ewl_Text *t, Ewl_Text_Style style, unsigned int len);
 unsigned int ewl_text_style_has(Ewl_Text *t, Ewl_Text_Style style, unsigned int idx);

If you want users to be able to select text from the Ewl_Text widget you'll use:

 void ewl_text_selectable_set(Ewl_Text *t, unsigned int selectable);
 unsigned int ewl_text_selectable_get(Ewl_Text *t);

After the user has made a selection it can be checked and retrieved with:

 unsigned int ewl_text_has_selection(Ewl_Text *t);
 Ewl_Text_Trigger *ewl_text_selection_get(Ewl_Text *t);
 char *ewl_text_selection_text_get(Ewl_Text *t);

This should hopefully give you some idea of the capabilities of the Ewl_Text widget. Take a look at the test code and the header file for more information.


Data Structures

struct  Ewl_Text
 Inherits from the Ewl_Container class and extends it to provide text layout and formatting. More...

Defines

#define EWL_TEXT(x)   ((Ewl_Text *)x)
#define EWL_TEXT_IS(w)   (ewl_widget_type_is(EWL_WIDGET(w), EWL_TEXT_TYPE))
#define EWL_TEXT_SELECTION_IS(w)   (ewl_widget_type_is(EWL_WIDGET(w), EWL_TEXT_SELECTION_TYPE))
#define EWL_TEXT_SELECTION_TYPE   "selection"
#define EWL_TEXT_TYPE   "text"

Typedefs

typedef Ewl_Text Ewl_Text

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)
void ewl_text_cb_configure (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_destroy (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_hide (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_key_down (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_mouse_down (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_mouse_move (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_mouse_up (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_obscure (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_realize (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_reveal (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_selection_clear (Ewl_Widget *w, void *ev, void *data)
void ewl_text_cb_show (Ewl_Widget *w, void *ev, void *data)
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_Widgetewl_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 *utf8_character)
 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_Widgetewl_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 sytle, 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 length)
 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_trigger_cb_destroy (Ewl_Widget *w, void *ev, void *data)
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 (  )     ((Ewl_Text *)x)

Typecasts a pointer to an Ewl_Text pointer.

#define EWL_TEXT_IS (  )     (ewl_widget_type_is(EWL_WIDGET(w), EWL_TEXT_TYPE))

Returns TRUE if the widget is an Ewl_Text, FALSE otherwise

#define EWL_TEXT_SELECTION_IS (  )     (ewl_widget_type_is(EWL_WIDGET(w), EWL_TEXT_SELECTION_TYPE))

Returns TRUE if the widget is an Ewl_Text_Selection, FALSE otherwise

#define EWL_TEXT_SELECTION_TYPE   "selection"

The type name for the Ewl_Text_Selection widget

#define EWL_TEXT_TYPE   "text"

The type name for the Ewl_Text widget


Typedef Documentation

typedef struct Ewl_Text Ewl_Text

Provides for layout of text as well as formatting portions of the text in different ways.


Function Documentation

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.

Parameters:
t,: The Ewl_Text to apply the alignment too
align,: The alignment to apply
char_len,: The length to apply the alignment for
Returns:
Returns no value

unsigned int ewl_text_align_get ( Ewl_Text t,
unsigned int  char_idx 
)

Retrieves the alignment value from the given index.

Parameters:
t,: The Ewl_Text to get the alignment from
char_idx,: The index to get the alignment from
Returns:
Returns the current text alignment value

void ewl_text_align_set ( Ewl_Text t,
unsigned int  align 
)

Set the current alignment value of the text.

Parameters:
t,: The Ewl_Text ot set the alignment into
align,: The alignment to set
Returns:
Returns no value

void ewl_text_all_select ( Ewl_Text t  ) 

Select the whole text.

Parameters:
t,: The text to do the selection on
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text background colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
char_len,: The length of text to apply the bg colour over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the text background colour from
r,: Where to put the red value
g,: Where to put the green value
b,: Where to put the blue value
a,: Where to put the alpha value
char_idx,: The index to get the colour from
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text background colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
Returns:
Returns no value

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 
)

void ewl_text_cb_configure ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_destroy ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_hide ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_key_down ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_mouse_down ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_mouse_move ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_mouse_up ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_obscure ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_realize ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_reveal ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_selection_clear ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_cb_show ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_text_clear ( Ewl_Text t  ) 

Clear the text widget.

Parameters:
t,: The Ewl_Text to clear
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the colour into
r,: The red value to set
g,: The green value to set
b,: The blue value to set
a,: The alpha value to set
char_len,: The length of text to apply the colour over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the colour from
r,: Where to put the red value
g,: Where to put the green value
b,: Where to put the blue value
a,: Where to put the alpha value
char_idx,: The index to get the colour from
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the colour on
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to mapp the coords into
x,: The x coord to map
y,: The y coord to map
Returns:
Returns the character index of the given coordinates

unsigned int ewl_text_cursor_position_get ( Ewl_Text t  ) 

Retrieve the cursor position from the text widget.

Parameters:
t,: The Ewl_Text to get the cursor position from
Returns:
Returns the current cursor position in the 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.

Parameters:
t,: The Ewl_Text to get the cursor position one line down from
Returns:
Returns the cursor position if we moved 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.

Parameters:
t,: The Ewl_Text to get the cursor position one line up from
Returns:
Returns the cursor position if we moved up one line

void ewl_text_cursor_position_set ( Ewl_Text t,
unsigned int  char_pos 
)

Set the cursor position in the text widget.

Parameters:
t,: The Ewl_Text widget to set the position into
char_pos,: The position to set
Returns:
Returns no value.

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.

Parameters:
t,: The Ewl_Text to get the cursor position of the beginning of the next word
Returns:
Returns the cursor position if we moved 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.

Parameters:
t,: The Ewl_Text to get the cursor position of the beginning of previous word
Returns:
Returns the cursor position if we moved 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.

Parameters:
t,: The Ewl_Text to set the text double underline colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
char_len,: The length of text to apply the double underline colour over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the text double underline colour from
r,: Where to put the red value
g,: Where to put the green value
b,: Where to put the blue value
a,: Where to put the alpha value
char_idx,: The index to get the colour from
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text double underline colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the font too
font,: The font to set
char_len,: The distance to set the font over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the font from
char_idx,: The index to get the font at
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Widget to set the font into
font,: The font to set
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the size into
size,: The size to set
char_len,: Length of block to get the new size
Returns:
Returns no value

unsigned int ewl_text_font_size_get ( Ewl_Text t,
unsigned int  char_idx 
)

Retrieve the font size at the given index.

Parameters:
t,: The Ewl_Text to get the size from
char_idx,: The index you want to get the size for
Returns:
Returns no value

void ewl_text_font_size_set ( Ewl_Text t,
unsigned int  size 
)

Set the font size to use when inserting new text.

Parameters:
t,: The Ewl_Text to set the size too
size,: The size to set the font too
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the font too
source,: The font souce
font,: The font to set
char_len,: The distance to set the font over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the font from
char_idx,: The index to get the font at
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Widget to set the font into
source,: The font source to set
font,: The font to set
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text glow colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
char_len,: The length of text to apply the glow colour over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the text glow colour from
r,: Where to put the red value
g,: Where to put the green value
b,: Where to put the blue value
a,: Where to put the alpha value
char_idx,: The index to get the colour from
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text glow colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
Returns:
Returns no value

unsigned int ewl_text_has_selection ( Ewl_Text t  ) 

Check if anything is selected in the text widget.

Parameters:
t,: The text to check if there is a selection
Returns:
Returns TRUE if there is selected text, FALSE otherwise

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.

Parameters:
t,: The Ewl_Text to get the geometry from
char_idx,: The character index to get the geometry for
x,: Where to put the x value
y,: Where to put the y value
w,: Where to put the w value
h,: Where to put the h value

int ewl_text_init ( Ewl_Text t  ) 

Initializes an Ewl_Text widget to default values.

Parameters:
t,: The Ewl_Text widget
Returns:
Returns TRUE on successfully init or FALSE on failure

unsigned int ewl_text_length_get ( Ewl_Text t  ) 

Retrieve the character length of the text.

Parameters:
t,: The Ewl_Text to get the length from
Returns:
Returns the character length of the text in the widget t

unsigned int ewl_text_length_maximum_get ( Ewl_Text t  ) 

Retrieve if maximum number of characters.

Parameters:
t,: The Ewl_Text to get the maximum number of characters
Returns:
Returns the maximum length of characters, if the number is unlimited it returns 0

void ewl_text_length_maximum_set ( Ewl_Text t,
unsigned int  char_num 
)

Set the maximum number of characters.

Parameters:
t,: The Ewl_Text to set the maximum number of characters
char_num,: The maximum number of characters
Returns:
Returns no value
This function set the maximum number of characters that can be insert into the text. The number of characters is unlimited if the value is equal to 0. If there is already text inside of the text widget, every thing after the limit will be deleted.

const char* ewl_text_maximum_size_string_get ( Ewl_Text t  ) 

Retrieve the maximum size string.

Parameters:
t,: The Ewl_Text to get the maximum size string from
Returns:
Returns the string which defines the maximum size

void ewl_text_maximum_size_string_set ( Ewl_Text t,
const char *  string 
)

Set a maximum size based on a given string.

Parameters:
t,: The Ewl_Text to set the maximum size string
string,: The string to set define the maximum size
Returns:
Returns no value
The text widget will set its maximum size to be not wider then to show the given string. It will use the default context, for font and size.

const char* ewl_text_minimum_size_string_get ( Ewl_Text t  ) 

Retrieve the minimum size string.

Parameters:
t,: The Ewl_Text to get the minimum size string from
Returns:
Returns the string which defines the minimum size

void ewl_text_minimum_size_string_set ( Ewl_Text t,
const char *  string 
)

Set a minimum size based on a given string.

Parameters:
t,: The Ewl_Text to set the minimum size string
string,: The string to set define the minimum size
Returns:
Returns no value
The text widget will set its minimum size to be wide enough to show the given string. It will use the default context, for font and size.

Ewl_Widget* ewl_text_new ( void   ) 

Creates a new Ewl_Text widget.

Returns:
Returns a new Ewl_Text widget on success, NULL on failure.

const char* ewl_text_obscure_get ( Ewl_Text t  ) 

Retrieves the character used to obscure the text for a password.

Parameters:
t,: the text to retrieve the obscuring character
Returns:
Returns the character value of the obscuring character. This is a null-terminated string containing an UTF-8 character or NULL if the text isn't set to obscure the text.

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.

Parameters:
t,: the text to set the obscuring character
o,: the character to obscure the password characters. This need to be a string, because UTF-8 characters can be longer then one byte. If it is not a valid UTF-8 character it will fallback to an asterix (*). NULL will turn the option off and let the text widget return to the normal text view.
Returns:
Returns no value.

void ewl_text_offsets_get ( Ewl_Text t,
int *  x,
int *  y 
)

Retrieve the current layout offsets of the text.

Parameters:
t,: The Ewl_Text to get the layout offsets from
x,: A pointer to an integer to store the x offset of the text display
y,: A pointer to an integer to store the y offset of the text display
Returns:
Returns no value.

void ewl_text_offsets_set ( Ewl_Text t,
int  x,
int  y 
)

Set the current layout offsets of the text.

Parameters:
t,: The Ewl_Text to set the layout offsets
x,: The x amount to offset of the text display
y,: The y amount to offset of the text display
Returns:
Returns no value.

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.

Parameters:
t,: The Ewl_Text to set the text outline colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
char_len,: The length of text to apply the outline colour over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the text outline colour from
r,: Where to put the red value
g,: Where to put the green value
b,: Where to put the blue value
a,: Where to put the alpha value
char_idx,: The index to get the colour from
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text outline colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
Returns:
Returns no value

void ewl_text_select ( Ewl_Text t,
unsigned int  char_idx,
unsigned int  char_len 
)

Select the text.

Parameters:
t,: The text to do the selection on
char_idx,: The start position of the selection
char_len,: The length of the selection
Returns:
Returns no value

unsigned int ewl_text_selectable_get ( Ewl_Text t  ) 

Get the selectable state of the text.

Parameters:
t,: The text to get the selectable value from
Returns:
Returns the selectable value of the widget

void ewl_text_selectable_set ( Ewl_Text t,
unsigned int  selectable 
)

Set if the text is selectable.

Parameters:
t,: The text to set the selectable value of
selectable,: The selectable value to set
Returns:
Returns no value

Ewl_Widget* ewl_text_selection_get ( Ewl_Text t  ) 

Get the current text selection.

Parameters:
t,: The Ewl_Text to get the selection from
Returns:
Returns the selection object of this text or NULL if no current selection

char* ewl_text_selection_text_get ( Ewl_Text t  ) 

Gets the current text of the selection.

Parameters:
t,: The Ewl_Text widget to get the selection text from
Returns:
Returns the selection text or NULL if none set

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.

Parameters:
t,: The Ewl_Text to set the text shadow colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
char_len,: The length of text to apply the shadow colour over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the text shadow colour from
r,: Where to put the red value
g,: Where to put the green value
b,: Where to put the blue value
a,: Where to put the alpha value
char_idx,: The index to get the colour from
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text shadow colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text strikethrough colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
char_len,: The length of text to apply the strikethrough colour over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the text strikethrough colour from
r,: Where to put the red value
g,: Where to put the green value
b,: Where to put the blue value
a,: Where to put the alpha value
char_idx,: The index to get the colour from
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text strikethrough colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
Returns:
Returns no value

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.

Parameters:
t,: The text to add the style too
style,: The style to add to the text
char_len,: The lenght of text to add the style too
Returns:
Returns no value

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.

Parameters:
t,: The text to delete the style from
style,: The style to delete from the text
char_len,: The lenght of text to delete the style from
Returns:
Returns no value

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.

Parameters:
t,: The text to check for the style
style,: The style to check for
char_idx,: The index to check for the style
Returns:
Returns no value

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.

Parameters:
t,: The text to invert the style on
style,: The style to invert in the text
char_len,: The lenght of text to invert the style on
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to apply the style too
styles,: The styles to set into the text
char_len,: The length of text to apply the style too
Returns:
Returns no value

unsigned int ewl_text_styles_get ( Ewl_Text t,
unsigned int  char_idx 
)

Retrives the styles in use at the given index.

Parameters:
t,: The Ewl_Text to get the style from
char_idx,: The index to get the style from
Returns:
Get the styles set at the given index in the text

void ewl_text_styles_set ( Ewl_Text t,
unsigned int  styles 
)

Sets the given styles into the text at the cursor.

Parameters:
t,: The Ewl_Text to set the style into
styles,: The styles to set into the text
Returns:
Returns no value

void ewl_text_text_append ( Ewl_Text t,
const char *  text 
)

Append the text into the text widget.

Parameters:
t,: The Ewl_Text to set the text into
text,: The text to set into the widget
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to delete the text from
char_len,: The length of text to delete
Returns:
Returns no value

char* ewl_text_text_get ( Ewl_Text t  ) 

Retrieve the text from the text widget.

Parameters:
t,: The Ewl_Text to get the text from
Returns:
Returns the text in the widget t or NULL if no text is set

void ewl_text_text_insert ( Ewl_Text t,
const char *  text,
unsigned int  char_idx 
)

Insert the given text into the text widget.

Parameters:
t,: The Ewl_Text to set the text into
text,: The text to set into the widget
char_idx,: The index to insert the text at
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text into
text,: The text to set into the widget
Returns:
Returns no value

void ewl_text_text_set ( Ewl_Text t,
const char *  text 
)

Set the text in the text widget.

Parameters:
t,: The Ewl_Text to set the text into
text,: The text to set into the widget
Returns:
Returns no value

void ewl_text_trigger_cb_destroy ( Ewl_Widget w,
void *  ev,
void *  data 
)

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.

Parameters:
t,: The Ewl_Text to set the text underline colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
char_len,: The length of text to apply the underline colour over
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to get the text underline colour from
r,: Where to put the red value
g,: Where to put the green value
b,: Where to put the blue value
a,: Where to put the alpha value
char_idx,: The index to get the colour from
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to set the text underline colour of
r,: The red value
g,: The green value
b,: The blue value
a,: The alpha value
Returns:
Returns no value

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.

Parameters:
t,: The Ewl_Text to apply the wrap value too
wrap,: The wrap value to apply
char_len,: The length of text to apply the wrap value over
Returns:
Returns no value

Ewl_Text_Wrap ewl_text_wrap_get ( Ewl_Text t,
unsigned int  char_idx 
)

Retrives the text wrap value at the given index.

Parameters:
t,: The Ewl_Text to get the wrap value for
char_idx,: The index to get the wrap value from
Returns:
Returns the wrap value of the text 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.

Parameters:
t,: The Ewl_Text to set the wrap into
wrap,: The wrap value to set
Returns:
Returns no value


Copyright © Enlightenment.org

Enlightened Widget Library Documentation Generated: Sun Sep 27 01:49:47 2009