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/glib"
11 "github.com/bnema/puregotk/v4/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// A single-line text entry widget for use as a search entry.
16//
17// The main API for interacting with a `GtkSearchEntry` as entry
18// is the `GtkEditable` interface.
19//
20// <picture>
21//
22// <source srcset="search-entry-dark.png" media="(prefers-color-scheme: dark)">
23// <img alt="An example GtkSearchEntry" src="search-entry.png">
24//
25// </picture>
26//
27// It will show an inactive symbolic “find” icon when the search
28// entry is empty, and a symbolic “clear” icon when there is text.
29// Clicking on the “clear” icon will empty the search entry.
30//
31// To make filtering appear more reactive, it is a good idea to
32// not react to every change in the entry text immediately, but
33// only after a short delay. To support this, `GtkSearchEntry`
34// emits the [signal@Gtk.SearchEntry::search-changed] signal which
35// can be used instead of the [signal@Gtk.Editable::changed] signal.
36//
37// The [signal@Gtk.SearchEntry::previous-match],
38// [signal@Gtk.SearchEntry::next-match] and
39// [signal@Gtk.SearchEntry::stop-search] signals can be used to
40// implement moving between search results and ending the search.
41//
42// Often, `GtkSearchEntry` will be fed events by means of being
43// placed inside a [class@Gtk.SearchBar]. If that is not the case,
44// you can use [method@Gtk.SearchEntry.set_key_capture_widget] to
45// let it capture key input from another widget.
46//
47// `GtkSearchEntry` provides only minimal API and should be used with
48// the [iface@Gtk.Editable] API.
49//
50// ## Shortcuts and Gestures
51//
52// The following signals have default keybindings:
53//
54// - [signal@Gtk.SearchEntry::activate]
55// - [signal@Gtk.SearchEntry::next-match]
56// - [signal@Gtk.SearchEntry::previous-match]
57// - [signal@Gtk.SearchEntry::stop-search]
58//
59// ## CSS Nodes
60//
61// ```
62// entry.search
63// ╰── text
64// ```
65//
66// `GtkSearchEntry` has a single CSS node with name entry that carries
67// a `.search` style class, and the text node is a child of that.
68//
69// ## Accessibility
70//
71// `GtkSearchEntry` uses the [enum@Gtk.AccessibleRole.search_box] role.
72type SearchEntry struct {
73 Widget
74}
75
76var xSearchEntryGLibType func() types.GType
77
78func SearchEntryGLibType() types.GType {
79 return xSearchEntryGLibType()
80}
81
82func SearchEntryNewFromInternalPtr(ptr uintptr) *SearchEntry {
83 cls := &SearchEntry{}
84 cls.Ptr = ptr
85 return cls
86}
87
88var xNewSearchEntry func() uintptr
89
90// Creates a `GtkSearchEntry`.
91func NewSearchEntry() *SearchEntry {
92 var cls *SearchEntry
93
94 cret := xNewSearchEntry()
95
96 if cret == 0 {
97 return nil
98 }
99 gobject.IncreaseRef(cret)
100 cls = &SearchEntry{}
101 cls.Ptr = cret
102 return cls
103}
104
105var xSearchEntryGetInputHints func(uintptr) InputHints
106
107// Gets the input purpose for @entry.
108func (x *SearchEntry) GetInputHints() InputHints {
109
110 cret := xSearchEntryGetInputHints(x.GoPointer())
111 return cret
112}
113
114var xSearchEntryGetInputPurpose func(uintptr) InputPurpose
115
116// Gets the input purpose of @entry.
117func (x *SearchEntry) GetInputPurpose() InputPurpose {
118
119 cret := xSearchEntryGetInputPurpose(x.GoPointer())
120 return cret
121}
122
123var xSearchEntryGetKeyCaptureWidget func(uintptr) uintptr
124
125// Gets the widget that @entry is capturing key events from.
126func (x *SearchEntry) GetKeyCaptureWidget() *Widget {
127 var cls *Widget
128
129 cret := xSearchEntryGetKeyCaptureWidget(x.GoPointer())
130
131 if cret == 0 {
132 return nil
133 }
134 gobject.IncreaseRef(cret)
135 cls = &Widget{}
136 cls.Ptr = cret
137 return cls
138}
139
140var xSearchEntryGetPlaceholderText func(uintptr) string
141
142// Gets the placeholder text associated with @entry.
143func (x *SearchEntry) GetPlaceholderText() string {
144
145 cret := xSearchEntryGetPlaceholderText(x.GoPointer())
146 return cret
147}
148
149var xSearchEntryGetSearchDelay func(uintptr) uint
150
151// Get the delay to be used between the last keypress and the
152// [signal@Gtk.SearchEntry::search-changed] signal being emitted.
153func (x *SearchEntry) GetSearchDelay() uint {
154
155 cret := xSearchEntryGetSearchDelay(x.GoPointer())
156 return cret
157}
158
159var xSearchEntrySetInputHints func(uintptr, InputHints)
160
161// Sets the input hints for @entry.
162func (x *SearchEntry) SetInputHints(HintsVar InputHints) {
163
164 xSearchEntrySetInputHints(x.GoPointer(), HintsVar)
165
166}
167
168var xSearchEntrySetInputPurpose func(uintptr, InputPurpose)
169
170// Sets the input purpose of @entry.
171func (x *SearchEntry) SetInputPurpose(PurposeVar InputPurpose) {
172
173 xSearchEntrySetInputPurpose(x.GoPointer(), PurposeVar)
174
175}
176
177var xSearchEntrySetKeyCaptureWidget func(uintptr, uintptr)
178
179// Sets @widget as the widget that @entry will capture key
180// events from.
181//
182// Key events are consumed by the search entry to start or
183// continue a search.
184//
185// If the entry is part of a `GtkSearchBar`, it is preferable
186// to call [method@Gtk.SearchBar.set_key_capture_widget] instead,
187// which will reveal the entry in addition to triggering the
188// search entry.
189//
190// Note that despite the name of this function, the events
191// are only 'captured' in the bubble phase, which means that
192// editable child widgets of @widget will receive text input
193// before it gets captured. If that is not desired, you can
194// capture and forward the events yourself with
195// [method@Gtk.EventControllerKey.forward].
196func (x *SearchEntry) SetKeyCaptureWidget(WidgetVar *Widget) {
197
198 xSearchEntrySetKeyCaptureWidget(x.GoPointer(), WidgetVar.GoPointer())
199
200}
201
202var xSearchEntrySetPlaceholderText func(uintptr, uintptr)
203
204// Sets the placeholder text associated with @entry.
205func (x *SearchEntry) SetPlaceholderText(TextVar *string) {
206
207 TextVarPtr := core.GStrdupNullable(TextVar)
208 defer core.GFreeNullable(TextVarPtr)
209
210 xSearchEntrySetPlaceholderText(x.GoPointer(), TextVarPtr)
211
212}
213
214var xSearchEntrySetSearchDelay func(uintptr, uint)
215
216// Set the delay to be used between the last keypress and the
217// [signal@Gtk.SearchEntry::search-changed] signal being emitted.
218func (x *SearchEntry) SetSearchDelay(DelayVar uint) {
219
220 xSearchEntrySetSearchDelay(x.GoPointer(), DelayVar)
221
222}
223
224func (c *SearchEntry) GoPointer() uintptr {
225 if c == nil {
226 return 0
227 }
228 return c.Ptr
229}
230
231func (c *SearchEntry) SetGoPointer(ptr uintptr) {
232 c.Ptr = ptr
233}
234
235// SetPropertyActivatesDefault sets the "activates-default" property.
236// Whether to activate the default widget when Enter is pressed.
237func (x *SearchEntry) SetPropertyActivatesDefault(value bool) {
238 var v gobject.Value
239 v.Init(gobject.TypeBooleanVal)
240 v.SetBoolean(value)
241 x.SetProperty("activates-default", &v)
242}
243
244// GetPropertyActivatesDefault gets the "activates-default" property.
245// Whether to activate the default widget when Enter is pressed.
246func (x *SearchEntry) GetPropertyActivatesDefault() bool {
247 var v gobject.Value
248 x.GetProperty("activates-default", &v)
249 return v.GetBoolean()
250}
251
252// SetPropertyPlaceholderText sets the "placeholder-text" property.
253// The text that will be displayed in the `GtkSearchEntry`
254// when it is empty and unfocused.
255func (x *SearchEntry) SetPropertyPlaceholderText(value string) {
256 var v gobject.Value
257 v.Init(gobject.TypeStringVal)
258 v.SetString(&value)
259 x.SetProperty("placeholder-text", &v)
260}
261
262// GetPropertyPlaceholderText gets the "placeholder-text" property.
263// The text that will be displayed in the `GtkSearchEntry`
264// when it is empty and unfocused.
265func (x *SearchEntry) GetPropertyPlaceholderText() string {
266 var v gobject.Value
267 x.GetProperty("placeholder-text", &v)
268 return v.GetString()
269}
270
271// SetPropertySearchDelay sets the "search-delay" property.
272// The delay in milliseconds from last keypress to the search
273// changed signal.
274func (x *SearchEntry) SetPropertySearchDelay(value uint) {
275 var v gobject.Value
276 v.Init(gobject.TypeUintVal)
277 v.SetUint(value)
278 x.SetProperty("search-delay", &v)
279}
280
281// GetPropertySearchDelay gets the "search-delay" property.
282// The delay in milliseconds from last keypress to the search
283// changed signal.
284func (x *SearchEntry) GetPropertySearchDelay() uint {
285 var v gobject.Value
286 x.GetProperty("search-delay", &v)
287 return v.GetUint()
288}
289
290// Emitted when the entry is activated.
291//
292// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
293func (x *SearchEntry) ConnectActivate(cb *func(SearchEntry)) uint {
294 cbPtr := uintptr(unsafe.Pointer(cb))
295 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
296 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
297 glib.SaveHandlerMapping(handlerID, cbPtr)
298 return handlerID
299 }
300
301 fcb := func(clsPtr uintptr) {
302 fa := SearchEntry{}
303 fa.Ptr = clsPtr
304 cbFn := *cb
305
306 cbFn(fa)
307
308 }
309 cbRefPtr := purego.NewCallback(fcb)
310 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
311 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
312 glib.SaveHandlerMapping(handlerID, cbPtr)
313 return handlerID
314}
315
316// Emitted when the user initiates a move to the next match
317// for the current search string.
318//
319// This is a [keybinding signal](class.SignalAction.html).
320//
321// Applications should connect to it, to implement moving
322// between matches.
323//
324// The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>g</kbd>.
325func (x *SearchEntry) ConnectNextMatch(cb *func(SearchEntry)) uint {
326 cbPtr := uintptr(unsafe.Pointer(cb))
327 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
328 handlerID := gobject.SignalConnect(x.GoPointer(), "next-match", cbRefPtr)
329 glib.SaveHandlerMapping(handlerID, cbPtr)
330 return handlerID
331 }
332
333 fcb := func(clsPtr uintptr) {
334 fa := SearchEntry{}
335 fa.Ptr = clsPtr
336 cbFn := *cb
337
338 cbFn(fa)
339
340 }
341 cbRefPtr := purego.NewCallback(fcb)
342 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
343 handlerID := gobject.SignalConnect(x.GoPointer(), "next-match", cbRefPtr)
344 glib.SaveHandlerMapping(handlerID, cbPtr)
345 return handlerID
346}
347
348// Emitted when the user initiates a move to the previous match
349// for the current search string.
350//
351// This is a [keybinding signal](class.SignalAction.html).
352//
353// Applications should connect to it, to implement moving
354// between matches.
355//
356// The default bindings for this signal is
357// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>g</kbd>.
358func (x *SearchEntry) ConnectPreviousMatch(cb *func(SearchEntry)) uint {
359 cbPtr := uintptr(unsafe.Pointer(cb))
360 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
361 handlerID := gobject.SignalConnect(x.GoPointer(), "previous-match", cbRefPtr)
362 glib.SaveHandlerMapping(handlerID, cbPtr)
363 return handlerID
364 }
365
366 fcb := func(clsPtr uintptr) {
367 fa := SearchEntry{}
368 fa.Ptr = clsPtr
369 cbFn := *cb
370
371 cbFn(fa)
372
373 }
374 cbRefPtr := purego.NewCallback(fcb)
375 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
376 handlerID := gobject.SignalConnect(x.GoPointer(), "previous-match", cbRefPtr)
377 glib.SaveHandlerMapping(handlerID, cbPtr)
378 return handlerID
379}
380
381// Emitted with a delay. The length of the delay can be
382// changed with the [property@Gtk.SearchEntry:search-delay]
383// property.
384func (x *SearchEntry) ConnectSearchChanged(cb *func(SearchEntry)) uint {
385 cbPtr := uintptr(unsafe.Pointer(cb))
386 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
387 handlerID := gobject.SignalConnect(x.GoPointer(), "search-changed", cbRefPtr)
388 glib.SaveHandlerMapping(handlerID, cbPtr)
389 return handlerID
390 }
391
392 fcb := func(clsPtr uintptr) {
393 fa := SearchEntry{}
394 fa.Ptr = clsPtr
395 cbFn := *cb
396
397 cbFn(fa)
398
399 }
400 cbRefPtr := purego.NewCallback(fcb)
401 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
402 handlerID := gobject.SignalConnect(x.GoPointer(), "search-changed", cbRefPtr)
403 glib.SaveHandlerMapping(handlerID, cbPtr)
404 return handlerID
405}
406
407// Emitted when the user initiated a search on the entry.
408func (x *SearchEntry) ConnectSearchStarted(cb *func(SearchEntry)) uint {
409 cbPtr := uintptr(unsafe.Pointer(cb))
410 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
411 handlerID := gobject.SignalConnect(x.GoPointer(), "search-started", cbRefPtr)
412 glib.SaveHandlerMapping(handlerID, cbPtr)
413 return handlerID
414 }
415
416 fcb := func(clsPtr uintptr) {
417 fa := SearchEntry{}
418 fa.Ptr = clsPtr
419 cbFn := *cb
420
421 cbFn(fa)
422
423 }
424 cbRefPtr := purego.NewCallback(fcb)
425 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
426 handlerID := gobject.SignalConnect(x.GoPointer(), "search-started", cbRefPtr)
427 glib.SaveHandlerMapping(handlerID, cbPtr)
428 return handlerID
429}
430
431// Emitted when the user stops a search via keyboard input.
432//
433// This is a [keybinding signal](class.SignalAction.html).
434//
435// Applications should connect to it, to implement hiding
436// the search entry in this case.
437//
438// The default bindings for this signal is <kbd>Escape</kbd>.
439func (x *SearchEntry) ConnectStopSearch(cb *func(SearchEntry)) uint {
440 cbPtr := uintptr(unsafe.Pointer(cb))
441 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
442 handlerID := gobject.SignalConnect(x.GoPointer(), "stop-search", cbRefPtr)
443 glib.SaveHandlerMapping(handlerID, cbPtr)
444 return handlerID
445 }
446
447 fcb := func(clsPtr uintptr) {
448 fa := SearchEntry{}
449 fa.Ptr = clsPtr
450 cbFn := *cb
451
452 cbFn(fa)
453
454 }
455 cbRefPtr := purego.NewCallback(fcb)
456 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
457 handlerID := gobject.SignalConnect(x.GoPointer(), "stop-search", cbRefPtr)
458 glib.SaveHandlerMapping(handlerID, cbPtr)
459 return handlerID
460}
461
462// Requests the user's screen reader to announce the given message.
463//
464// This kind of notification is useful for messages that
465// either have only a visual representation or that are not
466// exposed visually at all, e.g. a notification about a
467// successful operation.
468//
469// Also, by using this API, you can ensure that the message
470// does not interrupts the user's current screen reader output.
471func (x *SearchEntry) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
472
473 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
474
475}
476
477// Retrieves the accessible parent for an accessible object.
478//
479// This function returns `NULL` for top level widgets.
480func (x *SearchEntry) GetAccessibleParent() *AccessibleBase {
481 var cls *AccessibleBase
482
483 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
484
485 if cret == 0 {
486 return nil
487 }
488 cls = &AccessibleBase{}
489 cls.Ptr = cret
490 return cls
491}
492
493// Retrieves the accessible role of an accessible object.
494func (x *SearchEntry) GetAccessibleRole() AccessibleRole {
495
496 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
497 return cret
498}
499
500// Retrieves the implementation for the given accessible object.
501func (x *SearchEntry) GetAtContext() *ATContext {
502 var cls *ATContext
503
504 cret := XGtkAccessibleGetAtContext(x.GoPointer())
505
506 if cret == 0 {
507 return nil
508 }
509 cls = &ATContext{}
510 cls.Ptr = cret
511 return cls
512}
513
514// Queries the coordinates and dimensions of this accessible
515//
516// This functionality can be overridden by `GtkAccessible`
517// implementations, e.g. to get the bounds from an ignored
518// child widget.
519func (x *SearchEntry) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
520
521 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
522 return cret
523}
524
525// Retrieves the first accessible child of an accessible object.
526func (x *SearchEntry) GetFirstAccessibleChild() *AccessibleBase {
527 var cls *AccessibleBase
528
529 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
530
531 if cret == 0 {
532 return nil
533 }
534 cls = &AccessibleBase{}
535 cls.Ptr = cret
536 return cls
537}
538
539// Retrieves the next accessible sibling of an accessible object
540func (x *SearchEntry) GetNextAccessibleSibling() *AccessibleBase {
541 var cls *AccessibleBase
542
543 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
544
545 if cret == 0 {
546 return nil
547 }
548 cls = &AccessibleBase{}
549 cls.Ptr = cret
550 return cls
551}
552
553// Queries a platform state, such as focus.
554//
555// This functionality can be overridden by `GtkAccessible`
556// implementations, e.g. to get platform state from an ignored
557// child widget, as is the case for `GtkText` wrappers.
558func (x *SearchEntry) GetPlatformState(StateVar AccessiblePlatformState) bool {
559
560 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
561 return cret
562}
563
564// Resets the accessible property to its default value.
565func (x *SearchEntry) ResetProperty(PropertyVar AccessibleProperty) {
566
567 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
568
569}
570
571// Resets the accessible relation to its default value.
572func (x *SearchEntry) ResetRelation(RelationVar AccessibleRelation) {
573
574 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
575
576}
577
578// Resets the accessible state to its default value.
579func (x *SearchEntry) ResetState(StateVar AccessibleState) {
580
581 XGtkAccessibleResetState(x.GoPointer(), StateVar)
582
583}
584
585// Sets the parent and sibling of an accessible object.
586//
587// This function is meant to be used by accessible implementations that are
588// not part of the widget hierarchy, and but act as a logical bridge between
589// widgets. For instance, if a widget creates an object that holds metadata
590// for each child, and you want that object to implement the `GtkAccessible`
591// interface, you will use this function to ensure that the parent of each
592// child widget is the metadata object, and the parent of each metadata
593// object is the container widget.
594func (x *SearchEntry) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
595
596 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
597
598}
599
600// Updates the next accessible sibling.
601//
602// That might be useful when a new child of a custom accessible
603// is created, and it needs to be linked to a previous child.
604func (x *SearchEntry) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
605
606 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
607
608}
609
610// Informs ATs that the platform state has changed.
611//
612// This function should be used by `GtkAccessible` implementations that
613// have a platform state but are not widgets. Widgets handle platform
614// states automatically.
615func (x *SearchEntry) UpdatePlatformState(StateVar AccessiblePlatformState) {
616
617 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
618
619}
620
621// Updates a list of accessible properties.
622//
623// See the [enum@Gtk.AccessibleProperty] documentation for the
624// value types of accessible properties.
625//
626// This function should be called by `GtkWidget` types whenever
627// an accessible property change must be communicated to assistive
628// technologies.
629//
630// Example:
631// ```c
632// value = gtk_adjustment_get_value (adjustment);
633// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
634//
635// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
636// -1);
637//
638// ```
639func (x *SearchEntry) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
640
641 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
642
643}
644
645// Updates an array of accessible properties.
646//
647// This function should be called by `GtkWidget` types whenever an accessible
648// property change must be communicated to assistive technologies.
649//
650// This function is meant to be used by language bindings.
651func (x *SearchEntry) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
652
653 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
654
655}
656
657// Updates a list of accessible relations.
658//
659// This function should be called by `GtkWidget` types whenever an accessible
660// relation change must be communicated to assistive technologies.
661//
662// If the [enum@Gtk.AccessibleRelation] requires a list of references,
663// you should pass each reference individually, followed by `NULL`, e.g.
664//
665// ```c
666// gtk_accessible_update_relation (accessible,
667//
668// GTK_ACCESSIBLE_RELATION_CONTROLS,
669// ref1, NULL,
670// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
671// ref1, ref2, ref3, NULL,
672// -1);
673//
674// ```
675func (x *SearchEntry) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
676
677 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
678
679}
680
681// Updates an array of accessible relations.
682//
683// This function should be called by `GtkWidget` types whenever an accessible
684// relation change must be communicated to assistive technologies.
685//
686// This function is meant to be used by language bindings.
687func (x *SearchEntry) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
688
689 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
690
691}
692
693// Updates a list of accessible states.
694//
695// See the [enum@Gtk.AccessibleState] documentation for the
696// value types of accessible states.
697//
698// This function should be called by `GtkWidget` types whenever
699// an accessible state change must be communicated to assistive
700// technologies.
701//
702// Example:
703//
704// ```c
705// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
706// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
707//
708// GTK_ACCESSIBLE_STATE_CHECKED, value,
709// -1);
710//
711// ```
712func (x *SearchEntry) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
713
714 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
715
716}
717
718// Updates an array of accessible states.
719//
720// This function should be called by `GtkWidget` types whenever an accessible
721// state change must be communicated to assistive technologies.
722//
723// This function is meant to be used by language bindings.
724func (x *SearchEntry) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
725
726 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
727
728}
729
730// Gets the ID of the @buildable object.
731//
732// `GtkBuilder` sets the name based on the ID attribute
733// of the `<object>` tag used to construct the @buildable.
734func (x *SearchEntry) GetBuildableId() string {
735
736 cret := XGtkBuildableGetBuildableId(x.GoPointer())
737 return cret
738}
739
740// Retrieves the accessible platform state from the editable delegate.
741//
742// This is an helper function to retrieve the accessible state for
743// `GtkEditable` interface implementations using a delegate pattern.
744//
745// You should call this function in your editable widget implementation
746// of the [vfunc@Gtk.Accessible.get_platform_state] virtual function, for
747// instance:
748//
749// ```c
750// static void
751// accessible_interface_init (GtkAccessibleInterface *iface)
752//
753// {
754// iface->get_platform_state = your_editable_get_accessible_platform_state;
755// }
756//
757// static gboolean
758// your_editable_get_accessible_platform_state (GtkAccessible *accessible,
759//
760// GtkAccessiblePlatformState state)
761//
762// {
763// return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state);
764// }
765//
766// ```
767//
768// Note that the widget which is the delegate *must* be a direct child of
769// this widget, otherwise your implementation of [vfunc@Gtk.Accessible.get_platform_state]
770// might not even be called, as the platform change will originate from
771// the parent of the delegate, and, as a result, will not work properly.
772//
773// So, if you can't ensure the direct child condition, you should give the
774// delegate the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role, or you can
775// change your tree to allow this function to work.
776func (x *SearchEntry) DelegateGetAccessiblePlatformState(StateVar AccessiblePlatformState) bool {
777
778 cret := XGtkEditableDelegateGetAccessiblePlatformState(x.GoPointer(), StateVar)
779 return cret
780}
781
782// Deletes the currently selected text of the editable.
783//
784// This call doesn’t do anything if there is no selected text.
785func (x *SearchEntry) DeleteSelection() {
786
787 XGtkEditableDeleteSelection(x.GoPointer())
788
789}
790
791// Deletes a sequence of characters.
792//
793// The characters that are deleted are those characters at positions
794// from @start_pos up to, but not including @end_pos. If @end_pos is
795// negative, then the characters deleted are those from @start_pos to
796// the end of the text.
797//
798// Note that the positions are specified in characters, not bytes.
799func (x *SearchEntry) DeleteText(StartPosVar int, EndPosVar int) {
800
801 XGtkEditableDeleteText(x.GoPointer(), StartPosVar, EndPosVar)
802
803}
804
805// Undoes the setup done by [method@Gtk.Editable.init_delegate].
806//
807// This is a helper function that should be called from dispose,
808// before removing the delegate object.
809func (x *SearchEntry) FinishDelegate() {
810
811 XGtkEditableFinishDelegate(x.GoPointer())
812
813}
814
815// Gets the alignment of the editable.
816func (x *SearchEntry) GetAlignment() float32 {
817
818 cret := XGtkEditableGetAlignment(x.GoPointer())
819 return cret
820}
821
822// Retrieves a sequence of characters.
823//
824// The characters that are retrieved are those characters at positions
825// from @start_pos up to, but not including @end_pos. If @end_pos is negative,
826// then the characters retrieved are those characters from @start_pos to
827// the end of the text.
828//
829// Note that positions are specified in characters, not bytes.
830func (x *SearchEntry) GetChars(StartPosVar int, EndPosVar int) string {
831
832 cret := XGtkEditableGetChars(x.GoPointer(), StartPosVar, EndPosVar)
833 return cret
834}
835
836// Gets the `GtkEditable` that @editable is delegating its
837// implementation to.
838//
839// Typically, the delegate is a [class@Gtk.Text] widget.
840func (x *SearchEntry) GetDelegate() *EditableBase {
841 var cls *EditableBase
842
843 cret := XGtkEditableGetDelegate(x.GoPointer())
844
845 if cret == 0 {
846 return nil
847 }
848 gobject.IncreaseRef(cret)
849 cls = &EditableBase{}
850 cls.Ptr = cret
851 return cls
852}
853
854// Retrieves whether @editable is editable.
855func (x *SearchEntry) GetEditable() bool {
856
857 cret := XGtkEditableGetEditable(x.GoPointer())
858 return cret
859}
860
861// Gets if undo/redo actions are enabled for @editable
862func (x *SearchEntry) GetEnableUndo() bool {
863
864 cret := XGtkEditableGetEnableUndo(x.GoPointer())
865 return cret
866}
867
868// Retrieves the desired maximum width of @editable, in characters.
869func (x *SearchEntry) GetMaxWidthChars() int {
870
871 cret := XGtkEditableGetMaxWidthChars(x.GoPointer())
872 return cret
873}
874
875// Retrieves the current position of the cursor relative
876// to the start of the content of the editable.
877//
878// Note that this position is in characters, not in bytes.
879func (x *SearchEntry) GetPosition() int {
880
881 cret := XGtkEditableGetPosition(x.GoPointer())
882 return cret
883}
884
885// Retrieves the selection bound of the editable.
886//
887// @start_pos will be filled with the start of the selection and
888// @end_pos with end. If no text was selected both will be identical
889// and %FALSE will be returned.
890//
891// Note that positions are specified in characters, not bytes.
892func (x *SearchEntry) GetSelectionBounds(StartPosVar *int, EndPosVar *int) bool {
893
894 cret := XGtkEditableGetSelectionBounds(x.GoPointer(), StartPosVar, EndPosVar)
895 return cret
896}
897
898// Retrieves the contents of @editable.
899//
900// The returned string is owned by GTK and must not be modified or freed.
901func (x *SearchEntry) GetText() string {
902
903 cret := XGtkEditableGetText(x.GoPointer())
904 return cret
905}
906
907// Gets the number of characters of space reserved
908// for the contents of the editable.
909func (x *SearchEntry) GetWidthChars() int {
910
911 cret := XGtkEditableGetWidthChars(x.GoPointer())
912 return cret
913}
914
915// Sets up a delegate for `GtkEditable`.
916//
917// This is assuming that the get_delegate vfunc in the `GtkEditable`
918// interface has been set up for the @editable's type.
919//
920// This is a helper function that should be called in instance init,
921// after creating the delegate object.
922func (x *SearchEntry) InitDelegate() {
923
924 XGtkEditableInitDelegate(x.GoPointer())
925
926}
927
928// Inserts @length bytes of @text into the contents of the
929// widget, at position @position.
930//
931// Note that the position is in characters, not in bytes.
932// The function updates @position to point after the newly
933// inserted text.
934func (x *SearchEntry) InsertText(TextVar string, LengthVar int, PositionVar int) {
935
936 XGtkEditableInsertText(x.GoPointer(), TextVar, LengthVar, PositionVar)
937
938}
939
940// Selects a region of text.
941//
942// The characters that are selected are those characters at positions
943// from @start_pos up to, but not including @end_pos. If @end_pos is
944// negative, then the characters selected are those characters from
945// @start_pos to the end of the text.
946//
947// Note that positions are specified in characters, not bytes.
948func (x *SearchEntry) SelectRegion(StartPosVar int, EndPosVar int) {
949
950 XGtkEditableSelectRegion(x.GoPointer(), StartPosVar, EndPosVar)
951
952}
953
954// Sets the alignment for the contents of the editable.
955//
956// This controls the horizontal positioning of the contents when
957// the displayed text is shorter than the width of the editable.
958func (x *SearchEntry) SetAlignment(XalignVar float32) {
959
960 XGtkEditableSetAlignment(x.GoPointer(), XalignVar)
961
962}
963
964// Determines if the user can edit the text in the editable widget.
965func (x *SearchEntry) SetEditable(IsEditableVar bool) {
966
967 XGtkEditableSetEditable(x.GoPointer(), IsEditableVar)
968
969}
970
971// If enabled, changes to @editable will be saved for undo/redo
972// actions.
973//
974// This results in an additional copy of text changes and are not
975// stored in secure memory. As such, undo is forcefully disabled
976// when [property@Gtk.Text:visibility] is set to %FALSE.
977func (x *SearchEntry) SetEnableUndo(EnableUndoVar bool) {
978
979 XGtkEditableSetEnableUndo(x.GoPointer(), EnableUndoVar)
980
981}
982
983// Sets the desired maximum width in characters of @editable.
984func (x *SearchEntry) SetMaxWidthChars(NCharsVar int) {
985
986 XGtkEditableSetMaxWidthChars(x.GoPointer(), NCharsVar)
987
988}
989
990// Sets the cursor position in the editable to the given value.
991//
992// The cursor is displayed before the character with the given (base 0)
993// index in the contents of the editable. The value must be less than
994// or equal to the number of characters in the editable. A value of -1
995// indicates that the position should be set after the last character
996// of the editable. Note that @position is in characters, not in bytes.
997func (x *SearchEntry) SetPosition(PositionVar int) {
998
999 XGtkEditableSetPosition(x.GoPointer(), PositionVar)
1000
1001}
1002
1003// Sets the text in the editable to the given value.
1004//
1005// This is replacing the current contents.
1006func (x *SearchEntry) SetText(TextVar string) {
1007
1008 XGtkEditableSetText(x.GoPointer(), TextVar)
1009
1010}
1011
1012// Changes the size request of the editable to be about the
1013// right size for @n_chars characters.
1014//
1015// Note that it changes the size request, the size can still
1016// be affected by how you pack the widget into containers.
1017// If @n_chars is -1, the size reverts to the default size.
1018func (x *SearchEntry) SetWidthChars(NCharsVar int) {
1019
1020 XGtkEditableSetWidthChars(x.GoPointer(), NCharsVar)
1021
1022}
1023
1024func init() {
1025 core.SetPackageName("GTK", "gtk4")
1026 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
1027 var libs []uintptr
1028 for _, libPath := range core.GetPaths("GTK") {
1029 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1030 if err != nil {
1031 panic(err)
1032 }
1033 libs = append(libs, lib)
1034 }
1035
1036 core.PuregoSafeRegister(&xSearchEntryGLibType, libs, "gtk_search_entry_get_type")
1037
1038 core.PuregoSafeRegister(&xNewSearchEntry, libs, "gtk_search_entry_new")
1039
1040 core.PuregoSafeRegister(&xSearchEntryGetInputHints, libs, "gtk_search_entry_get_input_hints")
1041 core.PuregoSafeRegister(&xSearchEntryGetInputPurpose, libs, "gtk_search_entry_get_input_purpose")
1042 core.PuregoSafeRegister(&xSearchEntryGetKeyCaptureWidget, libs, "gtk_search_entry_get_key_capture_widget")
1043 core.PuregoSafeRegister(&xSearchEntryGetPlaceholderText, libs, "gtk_search_entry_get_placeholder_text")
1044 core.PuregoSafeRegister(&xSearchEntryGetSearchDelay, libs, "gtk_search_entry_get_search_delay")
1045 core.PuregoSafeRegister(&xSearchEntrySetInputHints, libs, "gtk_search_entry_set_input_hints")
1046 core.PuregoSafeRegister(&xSearchEntrySetInputPurpose, libs, "gtk_search_entry_set_input_purpose")
1047 core.PuregoSafeRegister(&xSearchEntrySetKeyCaptureWidget, libs, "gtk_search_entry_set_key_capture_widget")
1048 core.PuregoSafeRegister(&xSearchEntrySetPlaceholderText, libs, "gtk_search_entry_set_placeholder_text")
1049 core.PuregoSafeRegister(&xSearchEntrySetSearchDelay, libs, "gtk_search_entry_set_search_delay")
1050
1051}