Next: , Previous: Clutter Effects, Up: Top


18 ClutterEntry

A single line text entry actor

18.1 Overview

<clutter-entry> is a <clutter-texture> that allows single line text entry.

<clutter-entry> is available since Clutter 0.4.

18.2 Usage

— Class: <clutter-entry>

Derives from <clutter-actor>.

This class defines the following slots:

font-name
Pango font description
text
Text to render
color
Font Colour
alignment
The preferred alignment for the string,
position
The cursor position
cursor-visible
Whether the input cursor is visible
text-visible
Whether the text is visible in plain form
max-length
The maximum length of the entry text
entry-padding
The padding space between the text and the left and right borders
x-align
The horizontal alignment to be used for the text
— Signal on <clutter-entry>: activate

The ::activate signal is emitted each time the entry is 'activated' by the user, normally by pressing the 'Enter' key.

Since 0.4

— Signal on <clutter-entry>: text-changed

The ::text-changed signal is emitted after entry's text changes

— Signal on <clutter-entry>: cursor-event (arg0 <clutter-geometry>)

The ::cursor-event signal is emitted each time the input cursor's geometry changes, this could be a positional or size change. If you would like to implement your own input cursor, set the cursor-visible property to ‘#f’, and connect to this signal to position and size your own cursor.

Since 0.4

— Function: clutter-entry-new   (ret <clutter-actor>)

Creates a new, empty <clutter-entry>.

ret
the newly created <clutter-entry>
— Function: clutter-entry-new-with-text (font_name mchars) (text mchars)   (ret <clutter-actor>)

Creates a new <clutter-entry> displaying text using font-name.

font-name
the name (and size) of the font to be used
text
the text to be displayed
ret
the newly created <clutter-entry>

Since 0.4

— Function: clutter-entry-new-full (font_name mchars) (text mchars) (color <clutter-color>)   (ret <clutter-actor>)

Creates a new <clutter-entry> displaying text with color using font-name.

font-name
the name (and size) of the font to be used
text
the text to be displayed
color
<clutter-color> for text
ret
the newly created <clutter-entry>

Since 0.4

— Function: clutter-entry-set-text (self <clutter-entry>) (text mchars)
— Method: set-text

Sets text as the text to be displayed by entry. The ClutterEntry::text-changed signal is emitted.

entry
a <clutter-entry>
text
the text to be displayed

Since 0.4

— Function: clutter-entry-get-text (self <clutter-entry>)   (ret mchars)
— Method: get-text

Retrieves the text displayed by entry.

entry
a <clutter-entry>
ret
the text of the entry. The returned string is owned by <clutter-entry> and should not be modified or freed.

Since 0.4

— Function: clutter-entry-set-font-name (self <clutter-entry>) (font_name mchars)
— Method: set-font-name

Sets font-name as the font used by entry.

font-name must be a string containing the font name and its size, similarly to what you would feed to the pango-font-description-from-string function.

entry
a <clutter-entry>
font-name
a font name and size, or ‘#f’ for the default font

Since 0.4

— Function: clutter-entry-get-font-name (self <clutter-entry>)   (ret mchars)
— Method: get-font-name

Retrieves the font used by entry.

entry
a <clutter-entry>
ret
a string containing the font name, in a format understandable by pango-font-description-from-string. The string is owned by <clutter-entry> and should not be modified or freed.

Since 0.4

— Function: clutter-entry-set-color (self <clutter-entry>) (color <clutter-color>)
— Method: set-color

Sets the color of entry.

entry
a <clutter-entry>
color
a <clutter-color>

Since 0.4

— Function: clutter-entry-get-color (self <clutter-entry>) (color <clutter-color>)
— Method: get-color

Retrieves the color of entry.

entry
a <clutter-entry>
color
return location for a <clutter-color>

Since 0.4

— Function: clutter-entry-get-layout (self <clutter-entry>)   (ret <pango-layout>)
— Method: get-layout

Gets the <pango-layout> used to display the entry. The layout is useful to e.g. convert text positions to pixel positions. The returned layout is owned by the entry so need not be freed by the caller.

entry
a <clutter-entry>
ret
the <pango-layout> for this entry

Since 0.4

— Function: clutter-entry-set-alignment (self <clutter-entry>) (alignment <pango-alignment>)
— Method: set-alignment

Sets text alignment of the entry.

entry
a <clutter-entry>
alignment
A <pango-alignment>

Since 0.4

— Function: clutter-entry-get-alignment (self <clutter-entry>)   (ret <pango-alignment>)
— Method: get-alignment

Returns the entry's text alignment

entry
a <clutter-entry>
ret
The entry's <pango-alignment> Since 0.4
— Function: clutter-entry-set-cursor-position (self <clutter-entry>) (position int)
— Method: set-cursor-position

Sets the position of the cursor. The position must be less than or equal to the number of characters in the entry. A value of -1 indicates that the position should be set after the last character in the entry. Note that this position is in characters, not in bytes.

entry
a <clutter-entry>
position
the position of the cursor.

Since 0.6

— Function: clutter-entry-get-cursor-position (self <clutter-entry>)   (ret int)
— Method: get-cursor-position

Gets the position, in characters, of the cursor in entry.

entry
a <clutter-entry>
ret
the position of the cursor.

Since 0.6

— Function: clutter-entry-handle-key-event (self <clutter-entry>) (kev <clutter-key-event>)
— Method: handle-key-event

clutter_entry_handle_key_event’ has been deprecated since version 0.8 and should not be used in newly-written code. The key events will automatically be handled when giving the key focus to an entry using clutter-stage-set-key-focus.

This function will handle a <clutter-key-event>, like those returned in a key-press/release-event, and will translate it for the entry. This includes non-alphanumeric keys, such as the arrows keys, which will move the input cursor. You should use this function inside a handler for the ClutterStage::key-press-event or ClutterStage::key-release-event.

entry
a <clutter-entry>
kev
a <clutter-key-event>

Since 0.4

— Function: clutter-entry-insert-unichar (self <clutter-entry>) (wc unsigned-int32)
— Method: insert-unichar

Insert a character to the right of the current position of the cursor, and updates the position of the cursor.

entry
a <clutter-entry>
wc
a Unicode character

Since 0.4

— Function: clutter-entry-delete-chars (self <clutter-entry>) (len unsigned-int)
— Method: delete-chars

Characters are removed from before the current postion of the cursor.

entry
a <clutter-entry>
len
the number of characters to remove.

Since 0.4

— Function: clutter-entry-insert-text (self <clutter-entry>) (text mchars) (position ssize_t)
— Method: insert-text

Insert text at a specifc position.

A value of 0 indicates that the text will be inserted before the first character in the entry's text, and a value of -1 indicates that the text will be inserted after the last character in the entry's text.

entry
a <clutter-entry>
text
the text to insert
position
the position at which to insert the text.

Since 0.4

— Function: clutter-entry-delete-text (self <clutter-entry>) (start_pos ssize_t) (end_pos ssize_t)
— Method: delete-text

Deletes a sequence of characters. The characters that are deleted are those characters at positions from start-pos up to, but not including, end-pos. If end-pos is negative, then the characters deleted will be those characters from start-pos to the end of the text.

entry
a <clutter-entry>
start-pos
the starting position.
end-pos
the end position.

Since 0.4

— Function: clutter-entry-set-visible-cursor (self <clutter-entry>) (visible bool)
— Method: set-visible-cursor

Sets the visibility of the input cursor.

entry
a <clutter-entry>
visible
whether the input cursor should be visible

Since 0.4

— Function: clutter-entry-get-visible-cursor (self <clutter-entry>)   (ret bool)
— Method: get-visible-cursor

Returns the input cursor's visibility

entry
a <clutter-entry>
ret
whether the input cursor is visible

Since 0.4

— Function: clutter-entry-set-visibility (self <clutter-entry>) (visible bool)
— Method: set-visibility

Sets whether the contents of the entry are visible or not. When visibility is set to ‘#f’, characters are displayed as the invisible char, and will also appear that way when the text in the entry widget is copied elsewhere.

The default invisible char is the asterisk '*', but it can be changed with clutter-entry-set-invisible-char.

entry
a <clutter-entry>
visible
#t’ if the contents of the entry are displayed as plaintext.

Since 0.4

— Function: clutter-entry-get-visibility (self <clutter-entry>)   (ret bool)
— Method: get-visibility

Returns the entry text visibility.

entry
a <clutter-entry>
ret
#t’ if the contents of the entry are displayed as plaintext.

Since 0.4

— Function: clutter-entry-set-invisible-char (self <clutter-entry>) (wc unsigned-int32)
— Method: set-invisible-char

Sets the character to use in place of the actual text when clutter-entry-set-visibility has been called to set text visibility to ‘#f’. i.e. this is the character used in "password mode" to show the user how many characters have been typed. The default invisible char is an asterisk ('*'). If you set the invisible char to 0, then the user will get no feedback at all; there will be no text on the screen as they type.

entry
a <clutter-entry>
wc
a Unicode character

Since 0.4

— Function: clutter-entry-get-invisible-char (self <clutter-entry>)   (ret unsigned-int32)
— Method: get-invisible-char

Returns the character to use in place of the actual text when text-visibility is set to ‘#f

entry
a <clutter-entry>
ret
a Unicode character
— Function: clutter-entry-set-max-length (self <clutter-entry>) (max int)
— Method: set-max-length

Sets the maximum allowed length of the contents of the actor. If the current contents are longer than the given length, then they will be truncated to fit.

entry
a <clutter-entry>
max
the maximum number of characters allowed in the entry; 0 to disable or -1 to set the length of the current string

Since 0.4

— Function: clutter-entry-get-max-length (self <clutter-entry>)   (ret int)
— Method: get-max-length

Gets the maximum length of text that can be set into entry. See clutter-entry-set-max-length.

entry
a <clutter-entry>
ret
the maximum number of characters.

Since 0.4