Class Text.Builder<B extends Text.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
,Accessible.Builder<B>
,Editable.Builder<B>
- Enclosing class:
Text
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theText
object.onActivate
(Text.ActivateCallback handler) Emitted when the user hits theEnter
key.onBackspace
(Text.BackspaceCallback handler) Emitted when the user asks for it.Emitted to copy the selection to the clipboard.onCutClipboard
(Text.CutClipboardCallback handler) Emitted to cut the selection to the clipboard.Emitted when the user initiates a text deletion.Emitted when the user initiates the insertion of a fixed string at the cursor.onInsertEmoji
(Text.InsertEmojiCallback handler) Emitted to present the Emoji chooser for the widget.onMoveCursor
(Text.MoveCursorCallback handler) Emitted when the user initiates a cursor movement.Emitted to paste the contents of the clipboard.Emitted when the preedit text changes.Emitted to toggle the overwrite mode of theGtkText
.setActivatesDefault
(boolean activatesDefault) Whether to activate the default widget when Enter is pressed.setAttributes
(AttrList attributes) A list of Pango attributes to apply to the text of theGtkText
.setBuffer
(EntryBuffer buffer) TheGtkEntryBuffer
object which stores the text.setEnableEmojiCompletion
(boolean enableEmojiCompletion) Whether to suggest Emoji replacements.setExtraMenu
(MenuModel extraMenu) A menu model whose contents will be appended to the context menu.setImModule
(String imModule) Which IM (input method) module should be used for this self.setInputHints
(Set<InputHints> inputHints) Additional hints that allow input methods to fine-tune their behaviour.setInputHints
(InputHints... inputHints) Additional hints that allow input methods to fine-tune their behaviour.setInputPurpose
(InputPurpose inputPurpose) The purpose of this text field.setInvisibleChar
(int invisibleChar) The character to used when masking contents (in “password mode”).setInvisibleCharSet
(boolean invisibleCharSet) Whether the invisible char has been set for theGtkText
.setMaxLength
(int maxLength) Maximum number of characters that are allowed.setOverwriteMode
(boolean overwriteMode) If text is overwritten when typing in theGtkText
.setPlaceholderText
(String placeholderText) The text that will be displayed in theGtkText
when it is empty and unfocused.setPropagateTextWidth
(boolean propagateTextWidth) Whether the widget should grow and shrink with the content.A list of tabstops to apply to the text of theGtkText
.setTruncateMultiline
(boolean truncateMultiline) Whentrue
, pasted multi-line text is truncated to the first line.setVisibility
(boolean visibility) Iffalse
, the text is masked with the “invisible char”.Methods inherited from class org.gnome.gtk.Widget.Builder
onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, setCanFocus, setCanTarget, setCssClasses, setCssName, setCursor, setFocusable, setFocusOnClick, setHalign, setHasTooltip, setHeightRequest, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setReceivesDefault, setSensitive, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthRequest
Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRole
Methods inherited from interface io.github.jwharm.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArena
Methods inherited from interface org.gnome.gtk.Editable.Builder
setEditable, setEnableUndo, setMaxWidthChars, setText, setWidthChars, setXalign
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theText
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toText
.- Overrides:
build
in classWidget.Builder<B extends Text.Builder<B>>
- Returns:
- a new instance of
Text
with the properties that were set in the Builder object.
-
setActivatesDefault
Whether to activate the default widget when Enter is pressed.- Parameters:
activatesDefault
- the value for theactivates-default
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setAttributes
A list of Pango attributes to apply to the text of theGtkText
.This is mainly useful to change the size or weight of the text.
The
PangoAttribute
'sstartIndex
andendIndex
must refer to theGtkEntryBuffer
text, i.e. without the preedit string.- Parameters:
attributes
- the value for theattributes
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setBuffer
TheGtkEntryBuffer
object which stores the text.- Parameters:
buffer
- the value for thebuffer
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setEnableEmojiCompletion
Whether to suggest Emoji replacements.- Parameters:
enableEmojiCompletion
- the value for theenable-emoji-completion
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setExtraMenu
-
setImModule
Which IM (input method) module should be used for this self.See
IMMulticontext
.Setting this to a non-
null
value overrides the system-wide IM module setting. See theGtk.Settings:gtk-im-module
property.- Parameters:
imModule
- the value for theim-module
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setInputHints
Additional hints that allow input methods to fine-tune their behaviour.- Parameters:
inputHints
- the value for theinput-hints
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setInputPurpose
The purpose of this text field.This property can be used by on-screen keyboards and other input methods to adjust their behaviour.
Note that setting the purpose to
InputPurpose.PASSWORD
orInputPurpose.PIN
is independent from settingGtk.Text:visibility
.- Parameters:
inputPurpose
- the value for theinput-purpose
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setInvisibleChar
The character to used when masking contents (in “password mode”).- Parameters:
invisibleChar
- the value for theinvisible-char
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setInvisibleCharSet
Whether the invisible char has been set for theGtkText
.- Parameters:
invisibleCharSet
- the value for theinvisible-char-set
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setMaxLength
Maximum number of characters that are allowed.Zero indicates no limit.
- Parameters:
maxLength
- the value for themax-length
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setOverwriteMode
If text is overwritten when typing in theGtkText
.- Parameters:
overwriteMode
- the value for theoverwrite-mode
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setPlaceholderText
-
setPropagateTextWidth
Whether the widget should grow and shrink with the content.- Parameters:
propagateTextWidth
- the value for thepropagate-text-width
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setTabs
-
setTruncateMultiline
Whentrue
, pasted multi-line text is truncated to the first line.- Parameters:
truncateMultiline
- the value for thetruncate-multiline
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setVisibility
Iffalse
, the text is masked with the “invisible char”.- Parameters:
visibility
- the value for thevisibility
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setInputHints
Additional hints that allow input methods to fine-tune their behaviour.- Parameters:
inputHints
- the value for theinput-hints
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onActivate
Emitted when the user hits theEnter
key.The default bindings for this signal are all forms of the
Enter
key.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onBackspace
Emitted when the user asks for it.This is a keybinding signal.
The default bindings for this signal are
Backspace
andShift
+Backspace
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onCopyClipboard
Emitted to copy the selection to the clipboard.This is a keybinding signal.
The default bindings for this signal are
Ctrl
+c
andCtrl
+Insert
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onCutClipboard
Emitted to cut the selection to the clipboard.This is a keybinding signal.
The default bindings for this signal are
Ctrl
+x
andShift
+Delete
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onDeleteFromCursor
Emitted when the user initiates a text deletion.This is a keybinding signal.
If the
type
isDeleteType.CHARS
, GTK deletes the selection if there is one, otherwise it deletes the requested number of characters.The default bindings for this signal are
Delete
for deleting a character andCtrl
+Delete
for deleting a word.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onInsertAtCursor
Emitted when the user initiates the insertion of a fixed string at the cursor.This is a keybinding signal.
This signal has no default bindings.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onInsertEmoji
Emitted to present the Emoji chooser for the widget.This is a keybinding signal.
The default bindings for this signal are
Ctrl
+.
andCtrl
+;
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onMoveCursor
Emitted when the user initiates a cursor movement.If the cursor is not visible in
self
, this signal causes the viewport to be moved instead.This is a keybinding signal.
Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically.
The default bindings for this signal come in two variants, the variant with the
Shift
modifier extends the selection, the variant without it does not. There are too many key combinations to list them all here.←
,→
,↑
,↓
move by individual characters/linesCtrl
+←
, etc. move by words/paragraphsHome
andEnd
move to the ends of the buffer
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onPasteClipboard
Emitted to paste the contents of the clipboard.This is a keybinding signal.
The default bindings for this signal are
Ctrl
+v
andShift
+Insert
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onPreeditChanged
Emitted when the preedit text changes.If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onToggleOverwrite
Emitted to toggle the overwrite mode of theGtkText
.This is a keybinding signal.
The default bindings for this signal is
Insert
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-