1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/gio"
11 "github.com/bnema/puregotk/v4/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14 "github.com/bnema/puregotk/v4/graphene"
15 "github.com/bnema/puregotk/v4/pango"
16)
17
18// A single-line text entry.
19//
20// `GtkText` is the common implementation of single-line text editing
21// that is shared between [class@Gtk.Entry], [class@Gtk.PasswordEntry],
22// [class@Gtk.SpinButton], and other widgets. In all of these, a `GtkText`
23// instance is used as the delegate for the [iface@Gtk.Editable] implementation.
24//
25// A large number of key bindings s supported by default. If the entered
26// text is longer than the allocation of the widget, the widget will scroll
27// so that the cursor position is visible.
28//
29// When using an entry for passwords and other sensitive information,
30// it can be put into “password mode” using [method@Gtk.Text.set_visibility].
31// In this mode, entered text is displayed using an “invisible” character.
32// By default, GTK picks the best invisible character that is available
33// in the current font, but it can be changed with
34// [method@Gtk.Text.set_invisible_char].
35//
36// If you want to add icons or progress display in an entry, look at
37// [class@Gtk.Entry]. There are other alternatives for more specialized
38// use cases, such as [class@Gtk.SearchEntry].
39//
40// If you need multi-line editable text, use [class@Gtk.TextView].
41//
42// # Shortcuts and Gestures
43//
44// `GtkText` supports the following keyboard shortcuts:
45//
46// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
47// - <kbd>Ctrl</kbd>+<kbd>A</kbd> or <kbd>Ctrl</kbd>+<kbd>&sol;</kbd>
48// selects all the text.
49// - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd> or
50// <kbd>Ctrl</kbd>+<kbd>&bsol;</kbd> unselects all.
51// - <kbd>Ctrl</kbd>+<kbd>Z</kbd> undoes the last modification.
52// - <kbd>Ctrl</kbd>+<kbd>Y</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd>
53// redoes the last undone modification.
54// - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> toggles the text direction.
55// - <kbd>Clear</kbd> clears the content.
56//
57// Additionally, the following signals have default keybindings:
58//
59// - [signal@Gtk.Text::activate]
60// - [signal@Gtk.Text::backspace]
61// - [signal@Gtk.Text::copy-clipboard]
62// - [signal@Gtk.Text::cut-clipboard]
63// - [signal@Gtk.Text::delete-from-cursor]
64// - [signal@Gtk.Text::insert-emoji]
65// - [signal@Gtk.Text::move-cursor]
66// - [signal@Gtk.Text::paste-clipboard]
67// - [signal@Gtk.Text::toggle-overwrite]
68//
69// # Actions
70//
71// `GtkText` defines a set of built-in actions:
72//
73// - `clipboard.copy` copies the contents to the clipboard.
74// - `clipboard.cut` copies the contents to the clipboard and deletes it from
75// the widget.
76// - `clipboard.paste` inserts the contents of the clipboard into the widget.
77// - `menu.popup` opens the context menu.
78// - `misc.insert-emoji` opens the Emoji chooser.
79// - `misc.toggle-visibility` toggles the `GtkText`:visibility property.
80// - `misc.toggle-direction` toggles the text direction.
81// - `selection.delete` deletes the current selection.
82// - `selection.select-all` selects all of the widgets content.
83// - `text.redo` redoes the last change to the contents.
84// - `text.undo` undoes the last change to the contents.
85// - `text.clear` removes all content.
86//
87// # CSS nodes
88//
89// ```
90// text[.read-only]
91// ├── placeholder
92// ├── undershoot.left
93// ├── undershoot.right
94// ├── [selection]
95// ├── [cursor-handle[.top]
96// ├── [cursor-handle.bottom]
97// ├── [block-cursor]
98// ├── [cursor-handle[.top/.bottom][.insertion-cursor]]
99// ╰── [window.popup]
100// ```
101//
102// `GtkText` has a main node with the name `text`. Depending on the properties
103// of the widget, the `.read-only` style class may appear.
104//
105// When the entry has a selection, it adds a subnode with the name `selection`.
106//
107// When the entry is in overwrite mode, it adds a subnode with the name
108// `block-cursor` that determines how the block cursor is drawn.
109//
110// The CSS node for a context menu is added as a subnode with the name `popup`.
111//
112// The `undershoot` nodes are used to draw the underflow indication when content
113// is scrolled out of view. These nodes get the `.left` or `.right` style class
114// added depending on where the indication is drawn.
115//
116// When touch is used and touch selection handles are shown, they are using
117// CSS nodes with name `cursor-handle`. They get the `.top` or `.bottom` style
118// class depending on where they are shown in relation to the selection. If
119// there is just a single handle for the text cursor, it gets the style class
120// `.insertion-cursor`.
121//
122// # Accessibility
123//
124// `GtkText` uses the [enum@Gtk.AccessibleRole.none] role, which causes it to be
125// skipped for accessibility. This is because `GtkText` is expected to be used
126// as a delegate for a `GtkEditable` implementation that will be represented
127// to accessibility.
128type Text struct {
129 Widget
130}
131
132var xTextGLibType func() types.GType
133
134func TextGLibType() types.GType {
135 return xTextGLibType()
136}
137
138func TextNewFromInternalPtr(ptr uintptr) *Text {
139 cls := &Text{}
140 cls.Ptr = ptr
141 return cls
142}
143
144var xNewText func() uintptr
145
146// Creates a new `GtkText`.
147func NewText() *Text {
148 var cls *Text
149
150 cret := xNewText()
151
152 if cret == 0 {
153 return nil
154 }
155 gobject.IncreaseRef(cret)
156 cls = &Text{}
157 cls.Ptr = cret
158 return cls
159}
160
161var xNewTextWithBuffer func(uintptr) uintptr
162
163// Creates a new `GtkText` with the specified buffer.
164func NewTextWithBuffer(BufferVar *EntryBuffer) *Text {
165 var cls *Text
166
167 cret := xNewTextWithBuffer(BufferVar.GoPointer())
168
169 if cret == 0 {
170 return nil
171 }
172 gobject.IncreaseRef(cret)
173 cls = &Text{}
174 cls.Ptr = cret
175 return cls
176}
177
178var xTextComputeCursorExtents func(uintptr, uint, *graphene.Rect, *graphene.Rect)
179
180// Determines the positions of the strong and weak cursors for a
181// given character position.
182//
183// The position of each cursor is stored as a zero-width rectangle.
184// The strong cursor location is the location where characters of
185// the directionality equal to the base direction are inserted.
186// The weak cursor location is the location where characters of
187// the directionality opposite to the base direction are inserted.
188//
189// The rectangle positions are in widget coordinates.
190func (x *Text) ComputeCursorExtents(PositionVar uint, StrongVar *graphene.Rect, WeakVar *graphene.Rect) {
191
192 xTextComputeCursorExtents(x.GoPointer(), PositionVar, StrongVar, WeakVar)
193
194}
195
196var xTextGetActivatesDefault func(uintptr) bool
197
198// Returns whether pressing <kbd>Enter</kbd> will activate
199// the default widget for the window containing the widget.
200//
201// See [method@Gtk.Text.set_activates_default].
202func (x *Text) GetActivatesDefault() bool {
203
204 cret := xTextGetActivatesDefault(x.GoPointer())
205 return cret
206}
207
208var xTextGetAttributes func(uintptr) *pango.AttrList
209
210// Gets the attribute list that was set on the text widget.
211//
212// See [method@Gtk.Text.set_attributes].
213func (x *Text) GetAttributes() *pango.AttrList {
214
215 cret := xTextGetAttributes(x.GoPointer())
216 return cret
217}
218
219var xTextGetBuffer func(uintptr) uintptr
220
221// Get the entry buffer object which holds the text for
222// this widget.
223func (x *Text) GetBuffer() *EntryBuffer {
224 var cls *EntryBuffer
225
226 cret := xTextGetBuffer(x.GoPointer())
227
228 if cret == 0 {
229 return nil
230 }
231 gobject.IncreaseRef(cret)
232 cls = &EntryBuffer{}
233 cls.Ptr = cret
234 return cls
235}
236
237var xTextGetEnableEmojiCompletion func(uintptr) bool
238
239// Returns whether Emoji completion is enabled.
240func (x *Text) GetEnableEmojiCompletion() bool {
241
242 cret := xTextGetEnableEmojiCompletion(x.GoPointer())
243 return cret
244}
245
246var xTextGetExtraMenu func(uintptr) uintptr
247
248// Gets the extra menu model of the text widget.
249//
250// See [method@Gtk.Text.set_extra_menu].
251func (x *Text) GetExtraMenu() *gio.MenuModel {
252 var cls *gio.MenuModel
253
254 cret := xTextGetExtraMenu(x.GoPointer())
255
256 if cret == 0 {
257 return nil
258 }
259 gobject.IncreaseRef(cret)
260 cls = &gio.MenuModel{}
261 cls.Ptr = cret
262 return cls
263}
264
265var xTextGetInputHints func(uintptr) InputHints
266
267// Gets the input hints of the text widget.
268func (x *Text) GetInputHints() InputHints {
269
270 cret := xTextGetInputHints(x.GoPointer())
271 return cret
272}
273
274var xTextGetInputPurpose func(uintptr) InputPurpose
275
276// Gets the input purpose of the text widget.
277func (x *Text) GetInputPurpose() InputPurpose {
278
279 cret := xTextGetInputPurpose(x.GoPointer())
280 return cret
281}
282
283var xTextGetInvisibleChar func(uintptr) uint32
284
285// Retrieves the character displayed when visibility is set to false.
286//
287// Note that GTK does not compute this value unless it needs it,
288// so the value returned by this function is not very useful unless
289// it has been explicitly set with [method@Gtk.Text.set_invisible_char].
290func (x *Text) GetInvisibleChar() uint32 {
291
292 cret := xTextGetInvisibleChar(x.GoPointer())
293 return cret
294}
295
296var xTextGetMaxLength func(uintptr) int
297
298// Retrieves the maximum allowed length of the contents.
299//
300// See [method@Gtk.Text.set_max_length].
301//
302// This is equivalent to getting @self's `GtkEntryBuffer` and
303// calling [method@Gtk.EntryBuffer.get_max_length] on it.
304func (x *Text) GetMaxLength() int {
305
306 cret := xTextGetMaxLength(x.GoPointer())
307 return cret
308}
309
310var xTextGetOverwriteMode func(uintptr) bool
311
312// Gets whether text is overwritten when typing.
313//
314// See [method@Gtk.Text.set_overwrite_mode].
315func (x *Text) GetOverwriteMode() bool {
316
317 cret := xTextGetOverwriteMode(x.GoPointer())
318 return cret
319}
320
321var xTextGetPlaceholderText func(uintptr) string
322
323// Retrieves the text that will be displayed when the text widget
324// is empty and unfocused
325//
326// See [method@Gtk.Text.set_placeholder_text].
327func (x *Text) GetPlaceholderText() string {
328
329 cret := xTextGetPlaceholderText(x.GoPointer())
330 return cret
331}
332
333var xTextGetPropagateTextWidth func(uintptr) bool
334
335// Returns whether the text widget will grow and shrink
336// with the content.
337func (x *Text) GetPropagateTextWidth() bool {
338
339 cret := xTextGetPropagateTextWidth(x.GoPointer())
340 return cret
341}
342
343var xTextGetTabs func(uintptr) *pango.TabArray
344
345// Gets the tab stops for the text widget.
346//
347// See [method@Gtk.Text.set_tabs].
348func (x *Text) GetTabs() *pango.TabArray {
349
350 cret := xTextGetTabs(x.GoPointer())
351 return cret
352}
353
354var xTextGetTextLength func(uintptr) uint16
355
356// Retrieves the length of the contents.
357//
358// This is equivalent to getting @self's `GtkEntryBuffer`
359// and calling [method@Gtk.EntryBuffer.get_length] on it.
360func (x *Text) GetTextLength() uint16 {
361
362 cret := xTextGetTextLength(x.GoPointer())
363 return cret
364}
365
366var xTextGetTruncateMultiline func(uintptr) bool
367
368// Returns whether pasted text will be truncated to the first line.
369func (x *Text) GetTruncateMultiline() bool {
370
371 cret := xTextGetTruncateMultiline(x.GoPointer())
372 return cret
373}
374
375var xTextGetVisibility func(uintptr) bool
376
377// Retrieves whether the text is visible.
378func (x *Text) GetVisibility() bool {
379
380 cret := xTextGetVisibility(x.GoPointer())
381 return cret
382}
383
384var xTextGrabFocusWithoutSelecting func(uintptr) bool
385
386// Causes the text widget to have the keyboard focus.
387//
388// It behaves like [method@Gtk.Widget.grab_focus],
389// except that it does not select the contents of @self.
390//
391// You only want to call this on some special entries
392// which the user usually doesn't want to replace all
393// text in, such as search-as-you-type entries.
394func (x *Text) GrabFocusWithoutSelecting() bool {
395
396 cret := xTextGrabFocusWithoutSelecting(x.GoPointer())
397 return cret
398}
399
400var xTextSetActivatesDefault func(uintptr, bool)
401
402// Sets whether pressing <kbd>Enter</kbd> will activate
403// the default widget.
404//
405// This usually means that the dialog containing @self will
406// be closed, since the default widget is usually one of
407// the dialog buttons.
408func (x *Text) SetActivatesDefault(ActivatesVar bool) {
409
410 xTextSetActivatesDefault(x.GoPointer(), ActivatesVar)
411
412}
413
414var xTextSetAttributes func(uintptr, *pango.AttrList)
415
416// Apply attributes to the contents of the text widget.
417func (x *Text) SetAttributes(AttrsVar *pango.AttrList) {
418
419 xTextSetAttributes(x.GoPointer(), AttrsVar)
420
421}
422
423var xTextSetBuffer func(uintptr, uintptr)
424
425// Set the entry buffer object which holds the text for
426// this widget.
427func (x *Text) SetBuffer(BufferVar *EntryBuffer) {
428
429 xTextSetBuffer(x.GoPointer(), BufferVar.GoPointer())
430
431}
432
433var xTextSetEnableEmojiCompletion func(uintptr, bool)
434
435// Sets whether Emoji completion is enabled.
436//
437// If it is, typing ':', followed by a recognized keyword,
438// will pop up a window with suggested Emojis matching the
439// keyword.
440func (x *Text) SetEnableEmojiCompletion(EnableEmojiCompletionVar bool) {
441
442 xTextSetEnableEmojiCompletion(x.GoPointer(), EnableEmojiCompletionVar)
443
444}
445
446var xTextSetExtraMenu func(uintptr, uintptr)
447
448// Sets a menu model to add to the context menu of the text widget.
449func (x *Text) SetExtraMenu(ModelVar *gio.MenuModel) {
450
451 xTextSetExtraMenu(x.GoPointer(), ModelVar.GoPointer())
452
453}
454
455var xTextSetInputHints func(uintptr, InputHints)
456
457// Sets hints that allow input methods to fine-tune their behaviour.
458func (x *Text) SetInputHints(HintsVar InputHints) {
459
460 xTextSetInputHints(x.GoPointer(), HintsVar)
461
462}
463
464var xTextSetInputPurpose func(uintptr, InputPurpose)
465
466// Sets the input purpose of the text widget.
467//
468// The input purpose can be used by on-screen keyboards
469// and other input methods to adjust their behaviour.
470func (x *Text) SetInputPurpose(PurposeVar InputPurpose) {
471
472 xTextSetInputPurpose(x.GoPointer(), PurposeVar)
473
474}
475
476var xTextSetInvisibleChar func(uintptr, uint32)
477
478// Sets the character to use when in “password mode”.
479//
480// By default, GTK picks the best invisible char available in the
481// current font. If you set the invisible char to 0, then the user
482// will get no feedback at all; there will be no text on the screen
483// as they type.
484func (x *Text) SetInvisibleChar(ChVar uint32) {
485
486 xTextSetInvisibleChar(x.GoPointer(), ChVar)
487
488}
489
490var xTextSetMaxLength func(uintptr, int)
491
492// Sets the maximum allowed length of the contents.
493//
494// If the current contents are longer than the given length,
495// they will be truncated to fit.
496//
497// This is equivalent to getting @self's `GtkEntryBuffer` and
498// calling [method@Gtk.EntryBuffer.set_max_length] on it.
499func (x *Text) SetMaxLength(LengthVar int) {
500
501 xTextSetMaxLength(x.GoPointer(), LengthVar)
502
503}
504
505var xTextSetOverwriteMode func(uintptr, bool)
506
507// Sets whether the text is overwritten when typing.
508func (x *Text) SetOverwriteMode(OverwriteVar bool) {
509
510 xTextSetOverwriteMode(x.GoPointer(), OverwriteVar)
511
512}
513
514var xTextSetPlaceholderText func(uintptr, uintptr)
515
516// Sets the text to be displayed when the text widget is
517// empty and unfocused.
518//
519// This can be used to give a visual hint of the expected
520// contents of the text widget.
521func (x *Text) SetPlaceholderText(TextVar *string) {
522
523 TextVarPtr := core.GStrdupNullable(TextVar)
524 defer core.GFreeNullable(TextVarPtr)
525
526 xTextSetPlaceholderText(x.GoPointer(), TextVarPtr)
527
528}
529
530var xTextSetPropagateTextWidth func(uintptr, bool)
531
532// Sets whether the text widget should grow and shrink with the content.
533func (x *Text) SetPropagateTextWidth(PropagateTextWidthVar bool) {
534
535 xTextSetPropagateTextWidth(x.GoPointer(), PropagateTextWidthVar)
536
537}
538
539var xTextSetTabs func(uintptr, *pango.TabArray)
540
541// Sets tab stops for the text widget.
542func (x *Text) SetTabs(TabsVar *pango.TabArray) {
543
544 xTextSetTabs(x.GoPointer(), TabsVar)
545
546}
547
548var xTextSetTruncateMultiline func(uintptr, bool)
549
550// Sets whether pasted text should be truncated to the first line.
551func (x *Text) SetTruncateMultiline(TruncateMultilineVar bool) {
552
553 xTextSetTruncateMultiline(x.GoPointer(), TruncateMultilineVar)
554
555}
556
557var xTextSetVisibility func(uintptr, bool)
558
559// Sets whether the contents of the text widget are visible or not.
560//
561// When visibility is set to false, characters are displayed
562// as the invisible char, and it will also appear that way when
563// the text in the widget is copied to the clipboard.
564//
565// By default, GTK picks the best invisible character available
566// in the current font, but it can be changed with
567// [method@Gtk.Text.set_invisible_char].
568//
569// Note that you probably want to set [property@Gtk.Text:input-purpose]
570// to [enum@Gtk.InputPurpose.password] or [enum@Gtk.InputPurpose.pin]
571// to inform input methods about the purpose of this widget, in addition
572// to setting visibility to false.
573func (x *Text) SetVisibility(VisibleVar bool) {
574
575 xTextSetVisibility(x.GoPointer(), VisibleVar)
576
577}
578
579var xTextUnsetInvisibleChar func(uintptr)
580
581// Unsets the invisible char.
582//
583// After calling this, the default invisible char is used again.
584func (x *Text) UnsetInvisibleChar() {
585
586 xTextUnsetInvisibleChar(x.GoPointer())
587
588}
589
590func (c *Text) GoPointer() uintptr {
591 if c == nil {
592 return 0
593 }
594 return c.Ptr
595}
596
597func (c *Text) SetGoPointer(ptr uintptr) {
598 c.Ptr = ptr
599}
600
601// SetPropertyActivatesDefault sets the "activates-default" property.
602// Whether to activate the default widget when <kbd>Enter</kbd> is pressed.
603func (x *Text) SetPropertyActivatesDefault(value bool) {
604 var v gobject.Value
605 v.Init(gobject.TypeBooleanVal)
606 v.SetBoolean(value)
607 x.SetProperty("activates-default", &v)
608}
609
610// GetPropertyActivatesDefault gets the "activates-default" property.
611// Whether to activate the default widget when <kbd>Enter</kbd> is pressed.
612func (x *Text) GetPropertyActivatesDefault() bool {
613 var v gobject.Value
614 x.GetProperty("activates-default", &v)
615 return v.GetBoolean()
616}
617
618// SetPropertyAttributes sets the "attributes" property.
619// A list of Pango attributes to apply to the text.
620//
621// This is mainly useful to change the size or weight of the text.
622//
623// The `PangoAttribute`'s @start_index and @end_index must refer to the
624// `GtkEntryBuffer` text, i.e. without the preedit string.
625func (x *Text) SetPropertyAttributes(value uintptr) {
626 var v gobject.Value
627 v.Init(gobject.TypePointerVal)
628 v.SetPointer(value)
629 x.SetProperty("attributes", &v)
630}
631
632// GetPropertyAttributes gets the "attributes" property.
633// A list of Pango attributes to apply to the text.
634//
635// This is mainly useful to change the size or weight of the text.
636//
637// The `PangoAttribute`'s @start_index and @end_index must refer to the
638// `GtkEntryBuffer` text, i.e. without the preedit string.
639func (x *Text) GetPropertyAttributes() uintptr {
640 var v gobject.Value
641 x.GetProperty("attributes", &v)
642 return v.GetPointer()
643}
644
645// SetPropertyEnableEmojiCompletion sets the "enable-emoji-completion" property.
646// Whether to suggest Emoji replacements.
647func (x *Text) SetPropertyEnableEmojiCompletion(value bool) {
648 var v gobject.Value
649 v.Init(gobject.TypeBooleanVal)
650 v.SetBoolean(value)
651 x.SetProperty("enable-emoji-completion", &v)
652}
653
654// GetPropertyEnableEmojiCompletion gets the "enable-emoji-completion" property.
655// Whether to suggest Emoji replacements.
656func (x *Text) GetPropertyEnableEmojiCompletion() bool {
657 var v gobject.Value
658 x.GetProperty("enable-emoji-completion", &v)
659 return v.GetBoolean()
660}
661
662// SetPropertyImModule sets the "im-module" property.
663// Which input method module should be used.
664//
665// See [class@Gtk.IMMulticontext].
666//
667// Setting this to a non-`NULL` value overrides the system-wide
668// input method. See the [property@Gtk.Settings:gtk-im-module]
669// setting.
670func (x *Text) SetPropertyImModule(value string) {
671 var v gobject.Value
672 v.Init(gobject.TypeStringVal)
673 v.SetString(&value)
674 x.SetProperty("im-module", &v)
675}
676
677// GetPropertyImModule gets the "im-module" property.
678// Which input method module should be used.
679//
680// See [class@Gtk.IMMulticontext].
681//
682// Setting this to a non-`NULL` value overrides the system-wide
683// input method. See the [property@Gtk.Settings:gtk-im-module]
684// setting.
685func (x *Text) GetPropertyImModule() string {
686 var v gobject.Value
687 x.GetProperty("im-module", &v)
688 return v.GetString()
689}
690
691// SetPropertyInvisibleChar sets the "invisible-char" property.
692// The character to used when masking contents (in “password mode”).
693func (x *Text) SetPropertyInvisibleChar(value uint) {
694 var v gobject.Value
695 v.Init(gobject.TypeUintVal)
696 v.SetUint(value)
697 x.SetProperty("invisible-char", &v)
698}
699
700// GetPropertyInvisibleChar gets the "invisible-char" property.
701// The character to used when masking contents (in “password mode”).
702func (x *Text) GetPropertyInvisibleChar() uint {
703 var v gobject.Value
704 x.GetProperty("invisible-char", &v)
705 return v.GetUint()
706}
707
708// SetPropertyInvisibleCharSet sets the "invisible-char-set" property.
709// Whether the invisible char has been set.
710func (x *Text) SetPropertyInvisibleCharSet(value bool) {
711 var v gobject.Value
712 v.Init(gobject.TypeBooleanVal)
713 v.SetBoolean(value)
714 x.SetProperty("invisible-char-set", &v)
715}
716
717// GetPropertyInvisibleCharSet gets the "invisible-char-set" property.
718// Whether the invisible char has been set.
719func (x *Text) GetPropertyInvisibleCharSet() bool {
720 var v gobject.Value
721 x.GetProperty("invisible-char-set", &v)
722 return v.GetBoolean()
723}
724
725// SetPropertyMaxLength sets the "max-length" property.
726// Maximum number of characters that are allowed.
727//
728// Zero indicates no limit.
729func (x *Text) SetPropertyMaxLength(value int) {
730 var v gobject.Value
731 v.Init(gobject.TypeIntVal)
732 v.SetInt(value)
733 x.SetProperty("max-length", &v)
734}
735
736// GetPropertyMaxLength gets the "max-length" property.
737// Maximum number of characters that are allowed.
738//
739// Zero indicates no limit.
740func (x *Text) GetPropertyMaxLength() int {
741 var v gobject.Value
742 x.GetProperty("max-length", &v)
743 return v.GetInt()
744}
745
746// SetPropertyOverwriteMode sets the "overwrite-mode" property.
747// If text is overwritten when typing.
748func (x *Text) SetPropertyOverwriteMode(value bool) {
749 var v gobject.Value
750 v.Init(gobject.TypeBooleanVal)
751 v.SetBoolean(value)
752 x.SetProperty("overwrite-mode", &v)
753}
754
755// GetPropertyOverwriteMode gets the "overwrite-mode" property.
756// If text is overwritten when typing.
757func (x *Text) GetPropertyOverwriteMode() bool {
758 var v gobject.Value
759 x.GetProperty("overwrite-mode", &v)
760 return v.GetBoolean()
761}
762
763// SetPropertyPlaceholderText sets the "placeholder-text" property.
764// The text that will be displayed in the `GtkText` when it is empty
765// and unfocused.
766func (x *Text) SetPropertyPlaceholderText(value string) {
767 var v gobject.Value
768 v.Init(gobject.TypeStringVal)
769 v.SetString(&value)
770 x.SetProperty("placeholder-text", &v)
771}
772
773// GetPropertyPlaceholderText gets the "placeholder-text" property.
774// The text that will be displayed in the `GtkText` when it is empty
775// and unfocused.
776func (x *Text) GetPropertyPlaceholderText() string {
777 var v gobject.Value
778 x.GetProperty("placeholder-text", &v)
779 return v.GetString()
780}
781
782// SetPropertyPropagateTextWidth sets the "propagate-text-width" property.
783// Whether the widget should grow and shrink with the content.
784func (x *Text) SetPropertyPropagateTextWidth(value bool) {
785 var v gobject.Value
786 v.Init(gobject.TypeBooleanVal)
787 v.SetBoolean(value)
788 x.SetProperty("propagate-text-width", &v)
789}
790
791// GetPropertyPropagateTextWidth gets the "propagate-text-width" property.
792// Whether the widget should grow and shrink with the content.
793func (x *Text) GetPropertyPropagateTextWidth() bool {
794 var v gobject.Value
795 x.GetProperty("propagate-text-width", &v)
796 return v.GetBoolean()
797}
798
799// GetPropertyScrollOffset gets the "scroll-offset" property.
800// Number of pixels scrolled of the screen to the left.
801func (x *Text) GetPropertyScrollOffset() int {
802 var v gobject.Value
803 x.GetProperty("scroll-offset", &v)
804 return v.GetInt()
805}
806
807// SetPropertyTabs sets the "tabs" property.
808// Custom tabs for this text widget.
809func (x *Text) SetPropertyTabs(value uintptr) {
810 var v gobject.Value
811 v.Init(gobject.TypePointerVal)
812 v.SetPointer(value)
813 x.SetProperty("tabs", &v)
814}
815
816// GetPropertyTabs gets the "tabs" property.
817// Custom tabs for this text widget.
818func (x *Text) GetPropertyTabs() uintptr {
819 var v gobject.Value
820 x.GetProperty("tabs", &v)
821 return v.GetPointer()
822}
823
824// SetPropertyTruncateMultiline sets the "truncate-multiline" property.
825// When true, pasted multi-line text is truncated to the first line.
826func (x *Text) SetPropertyTruncateMultiline(value bool) {
827 var v gobject.Value
828 v.Init(gobject.TypeBooleanVal)
829 v.SetBoolean(value)
830 x.SetProperty("truncate-multiline", &v)
831}
832
833// GetPropertyTruncateMultiline gets the "truncate-multiline" property.
834// When true, pasted multi-line text is truncated to the first line.
835func (x *Text) GetPropertyTruncateMultiline() bool {
836 var v gobject.Value
837 x.GetProperty("truncate-multiline", &v)
838 return v.GetBoolean()
839}
840
841// SetPropertyVisibility sets the "visibility" property.
842// If false, the text is masked with the “invisible char”.
843func (x *Text) SetPropertyVisibility(value bool) {
844 var v gobject.Value
845 v.Init(gobject.TypeBooleanVal)
846 v.SetBoolean(value)
847 x.SetProperty("visibility", &v)
848}
849
850// GetPropertyVisibility gets the "visibility" property.
851// If false, the text is masked with the “invisible char”.
852func (x *Text) GetPropertyVisibility() bool {
853 var v gobject.Value
854 x.GetProperty("visibility", &v)
855 return v.GetBoolean()
856}
857
858// Emitted when the user hits the <kbd>Enter</kbd> key.
859//
860// The default bindings for this signal are all forms
861// of the <kbd>Enter</kbd> key.
862func (x *Text) ConnectActivate(cb *func(Text)) uint {
863 cbPtr := uintptr(unsafe.Pointer(cb))
864 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
865 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
866 glib.SaveHandlerMapping(handlerID, cbPtr)
867 return handlerID
868 }
869
870 fcb := func(clsPtr uintptr) {
871 fa := Text{}
872 fa.Ptr = clsPtr
873 cbFn := *cb
874
875 cbFn(fa)
876
877 }
878 cbRefPtr := purego.NewCallback(fcb)
879 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
880 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
881 glib.SaveHandlerMapping(handlerID, cbPtr)
882 return handlerID
883}
884
885// Emitted when the user asks for it.
886//
887// This is a [keybinding signal](class.SignalAction.html).
888//
889// The default bindings for this signal are
890// <kbd>Backspace</kbd> and <kbd>Shift</kbd>+<kbd>Backspace</kbd>.
891func (x *Text) ConnectBackspace(cb *func(Text)) uint {
892 cbPtr := uintptr(unsafe.Pointer(cb))
893 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
894 handlerID := gobject.SignalConnect(x.GoPointer(), "backspace", cbRefPtr)
895 glib.SaveHandlerMapping(handlerID, cbPtr)
896 return handlerID
897 }
898
899 fcb := func(clsPtr uintptr) {
900 fa := Text{}
901 fa.Ptr = clsPtr
902 cbFn := *cb
903
904 cbFn(fa)
905
906 }
907 cbRefPtr := purego.NewCallback(fcb)
908 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
909 handlerID := gobject.SignalConnect(x.GoPointer(), "backspace", cbRefPtr)
910 glib.SaveHandlerMapping(handlerID, cbPtr)
911 return handlerID
912}
913
914// Emitted to copy the selection to the clipboard.
915//
916// This is a [keybinding signal](class.SignalAction.html).
917//
918// The default bindings for this signal are
919// <kbd>Ctrl</kbd>+<kbd>c</kbd> and
920// <kbd>Ctrl</kbd>+<kbd>Insert</kbd>.
921func (x *Text) ConnectCopyClipboard(cb *func(Text)) uint {
922 cbPtr := uintptr(unsafe.Pointer(cb))
923 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
924 handlerID := gobject.SignalConnect(x.GoPointer(), "copy-clipboard", cbRefPtr)
925 glib.SaveHandlerMapping(handlerID, cbPtr)
926 return handlerID
927 }
928
929 fcb := func(clsPtr uintptr) {
930 fa := Text{}
931 fa.Ptr = clsPtr
932 cbFn := *cb
933
934 cbFn(fa)
935
936 }
937 cbRefPtr := purego.NewCallback(fcb)
938 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
939 handlerID := gobject.SignalConnect(x.GoPointer(), "copy-clipboard", cbRefPtr)
940 glib.SaveHandlerMapping(handlerID, cbPtr)
941 return handlerID
942}
943
944// Emitted to cut the selection to the clipboard.
945//
946// This is a [keybinding signal](class.SignalAction.html).
947//
948// The default bindings for this signal are
949// <kbd>Ctrl</kbd>+<kbd>x</kbd> and
950// <kbd>Shift</kbd>+<kbd>Delete</kbd>.
951func (x *Text) ConnectCutClipboard(cb *func(Text)) uint {
952 cbPtr := uintptr(unsafe.Pointer(cb))
953 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
954 handlerID := gobject.SignalConnect(x.GoPointer(), "cut-clipboard", cbRefPtr)
955 glib.SaveHandlerMapping(handlerID, cbPtr)
956 return handlerID
957 }
958
959 fcb := func(clsPtr uintptr) {
960 fa := Text{}
961 fa.Ptr = clsPtr
962 cbFn := *cb
963
964 cbFn(fa)
965
966 }
967 cbRefPtr := purego.NewCallback(fcb)
968 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
969 handlerID := gobject.SignalConnect(x.GoPointer(), "cut-clipboard", cbRefPtr)
970 glib.SaveHandlerMapping(handlerID, cbPtr)
971 return handlerID
972}
973
974// Emitted when the user initiates a text deletion.
975//
976// This is a [keybinding signal](class.SignalAction.html).
977//
978// If the @type is [enum@Gtk.DeleteType.chars], GTK deletes the
979// selection if there is one, otherwise it deletes the requested
980// number of characters.
981//
982// The default bindings for this signal are <kbd>Delete</kbd>
983// for deleting a character and <kbd>Ctrl</kbd>+<kbd>Delete</kbd>
984// for deleting a word.
985func (x *Text) ConnectDeleteFromCursor(cb *func(Text, DeleteType, int)) uint {
986 cbPtr := uintptr(unsafe.Pointer(cb))
987 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
988 handlerID := gobject.SignalConnect(x.GoPointer(), "delete-from-cursor", cbRefPtr)
989 glib.SaveHandlerMapping(handlerID, cbPtr)
990 return handlerID
991 }
992
993 fcb := func(clsPtr uintptr, TypeVarp DeleteType, CountVarp int) {
994 fa := Text{}
995 fa.Ptr = clsPtr
996 cbFn := *cb
997
998 cbFn(fa, TypeVarp, CountVarp)
999
1000 }
1001 cbRefPtr := purego.NewCallback(fcb)
1002 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1003 handlerID := gobject.SignalConnect(x.GoPointer(), "delete-from-cursor", cbRefPtr)
1004 glib.SaveHandlerMapping(handlerID, cbPtr)
1005 return handlerID
1006}
1007
1008// Emitted when the user initiates the insertion of a
1009// fixed string at the cursor.
1010//
1011// This is a [keybinding signal](class.SignalAction.html).
1012//
1013// This signal has no default bindings.
1014func (x *Text) ConnectInsertAtCursor(cb *func(Text, string)) uint {
1015 cbPtr := uintptr(unsafe.Pointer(cb))
1016 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1017 handlerID := gobject.SignalConnect(x.GoPointer(), "insert-at-cursor", cbRefPtr)
1018 glib.SaveHandlerMapping(handlerID, cbPtr)
1019 return handlerID
1020 }
1021
1022 fcb := func(clsPtr uintptr, StringVarp uintptr) {
1023 fa := Text{}
1024 fa.Ptr = clsPtr
1025 cbFn := *cb
1026
1027 cbFn(fa, core.GoString(StringVarp))
1028
1029 }
1030 cbRefPtr := purego.NewCallback(fcb)
1031 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1032 handlerID := gobject.SignalConnect(x.GoPointer(), "insert-at-cursor", cbRefPtr)
1033 glib.SaveHandlerMapping(handlerID, cbPtr)
1034 return handlerID
1035}
1036
1037// Emitted to present the Emoji chooser.
1038//
1039// This is a [keybinding signal](class.SignalAction.html).
1040//
1041// The default bindings for this signal are
1042// <kbd>Ctrl</kbd>+<kbd>.</kbd> and
1043// <kbd>Ctrl</kbd>+<kbd>;</kbd>
1044func (x *Text) ConnectInsertEmoji(cb *func(Text)) uint {
1045 cbPtr := uintptr(unsafe.Pointer(cb))
1046 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1047 handlerID := gobject.SignalConnect(x.GoPointer(), "insert-emoji", cbRefPtr)
1048 glib.SaveHandlerMapping(handlerID, cbPtr)
1049 return handlerID
1050 }
1051
1052 fcb := func(clsPtr uintptr) {
1053 fa := Text{}
1054 fa.Ptr = clsPtr
1055 cbFn := *cb
1056
1057 cbFn(fa)
1058
1059 }
1060 cbRefPtr := purego.NewCallback(fcb)
1061 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1062 handlerID := gobject.SignalConnect(x.GoPointer(), "insert-emoji", cbRefPtr)
1063 glib.SaveHandlerMapping(handlerID, cbPtr)
1064 return handlerID
1065}
1066
1067// Emitted when the user initiates a cursor movement.
1068//
1069// If the cursor is not visible in @self, this signal causes
1070// the viewport to be moved instead.
1071//
1072// This is a [keybinding signal](class.SignalAction.html).
1073//
1074// Applications should not connect to it, but may emit it with
1075// [func@GObject.signal_emit_by_name] if they need to control
1076// the cursor programmatically.
1077//
1078// The default bindings for this signal come in two variants,
1079// the variant with the <kbd>Shift</kbd> modifier extends the
1080// selection, the variant without it does not.
1081// There are too many key combinations to list them all here.
1082//
1083// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
1084// move by individual characters/lines
1085// - <kbd>Ctrl</kbd>+<kbd>←</kbd>, etc. move by words/paragraphs
1086// - <kbd>Home</kbd> and <kbd>End</kbd> move to the ends of the buffer
1087func (x *Text) ConnectMoveCursor(cb *func(Text, MovementStep, int, bool)) uint {
1088 cbPtr := uintptr(unsafe.Pointer(cb))
1089 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1090 handlerID := gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr)
1091 glib.SaveHandlerMapping(handlerID, cbPtr)
1092 return handlerID
1093 }
1094
1095 fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendVarp bool) {
1096 fa := Text{}
1097 fa.Ptr = clsPtr
1098 cbFn := *cb
1099
1100 cbFn(fa, StepVarp, CountVarp, ExtendVarp)
1101
1102 }
1103 cbRefPtr := purego.NewCallback(fcb)
1104 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1105 handlerID := gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr)
1106 glib.SaveHandlerMapping(handlerID, cbPtr)
1107 return handlerID
1108}
1109
1110// Emitted to paste the contents of the clipboard.
1111//
1112// This is a [keybinding signal](class.SignalAction.html).
1113//
1114// The default bindings for this signal are
1115// <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>Shift</kbd>+<kbd>Insert</kbd>.
1116func (x *Text) ConnectPasteClipboard(cb *func(Text)) uint {
1117 cbPtr := uintptr(unsafe.Pointer(cb))
1118 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1119 handlerID := gobject.SignalConnect(x.GoPointer(), "paste-clipboard", cbRefPtr)
1120 glib.SaveHandlerMapping(handlerID, cbPtr)
1121 return handlerID
1122 }
1123
1124 fcb := func(clsPtr uintptr) {
1125 fa := Text{}
1126 fa.Ptr = clsPtr
1127 cbFn := *cb
1128
1129 cbFn(fa)
1130
1131 }
1132 cbRefPtr := purego.NewCallback(fcb)
1133 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1134 handlerID := gobject.SignalConnect(x.GoPointer(), "paste-clipboard", cbRefPtr)
1135 glib.SaveHandlerMapping(handlerID, cbPtr)
1136 return handlerID
1137}
1138
1139// Emitted when the preedit text changes.
1140//
1141// If an input method is used, the typed text will not immediately
1142// be committed to the buffer. So if you are interested in the text,
1143// connect to this signal.
1144func (x *Text) ConnectPreeditChanged(cb *func(Text, string)) uint {
1145 cbPtr := uintptr(unsafe.Pointer(cb))
1146 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1147 handlerID := gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr)
1148 glib.SaveHandlerMapping(handlerID, cbPtr)
1149 return handlerID
1150 }
1151
1152 fcb := func(clsPtr uintptr, PreeditVarp uintptr) {
1153 fa := Text{}
1154 fa.Ptr = clsPtr
1155 cbFn := *cb
1156
1157 cbFn(fa, core.GoString(PreeditVarp))
1158
1159 }
1160 cbRefPtr := purego.NewCallback(fcb)
1161 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1162 handlerID := gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr)
1163 glib.SaveHandlerMapping(handlerID, cbPtr)
1164 return handlerID
1165}
1166
1167// Emitted to toggle the overwrite mode.
1168//
1169// This is a [keybinding signal](class.SignalAction.html).
1170//
1171// The default bindings for this signal is <kbd>Insert</kbd>.
1172func (x *Text) ConnectToggleOverwrite(cb *func(Text)) uint {
1173 cbPtr := uintptr(unsafe.Pointer(cb))
1174 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1175 handlerID := gobject.SignalConnect(x.GoPointer(), "toggle-overwrite", cbRefPtr)
1176 glib.SaveHandlerMapping(handlerID, cbPtr)
1177 return handlerID
1178 }
1179
1180 fcb := func(clsPtr uintptr) {
1181 fa := Text{}
1182 fa.Ptr = clsPtr
1183 cbFn := *cb
1184
1185 cbFn(fa)
1186
1187 }
1188 cbRefPtr := purego.NewCallback(fcb)
1189 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1190 handlerID := gobject.SignalConnect(x.GoPointer(), "toggle-overwrite", cbRefPtr)
1191 glib.SaveHandlerMapping(handlerID, cbPtr)
1192 return handlerID
1193}
1194
1195// Requests the user's screen reader to announce the given message.
1196//
1197// This kind of notification is useful for messages that
1198// either have only a visual representation or that are not
1199// exposed visually at all, e.g. a notification about a
1200// successful operation.
1201//
1202// Also, by using this API, you can ensure that the message
1203// does not interrupts the user's current screen reader output.
1204func (x *Text) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
1205
1206 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
1207
1208}
1209
1210// Retrieves the accessible parent for an accessible object.
1211//
1212// This function returns `NULL` for top level widgets.
1213func (x *Text) GetAccessibleParent() *AccessibleBase {
1214 var cls *AccessibleBase
1215
1216 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
1217
1218 if cret == 0 {
1219 return nil
1220 }
1221 cls = &AccessibleBase{}
1222 cls.Ptr = cret
1223 return cls
1224}
1225
1226// Retrieves the accessible role of an accessible object.
1227func (x *Text) GetAccessibleRole() AccessibleRole {
1228
1229 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
1230 return cret
1231}
1232
1233// Retrieves the implementation for the given accessible object.
1234func (x *Text) GetAtContext() *ATContext {
1235 var cls *ATContext
1236
1237 cret := XGtkAccessibleGetAtContext(x.GoPointer())
1238
1239 if cret == 0 {
1240 return nil
1241 }
1242 cls = &ATContext{}
1243 cls.Ptr = cret
1244 return cls
1245}
1246
1247// Queries the coordinates and dimensions of this accessible
1248//
1249// This functionality can be overridden by `GtkAccessible`
1250// implementations, e.g. to get the bounds from an ignored
1251// child widget.
1252func (x *Text) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
1253
1254 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
1255 return cret
1256}
1257
1258// Retrieves the first accessible child of an accessible object.
1259func (x *Text) GetFirstAccessibleChild() *AccessibleBase {
1260 var cls *AccessibleBase
1261
1262 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
1263
1264 if cret == 0 {
1265 return nil
1266 }
1267 cls = &AccessibleBase{}
1268 cls.Ptr = cret
1269 return cls
1270}
1271
1272// Retrieves the next accessible sibling of an accessible object
1273func (x *Text) GetNextAccessibleSibling() *AccessibleBase {
1274 var cls *AccessibleBase
1275
1276 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
1277
1278 if cret == 0 {
1279 return nil
1280 }
1281 cls = &AccessibleBase{}
1282 cls.Ptr = cret
1283 return cls
1284}
1285
1286// Queries a platform state, such as focus.
1287//
1288// This functionality can be overridden by `GtkAccessible`
1289// implementations, e.g. to get platform state from an ignored
1290// child widget, as is the case for `GtkText` wrappers.
1291func (x *Text) GetPlatformState(StateVar AccessiblePlatformState) bool {
1292
1293 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
1294 return cret
1295}
1296
1297// Resets the accessible property to its default value.
1298func (x *Text) ResetProperty(PropertyVar AccessibleProperty) {
1299
1300 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
1301
1302}
1303
1304// Resets the accessible relation to its default value.
1305func (x *Text) ResetRelation(RelationVar AccessibleRelation) {
1306
1307 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
1308
1309}
1310
1311// Resets the accessible state to its default value.
1312func (x *Text) ResetState(StateVar AccessibleState) {
1313
1314 XGtkAccessibleResetState(x.GoPointer(), StateVar)
1315
1316}
1317
1318// Sets the parent and sibling of an accessible object.
1319//
1320// This function is meant to be used by accessible implementations that are
1321// not part of the widget hierarchy, and but act as a logical bridge between
1322// widgets. For instance, if a widget creates an object that holds metadata
1323// for each child, and you want that object to implement the `GtkAccessible`
1324// interface, you will use this function to ensure that the parent of each
1325// child widget is the metadata object, and the parent of each metadata
1326// object is the container widget.
1327func (x *Text) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
1328
1329 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
1330
1331}
1332
1333// Updates the next accessible sibling.
1334//
1335// That might be useful when a new child of a custom accessible
1336// is created, and it needs to be linked to a previous child.
1337func (x *Text) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
1338
1339 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
1340
1341}
1342
1343// Informs ATs that the platform state has changed.
1344//
1345// This function should be used by `GtkAccessible` implementations that
1346// have a platform state but are not widgets. Widgets handle platform
1347// states automatically.
1348func (x *Text) UpdatePlatformState(StateVar AccessiblePlatformState) {
1349
1350 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
1351
1352}
1353
1354// Updates a list of accessible properties.
1355//
1356// See the [enum@Gtk.AccessibleProperty] documentation for the
1357// value types of accessible properties.
1358//
1359// This function should be called by `GtkWidget` types whenever
1360// an accessible property change must be communicated to assistive
1361// technologies.
1362//
1363// Example:
1364// ```c
1365// value = gtk_adjustment_get_value (adjustment);
1366// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
1367//
1368// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
1369// -1);
1370//
1371// ```
1372func (x *Text) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
1373
1374 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
1375
1376}
1377
1378// Updates an array of accessible properties.
1379//
1380// This function should be called by `GtkWidget` types whenever an accessible
1381// property change must be communicated to assistive technologies.
1382//
1383// This function is meant to be used by language bindings.
1384func (x *Text) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
1385
1386 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
1387
1388}
1389
1390// Updates a list of accessible relations.
1391//
1392// This function should be called by `GtkWidget` types whenever an accessible
1393// relation change must be communicated to assistive technologies.
1394//
1395// If the [enum@Gtk.AccessibleRelation] requires a list of references,
1396// you should pass each reference individually, followed by `NULL`, e.g.
1397//
1398// ```c
1399// gtk_accessible_update_relation (accessible,
1400//
1401// GTK_ACCESSIBLE_RELATION_CONTROLS,
1402// ref1, NULL,
1403// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
1404// ref1, ref2, ref3, NULL,
1405// -1);
1406//
1407// ```
1408func (x *Text) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
1409
1410 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
1411
1412}
1413
1414// Updates an array of accessible relations.
1415//
1416// This function should be called by `GtkWidget` types whenever an accessible
1417// relation change must be communicated to assistive technologies.
1418//
1419// This function is meant to be used by language bindings.
1420func (x *Text) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
1421
1422 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
1423
1424}
1425
1426// Updates a list of accessible states.
1427//
1428// See the [enum@Gtk.AccessibleState] documentation for the
1429// value types of accessible states.
1430//
1431// This function should be called by `GtkWidget` types whenever
1432// an accessible state change must be communicated to assistive
1433// technologies.
1434//
1435// Example:
1436//
1437// ```c
1438// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
1439// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
1440//
1441// GTK_ACCESSIBLE_STATE_CHECKED, value,
1442// -1);
1443//
1444// ```
1445func (x *Text) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
1446
1447 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
1448
1449}
1450
1451// Updates an array of accessible states.
1452//
1453// This function should be called by `GtkWidget` types whenever an accessible
1454// state change must be communicated to assistive technologies.
1455//
1456// This function is meant to be used by language bindings.
1457func (x *Text) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
1458
1459 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
1460
1461}
1462
1463// Updates the position of the caret.
1464//
1465// Implementations of the `GtkAccessibleText` interface should call this
1466// function every time the caret has moved, in order to notify assistive
1467// technologies.
1468func (x *Text) UpdateCaretPosition() {
1469
1470 XGtkAccessibleTextUpdateCaretPosition(x.GoPointer())
1471
1472}
1473
1474// Notifies assistive technologies of a change in contents.
1475//
1476// Implementations of the `GtkAccessibleText` interface should call this
1477// function every time their contents change as the result of an operation,
1478// like an insertion or a removal.
1479//
1480// Note: If the change is a deletion, this function must be called *before*
1481// removing the contents, if it is an insertion, it must be called *after*
1482// inserting the new contents.
1483func (x *Text) UpdateContents(ChangeVar AccessibleTextContentChange, StartVar uint, EndVar uint) {
1484
1485 XGtkAccessibleTextUpdateContents(x.GoPointer(), ChangeVar, StartVar, EndVar)
1486
1487}
1488
1489// Updates the boundary of the selection.
1490//
1491// Implementations of the `GtkAccessibleText` interface should call this
1492// function every time the selection has moved, in order to notify assistive
1493// technologies.
1494func (x *Text) UpdateSelectionBound() {
1495
1496 XGtkAccessibleTextUpdateSelectionBound(x.GoPointer())
1497
1498}
1499
1500// Gets the ID of the @buildable object.
1501//
1502// `GtkBuilder` sets the name based on the ID attribute
1503// of the `<object>` tag used to construct the @buildable.
1504func (x *Text) GetBuildableId() string {
1505
1506 cret := XGtkBuildableGetBuildableId(x.GoPointer())
1507 return cret
1508}
1509
1510// Retrieves the accessible platform state from the editable delegate.
1511//
1512// This is an helper function to retrieve the accessible state for
1513// `GtkEditable` interface implementations using a delegate pattern.
1514//
1515// You should call this function in your editable widget implementation
1516// of the [vfunc@Gtk.Accessible.get_platform_state] virtual function, for
1517// instance:
1518//
1519// ```c
1520// static void
1521// accessible_interface_init (GtkAccessibleInterface *iface)
1522//
1523// {
1524// iface->get_platform_state = your_editable_get_accessible_platform_state;
1525// }
1526//
1527// static gboolean
1528// your_editable_get_accessible_platform_state (GtkAccessible *accessible,
1529//
1530// GtkAccessiblePlatformState state)
1531//
1532// {
1533// return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state);
1534// }
1535//
1536// ```
1537//
1538// Note that the widget which is the delegate *must* be a direct child of
1539// this widget, otherwise your implementation of [vfunc@Gtk.Accessible.get_platform_state]
1540// might not even be called, as the platform change will originate from
1541// the parent of the delegate, and, as a result, will not work properly.
1542//
1543// So, if you can't ensure the direct child condition, you should give the
1544// delegate the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role, or you can
1545// change your tree to allow this function to work.
1546func (x *Text) DelegateGetAccessiblePlatformState(StateVar AccessiblePlatformState) bool {
1547
1548 cret := XGtkEditableDelegateGetAccessiblePlatformState(x.GoPointer(), StateVar)
1549 return cret
1550}
1551
1552// Deletes the currently selected text of the editable.
1553//
1554// This call doesn’t do anything if there is no selected text.
1555func (x *Text) DeleteSelection() {
1556
1557 XGtkEditableDeleteSelection(x.GoPointer())
1558
1559}
1560
1561// Deletes a sequence of characters.
1562//
1563// The characters that are deleted are those characters at positions
1564// from @start_pos up to, but not including @end_pos. If @end_pos is
1565// negative, then the characters deleted are those from @start_pos to
1566// the end of the text.
1567//
1568// Note that the positions are specified in characters, not bytes.
1569func (x *Text) DeleteText(StartPosVar int, EndPosVar int) {
1570
1571 XGtkEditableDeleteText(x.GoPointer(), StartPosVar, EndPosVar)
1572
1573}
1574
1575// Undoes the setup done by [method@Gtk.Editable.init_delegate].
1576//
1577// This is a helper function that should be called from dispose,
1578// before removing the delegate object.
1579func (x *Text) FinishDelegate() {
1580
1581 XGtkEditableFinishDelegate(x.GoPointer())
1582
1583}
1584
1585// Gets the alignment of the editable.
1586func (x *Text) GetAlignment() float32 {
1587
1588 cret := XGtkEditableGetAlignment(x.GoPointer())
1589 return cret
1590}
1591
1592// Retrieves a sequence of characters.
1593//
1594// The characters that are retrieved are those characters at positions
1595// from @start_pos up to, but not including @end_pos. If @end_pos is negative,
1596// then the characters retrieved are those characters from @start_pos to
1597// the end of the text.
1598//
1599// Note that positions are specified in characters, not bytes.
1600func (x *Text) GetChars(StartPosVar int, EndPosVar int) string {
1601
1602 cret := XGtkEditableGetChars(x.GoPointer(), StartPosVar, EndPosVar)
1603 return cret
1604}
1605
1606// Gets the `GtkEditable` that @editable is delegating its
1607// implementation to.
1608//
1609// Typically, the delegate is a [class@Gtk.Text] widget.
1610func (x *Text) GetDelegate() *EditableBase {
1611 var cls *EditableBase
1612
1613 cret := XGtkEditableGetDelegate(x.GoPointer())
1614
1615 if cret == 0 {
1616 return nil
1617 }
1618 gobject.IncreaseRef(cret)
1619 cls = &EditableBase{}
1620 cls.Ptr = cret
1621 return cls
1622}
1623
1624// Retrieves whether @editable is editable.
1625func (x *Text) GetEditable() bool {
1626
1627 cret := XGtkEditableGetEditable(x.GoPointer())
1628 return cret
1629}
1630
1631// Gets if undo/redo actions are enabled for @editable
1632func (x *Text) GetEnableUndo() bool {
1633
1634 cret := XGtkEditableGetEnableUndo(x.GoPointer())
1635 return cret
1636}
1637
1638// Retrieves the desired maximum width of @editable, in characters.
1639func (x *Text) GetMaxWidthChars() int {
1640
1641 cret := XGtkEditableGetMaxWidthChars(x.GoPointer())
1642 return cret
1643}
1644
1645// Retrieves the current position of the cursor relative
1646// to the start of the content of the editable.
1647//
1648// Note that this position is in characters, not in bytes.
1649func (x *Text) GetPosition() int {
1650
1651 cret := XGtkEditableGetPosition(x.GoPointer())
1652 return cret
1653}
1654
1655// Retrieves the selection bound of the editable.
1656//
1657// @start_pos will be filled with the start of the selection and
1658// @end_pos with end. If no text was selected both will be identical
1659// and %FALSE will be returned.
1660//
1661// Note that positions are specified in characters, not bytes.
1662func (x *Text) GetSelectionBounds(StartPosVar *int, EndPosVar *int) bool {
1663
1664 cret := XGtkEditableGetSelectionBounds(x.GoPointer(), StartPosVar, EndPosVar)
1665 return cret
1666}
1667
1668// Retrieves the contents of @editable.
1669//
1670// The returned string is owned by GTK and must not be modified or freed.
1671func (x *Text) GetText() string {
1672
1673 cret := XGtkEditableGetText(x.GoPointer())
1674 return cret
1675}
1676
1677// Gets the number of characters of space reserved
1678// for the contents of the editable.
1679func (x *Text) GetWidthChars() int {
1680
1681 cret := XGtkEditableGetWidthChars(x.GoPointer())
1682 return cret
1683}
1684
1685// Sets up a delegate for `GtkEditable`.
1686//
1687// This is assuming that the get_delegate vfunc in the `GtkEditable`
1688// interface has been set up for the @editable's type.
1689//
1690// This is a helper function that should be called in instance init,
1691// after creating the delegate object.
1692func (x *Text) InitDelegate() {
1693
1694 XGtkEditableInitDelegate(x.GoPointer())
1695
1696}
1697
1698// Inserts @length bytes of @text into the contents of the
1699// widget, at position @position.
1700//
1701// Note that the position is in characters, not in bytes.
1702// The function updates @position to point after the newly
1703// inserted text.
1704func (x *Text) InsertText(TextVar string, LengthVar int, PositionVar int) {
1705
1706 XGtkEditableInsertText(x.GoPointer(), TextVar, LengthVar, PositionVar)
1707
1708}
1709
1710// Selects a region of text.
1711//
1712// The characters that are selected are those characters at positions
1713// from @start_pos up to, but not including @end_pos. If @end_pos is
1714// negative, then the characters selected are those characters from
1715// @start_pos to the end of the text.
1716//
1717// Note that positions are specified in characters, not bytes.
1718func (x *Text) SelectRegion(StartPosVar int, EndPosVar int) {
1719
1720 XGtkEditableSelectRegion(x.GoPointer(), StartPosVar, EndPosVar)
1721
1722}
1723
1724// Sets the alignment for the contents of the editable.
1725//
1726// This controls the horizontal positioning of the contents when
1727// the displayed text is shorter than the width of the editable.
1728func (x *Text) SetAlignment(XalignVar float32) {
1729
1730 XGtkEditableSetAlignment(x.GoPointer(), XalignVar)
1731
1732}
1733
1734// Determines if the user can edit the text in the editable widget.
1735func (x *Text) SetEditable(IsEditableVar bool) {
1736
1737 XGtkEditableSetEditable(x.GoPointer(), IsEditableVar)
1738
1739}
1740
1741// If enabled, changes to @editable will be saved for undo/redo
1742// actions.
1743//
1744// This results in an additional copy of text changes and are not
1745// stored in secure memory. As such, undo is forcefully disabled
1746// when [property@Gtk.Text:visibility] is set to %FALSE.
1747func (x *Text) SetEnableUndo(EnableUndoVar bool) {
1748
1749 XGtkEditableSetEnableUndo(x.GoPointer(), EnableUndoVar)
1750
1751}
1752
1753// Sets the desired maximum width in characters of @editable.
1754func (x *Text) SetMaxWidthChars(NCharsVar int) {
1755
1756 XGtkEditableSetMaxWidthChars(x.GoPointer(), NCharsVar)
1757
1758}
1759
1760// Sets the cursor position in the editable to the given value.
1761//
1762// The cursor is displayed before the character with the given (base 0)
1763// index in the contents of the editable. The value must be less than
1764// or equal to the number of characters in the editable. A value of -1
1765// indicates that the position should be set after the last character
1766// of the editable. Note that @position is in characters, not in bytes.
1767func (x *Text) SetPosition(PositionVar int) {
1768
1769 XGtkEditableSetPosition(x.GoPointer(), PositionVar)
1770
1771}
1772
1773// Sets the text in the editable to the given value.
1774//
1775// This is replacing the current contents.
1776func (x *Text) SetText(TextVar string) {
1777
1778 XGtkEditableSetText(x.GoPointer(), TextVar)
1779
1780}
1781
1782// Changes the size request of the editable to be about the
1783// right size for @n_chars characters.
1784//
1785// Note that it changes the size request, the size can still
1786// be affected by how you pack the widget into containers.
1787// If @n_chars is -1, the size reverts to the default size.
1788func (x *Text) SetWidthChars(NCharsVar int) {
1789
1790 XGtkEditableSetWidthChars(x.GoPointer(), NCharsVar)
1791
1792}
1793
1794func init() {
1795 core.SetPackageName("GTK", "gtk4")
1796 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
1797 var libs []uintptr
1798 for _, libPath := range core.GetPaths("GTK") {
1799 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1800 if err != nil {
1801 panic(err)
1802 }
1803 libs = append(libs, lib)
1804 }
1805
1806 core.PuregoSafeRegister(&xTextGLibType, libs, "gtk_text_get_type")
1807
1808 core.PuregoSafeRegister(&xNewText, libs, "gtk_text_new")
1809 core.PuregoSafeRegister(&xNewTextWithBuffer, libs, "gtk_text_new_with_buffer")
1810
1811 core.PuregoSafeRegister(&xTextComputeCursorExtents, libs, "gtk_text_compute_cursor_extents")
1812 core.PuregoSafeRegister(&xTextGetActivatesDefault, libs, "gtk_text_get_activates_default")
1813 core.PuregoSafeRegister(&xTextGetAttributes, libs, "gtk_text_get_attributes")
1814 core.PuregoSafeRegister(&xTextGetBuffer, libs, "gtk_text_get_buffer")
1815 core.PuregoSafeRegister(&xTextGetEnableEmojiCompletion, libs, "gtk_text_get_enable_emoji_completion")
1816 core.PuregoSafeRegister(&xTextGetExtraMenu, libs, "gtk_text_get_extra_menu")
1817 core.PuregoSafeRegister(&xTextGetInputHints, libs, "gtk_text_get_input_hints")
1818 core.PuregoSafeRegister(&xTextGetInputPurpose, libs, "gtk_text_get_input_purpose")
1819 core.PuregoSafeRegister(&xTextGetInvisibleChar, libs, "gtk_text_get_invisible_char")
1820 core.PuregoSafeRegister(&xTextGetMaxLength, libs, "gtk_text_get_max_length")
1821 core.PuregoSafeRegister(&xTextGetOverwriteMode, libs, "gtk_text_get_overwrite_mode")
1822 core.PuregoSafeRegister(&xTextGetPlaceholderText, libs, "gtk_text_get_placeholder_text")
1823 core.PuregoSafeRegister(&xTextGetPropagateTextWidth, libs, "gtk_text_get_propagate_text_width")
1824 core.PuregoSafeRegister(&xTextGetTabs, libs, "gtk_text_get_tabs")
1825 core.PuregoSafeRegister(&xTextGetTextLength, libs, "gtk_text_get_text_length")
1826 core.PuregoSafeRegister(&xTextGetTruncateMultiline, libs, "gtk_text_get_truncate_multiline")
1827 core.PuregoSafeRegister(&xTextGetVisibility, libs, "gtk_text_get_visibility")
1828 core.PuregoSafeRegister(&xTextGrabFocusWithoutSelecting, libs, "gtk_text_grab_focus_without_selecting")
1829 core.PuregoSafeRegister(&xTextSetActivatesDefault, libs, "gtk_text_set_activates_default")
1830 core.PuregoSafeRegister(&xTextSetAttributes, libs, "gtk_text_set_attributes")
1831 core.PuregoSafeRegister(&xTextSetBuffer, libs, "gtk_text_set_buffer")
1832 core.PuregoSafeRegister(&xTextSetEnableEmojiCompletion, libs, "gtk_text_set_enable_emoji_completion")
1833 core.PuregoSafeRegister(&xTextSetExtraMenu, libs, "gtk_text_set_extra_menu")
1834 core.PuregoSafeRegister(&xTextSetInputHints, libs, "gtk_text_set_input_hints")
1835 core.PuregoSafeRegister(&xTextSetInputPurpose, libs, "gtk_text_set_input_purpose")
1836 core.PuregoSafeRegister(&xTextSetInvisibleChar, libs, "gtk_text_set_invisible_char")
1837 core.PuregoSafeRegister(&xTextSetMaxLength, libs, "gtk_text_set_max_length")
1838 core.PuregoSafeRegister(&xTextSetOverwriteMode, libs, "gtk_text_set_overwrite_mode")
1839 core.PuregoSafeRegister(&xTextSetPlaceholderText, libs, "gtk_text_set_placeholder_text")
1840 core.PuregoSafeRegister(&xTextSetPropagateTextWidth, libs, "gtk_text_set_propagate_text_width")
1841 core.PuregoSafeRegister(&xTextSetTabs, libs, "gtk_text_set_tabs")
1842 core.PuregoSafeRegister(&xTextSetTruncateMultiline, libs, "gtk_text_set_truncate_multiline")
1843 core.PuregoSafeRegister(&xTextSetVisibility, libs, "gtk_text_set_visibility")
1844 core.PuregoSafeRegister(&xTextUnsetInvisibleChar, libs, "gtk_text_unset_invisible_char")
1845
1846}