Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Editable


Detailed Description

An editable object is an evas smart-object that displays a single-line text and allows the user to select and edit it. It is used by widgets such as the entry, the spinner, ...

You will almost never have to use directly an editable object, except if you are implementing a new widget that needs an editable single-line.


Functions

Evas_Object * etk_editable_add (Evas *evas)
 Creates a new editable object.
void etk_editable_theme_set (Evas_Object *editable, const char *file, const char *group)
 Sets the theme of the editable object. If this function is not called, the editable object won't be visible.
void etk_editable_align_set (Evas_Object *editable, float align)
 Sets the alignment of the text inside the editable object.
float etk_editable_align_get (Evas_Object *editable)
 Gets the alignment of the text inside the editable object.
void etk_editable_password_mode_set (Evas_Object *editable, Etk_Bool password_mode)
 Sets whether or not the editable object is in password mode. In password mode, the editable object displays '*' instead of the characters.
Etk_Bool etk_editable_password_mode_get (Evas_Object *editable)
 Gets whether or not the editable object is in password mode.
void etk_editable_disabled_set (Evas_Object *editable, Etk_Bool disabled)
 Sets whether or not the editable object is disabled. This will just emit the "etk,state,disabled" or "etk,state,enabled" signal to the text-object of the editable.
Etk_Bool etk_editable_disabled_get (Evas_Object *editable)
 Gets whether or not the editable object is disabled.
void etk_editable_text_set (Evas_Object *editable, const char *text)
 Sets the text of the editable object.
const char * etk_editable_text_get (Evas_Object *editable)
 Gets the entire text of the editable object.
char * etk_editable_text_range_get (Evas_Object *editable, int start, int end)
 Gets a range of the text of the editable object, from position start to position end.
int etk_editable_text_length_get (Evas_Object *editable)
 Gets the unicode length of the text of the editable object. The unicode length is not always the length returned by strlen() since a UTF-8 char can take several bytes.
Etk_Bool etk_editable_insert (Evas_Object *editable, int pos, const char *text)
 Inserts some text at the given position in the editable object.
Etk_Bool etk_editable_delete (Evas_Object *editable, int start, int end)
 Deletes the text of the editable object, between position start and position end.
void etk_editable_cursor_pos_set (Evas_Object *editable, int pos)
 Moves the cursor of the editable object to the given position.
int etk_editable_cursor_pos_get (Evas_Object *editable)
 Gets the position of the cursor of the editable object.
void etk_editable_cursor_move_to_start (Evas_Object *editable)
 Moves the cursor to the start of the editable object.
void etk_editable_cursor_move_to_end (Evas_Object *editable)
 Moves the cursor to the end of the editable object.
void etk_editable_cursor_move_left (Evas_Object *editable)
 Moves the cursor backward by one character offset.
void etk_editable_cursor_move_right (Evas_Object *editable)
 Moves the cursor forward by one character offset.
void etk_editable_cursor_show (Evas_Object *editable)
 Shows the cursor of the editable object.
void etk_editable_cursor_hide (Evas_Object *editable)
 Hides the cursor of the editable object.
void etk_editable_selection_pos_set (Evas_Object *editable, int pos)
 Moves the selection bound of the editable object to the given position.
int etk_editable_selection_pos_get (Evas_Object *editable)
 Gets the position of the selection bound of the editable object.
void etk_editable_selection_move_to_start (Evas_Object *editable)
 Moves the selection bound to the start of the editable object.
void etk_editable_selection_move_to_end (Evas_Object *editable)
 Moves the selection bound to the end of the editable object.
void etk_editable_selection_move_left (Evas_Object *editable)
 Moves the selection bound backward by one character offset.
void etk_editable_selection_move_right (Evas_Object *editable)
 Moves the selection bound forward by one character offset.
void etk_editable_select_all (Evas_Object *editable)
 Selects all the text of the editable object. The selection bound will be moved to the start of the editable object and the cursor will be moved to the end.
void etk_editable_unselect_all (Evas_Object *editable)
 Unselects all the text of the editable object. The selection bound will be moved to the cursor position.
void etk_editable_selection_show (Evas_Object *editable)
 Shows the selection of the editable object.
void etk_editable_selection_hide (Evas_Object *editable)
 Hides the selection of the editable object.
int etk_editable_pos_get_from_coords (Evas_Object *editable, int x, int y)
 Gets the cursor position at the coords ( x, y ). It's used to know where to place the cursor or the selection bound on mouse evevents.
void etk_editable_char_size_get (Evas_Object *editable, int *w, int *h)
 A utility function to get the average size of a character written inside the editable object.


Function Documentation

Evas_Object * etk_editable_add ( Evas *  evas  ) 

Creates a new editable object.

Parameters:
evas the evas where to add the editable object
Returns:
Returns the new editable object

void etk_editable_theme_set ( Evas_Object *  editable,
const char *  file,
const char *  group 
)

Sets the theme of the editable object. If this function is not called, the editable object won't be visible.

Parameters:
editable an editable object
file the path of the theme-file to use (NULL to use the current theme-file of Etk)
group the theme-group to use ("entry", "spinner", ...)

void etk_editable_align_set ( Evas_Object *  editable,
float  align 
)

Sets the alignment of the text inside the editable object.

Parameters:
editable an editable object
align the alignment of the text, from 0.0 (left alignment) to 1.0 (right alignment)

float etk_editable_align_get ( Evas_Object *  editable  ) 

Gets the alignment of the text inside the editable object.

Parameters:
editable an editable object
Returns:
Returns the alignment of the text, from 0.0 (left alignment) to 1.0 (right alignment)

void etk_editable_password_mode_set ( Evas_Object *  editable,
Etk_Bool  password_mode 
)

Sets whether or not the editable object is in password mode. In password mode, the editable object displays '*' instead of the characters.

Parameters:
editable an editable object
password_mode ETK_TRUE to turn on the password mode, ETK_FALSE to turn it off

Etk_Bool etk_editable_password_mode_get ( Evas_Object *  editable  ) 

Gets whether or not the editable object is in password mode.

Parameters:
editable an editable object
Returns:
Returns ETK_TRUE if the editable object is in password mode, ETK_FALSE otherwise

void etk_editable_disabled_set ( Evas_Object *  editable,
Etk_Bool  disabled 
)

Sets whether or not the editable object is disabled. This will just emit the "etk,state,disabled" or "etk,state,enabled" signal to the text-object of the editable.

Parameters:
editable an editable object
disabled ETK_TRUE to disable the editable object, ETK_FALSE to enable it

Etk_Bool etk_editable_disabled_get ( Evas_Object *  editable  ) 

Gets whether or not the editable object is disabled.

Parameters:
editable an editable object
Returns:
Returns ETK_TRUE if the editable object is disabled, ETK_FALSE otherwise

void etk_editable_text_set ( Evas_Object *  editable,
const char *  text 
)

Sets the text of the editable object.

Parameters:
editable an editable object
text the text to set

const char * etk_editable_text_get ( Evas_Object *  editable  ) 

Gets the entire text of the editable object.

Parameters:
editable an editable object
Returns:
Returns the entire text of the editable object

char * etk_editable_text_range_get ( Evas_Object *  editable,
int  start,
int  end 
)

Gets a range of the text of the editable object, from position start to position end.

Parameters:
editable an editable object
start the start position of the text range to get
end the end position of the text range to get
Returns:
Returns the range of text. The returned string will have to be freed with free()

int etk_editable_text_length_get ( Evas_Object *  editable  ) 

Gets the unicode length of the text of the editable object. The unicode length is not always the length returned by strlen() since a UTF-8 char can take several bytes.

Parameters:
editable an editable object
Returns:
Returns the unicode length of the text of the editable object

Etk_Bool etk_editable_insert ( Evas_Object *  editable,
int  pos,
const char *  text 
)

Inserts some text at the given position in the editable object.

Parameters:
editable the editable object in which the text should be inserted
pos the position where to insert the text
text the text to insert
Returns:
Returns ETK_TRUE if the text has been modified, ETK_FALSE otherwise

Etk_Bool etk_editable_delete ( Evas_Object *  editable,
int  start,
int  end 
)

Deletes the text of the editable object, between position start and position end.

Parameters:
editable the editable object in which the text should be deleted
start the position of the first char to delete
end the position where to stop the deletion
Returns:
Returns ETK_TRUE if the text has been modified, ETK_FALSE otherwise

void etk_editable_cursor_pos_set ( Evas_Object *  editable,
int  pos 
)

Moves the cursor of the editable object to the given position.

Parameters:
editable an editable object
pos the position where to move the cursor

int etk_editable_cursor_pos_get ( Evas_Object *  editable  ) 

Gets the position of the cursor of the editable object.

Parameters:
editable an editable object
Returns:
Returns the position of the cursor of the editable object

void etk_editable_cursor_move_to_start ( Evas_Object *  editable  ) 

Moves the cursor to the start of the editable object.

Parameters:
editable an editable object

void etk_editable_cursor_move_to_end ( Evas_Object *  editable  ) 

Moves the cursor to the end of the editable object.

Parameters:
editable an editable object

void etk_editable_cursor_move_left ( Evas_Object *  editable  ) 

Moves the cursor backward by one character offset.

Parameters:
editable an editable object

void etk_editable_cursor_move_right ( Evas_Object *  editable  ) 

Moves the cursor forward by one character offset.

Parameters:
editable an editable object

void etk_editable_cursor_show ( Evas_Object *  editable  ) 

Shows the cursor of the editable object.

Parameters:
editable the editable object whose cursor should be shown

void etk_editable_cursor_hide ( Evas_Object *  editable  ) 

Hides the cursor of the editable object.

Parameters:
editable the editable object whose cursor should be hidden

void etk_editable_selection_pos_set ( Evas_Object *  editable,
int  pos 
)

Moves the selection bound of the editable object to the given position.

Parameters:
editable an editable object
pos the position where to move the selection bound

int etk_editable_selection_pos_get ( Evas_Object *  editable  ) 

Gets the position of the selection bound of the editable object.

Parameters:
editable an editable object
Returns:
Returns the position of the selection bound of the editable object

void etk_editable_selection_move_to_start ( Evas_Object *  editable  ) 

Moves the selection bound to the start of the editable object.

Parameters:
editable an editable object

void etk_editable_selection_move_to_end ( Evas_Object *  editable  ) 

Moves the selection bound to the end of the editable object.

Parameters:
editable an editable object

void etk_editable_selection_move_left ( Evas_Object *  editable  ) 

Moves the selection bound backward by one character offset.

Parameters:
editable an editable object

void etk_editable_selection_move_right ( Evas_Object *  editable  ) 

Moves the selection bound forward by one character offset.

Parameters:
editable an editable object

void etk_editable_select_all ( Evas_Object *  editable  ) 

Selects all the text of the editable object. The selection bound will be moved to the start of the editable object and the cursor will be moved to the end.

Parameters:
editable an editable object

void etk_editable_unselect_all ( Evas_Object *  editable  ) 

Unselects all the text of the editable object. The selection bound will be moved to the cursor position.

Parameters:
editable an editable object

void etk_editable_selection_show ( Evas_Object *  editable  ) 

Shows the selection of the editable object.

Parameters:
editable an editable object

void etk_editable_selection_hide ( Evas_Object *  editable  ) 

Hides the selection of the editable object.

Parameters:
editable an editable object

int etk_editable_pos_get_from_coords ( Evas_Object *  editable,
int  x,
int  y 
)

Gets the cursor position at the coords ( x, y ). It's used to know where to place the cursor or the selection bound on mouse evevents.

Parameters:
editable an editable object
x the x coord, relative to the editable object
y the y coord, relative to the editable object
Returns:
Returns the position where to place the cursor according to the given coords, or -1 on failure

void etk_editable_char_size_get ( Evas_Object *  editable,
int *  w,
int *  h 
)

A utility function to get the average size of a character written inside the editable object.

Parameters:
editable an editable object
w the location where to store the average width of a character
h the location where to store the average height of a character