Text buffer for ClutterText
The <clutter-text-buffer>
class contains the actual text
displayed in a <clutter-text>
widget.
A single <clutter-text-buffer>
object can be shared by multiple
<clutter-text>
widgets which will then share the same text
content, but not the cursor position, visibility attributes, icon etc.
<clutter-text-buffer>
may be derived from. Such a derived class
might allow text to be stored in an alternate location, such as
non-pageable memory, useful in the case of important passwords. Or a
derived class could integrate with an application's concept of
undo/redo.
<clutter-text-buffer>
)Create a new ClutterTextBuffer object.
- ret
- A new ClutterTextBuffer object.
Since 1.10
mchars
) (text_len ssize_t
) ⇒ (ret <clutter-text-buffer>
)Create a new ClutterTextBuffer object with some text.
- text
- initial buffer text.
- text-len
- initial buffer text length, or -1 for null-terminated.
- ret
- A new ClutterTextBuffer object.
Since 1.10
<clutter-text-buffer>
) (chars mchars
) (n_chars int
)Sets the text in the buffer.
This is roughly equivalent to calling
clutter-text-buffer-delete-text
andclutter-text-buffer-insert-text
.Note that n-chars is in characters, not in bytes.
- buffer
- a
<clutter-text-buffer>
- chars
- the new text
- n-chars
- the number of characters in text, or -1
Since 1.10
<clutter-text-buffer>
) ⇒ (ret mchars
)Retrieves the contents of the buffer.
The memory pointer returned by this call will not change unless this object emits a signal, or is finalized.
- buffer
- a
<clutter-text-buffer>
- ret
- a pointer to the contents of the widget as a string. This string points to internally allocated storage in the buffer and must not be freed, modified or stored.
Since 1.10
<clutter-text-buffer>
) ⇒ (ret size_t
)Retrieves the length in bytes of the buffer. See
clutter-text-buffer-get-length
.
- buffer
- a
<clutter-text-buffer>
- ret
- The byte length of the buffer.
Since 1.10
<clutter-text-buffer>
) ⇒ (ret unsigned-int
)Retrieves the length in characters of the buffer.
- buffer
- a
<clutter-text-buffer>
- ret
- The number of characters in the buffer.
Since 1.10
<clutter-text-buffer>
) (max_length int
)Sets the maximum allowed length of the contents of the buffer. If the current contents are longer than the given length, then they will be truncated to fit.
- buffer
- a
<clutter-text-buffer>
- max-length
- the maximum length of the entry buffer, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range [ 0, ‘CLUTTER_TEXT_BUFFER_MAX_SIZE’ ].
Since 1.10
<clutter-text-buffer>
) ⇒ (ret int
)Retrieves the maximum allowed length of the text in buffer. See
clutter-text-buffer-set-max-length
.
- buffer
- a
<clutter-text-buffer>
- ret
- the maximum allowed number of characters in
<clutter-text-buffer>
, or 0 if there is no maximum.Since 1.10
<clutter-text-buffer>
) (position unsigned-int
) (chars mchars
) (n_chars int
) ⇒ (ret unsigned-int
)Inserts n-chars characters of chars into the contents of the buffer, at position position.
If n-chars is negative, then characters from chars will be inserted until a null-terminator is found. If position or n-chars are out of bounds, or the maximum buffer text length is exceeded, then they are coerced to sane values.
Note that the position and length are in characters, not in bytes.
- buffer
- a
<clutter-text-buffer>
- position
- the position at which to insert text.
- chars
- the text to insert into the buffer.
- n-chars
- the length of the text in characters, or -1
- ret
- The number of characters actually inserted.
Since 1.10
<clutter-text-buffer>
) (position unsigned-int
) (n_chars int
) ⇒ (ret unsigned-int
)Deletes a sequence of characters from the buffer. n-chars characters are deleted starting at position. If n-chars is negative, then all characters until the end of the text are deleted.
If position or n-chars are out of bounds, then they are coerced to sane values.
Note that the positions are specified in characters, not bytes.
- buffer
- a
<clutter-text-buffer>
- position
- position at which to delete text
- n-chars
- number of characters to delete
- ret
- The number of characters deleted.
Since 1.10