Ewl_Entry: A text entry widget
Detailed Description
This widget provides all text entry needs, from single to multiline
- Remarks:
- Inherits from Ewl_Text.
Tutorial
The Ewl_Entry provides a widget for editing single line or multi-line text. Since the entry widget inherits from Ewl_Text, all operations that can be performed on text can be used on the entry, including programmatic control of formatting, selections and text contents.
Ewl_Widget *entry; entry = ewl_entry_new(); ewl_text_text_set(EWL_TEXT(entry), "Text to display"); ewl_widget_show(entry);
Almost all manipulation of the entry widget is performed through the Ewl_Text API, with some minor exceptions. Since the entry widget takes user input, it requires an API to enable or disable the editing capability.
void ewl_entry_editable_set(Ewl_Entry *e, unsigned int editable); unsigned int ewl_entry_editable_get(Ewl_Entry *e);
It is also important to be able to indicate if the text entry can contain multiple lines of text, as the reaction to the Enter/Return keys changes. When multiline is enabled, Enter will insert a carriage return in the text, otherwise it raises an EWL_CALLBACK_VALUE_CHANGED callback on the entry widget.
void ewl_entry_multiline_set(Ewl_Entry *e, unsigned int multiline); unsigned int ewl_entry_multiline_get(Ewl_Entry *e);
By inheriting from Ewl_Text, the capabalities of Ewl_Entry are expanded to the full API available for text manipulation. This reduces the number of calls for the user to learn without sacrificing functionality.
Data Structures | |
struct | Ewl_Entry |
Inherits from Ewl_Text and extends to allow editing of the text. More... | |
struct | Ewl_Entry_Cursor |
Inherit from Ewl_Widget and extend for the Entry cursor. More... | |
Defines | |
#define | EWL_ENTRY(entry) ((Ewl_Entry *) entry) |
#define | EWL_ENTRY_CURSOR(cursor) ((Ewl_Entry_Cursor *) cursor) |
#define | EWL_ENTRY_CURSOR_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), EWL_ENTRY_CURSOR_TYPE)) |
#define | EWL_ENTRY_CURSOR_TYPE "cursor" |
#define | EWL_ENTRY_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), EWL_ENTRY_TYPE)) |
#define | EWL_ENTRY_TYPE "entry" |
Typedefs | |
typedef Ewl_Entry | Ewl_Entry |
typedef Ewl_Entry_Cursor | Ewl_Entry_Cursor |
Functions | |
void | ewl_entry_cb_configure (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_disable (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_dnd_data (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_dnd_position (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_enable (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_focus_in (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_focus_out (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_key_down (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_mouse_down (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_mouse_move (Ewl_Widget *w, void *ev, void *data) |
void | ewl_entry_cb_mouse_up (Ewl_Widget *w, void *ev, void *data) |
int | ewl_entry_cursor_init (Ewl_Entry_Cursor *c, Ewl_Entry *parent) |
Initializes an Ewl_Entry_Cursor to default values. | |
void | ewl_entry_cursor_move_down (Ewl_Entry *e) |
Moves the cursor down one line from its current position. | |
void | ewl_entry_cursor_move_end (Ewl_Entry *e) |
Moves the cursor to the last position. | |
void | ewl_entry_cursor_move_left (Ewl_Entry *e) |
Moves the cursor to the left of it's current position. | |
void | ewl_entry_cursor_move_line_end (Ewl_Entry *e) |
Moves the cursor to the end of the line. | |
void | ewl_entry_cursor_move_line_start (Ewl_Entry *e) |
Moves the cursor to the beginning of the line. | |
void | ewl_entry_cursor_move_right (Ewl_Entry *e) |
Moves the cursor to the right of its current position. | |
void | ewl_entry_cursor_move_start (Ewl_Entry *e) |
Moves the cursor to the first position. | |
void | ewl_entry_cursor_move_up (Ewl_Entry *e) |
Moves the cursor up one line from its current position. | |
void | ewl_entry_cursor_move_word_next (Ewl_Entry *e) |
Moves the cursor to the beginning of the next word. | |
void | ewl_entry_cursor_move_word_previous (Ewl_Entry *e) |
Moves the cursor to the beginning of the previous word. | |
Ewl_Widget * | ewl_entry_cursor_new (Ewl_Entry *parent) |
Creates and initializes a new Ewl_Entry_Cursor widget. | |
unsigned int | ewl_entry_cursor_position_get (Ewl_Entry_Cursor *c) |
Retrieves the current position of the Ewl_Entry_Cursor. | |
void | ewl_entry_cursor_position_set (Ewl_Entry_Cursor *c, unsigned int pos) |
Set the current cursor position. | |
void | ewl_entry_delete_left (Ewl_Entry *e) |
Deletes the character to the left of the cursor. | |
void | ewl_entry_delete_right (Ewl_Entry *e) |
Deletes the character to the right of the cursor. | |
unsigned int | ewl_entry_editable_get (Ewl_Entry *e) |
Retrieve if the entry is editable or not. | |
void | ewl_entry_editable_set (Ewl_Entry *e, unsigned int editable) |
Set if the entry is editable or not. | |
int | ewl_entry_init (Ewl_Entry *e) |
Initializes an Ewl_Entry widget to default values. | |
unsigned int | ewl_entry_multiline_get (Ewl_Entry *e) |
Retrieve if the entry is multiline or not. | |
void | ewl_entry_multiline_set (Ewl_Entry *e, unsigned int multiline) |
Set if the entry is multiline or not. | |
Ewl_Widget * | ewl_entry_new (void) |
Create and return a new Ewl_Entry widget. | |
unsigned int | ewl_entry_selection_clear (Ewl_Entry *e) |
Clear the current selection in the entry. | |
Ewl_Widget * | ewl_password_new (void) |
Allocate and initialize a new password widget. |
Define Documentation
#define EWL_ENTRY_CURSOR | ( | cursor | ) | ((Ewl_Entry_Cursor *) cursor) |
Typecast a pointer to an Ewl_Entry_Cursor pointer
#define EWL_ENTRY_CURSOR_IS | ( | w | ) | (ewl_widget_type_is(EWL_WIDGET(w), EWL_ENTRY_CURSOR_TYPE)) |
Returns TRUE if the widget is an Ewl_Entry_Cursor, FALSE otherwise
#define EWL_ENTRY_CURSOR_TYPE "cursor" |
The type name for the Ewl_Entry_Cursor widget
#define EWL_ENTRY_IS | ( | w | ) | (ewl_widget_type_is(EWL_WIDGET(w), EWL_ENTRY_TYPE)) |
Returns TRUE if the widget is an Ewl_Entry, FALSE otherwise
#define EWL_ENTRY_TYPE "entry" |
The type name for the Ewl_Entry widget
Typedef Documentation
typedef struct Ewl_Entry_Cursor Ewl_Entry_Cursor |
The Ewl_Entry_Cursor widget
Function Documentation
void ewl_entry_cb_configure | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_disable | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_dnd_data | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_dnd_position | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_enable | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_focus_in | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_focus_out | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_key_down | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_mouse_down | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_mouse_move | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
void ewl_entry_cb_mouse_up | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
int ewl_entry_cursor_init | ( | Ewl_Entry_Cursor * | c, | |
Ewl_Entry * | parent | |||
) |
Initializes an Ewl_Entry_Cursor to default values.
- Parameters:
-
c,: The Ewl_Entry_Cursor to initialize parent,: The parent Ewl_Text widget
- Returns:
- Returns TRUE on success or FALSE on failure
void ewl_entry_cursor_move_down | ( | Ewl_Entry * | e | ) |
Moves the cursor down one line from its current position.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
void ewl_entry_cursor_move_end | ( | Ewl_Entry * | e | ) |
Moves the cursor to the last position.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
void ewl_entry_cursor_move_left | ( | Ewl_Entry * | e | ) |
Moves the cursor to the left of it's current position.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value
void ewl_entry_cursor_move_line_end | ( | Ewl_Entry * | e | ) |
Moves the cursor to the end of the line.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
void ewl_entry_cursor_move_line_start | ( | Ewl_Entry * | e | ) |
Moves the cursor to the beginning of the line.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
void ewl_entry_cursor_move_right | ( | Ewl_Entry * | e | ) |
Moves the cursor to the right of its current position.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
void ewl_entry_cursor_move_start | ( | Ewl_Entry * | e | ) |
Moves the cursor to the first position.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
void ewl_entry_cursor_move_up | ( | Ewl_Entry * | e | ) |
Moves the cursor up one line from its current position.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
void ewl_entry_cursor_move_word_next | ( | Ewl_Entry * | e | ) |
Moves the cursor to the beginning of the next word.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
void ewl_entry_cursor_move_word_previous | ( | Ewl_Entry * | e | ) |
Moves the cursor to the beginning of the previous word.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
Ewl_Widget* ewl_entry_cursor_new | ( | Ewl_Entry * | parent | ) |
Creates and initializes a new Ewl_Entry_Cursor widget.
- Parameters:
-
parent,: The parent Ewl_Entry widget
- Returns:
- Returns a new Ewl_Entry_Cursor on success or NULL on failure
unsigned int ewl_entry_cursor_position_get | ( | Ewl_Entry_Cursor * | c | ) |
Retrieves the current position of the Ewl_Entry_Cursor.
- Parameters:
-
c,: The cursor to get the position from
- Returns:
- Returns the current position of the cursor
void ewl_entry_cursor_position_set | ( | Ewl_Entry_Cursor * | c, | |
unsigned int | pos | |||
) |
Set the current cursor position.
- Parameters:
-
c,: The cursor to work with pos,: The position to set the cursor too
- Returns:
- Returns no value.
void ewl_entry_delete_left | ( | Ewl_Entry * | e | ) |
Deletes the character to the left of the cursor.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
void ewl_entry_delete_right | ( | Ewl_Entry * | e | ) |
Deletes the character to the right of the cursor.
- Parameters:
-
e,: The Ewl_Entry to work with
- Returns:
- Returns no value.
unsigned int ewl_entry_editable_get | ( | Ewl_Entry * | e | ) |
Retrieve if the entry is editable or not.
- Parameters:
-
e,: The Ewl_Entry to get the editable status from
- Returns:
- Returns the editable status of the entry
void ewl_entry_editable_set | ( | Ewl_Entry * | e, | |
unsigned int | editable | |||
) |
Set if the entry is editable or not.
- Parameters:
-
e,: The Ewl_Entry to set the editable status of editable,: The value to set for the editable flag
- Returns:
- Returns no value
int ewl_entry_init | ( | Ewl_Entry * | e | ) |
unsigned int ewl_entry_multiline_get | ( | Ewl_Entry * | e | ) |
Retrieve if the entry is multiline or not.
- Parameters:
-
e,: The Ewl_Entry to get the multiline status from
- Returns:
- Returns the multline status of the widget
void ewl_entry_multiline_set | ( | Ewl_Entry * | e, | |
unsigned int | multiline | |||
) |
Set if the entry is multiline or not.
- Parameters:
-
e,: The Ewl_Entry to set the multiline status multiline,: The multiline status to set
- Returns:
- Returns no value
Ewl_Widget* ewl_entry_new | ( | void | ) |
Create and return a new Ewl_Entry widget.
- Returns:
- Returns a new Ewl_Widget on success or NULL on failure
unsigned int ewl_entry_selection_clear | ( | Ewl_Entry * | e | ) |
Clear the current selection in the entry.
- Parameters:
-
e,: The entry to clear the selection of
- Returns:
- Returns TRUE if a selection was cleared, FALSE otherwise.
Ewl_Widget* ewl_password_new | ( | void | ) |
Allocate and initialize a new password widget.
- Returns:
- Returns a new password widget on success, NULL on failure.