Package ch.bailu.gtk.gtk
Class EntryBuffer
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gtk.EntryBuffer
- All Implemented Interfaces:
PointerInterface
- Direct Known Subclasses:
PasswordEntryBuffer
A `GtkEntryBuffer` hold the text displayed in a `GtkText` widget.
A single `GtkEntryBuffer` object can be shared by multiple widgets
which will then share the same text content, but not the cursor
position, visibility attributes, icon etc.
`GtkEntryBuffer` 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.
A single `GtkEntryBuffer` object can be shared by multiple widgets
which will then share the same text content, but not the cursor
position, visibility attributes, icon etc.
`GtkEntryBuffer` 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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
ConstructorDescriptionEntryBuffer
(PointerContainer pointer) EntryBuffer
(Str initial_chars, int n_initial_chars) Create a new `GtkEntryBuffer` object.EntryBuffer
(String initial_chars, int n_initial_chars) Create a new `GtkEntryBuffer` object. -
Method Summary
Modifier and TypeMethodDescriptionint
deleteText
(int position, int n_chars) Deletes a sequence of characters from the buffer.void
emitDeletedText
(int position, int n_chars) Used when subclassing `GtkEntryBuffer`.void
emitInsertedText
(int position, Str chars, int n_chars) Used when subclassing `GtkEntryBuffer`.void
emitInsertedText
(int position, String chars, int n_chars) Used when subclassing `GtkEntryBuffer`.long
getBytes()
Retrieves the length in bytes of the buffer.static ClassHandler
static int
int
Retrieves the length in characters of the buffer.int
Retrieves the maximum allowed length of the text in @buffer.static long
static TypeSystem.TypeSize
getText()
Retrieves the contents of the buffer.static long
static TypeSystem.TypeSize
int
insertText
(int position, Str chars, int n_chars) Inserts @n_chars characters of @chars into the contents of the
buffer, at position @position.int
insertText
(int position, String chars, int n_chars) Inserts @n_chars characters of @chars into the contents of the
buffer, at position @position.Connect to signal "deleted-text".Connect to signal "inserted-text".void
setMaxLength
(int max_length) Sets the maximum allowed length of the contents of the buffer.void
Sets the text in the buffer.void
Sets the text in the buffer.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_DELETED_TEXT
- See Also:
-
SIGNAL_ON_INSERTED_TEXT
- See Also:
-
-
Constructor Details
-
EntryBuffer
-
EntryBuffer
Create a new `GtkEntryBuffer` object.
Optionally, specify initial text to set in the buffer.- Parameters:
initial_chars
- initial buffer textn_initial_chars
- number of characters in @initial_chars, or -1
-
EntryBuffer
Create a new `GtkEntryBuffer` object.
Optionally, specify initial text to set in the buffer.- Parameters:
initial_chars
- initial buffer textn_initial_chars
- number of characters in @initial_chars, or -1
-
-
Method Details
-
getClassHandler
-
deleteText
public int deleteText(int position, int n_chars) 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.- Parameters:
position
- position at which to delete textn_chars
- number of characters to delete- Returns:
- The number of characters deleted.
-
emitDeletedText
public void emitDeletedText(int position, int n_chars) Used when subclassing `GtkEntryBuffer`.- Parameters:
position
- position at which text was deletedn_chars
- number of characters deleted
-
emitInsertedText
Used when subclassing `GtkEntryBuffer`.- Parameters:
position
- position at which text was insertedchars
- text that was insertedn_chars
- number of characters inserted
-
emitInsertedText
Used when subclassing `GtkEntryBuffer`.- Parameters:
position
- position at which text was insertedchars
- text that was insertedn_chars
- number of characters inserted
-
getBytes
public long getBytes()Retrieves the length in bytes of the buffer.
See [method@Gtk.EntryBuffer.get_length].- Returns:
- The byte length of the buffer.
-
getLength
public int getLength()Retrieves the length in characters of the buffer.- Returns:
- The number of characters in the buffer.
-
getMaxLength
public int getMaxLength()Retrieves the maximum allowed length of the text in @buffer.- Returns:
- the maximum allowed number of characters in `GtkEntryBuffer`, or 0 if there is no maximum.
-
getText
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.- Returns:
- 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.
-
insertText
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.- Parameters:
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- Returns:
- The number of characters actually inserted.
-
insertText
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.- Parameters:
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- Returns:
- The number of characters actually inserted.
-
setMaxLength
public void setMaxLength(int max_length) 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.- Parameters:
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-65536.
-
setText
Sets the text in the buffer.
This is roughly equivalent to calling
[method@Gtk.EntryBuffer.delete_text] and
[method@Gtk.EntryBuffer.insert_text].
Note that @n_chars is in characters, not in bytes.- Parameters:
chars
- the new textn_chars
- the number of characters in @text, or -1
-
setText
Sets the text in the buffer.
This is roughly equivalent to calling
[method@Gtk.EntryBuffer.delete_text] and
[method@Gtk.EntryBuffer.insert_text].
Note that @n_chars is in characters, not in bytes.- Parameters:
chars
- the new textn_chars
- the number of characters in @text, or -1
-
onDeletedText
Connect to signal "deleted-text".
SeeEntryBuffer.OnDeletedText.onDeletedText(int, int)
for signal description.
FieldSIGNAL_ON_DELETED_TEXT
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onInsertedText
Connect to signal "inserted-text".
SeeEntryBuffer.OnInsertedText.onInsertedText(int, ch.bailu.gtk.type.Str, int)
for signal description.
FieldSIGNAL_ON_INSERTED_TEXT
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-