An actor for displaying and editing text
<clutter-text>
is an actor that displays custom text using Pango
as the text rendering engine.
<clutter-text>
also allows inline editing of the text if the
actor is set editable using clutter-text-set-editable
.
Selection using keyboard or pointers can be enabled using
clutter-text-set-selectable
.
<clutter-text>
is available since Clutter 1.0
<clutter-actor>
)Creates a new
<clutter-text>
actor. This actor can be used to display and edit text.
- ret
- the newly created
<clutter-text>
actorSince 1.0
mchars
) (text mchars
) (color <clutter-color>
) ⇒ (ret <clutter-actor>
)Creates a new
<clutter-text>
actor, using font-name as the font description; text will be used to set the contents of the actor; and color will be used as the color to render text.This function is equivalent to calling
clutter-text-new
,clutter-text-set-font-name
,clutter-text-set-text
andclutter-text-set-color
.
- font-name
- a string with a font description
- text
- the contents of the actor
- color
- the color to be used to render text
- ret
- the newly created
<clutter-text>
actorSince 1.0
mchars
) (text mchars
) ⇒ (ret <clutter-actor>
)Creates a new
<clutter-text>
actor, using font-name as the font description; text will be used to set the contents of the actor.This function is equivalent to calling
clutter-text-new
,clutter-text-set-font-name
, andclutter-text-set-text
.
- font-name
- a string with a font description.
- text
- the contents of the actor
- ret
- the newly created
<clutter-text>
actorSince 1.0
<clutter-text-buffer>
) ⇒ (ret <clutter-actor>
)Creates a new entry with the specified text buffer.
- buffer
- The buffer to use for the new
<clutter-text>
.- ret
- a new
<clutter-text>
Since 1.10
<clutter-text>
) (buffer <clutter-text-buffer>
)Set the
<clutter-text-buffer>
object which holds the text for this widget.
- self
- a
<clutter-text>
- buffer
- a
<clutter-text-buffer>
Since 1.10
<clutter-text>
) ⇒ (ret <clutter-text-buffer>
)Get the
<clutter-text-buffer>
object which holds the text for this widget.
- self
- a
<clutter-text>
- ret
- A
<gtk-entry-buffer>
object.Since 1.10
<clutter-text>
) (text mchars
)Sets the contents of a
<clutter-text>
actor.If the
<"use-markup">
property was set to ‘#t
’ it will be reset to ‘#f
’ as a side effect. If you want to maintain the<"use-markup">
you should use theclutter-text-set-markup
function instead
- self
- a
<clutter-text>
- text
- the text to set. Passing ‘
#f
’ is the same as passing "" (the empty string).Since 1.0
<clutter-text>
) (markup mchars
)Sets markup as the contents of a
<clutter-text>
.This is a convenience function for setting a string containing Pango markup, and it is logically equivalent to:
/* the order is important */ clutter_text_set_text (CLUTTER_TEXT (actor), markup); clutter_text_set_use_markup (CLUTTER_TEXT (actor), TRUE);
- self
- a
<clutter-text>
- markup
- a string containing Pango markup. Passing ‘
#f
’ is the same as passing "" (the empty string).Since 1.0
<clutter-text>
) ⇒ (ret mchars
)Retrieves a pointer to the current contents of a
<clutter-text>
actor.If you need a copy of the contents for manipulating, either use
g-strdup
on the returned string, or use:copy = clutter_text_get_chars (text, 0, -1);Which will return a newly allocated string.
If the
<clutter-text>
actor is empty, this function will return an empty string, and not ‘#f
’.
- self
- a
<clutter-text>
- ret
- the contents of the actor. The returned string is owned by the
<clutter-text>
actor and should never be modified or freed.Since 1.0
<clutter-text>
) (activatable bool
)Sets whether a
<clutter-text>
actor should be activatable.An activatable
<clutter-text>
actor will emit the<"activate">
signal whenever the 'Enter' (or 'Return') key is pressed; if it is not activatable, a new line will be appended to the current content.An activatable
<clutter-text>
must also be set as editable usingclutter-text-set-editable
.
- self
- a
<clutter-text>
- activatable
- whether the
<clutter-text>
actor should be activatableSince 1.0
<clutter-text>
) ⇒ (ret bool
)Retrieves whether a
<clutter-text>
is activatable or not.
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if the actor is activatableSince 1.0
<clutter-text>
) (attrs <pango-attr-list>
)Sets the attributes list that are going to be applied to the
<clutter-text>
contents.The
<clutter-text>
actor will take a reference on the<pango-attr-list>
passed to this function.
- self
- a
<clutter-text>
- attrs
- a
<pango-attr-list>
or ‘#f
’ to unset the attributesSince 1.0
<clutter-text>
) ⇒ (ret <pango-attr-list>
)Gets the attribute list that was set on the
<clutter-text>
actorclutter-text-set-attributes
, if any.
- self
- a
<clutter-text>
- ret
- the attribute list, or ‘
#f
’ if none was set. The returned value is owned by the<clutter-text>
and should not be unreferenced.Since 1.0
<clutter-text>
) (color <clutter-color>
)Sets the color of the contents of a
<clutter-text>
actor.The overall opacity of the
<clutter-text>
actor will be the result of the alpha value of color and the composited opacity of the actor itself on the scenegraph, as returned byclutter-actor-get-paint-opacity
.
- self
- a
<clutter-text>
- color
- a
<clutter-color>
Since 1.0
<clutter-text>
) (color <clutter-color>
)Retrieves the text color as set by
clutter-text-set-color
.
- self
- a
<clutter-text>
- color
- return location for a
<clutter-color>
.Since 1.0
<clutter-text>
) (mode <pango-ellipsize-mode>
)Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there is not enough space to render the entire contents of a
<clutter-text>
actor
- self
- a
<clutter-text>
- mode
- a
<pango-ellipsize-mode>
Since 1.0
<clutter-text>
) ⇒ (ret <pango-ellipsize-mode>
)Returns the ellipsizing position of a
<clutter-text>
actor, as set byclutter-text-set-ellipsize
.
- self
- a
<clutter-text>
- ret
<pango-ellipsize-mode>
Since 1.0
<clutter-text>
) (font_name mchars
)Sets the font used by a
<clutter-text>
. The font-name string must either be ‘#f
’, which means that the font name from the default<clutter-backend>
will be used; or be something that can be parsed by thepango-font-description-from-string
function, like:clutter_text_set_font_name (text, "Sans 10pt"); clutter_text_set_font_name (text, "Serif 16px"); clutter_text_set_font_name (text, "Helvetica 10");
- self
- a
<clutter-text>
- font-name
- a font name, or ‘
#f
’ to set the default font name.Since 1.0
<clutter-text>
) ⇒ (ret mchars
)Retrieves the font name as set by
clutter-text-set-font-name
.
- self
- a
<clutter-text>
- ret
- a string containing the font name. The returned string is owned by the
<clutter-text>
actor and should not be modified or freedSince 1.0
<clutter-text>
) (font_desc <pango-font-description>
)Sets font-desc as the font description for a
<clutter-text>
The
<pango-font-description>
is copied by the<clutter-text>
actor so you can safely callpango-font-description-free
on it after calling this function.
- self
- a
<clutter-text>
- font-desc
- a
<pango-font-description>
Since 1.2
<clutter-text>
) (wc unsigned-int32
)Sets the character to use in place of the actual text in a password text actor.
If wc is 0 the text will be displayed as it is entered in the
<clutter-text>
actor.
- self
- a
<clutter-text>
- wc
- a Unicode character, or 0 to unset the password character
Since 1.0
<clutter-text>
) ⇒ (ret unsigned-int32
)Retrieves the character to use in place of the actual text as set by
clutter-text-set-password-char
.
- self
- a
<clutter-text>
- ret
- a Unicode character or 0 if the password character is not set
Since 1.0
<clutter-text>
) (justify bool
)Sets whether the text of the
<clutter-text>
actor should be justified on both margins. This setting is ignored if Clutter is compiled against Pango < 1.18.
- self
- a
<clutter-text>
- justify
- whether the text should be justified
Since 1.0
<clutter-text>
) ⇒ (ret bool
)Retrieves whether the
<clutter-text>
actor should justify its contents on both margins.
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if the text should be justifiedSince 0.6
<clutter-text>
) ⇒ (ret <pango-layout>
)Retrieves the current
<pango-layout>
used by a<clutter-text>
actor.
- self
- a
<clutter-text>
- ret
- a
<pango-layout>
. The returned object is owned by the<clutter-text>
actor and should not be modified or freed.Since 1.0
<clutter-text>
) (alignment <pango-alignment>
)Sets the way that the lines of a wrapped label are aligned with respect to each other. This does not affect the overall alignment of the label within its allocated or specified width.
To align a
<clutter-text>
actor you should add it to a container that supports alignment, or use the anchor point.
- self
- a
<clutter-text>
- alignment
- A
<pango-alignment>
Since 1.0
<clutter-text>
) ⇒ (ret <pango-alignment>
)Retrieves the alignment of a
<clutter-text>
, as set byclutter-text-set-line-alignment
.
- self
- a
<clutter-text>
- ret
- a
<pango-alignment>
Since 1.0
<clutter-text>
) (line_wrap bool
)Sets whether the contents of a
<clutter-text>
actor should wrap, if they don't fit the size assigned to the actor.
- self
- a
<clutter-text>
- line-wrap
- whether the contents should wrap
Since 1.0
<clutter-text>
) ⇒ (ret bool
)Retrieves the value set using
clutter-text-set-line-wrap
.
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if the<clutter-text>
actor should wrap its contentsSince 1.0
<clutter-text>
) (wrap_mode <pango-wrap-mode>
)If line wrapping is enabled (see
clutter-text-set-line-wrap
) this function controls how the line wrapping is performed. The default is ‘PANGO_WRAP_WORD’ which means wrap on word boundaries.
- self
- a
<clutter-text>
- wrap-mode
- the line wrapping mode
Since 1.0
<clutter-text>
) ⇒ (ret <pango-wrap-mode>
)Retrieves the line wrap mode used by the
<clutter-text>
actor.See
clutter-text-set-line-wrap-mode
.
- self
- a
<clutter-text>
- ret
- the wrap mode used by the
<clutter-text>
Since 1.0
<clutter-text>
) (max int
)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.
- self
- a
<clutter-text>
- max
- the maximum number of characters allowed in the text actor; 0 to disable or -1 to set the length of the current string
Since 1.0
<clutter-text>
) ⇒ (ret int
)Gets the maximum length of text that can be set into a text actor.
See
clutter-text-set-max-length
.
- self
- a
<clutter-text>
- ret
- the maximum number of characters.
Since 1.0
<clutter-text>
) (selectable bool
)Sets whether a
<clutter-text>
actor should be selectable.A selectable
<clutter-text>
will allow selecting its contents using the pointer or the keyboard.
- self
- a
<clutter-text>
- selectable
- whether the
<clutter-text>
actor should be selectableSince 1.0
<clutter-text>
) ⇒ (ret bool
)Retrieves whether a
<clutter-text>
is selectable or not.
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if the actor is selectableSince 1.0
<clutter-text>
) (start_pos ssize_t
) (end_pos ssize_t
)Selects the region of text between start-pos and end-pos.
This function changes the position of the cursor to match start-pos and the selection bound to match end-pos.
- self
- a
<clutter-text>
- start-pos
- start of the selection, in characters
- end-pos
- end of the selection, in characters
Since 1.0
<clutter-text>
) ⇒ (ret mchars
)Retrieves the currently selected text.
- self
- a
<clutter-text>
- ret
- a newly allocated string containing the currently selected text, or ‘
#f
’. Useg-free
to free the returned string.Since 1.0
<clutter-text>
) (selection_bound int
)Sets the other end of the selection, starting from the current cursor position.
If selection-bound is -1, the selection unset.
- self
- a
<clutter-text>
- selection-bound
- the position of the end of the selection, in characters
Since 1.0
<clutter-text>
) ⇒ (ret int
)Retrieves the other end of the selection of a
<clutter-text>
actor, in characters from the current cursor position.
- self
- a
<clutter-text>
- ret
- the position of the other end of the selection
Since 1.0
<clutter-text>
) (single_line bool
)Sets whether a
<clutter-text>
actor should be in single line mode or not. Only editable<clutter-text>
s can be in single line mode.A text actor in single line mode will not wrap text and will clip the visible area to the predefined size. The contents of the text actor will scroll to display the end of the text if its length is bigger than the allocated width.
When setting the single line mode the
<"activatable">
property is also set as a side effect. Instead of entering a new line character, the text actor will emit the<"activate">
signal.
- self
- a
<clutter-text>
- single-line
- whether to enable single line mode
Since 1.0
<clutter-text>
) ⇒ (ret bool
)Retrieves whether the
<clutter-text>
actor is in single line mode.
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if the<clutter-text>
actor is in single line modeSince 1.0
<clutter-text>
) (setting bool
)Sets whether the contents of the
<clutter-text>
actor contains markup in Pango's text markup language.Setting
<"use-markup">
on an editable<clutter-text>
will not have any effect except hiding the markup.See also
<"use-markup">
.
- self
- a
<clutter-text>
- setting
- ‘
#t
’ if the text should be parsed for markup.Since 1.0
<clutter-text>
) ⇒ (ret bool
)Retrieves whether the contents of the
<clutter-text>
actor should be parsed for the Pango text markup.
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if the contents will be parsed for markupSince 1.0
<clutter-text>
) (editable bool
)Sets whether the
<clutter-text>
actor should be editable.An editable
<clutter-text>
with key focus set usingclutter-actor-grab-key-focus
orclutter-stage-set-key-focus
will receive key events and will update its contents accordingly.
- self
- a
<clutter-text>
- editable
- whether the
<clutter-text>
should be editableSince 1.0
<clutter-text>
) ⇒ (ret bool
)Retrieves whether a
<clutter-text>
is editable or not.
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if the actor is editableSince 1.0
<clutter-text>
) (text mchars
) (position ssize_t
)Inserts text into a
<clutter-actor>
at the given position.If position is a negative number, the text will be appended at the end of the current contents of the
<clutter-text>
.The position is expressed in characters, not in bytes.
- self
- a
<clutter-text>
- text
- the text to be inserted
- position
- the position of the insertion, or -1
Since 1.0
<clutter-text>
) (wc unsigned-int32
)Inserts wc at the current cursor position of a
<clutter-text>
actor.
- self
- a
<clutter-text>
- wc
- a Unicode character
Since 1.0
<clutter-text>
) (n_chars unsigned-int
)Deletes n-chars inside a
<clutter-text>
actor, starting from the current cursor position.Somewhat awkwardly, the cursor position is decremented by the same number of characters you've deleted.
- self
- a
<clutter-text>
- n-chars
- the number of characters to delete
Since 1.0
<clutter-text>
) (start_pos ssize_t
) (end_pos ssize_t
)Deletes the text inside a
<clutter-text>
actor between start-pos and end-pos.The starting and ending positions are expressed in characters, not in bytes.
- self
- a
<clutter-text>
- start-pos
- starting position
- end-pos
- ending position
Since 1.0
<clutter-text>
) ⇒ (ret bool
)Deletes the currently selected text
This function is only useful in subclasses of
<clutter-text>
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if text was deleted or if the text actor is empty, and ‘#f
’ otherwiseSince 1.0
<clutter-text>
) (start_pos ssize_t
) (end_pos ssize_t
) ⇒ (ret mchars
)Retrieves the contents of the
<clutter-text>
actor between start-pos and end-pos, but not including end-pos.The positions are specified in characters, not in bytes.
- self
- a
<clutter-text>
- start-pos
- start of text, in characters
- end-pos
- end of text, in characters
- ret
- a newly allocated string with the contents of the text actor between the specified positions. Use
g-free
to free the resources when doneSince 1.0
<clutter-text>
) (color <clutter-color>
)Sets the color of the cursor of a
<clutter-text>
actor.If color is ‘
#f
’, the cursor color will be the same as the text color.
- self
- a
<clutter-text>
- color
- the color of the cursor, or ‘
#f
’ to unset itSince 1.0
<clutter-text>
) (color <clutter-color>
)Retrieves the color of the cursor of a
<clutter-text>
actor.
- self
- a
<clutter-text>
- color
- return location for a
<clutter-color>
.Since 1.0
<clutter-text>
) (color <clutter-color>
)Sets the color of the selection of a
<clutter-text>
actor.If color is ‘
#f
’, the selection color will be the same as the cursor color, or if no cursor color is set either then it will be the same as the text color.
- self
- a
<clutter-text>
- color
- the color of the selection, or ‘
#f
’ to unset itSince 1.0
<clutter-text>
) (color <clutter-color>
)Retrieves the color of the selection of a
<clutter-text>
actor.
- self
- a
<clutter-text>
- color
- return location for a
<clutter-color>
.Since 1.0
<clutter-text>
) (position int
)Sets the cursor of a
<clutter-text>
actor at position.The position is expressed in characters, not in bytes.
- self
- a
<clutter-text>
- position
- the new cursor position, in characters
Since 1.0
<clutter-text>
) ⇒ (ret int
)Retrieves the cursor position.
- self
- a
<clutter-text>
- ret
- the cursor position, in characters
Since 1.0
<clutter-text>
) (cursor_visible bool
)Sets whether the cursor of a
<clutter-text>
actor should be visible or not.The color of the cursor will be the same as the text color unless
clutter-text-set-cursor-color
has been called.The size of the cursor can be set using
clutter-text-set-cursor-size
.The position of the cursor can be changed programmatically using
clutter-text-set-cursor-position
.
- self
- a
<clutter-text>
- cursor-visible
- whether the cursor should be visible
Since 1.0
<clutter-text>
) ⇒ (ret bool
)Retrieves whether the cursor of a
<clutter-text>
actor is visible.
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if the cursor is visibleSince 1.0
<clutter-text>
) (size int
)Sets the size of the cursor of a
<clutter-text>
. The cursor will only be visible if the<"cursor-visible">
property is set to ‘#t
’.
- self
- a
<clutter-text>
- size
- the size of the cursor, in pixels, or -1 to use the default value
Since 1.0
<clutter-text>
) ⇒ (ret unsigned-int
)Retrieves the size of the cursor of a
<clutter-text>
actor.
- self
- a
<clutter-text>
- ret
- the size of the cursor, in pixels
Since 1.0
<clutter-text>
) ⇒ (ret bool
)Emits the
<"activate">
signal, if self has been set as activatable usingclutter-text-set-activatable
.This function can be used to emit the ::activate signal inside a
<"captured-event">
or<"key-press-event">
signal handlers before the default signal handler for the<clutter-text>
is invoked.
- self
- a
<clutter-text>
- ret
- ‘
#t
’ if the ::activate signal has been emitted, and ‘#f
’ otherwiseSince 1.0
<clutter-text>
) (x float
) (y float
) ⇒ (ret int
)Retrieves the position of the character at the given coordinates.
Return: the position of the character
- self
- a
<clutter-text>
- x
- the X coordinate, relative to the actor
- y
- the Y coordinate, relative to the actor
Since 1.10
<clutter-text>
) (position int
) ⇒ (ret bool
) (x float
) (y float
) (line_height float
)Retrieves the coordinates of the given position.
- self
- a
<clutter-text>
- position
- position in characters
- x
- return location for the X coordinate, or ‘
#f
’.- y
- return location for the Y coordinate, or ‘
#f
’.- line-height
- return location for the line height, or ‘
#f
’.- ret
- ‘
#t
’ if the conversion was successfulSince 1.0
<clutter-text>
) (preedit_str mchars
) (preedit_attrs <pango-attr-list>
) (cursor_pos unsigned-int
)Sets, or unsets, the pre-edit string. This function is useful for input methods to display a string (with eventual specific Pango attributes) before it is entered inside the
<clutter-text>
buffer.The preedit string and attributes are ignored if the
<clutter-text>
actor is not editable.This function should not be used by applications
- self
- a
<clutter-text>
- preedit-str
- the pre-edit string, or ‘
#f
’ to unset it.- preedit-attrs
- the pre-edit string attributes.
- cursor-pos
- the cursor position for the pre-edit string
Since 1.2
<clutter-text>
) ⇒ (x int
) (y int
)Obtains the coordinates where the
<clutter-text>
will draw the<pango-layout>
representing the text.
- self
- a
<clutter-text>
- x
- location to store X offset of layout, or ‘
#f
’.- y
- location to store Y offset of layout, or ‘
#f
’.Since 1.8