Download

Support

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 struct Ewl_Entry Ewl_Entry
typedef struct 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_left (Ewl_Entry *e)
 Moves the cursor to the left of it's current position.
void ewl_entry_cursor_move_right (Ewl_Entry *e)
 Moves the cursor to the right of its current position.
void ewl_entry_cursor_move_up (Ewl_Entry *e)
 Moves the cursor up one line from its current position.
Ewl_Widgetewl_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_Widgetewl_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_Viewewl_entry_view_get (void)
 Creates and returns a view to be used by Ewl_Entry widgets.
Ewl_Widgetewl_password_new (void)
 Allocate and initialize a new password widget.

Define Documentation

#define EWL_ENTRY_CURSOR_IS (  )     (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"

#define EWL_ENTRY_IS (  )     (ewl_widget_type_is(EWL_WIDGET(w), EWL_ENTRY_TYPE))

Returns TRUE if the widget is an Ewl_Entry, FALSE otherwise


Typedef Documentation

typedef struct Ewl_Entry Ewl_Entry

The Ewl_Entry


Function Documentation

void ewl_entry_cb_disable ( 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_mouse_move ( 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

References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_ENTRY_CURSOR_TYPE, EWL_ENTRY_TYPE, EWL_WIDGET, ewl_widget_appearance_set(), ewl_widget_focusable_set(), ewl_widget_inherit(), ewl_widget_init(), and Ewl_Entry_Cursor::parent.

Referenced by ewl_entry_cursor_new().

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.

References cursor, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_ENTRY_CURSOR, ewl_entry_cursor_position_set(), EWL_ENTRY_TYPE, EWL_TEXT, ewl_text_cursor_position_line_down_get(), EWL_WIDGET, and ewl_widget_configure().

Referenced by ewl_entry_cb_key_down().

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

References cursor, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, EWL_ENTRY_CURSOR, ewl_entry_cursor_position_get(), ewl_entry_cursor_position_set(), EWL_ENTRY_TYPE, EWL_WIDGET, and ewl_widget_configure().

Referenced by ewl_entry_cb_key_down(), and ewl_spinner_cb_key_down().

void ewl_entry_cursor_move_right ( Ewl_Entry e  ) 

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.

References cursor, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_ENTRY_CURSOR, ewl_entry_cursor_position_set(), EWL_ENTRY_TYPE, EWL_TEXT, ewl_text_cursor_position_line_up_get(), EWL_WIDGET, and ewl_widget_configure().

Referenced by ewl_entry_cb_key_down().

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

References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, EWL_ENTRY_CURSOR, ewl_entry_cursor_init(), ewl_widget_destroy(), and NEW.

Referenced by ewl_entry_init().

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

References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_ENTRY_CURSOR_TYPE, EWL_TEXT, ewl_text_cursor_position_get(), and Ewl_Entry_Cursor::parent.

Referenced by ewl_entry_cb_configure(), ewl_entry_cb_key_down(), ewl_entry_cursor_move_left(), ewl_entry_cursor_move_right(), and ewl_entry_delete_left().

void ewl_entry_cursor_position_set ( Ewl_Entry_Cursor c,
unsigned int  pos 
)

void ewl_entry_delete_left ( Ewl_Entry e  ) 

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.

References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, EWL_ENTRY_TYPE, EWL_TEXT, and ewl_text_text_delete().

Referenced by ewl_entry_cb_key_down(), and ewl_spinner_cb_key_down().

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

References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, editable, and EWL_ENTRY_TYPE.

void ewl_entry_editable_set ( Ewl_Entry e,
unsigned int  editable 
)

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

References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_ENTRY_TYPE, and multiline.

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

References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_ENTRY_TYPE, and multiline.

Referenced by ewl_entry_init().

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

References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, EWL_ENTRY, ewl_entry_init(), ewl_widget_destroy(), and NEW.

Referenced by ewl_filepicker_init(), ewl_password_new(), and ewl_spinner_init().

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.

References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_ENTRY_TYPE, EWL_TEXT, ewl_text_cursor_position_set(), ewl_text_selection_get(), ewl_text_text_delete(), EWL_TEXT_TRIGGER, ewl_text_trigger_length_get(), ewl_text_trigger_length_set(), and ewl_text_trigger_start_pos_get().

Referenced by ewl_entry_cb_key_down(), and ewl_spinner_cb_key_down().

Ewl_View* ewl_entry_view_get ( void   ) 

Creates and returns a view to be used by Ewl_Entry widgets.

Returns:
Returns a view that can be used to display Ewl_Entry widgets

References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, ewl_view_header_fetch_set(), ewl_view_new(), and ewl_view_widget_fetch_set().

Ewl_Widget* ewl_password_new ( void   ) 

Allocate and initialize a new password widget.

Returns:
Returns a new password widget on success, NULL on failure. A password widget is an entry with a set obscure character. The default is a star (*)

References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, ewl_entry_new(), EWL_ENTRY_TYPE, EWL_TEXT, ewl_text_obscure_set(), and ewl_widget_appearance_set().


Copyright © Enlightenment.org

Enlightened Widget Library Documentation Generated: Sat May 17 16:51:09 2008