Class Text.Builder<B extends Text.Builder<B>>
- Type Parameters:
B- the type of the Builder that is returned
- All Implemented Interfaces:
Accessible.Builder<B>,Editable.Builder<B>,BuilderInterface
- Enclosing class:
Text
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theTextobject.onActivate(Text.ActivateCallback handler) Emitted when the user hits theEnterkey.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.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.setActivatesDefault(boolean activatesDefault) Whether to activate the default widget whenEnteris pressed.setAttributes(AttrList attributes) A list of Pango attributes to apply to the text.setBuffer(EntryBuffer buffer) TheGtkEntryBufferobject 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 input method module should be used.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.setMaxLength(int maxLength) Maximum number of characters that are allowed.setOverwriteMode(boolean overwriteMode) If text is overwritten when typing.setPlaceholderText(String placeholderText) The text that will be displayed in theGtkTextwhen it is empty and unfocused.setPropagateTextWidth(boolean propagateTextWidth) Whether the widget should grow and shrink with the content.Custom tabs for this text widget.setTruncateMultiline(boolean truncateMultiline) When true, pasted multi-line text is truncated to the first line.setVisibility(boolean visibility) If false, 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, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setReceivesDefault, setSensitive, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthRequestMethods inherited from class org.gnome.gobject.GObject.Builder
onNotifyMethods inherited from class org.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValuesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRoleMethods inherited from interface org.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArenaMethods inherited from interface org.gnome.gtk.Editable.Builder
setEditable, setEnableUndo, setMaxWidthChars, setText, setWidthChars, setXalign
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theTextobject. 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:
buildin classWidget.Builder<B extends Text.Builder<B>>- Returns:
- a new instance of
Textwith the properties that were set in the Builder object.
-
setActivatesDefault
Whether to activate the default widget whenEnteris pressed.- Parameters:
activatesDefault- the value for theactivates-defaultproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setAttributes
A list of Pango attributes to apply to the text.This is mainly useful to change the size or weight of the text.
The
PangoAttribute'sstartIndexandendIndexmust refer to theGtkEntryBuffertext, i.e. without the preedit string.- Parameters:
attributes- the value for theattributesproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setBuffer
TheGtkEntryBufferobject which stores the text.- Parameters:
buffer- the value for thebufferproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setEnableEmojiCompletion
Whether to suggest Emoji replacements.- Parameters:
enableEmojiCompletion- the value for theenable-emoji-completionproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setExtraMenu
-
setImModule
Which input method module should be used.See
IMMulticontext.Setting this to a non-
NULLvalue overrides the system-wide input method. See theGtk.Settings:gtk-im-modulesetting.- Parameters:
imModule- the value for theim-moduleproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setInputHints
Additional hints that allow input methods to fine-tune their behaviour.- Parameters:
inputHints- the value for theinput-hintsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setInputPurpose
The purpose of this text field.This information can be used by on-screen keyboards and other input methods to adjust their behaviour.
Note that setting the purpose to
Gtk.InputPurpose.passwordorGtk.InputPurpose.pinis independent from settingGtk.Text:visibility.- Parameters:
inputPurpose- the value for theinput-purposeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setInvisibleChar
The character to used when masking contents (in “password mode”).- Parameters:
invisibleChar- the value for theinvisible-charproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setInvisibleCharSet
Whether the invisible char has been set.- Parameters:
invisibleCharSet- the value for theinvisible-char-setproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setMaxLength
Maximum number of characters that are allowed.Zero indicates no limit.
- Parameters:
maxLength- the value for themax-lengthproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setOverwriteMode
If text is overwritten when typing.- Parameters:
overwriteMode- the value for theoverwrite-modeproperty- Returns:
- the
Builderinstance 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-widthproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setTabs
-
setTruncateMultiline
When true, pasted multi-line text is truncated to the first line.- Parameters:
truncateMultiline- the value for thetruncate-multilineproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setVisibility
If false, the text is masked with the “invisible char”.- Parameters:
visibility- the value for thevisibilityproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setInputHints
Additional hints that allow input methods to fine-tune their behaviour.- Parameters:
inputHints- the value for theinput-hintsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
onActivate
Emitted when the user hits theEnterkey.The default bindings for this signal are all forms of the
Enterkey.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
BackspaceandShift+Backspace.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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+candCtrl+Insert.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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+xandShift+Delete.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onDeleteFromCursor
Emitted when the user initiates a text deletion.This is a keybinding signal.
If the
typeisGtk.DeleteType.chars, GTK deletes the selection if there is one, otherwise it deletes the requested number of characters.The default bindings for this signal are
Deletefor deleting a character andCtrl+Deletefor deleting a word.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
Builderinstance is returned, to allow method chaining - See Also:
-
onInsertEmoji
Emitted to present the Emoji chooser.This is a keybinding signal.
The default bindings for this signal are
Ctrl+.andCtrl+;- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
GObjects.signalEmitByName(org.gnome.gobject.GObject, java.lang.String, java.lang.Object...)if they need to control the cursor programmatically.The default bindings for this signal come in two variants, the variant with the
Shiftmodifier 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/paragraphsHomeandEndmove to the ends of the buffer
- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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+vandShift+Insert.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
Builderinstance is returned, to allow method chaining - See Also:
-
onToggleOverwrite
Emitted to toggle the overwrite mode.This is a keybinding signal.
The default bindings for this signal is
Insert.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-