Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Related Pages

Text: A Multi-Line Text Layout Display

Defines a class for multi-line text layout and formatting. More...

Data Structures

struct  Ewl_Text
 Inherits from the Ewl_Widget class and extends it to provide for multi-line text layout, obstacle wrapping, and a variety of formatting. More...

struct  Ewl_Text
 Inherits from the Ewl_Widget class and extends it to provide for multi-line text layout, obstacle wrapping, and a variety of formatting. More...


Defines

#define EWL_TEXT(text)   ((Ewl_Text *) text)
 Typecasts a pointer to an Ewl_Text pointer.


Typedefs

typedef Ewl_Text Ewl_Text
 Provides for layout of text across multiple lines, as well as formatting portions of the text in different ways, and wrapping around obstacles.


Functions

Ewl_Widgetewl_text_new (char *text)
 Allocate a new text area widget.

void ewl_text_init (Ewl_Text *ta, char *text)
 Initialize the fields and callbacks of a text area.

void ewl_text_text_set (Ewl_Text *ta, char *text)
 Set the text of a text area widget.

void ewl_text_text_prepend (Ewl_Text *ta, char *text)
 Append text to a text area widget.

void ewl_text_text_append (Ewl_Text *ta, char *text)
 Append text to a text area widget.

void ewl_text_text_insert (Ewl_Text *ta, char *text, int index)
 Append text to a text area widget.

char * ewl_text_text_get (Ewl_Text *ta)
 Retrieve the text of a text widget.

int ewl_text_length_get (Ewl_Text *ta)
 Retrieve the length of the text displayed by the text widget.

void ewl_text_font_set (Ewl_Text *ta, char *font, int size)
 Changes the currently applied font of the text to specified values.

char * ewl_text_font_get (Ewl_Text *ta)
 Retrieve the name of the currently used font.

void ewl_text_style_set (Ewl_Text *ta, char *style)
 Changes the currently applied style of the text to specified values.

char * ewl_text_style_get (Ewl_Text *ta)
 Retrieves the currently used text style from a text widget.

void ewl_text_color_set (Ewl_Text *ta, int r, int g, int b, int a)
 Changes the currently applied color of the text to specified values.

void ewl_text_align_set (Ewl_Text *ta, unsigned int align)
 Changes the currently applied alignment of the text to specified value.

unsigned int ewl_text_align_get (Ewl_Text *ta)
 Retrieves the currently used text alignment from a text widget.

void ewl_text_index_geometry_map (Ewl_Text *ta, int index, int *xx, int *yy, int *ww, int *hh)
 Maps a character index to a set of coordinates and sizes.

int ewl_text_coord_index_map (Ewl_Text *ta, int x, int y)
 Finds the index of the character under the specified coordinates.


Detailed Description

Defines a class for multi-line text layout and formatting.


Function Documentation

unsigned int ewl_text_align_get Ewl_Text ta  ) 
 

Retrieves the currently used text alignment from a text widget.

Parameters:
ta: the text widget to get the current alignment
Returns:
Returns the currently used text alignment.

void ewl_text_align_set Ewl_Text ta,
unsigned int  align
 

Changes the currently applied alignment of the text to specified value.

Parameters:
ta: the text widget to change alignment
align: the new alignment of the text widget
Returns:
Returns no value.

void ewl_text_color_set Ewl_Text ta,
int  r,
int  g,
int  b,
int  a
 

Changes the currently applied color of the text to specified values.

Parameters:
ta: the text widget to change color
r: the new red value
g: the new green value
b: the new blue value
a: the new alpha value
Returns:
Returns no value.

int ewl_text_coord_index_map Ewl_Text ta,
int  x,
int  y
 

Finds the index of the character under the specified coordinates.

Parameters:
ta: the text widget to map a coordinate to a character index
x: the x coordinate over the desired character
y: the y coordinate over the desired character
Returns:
Returns the index of the found character on success, 0 otherwise.

char* ewl_text_font_get Ewl_Text ta  ) 
 

Retrieve the name of the currently used font.

Parameters:
ta: the text widget to retrieve the current font
Returns:
Returns a copied string containing the name of the current font.

void ewl_text_font_set Ewl_Text ta,
char *  font,
int  size
 

Changes the currently applied font of the text to specified values.

Parameters:
ta: the text widget to change font
font: the name of the font
size: the size of the font
Returns:
Returns no value.

void ewl_text_index_geometry_map Ewl_Text ta,
int  index,
int *  x,
int *  y,
int *  w,
int *  h
 

Maps a character index to a set of coordinates and sizes.

Parameters:
ta: the text widget to map index to character geometry
index: character index to be mapped
x: pointer to store determined character x coordinate
y: pointer to store determined character y coordinate
w: pointer to store determined character width
h: pointer to store determined character height
Returns:
Returns no value.
Any of the coordinate parameters may be NULL, they will be ignored. If the index fails to map successfully, the values at the locations pointed to by the coordinate pointers will not be altered. This function can only succeed after the text widget has been realized.

void ewl_text_init Ewl_Text ta,
char *  text
 

Initialize the fields and callbacks of a text area.

Parameters:
ta: the text area to be initialized
text: the text to be displayed initially in the text area
Returns:
Returns no value.
Sets the internal fields and callbacks of a text area to their defaults.

int ewl_text_length_get Ewl_Text ta  ) 
 

Retrieve the length of the text displayed by the text widget.

Parameters:
ta: the text widget to retrieve length
Returns:
Returns the length of the text contained in the widget.

Ewl_Widget* ewl_text_new char *  text  ) 
 

Allocate a new text area widget.

Parameters:
text: the initial text of the text
Returns:
Returns a pointer to a new text on success, NULL on failure.
Sets the text initially to text if not NULL. This initial text will use the default formatting information from the theme. Pass text as NULL and use ewl_text_text_set after changing the settings to change attributes the text.

char* ewl_text_style_get Ewl_Text ta  ) 
 

Retrieves the currently used text style from a text widget.

Parameters:
ta: the text widget to get the current style
Returns:
Returns the currently used text style.

void ewl_text_style_set Ewl_Text ta,
char *  style
 

Changes the currently applied style of the text to specified values.

Parameters:
ta: the text widget to change style
style: the name of the style
Returns:
Returns no value.

void ewl_text_text_append Ewl_Text ta,
char *  text
 

Append text to a text area widget.

Parameters:
ta: the text area widget to append the text
text: the text to append in the text area widget ta
Returns:
Returns no value.
Appends text to the text area widget ta.

char* ewl_text_text_get Ewl_Text ta  ) 
 

Retrieve the text of a text widget.

Parameters:
ta: the text widget to retrieve text contents
Returns:
Returns a copy of the text in ta on success, NULL on failure.

void ewl_text_text_insert Ewl_Text ta,
char *  text,
int  index
 

Append text to a text area widget.

Parameters:
ta: the text area widget to insert the text
text: the text to insert in the text area widget ta
index: the index into the text to start inserting new text
Returns:
Returns no value.
Appends text to the text area widget ta.

void ewl_text_text_prepend Ewl_Text ta,
char *  text
 

Append text to a text area widget.

Parameters:
ta: the text area widget to prepend the text
text: the text to prepend in the text area widget ta
Returns:
Returns no value.
Appends text to the text area widget ta.

void ewl_text_text_set Ewl_Text ta,
char *  text
 

Set the text of a text area widget.

Parameters:
ta: the text area widget to set the text
text: the text to set in the text area widget ta
Returns:
Returns no value.
Sets the text of the text area widget ta to a copy of the contents of text.