Ewl_Text_Fmt: Contains the text formatting
Detailed Description
Defines a class for text formatting information.information
Data Structures | |
struct | Ewl_Text_Fmt |
Text formatting information. More... | |
struct | Ewl_Text_Fmt_Node |
Text formatting node. More... | |
Typedefs | |
typedef Ewl_Text_Fmt | Ewl_Text_Fmt |
typedef Ewl_Text_Fmt_Node | Ewl_Text_Fmt_Node |
Functions | |
void | ewl_text_fmt_apply (Ewl_Text_Fmt *fmt, unsigned int context_mask, Ewl_Text_Context *change, unsigned int char_idx, unsigned int char_len) |
Applies the change set to fmt starting at char_idx for char_len characters. | |
void | ewl_text_fmt_byte_to_char (Ewl_Text_Fmt *fmt, unsigned int byte_idx, unsigned int byte_len, unsigned int *char_idx, unsigned int *char_len) |
Calculates the char index for the given byte_idx and stores into char_idx. Also calculates the char_len for byte_len. | |
void | ewl_text_fmt_char_to_byte (Ewl_Text_Fmt *fmt, unsigned int char_idx, unsigned int char_len, unsigned int *byte_idx, unsigned int *byte_len) |
Calculates the byte index for the given char_idx and stores into byte_idx. Also calculates the byte_len for char_len. | |
void | ewl_text_fmt_clear (Ewl_Text_Fmt *fmt) |
Clears the formatting information. | |
void | ewl_text_fmt_destroy (Ewl_Text_Fmt *fmt) |
Cleans up the memory used by the Ewl_Text_Fmt structure. | |
void | ewl_text_fmt_dump (Ewl_Text_Fmt *fmt) |
Prints out the formatting information. | |
Ewl_Text_Fmt_Node * | ewl_text_fmt_get (Ewl_Text_Fmt *fmt, unsigned int char_idx) |
Returns the character index idx node from fmt. | |
Ewl_Text_Fmt_Node * | ewl_text_fmt_get_current (Ewl_Text_Fmt *fmt) |
Retrives the current formatting node. | |
Ewl_Text_Fmt_Node * | ewl_text_fmt_get_first (Ewl_Text_Fmt *fmt) |
Retrives the first formatting node. | |
Ewl_Text_Fmt_Node * | ewl_text_fmt_get_last (Ewl_Text_Fmt *fmt) |
Retrives the last formatting node. | |
void | ewl_text_fmt_goto (Ewl_Text_Fmt *fmt, unsigned int idx) |
Positions the last at character index idx. | |
Ewl_Text_Fmt * | ewl_text_fmt_new (Ewl_Text *t) |
Creates and initializes a new Ewl_Text_Fmt structure. | |
void | ewl_text_fmt_node_append (Ewl_Text_Fmt *fmt, Ewl_Text_Context *tx, unsigned int char_len, unsigned int byte_len) |
Appends tx for char_len bytes to fmt. | |
unsigned int | ewl_text_fmt_node_count_get (Ewl_Text_Fmt *fmt) |
Retrives the number of nodes in the formatting information. | |
void | ewl_text_fmt_node_delete (Ewl_Text_Fmt *fmt, unsigned int idx, unsigned int char_len) |
Removes any formatting for char_len bytes starting at idx. | |
void | ewl_text_fmt_node_insert (Ewl_Text_Fmt *fmt, unsigned int char_idx, Ewl_Text_Context *tx, unsigned int char_len, unsigned int byte_len) |
Inserts tx at idx for char_len bytes to fmt. | |
Ewl_Text_Fmt_Node * | ewl_text_fmt_node_new (Ewl_Text_Context *tx, unsigned int char_len, unsigned int byte_len) |
Creates a new Ewl_Text_Fmt_Node structure. | |
void | ewl_text_fmt_node_prepend (Ewl_Text_Fmt *fmt, Ewl_Text_Context *tx, unsigned int char_len, unsigned int byte_len) |
Prepends the tx for char_len bytes to fmt. | |
void | ewl_text_fmt_walk (Ewl_Text_Fmt *fmt, void(*cb)(Ewl_Text_Fmt_Node *, Ewl_Text *, unsigned int byte_idx)) |
Walks the formatting information and calls cb for each node. |
Typedef Documentation
typedef struct Ewl_Text_Fmt Ewl_Text_Fmt |
typedef struct Ewl_Text_Fmt_Node Ewl_Text_Fmt_Node |
Function Documentation
void ewl_text_fmt_apply | ( | Ewl_Text_Fmt * | fmt, | |
unsigned int | context_mask, | |||
Ewl_Text_Context * | change, | |||
unsigned int | char_idx, | |||
unsigned int | char_len | |||
) |
Applies the change set to fmt starting at char_idx for char_len characters.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with context_mask,: The set of changes in this context change,: The context containing the changes char_idx,: The character index to apply too char_len,: The character length to apply too
- Returns:
- Returns no value
void ewl_text_fmt_byte_to_char | ( | Ewl_Text_Fmt * | fmt, | |
unsigned int | byte_idx, | |||
unsigned int | byte_len, | |||
unsigned int * | char_idx, | |||
unsigned int * | char_len | |||
) |
Calculates the char index for the given byte_idx and stores into char_idx. Also calculates the char_len for byte_len.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with byte_idx,: Where to store the byte index byte_len,: Where to store the byte length char_idx,: The character index to convert char_len,: The cahracter length to convert
- Returns:
- Returns no value
void ewl_text_fmt_char_to_byte | ( | Ewl_Text_Fmt * | fmt, | |
unsigned int | char_idx, | |||
unsigned int | char_len, | |||
unsigned int * | byte_idx, | |||
unsigned int * | byte_len | |||
) |
Calculates the byte index for the given char_idx and stores into byte_idx. Also calculates the byte_len for char_len.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with char_idx,: The character index to convert char_len,: The cahracter length to convert byte_idx,: Where to store the byte index byte_len,: Where to store the byte length
- Returns:
- Returns no value
void ewl_text_fmt_clear | ( | Ewl_Text_Fmt * | fmt | ) |
Clears the formatting information.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with
- Returns:
- Returns no value
void ewl_text_fmt_destroy | ( | Ewl_Text_Fmt * | fmt | ) |
Cleans up the memory used by the Ewl_Text_Fmt structure.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to destroy
- Returns:
- Returns no value
void ewl_text_fmt_dump | ( | Ewl_Text_Fmt * | fmt | ) |
Prints out the formatting information.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to dump the formatting from
- Returns:
- Returns no value
Ewl_Text_Fmt_Node* ewl_text_fmt_get | ( | Ewl_Text_Fmt * | fmt, | |
unsigned int | idx | |||
) |
Returns the character index idx node from fmt.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with idx,: The index to get the node for
- Returns:
- Returns the node containing the character index idx
Ewl_Text_Fmt_Node* ewl_text_fmt_get_current | ( | Ewl_Text_Fmt * | fmt | ) |
Retrives the current formatting node.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with
- Returns:
- Returns the current node in the formatting information
Ewl_Text_Fmt_Node* ewl_text_fmt_get_first | ( | Ewl_Text_Fmt * | fmt | ) |
Retrives the first formatting node.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with
- Returns:
- Returns the first node in the formatting information
Ewl_Text_Fmt_Node* ewl_text_fmt_get_last | ( | Ewl_Text_Fmt * | fmt | ) |
Retrives the last formatting node.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with
- Returns:
- Returns the last node in the formatting information
void ewl_text_fmt_goto | ( | Ewl_Text_Fmt * | fmt, | |
unsigned int | idx | |||
) |
Positions the last at character index idx.
- Parameters:
-
fmt,: The Ewl_Text_fmt to work with idx,: The index to go to
- Returns:
- Returns no value
Ewl_Text_Fmt* ewl_text_fmt_new | ( | Ewl_Text * | t | ) |
Creates and initializes a new Ewl_Text_Fmt structure.
- Parameters:
-
t,: The parent Ewl_Text widget
- Returns:
- Returns a new Ewl_Text_Fmt structure on success or NULL on failure
void ewl_text_fmt_node_append | ( | Ewl_Text_Fmt * | fmt, | |
Ewl_Text_Context * | tx, | |||
unsigned int | char_len, | |||
unsigned int | byte_len | |||
) |
Appends tx for char_len bytes to fmt.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with tx,: The context to append char_len,: The character length to append byte_len,: The byte length to append
- Returns:
- Returns no value
unsigned int ewl_text_fmt_node_count_get | ( | Ewl_Text_Fmt * | fmt | ) |
Retrives the number of nodes in the formatting information.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with
- Returns:
- Returns the number of formatting nodes
void ewl_text_fmt_node_delete | ( | Ewl_Text_Fmt * | fmt, | |
unsigned int | idx, | |||
unsigned int | char_len | |||
) |
Removes any formatting for char_len bytes starting at idx.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with idx,: The index to delete from char_len,: The character length to delete
- Returns:
- Returns no value
void ewl_text_fmt_node_insert | ( | Ewl_Text_Fmt * | fmt, | |
unsigned int | idx, | |||
Ewl_Text_Context * | tx, | |||
unsigned int | char_len, | |||
unsigned int | byte_len | |||
) |
Inserts tx at idx for char_len bytes to fmt.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with idx,: The index to insert into tx,: The context to append char_len,: The character length to append byte_len,: The byte length to append
- Returns:
- Returns no value
Ewl_Text_Fmt_Node* ewl_text_fmt_node_new | ( | Ewl_Text_Context * | tx, | |
unsigned int | char_len, | |||
unsigned int | byte_len | |||
) |
Creates a new Ewl_Text_Fmt_Node structure.
- Parameters:
-
tx,: The context to set char_len,: The length of this node byte_len,: The byte length of this node
- Returns:
- Returns a new Ewl_Text_Fmt_Node no success or NULL on failure
void ewl_text_fmt_node_prepend | ( | Ewl_Text_Fmt * | fmt, | |
Ewl_Text_Context * | tx, | |||
unsigned int | char_len, | |||
unsigned int | byte_len | |||
) |
Prepends the tx for char_len bytes to fmt.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with tx,: The context to prepend char_len,: The character length being prepended byte_len,: The byte length being prepended
- Returns:
- Returns no value
void ewl_text_fmt_walk | ( | Ewl_Text_Fmt * | fmt, | |
void(*)(Ewl_Text_Fmt_Node *, Ewl_Text *, unsigned int byte_idx) | cb | |||
) |
Walks the formatting information and calls cb for each node.
- Parameters:
-
fmt,: The Ewl_Text_Fmt to work with cb,: The function to call for each formatting node
- Returns:
- Returns no value