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 function which decides whether the row indicated by @iter matches
16// a given @key, and should be displayed as a possible completion for @key.
17//
18// Note that @key is normalized and case-folded (see g_utf8_normalize()
19// and g_utf8_casefold()). If this is not appropriate, match functions
20// have access to the unmodified key via
21// `gtk_editable_get_text (GTK_EDITABLE (gtk_entry_completion_get_entry ()))`.
22type EntryCompletionMatchFunc func(uintptr, string, *TreeIter, uintptr) bool
23
24// `GtkEntryCompletion` is an auxiliary object to provide completion functionality
25// for `GtkEntry`.
26//
27// It implements the [iface@Gtk.CellLayout] interface, to allow the user
28// to add extra cells to the `GtkTreeView` with completion matches.
29//
30// “Completion functionality” means that when the user modifies the text
31// in the entry, `GtkEntryCompletion` checks which rows in the model match
32// the current content of the entry, and displays a list of matches.
33// By default, the matching is done by comparing the entry text
34// case-insensitively against the text column of the model (see
35// [method@Gtk.EntryCompletion.set_text_column]), but this can be overridden
36// with a custom match function (see [method@Gtk.EntryCompletion.set_match_func]).
37//
38// When the user selects a completion, the content of the entry is
39// updated. By default, the content of the entry is replaced by the
40// text column of the model, but this can be overridden by connecting
41// to the [signal@Gtk.EntryCompletion::match-selected] signal and updating the
42// entry in the signal handler. Note that you should return %TRUE from
43// the signal handler to suppress the default behaviour.
44//
45// To add completion functionality to an entry, use
46// [method@Gtk.Entry.set_completion].
47//
48// `GtkEntryCompletion` uses a [class@Gtk.TreeModelFilter] model to
49// represent the subset of the entire model that is currently matching.
50// While the `GtkEntryCompletion` signals
51// [signal@Gtk.EntryCompletion::match-selected] and
52// [signal@Gtk.EntryCompletion::cursor-on-match] take the original model
53// and an iter pointing to that model as arguments, other callbacks and
54// signals (such as `GtkCellLayoutDataFunc` or
55// [signal@Gtk.CellArea::apply-attributes)]
56// will generally take the filter model as argument. As long as you are
57// only calling [method@Gtk.TreeModel.get], this will make no difference to
58// you. If for some reason, you need the original model, use
59// [method@Gtk.TreeModelFilter.get_model]. Don’t forget to use
60// [method@Gtk.TreeModelFilter.convert_iter_to_child_iter] to obtain a
61// matching iter.
62type EntryCompletion struct {
63 gobject.Object
64}
65
66var xEntryCompletionGLibType func() types.GType
67
68func EntryCompletionGLibType() types.GType {
69 return xEntryCompletionGLibType()
70}
71
72func EntryCompletionNewFromInternalPtr(ptr uintptr) *EntryCompletion {
73 cls := &EntryCompletion{}
74 cls.Ptr = ptr
75 return cls
76}
77
78var xNewEntryCompletion func() uintptr
79
80// Creates a new `GtkEntryCompletion` object.
81func NewEntryCompletion() *EntryCompletion {
82 var cls *EntryCompletion
83
84 cret := xNewEntryCompletion()
85
86 if cret == 0 {
87 return nil
88 }
89 cls = &EntryCompletion{}
90 cls.Ptr = cret
91 return cls
92}
93
94var xNewEntryCompletionWithArea func(uintptr) uintptr
95
96// Creates a new `GtkEntryCompletion` object using the
97// specified @area.
98//
99// The `GtkCellArea` is used to layout cells in the underlying
100// `GtkTreeViewColumn` for the drop-down menu.
101func NewEntryCompletionWithArea(AreaVar *CellArea) *EntryCompletion {
102 var cls *EntryCompletion
103
104 cret := xNewEntryCompletionWithArea(AreaVar.GoPointer())
105
106 if cret == 0 {
107 return nil
108 }
109 cls = &EntryCompletion{}
110 cls.Ptr = cret
111 return cls
112}
113
114var xEntryCompletionComplete func(uintptr)
115
116// Requests a completion operation, or in other words a refiltering of the
117// current list with completions, using the current key.
118//
119// The completion list view will be updated accordingly.
120func (x *EntryCompletion) Complete() {
121
122 xEntryCompletionComplete(x.GoPointer())
123
124}
125
126var xEntryCompletionComputePrefix func(uintptr, string) string
127
128// Computes the common prefix that is shared by all rows in @completion
129// that start with @key.
130//
131// If no row matches @key, %NULL will be returned.
132// Note that a text column must have been set for this function to work,
133// see [method@Gtk.EntryCompletion.set_text_column] for details.
134func (x *EntryCompletion) ComputePrefix(KeyVar string) string {
135
136 cret := xEntryCompletionComputePrefix(x.GoPointer(), KeyVar)
137 return cret
138}
139
140var xEntryCompletionGetCompletionPrefix func(uintptr) string
141
142// Get the original text entered by the user that triggered
143// the completion or %NULL if there’s no completion ongoing.
144func (x *EntryCompletion) GetCompletionPrefix() string {
145
146 cret := xEntryCompletionGetCompletionPrefix(x.GoPointer())
147 return cret
148}
149
150var xEntryCompletionGetEntry func(uintptr) uintptr
151
152// Gets the entry @completion has been attached to.
153func (x *EntryCompletion) GetEntry() *Widget {
154 var cls *Widget
155
156 cret := xEntryCompletionGetEntry(x.GoPointer())
157
158 if cret == 0 {
159 return nil
160 }
161 gobject.IncreaseRef(cret)
162 cls = &Widget{}
163 cls.Ptr = cret
164 return cls
165}
166
167var xEntryCompletionGetInlineCompletion func(uintptr) bool
168
169// Returns whether the common prefix of the possible completions should
170// be automatically inserted in the entry.
171func (x *EntryCompletion) GetInlineCompletion() bool {
172
173 cret := xEntryCompletionGetInlineCompletion(x.GoPointer())
174 return cret
175}
176
177var xEntryCompletionGetInlineSelection func(uintptr) bool
178
179// Returns %TRUE if inline-selection mode is turned on.
180func (x *EntryCompletion) GetInlineSelection() bool {
181
182 cret := xEntryCompletionGetInlineSelection(x.GoPointer())
183 return cret
184}
185
186var xEntryCompletionGetMinimumKeyLength func(uintptr) int
187
188// Returns the minimum key length as set for @completion.
189func (x *EntryCompletion) GetMinimumKeyLength() int {
190
191 cret := xEntryCompletionGetMinimumKeyLength(x.GoPointer())
192 return cret
193}
194
195var xEntryCompletionGetModel func(uintptr) uintptr
196
197// Returns the model the `GtkEntryCompletion` is using as data source.
198//
199// Returns %NULL if the model is unset.
200func (x *EntryCompletion) GetModel() *TreeModelBase {
201 var cls *TreeModelBase
202
203 cret := xEntryCompletionGetModel(x.GoPointer())
204
205 if cret == 0 {
206 return nil
207 }
208 gobject.IncreaseRef(cret)
209 cls = &TreeModelBase{}
210 cls.Ptr = cret
211 return cls
212}
213
214var xEntryCompletionGetPopupCompletion func(uintptr) bool
215
216// Returns whether the completions should be presented in a popup window.
217func (x *EntryCompletion) GetPopupCompletion() bool {
218
219 cret := xEntryCompletionGetPopupCompletion(x.GoPointer())
220 return cret
221}
222
223var xEntryCompletionGetPopupSetWidth func(uintptr) bool
224
225// Returns whether the completion popup window will be resized to the
226// width of the entry.
227func (x *EntryCompletion) GetPopupSetWidth() bool {
228
229 cret := xEntryCompletionGetPopupSetWidth(x.GoPointer())
230 return cret
231}
232
233var xEntryCompletionGetPopupSingleMatch func(uintptr) bool
234
235// Returns whether the completion popup window will appear even if there is
236// only a single match.
237func (x *EntryCompletion) GetPopupSingleMatch() bool {
238
239 cret := xEntryCompletionGetPopupSingleMatch(x.GoPointer())
240 return cret
241}
242
243var xEntryCompletionGetTextColumn func(uintptr) int
244
245// Returns the column in the model of @completion to get strings from.
246func (x *EntryCompletion) GetTextColumn() int {
247
248 cret := xEntryCompletionGetTextColumn(x.GoPointer())
249 return cret
250}
251
252var xEntryCompletionInsertPrefix func(uintptr)
253
254// Requests a prefix insertion.
255func (x *EntryCompletion) InsertPrefix() {
256
257 xEntryCompletionInsertPrefix(x.GoPointer())
258
259}
260
261var xEntryCompletionSetInlineCompletion func(uintptr, bool)
262
263// Sets whether the common prefix of the possible completions should
264// be automatically inserted in the entry.
265func (x *EntryCompletion) SetInlineCompletion(InlineCompletionVar bool) {
266
267 xEntryCompletionSetInlineCompletion(x.GoPointer(), InlineCompletionVar)
268
269}
270
271var xEntryCompletionSetInlineSelection func(uintptr, bool)
272
273// Sets whether it is possible to cycle through the possible completions
274// inside the entry.
275func (x *EntryCompletion) SetInlineSelection(InlineSelectionVar bool) {
276
277 xEntryCompletionSetInlineSelection(x.GoPointer(), InlineSelectionVar)
278
279}
280
281var xEntryCompletionSetMatchFunc func(uintptr, uintptr, uintptr, uintptr)
282
283// Sets the match function for @completion to be @func.
284//
285// The match function is used to determine if a row should or
286// should not be in the completion list.
287func (x *EntryCompletion) SetMatchFunc(FuncVar *EntryCompletionMatchFunc, FuncDataVar uintptr, FuncNotifyVar *glib.DestroyNotify) {
288
289 var FuncVarRef uintptr
290 if FuncVar != nil {
291 FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
292 if cbRefPtr, ok := glib.GetCallback(FuncVarPtr); ok {
293 FuncVarRef = cbRefPtr
294 } else {
295 fcb := func(arg0 uintptr, arg1 uintptr, arg2 *TreeIter, arg3 uintptr) bool {
296 cbFn := *FuncVar
297 return cbFn(arg0, core.GoString(arg1), arg2, arg3)
298 }
299 FuncVarRef = purego.NewCallback(fcb)
300 glib.SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
301 }
302 }
303
304 var FuncNotifyVarRef uintptr
305 if FuncNotifyVar != nil {
306 FuncNotifyVarPtr := uintptr(unsafe.Pointer(FuncNotifyVar))
307 if cbRefPtr, ok := glib.GetCallback(FuncNotifyVarPtr); ok {
308 FuncNotifyVarRef = cbRefPtr
309 } else {
310 fcb := func(arg0 uintptr) {
311 cbFn := *FuncNotifyVar
312 cbFn(arg0)
313 }
314 FuncNotifyVarRef = purego.NewCallback(fcb)
315 glib.SaveCallbackWithClosure(FuncNotifyVarPtr, FuncNotifyVarRef, FuncNotifyVar)
316 }
317 }
318
319 xEntryCompletionSetMatchFunc(x.GoPointer(), FuncVarRef, FuncDataVar, FuncNotifyVarRef)
320
321}
322
323var xEntryCompletionSetMinimumKeyLength func(uintptr, int)
324
325// Requires the length of the search key for @completion to be at least
326// @length.
327//
328// This is useful for long lists, where completing using a small
329// key takes a lot of time and will come up with meaningless results anyway
330// (ie, a too large dataset).
331func (x *EntryCompletion) SetMinimumKeyLength(LengthVar int) {
332
333 xEntryCompletionSetMinimumKeyLength(x.GoPointer(), LengthVar)
334
335}
336
337var xEntryCompletionSetModel func(uintptr, uintptr)
338
339// Sets the model for a `GtkEntryCompletion`.
340//
341// If @completion already has a model set, it will remove it
342// before setting the new model. If model is %NULL, then it
343// will unset the model.
344func (x *EntryCompletion) SetModel(ModelVar TreeModel) {
345
346 xEntryCompletionSetModel(x.GoPointer(), ModelVar.GoPointer())
347
348}
349
350var xEntryCompletionSetPopupCompletion func(uintptr, bool)
351
352// Sets whether the completions should be presented in a popup window.
353func (x *EntryCompletion) SetPopupCompletion(PopupCompletionVar bool) {
354
355 xEntryCompletionSetPopupCompletion(x.GoPointer(), PopupCompletionVar)
356
357}
358
359var xEntryCompletionSetPopupSetWidth func(uintptr, bool)
360
361// Sets whether the completion popup window will be resized to be the same
362// width as the entry.
363func (x *EntryCompletion) SetPopupSetWidth(PopupSetWidthVar bool) {
364
365 xEntryCompletionSetPopupSetWidth(x.GoPointer(), PopupSetWidthVar)
366
367}
368
369var xEntryCompletionSetPopupSingleMatch func(uintptr, bool)
370
371// Sets whether the completion popup window will appear even if there is
372// only a single match.
373//
374// You may want to set this to %FALSE if you
375// are using [property@Gtk.EntryCompletion:inline-completion].
376func (x *EntryCompletion) SetPopupSingleMatch(PopupSingleMatchVar bool) {
377
378 xEntryCompletionSetPopupSingleMatch(x.GoPointer(), PopupSingleMatchVar)
379
380}
381
382var xEntryCompletionSetTextColumn func(uintptr, int)
383
384// Convenience function for setting up the most used case of this code: a
385// completion list with just strings.
386//
387// This function will set up @completion
388// to have a list displaying all (and just) strings in the completion list,
389// and to get those strings from @column in the model of @completion.
390//
391// This functions creates and adds a `GtkCellRendererText` for the selected
392// column. If you need to set the text column, but don't want the cell
393// renderer, use g_object_set() to set the
394// [property@Gtk.EntryCompletion:text-column] property directly.
395func (x *EntryCompletion) SetTextColumn(ColumnVar int) {
396
397 xEntryCompletionSetTextColumn(x.GoPointer(), ColumnVar)
398
399}
400
401func (c *EntryCompletion) GoPointer() uintptr {
402 if c == nil {
403 return 0
404 }
405 return c.Ptr
406}
407
408func (c *EntryCompletion) SetGoPointer(ptr uintptr) {
409 c.Ptr = ptr
410}
411
412// SetPropertyInlineCompletion sets the "inline-completion" property.
413// Determines whether the common prefix of the possible completions
414// should be inserted automatically in the entry.
415//
416// Note that this requires text-column to be set, even if you are
417// using a custom match function.
418func (x *EntryCompletion) SetPropertyInlineCompletion(value bool) {
419 var v gobject.Value
420 v.Init(gobject.TypeBooleanVal)
421 v.SetBoolean(value)
422 x.SetProperty("inline-completion", &v)
423}
424
425// GetPropertyInlineCompletion gets the "inline-completion" property.
426// Determines whether the common prefix of the possible completions
427// should be inserted automatically in the entry.
428//
429// Note that this requires text-column to be set, even if you are
430// using a custom match function.
431func (x *EntryCompletion) GetPropertyInlineCompletion() bool {
432 var v gobject.Value
433 x.GetProperty("inline-completion", &v)
434 return v.GetBoolean()
435}
436
437// SetPropertyInlineSelection sets the "inline-selection" property.
438// Determines whether the possible completions on the popup
439// will appear in the entry as you navigate through them.
440func (x *EntryCompletion) SetPropertyInlineSelection(value bool) {
441 var v gobject.Value
442 v.Init(gobject.TypeBooleanVal)
443 v.SetBoolean(value)
444 x.SetProperty("inline-selection", &v)
445}
446
447// GetPropertyInlineSelection gets the "inline-selection" property.
448// Determines whether the possible completions on the popup
449// will appear in the entry as you navigate through them.
450func (x *EntryCompletion) GetPropertyInlineSelection() bool {
451 var v gobject.Value
452 x.GetProperty("inline-selection", &v)
453 return v.GetBoolean()
454}
455
456// SetPropertyMinimumKeyLength sets the "minimum-key-length" property.
457// The minimum key length as set for completion.
458func (x *EntryCompletion) SetPropertyMinimumKeyLength(value int) {
459 var v gobject.Value
460 v.Init(gobject.TypeIntVal)
461 v.SetInt(value)
462 x.SetProperty("minimum-key-length", &v)
463}
464
465// GetPropertyMinimumKeyLength gets the "minimum-key-length" property.
466// The minimum key length as set for completion.
467func (x *EntryCompletion) GetPropertyMinimumKeyLength() int {
468 var v gobject.Value
469 x.GetProperty("minimum-key-length", &v)
470 return v.GetInt()
471}
472
473// SetPropertyPopupCompletion sets the "popup-completion" property.
474// Determines whether the possible completions should be
475// shown in a popup window.
476func (x *EntryCompletion) SetPropertyPopupCompletion(value bool) {
477 var v gobject.Value
478 v.Init(gobject.TypeBooleanVal)
479 v.SetBoolean(value)
480 x.SetProperty("popup-completion", &v)
481}
482
483// GetPropertyPopupCompletion gets the "popup-completion" property.
484// Determines whether the possible completions should be
485// shown in a popup window.
486func (x *EntryCompletion) GetPropertyPopupCompletion() bool {
487 var v gobject.Value
488 x.GetProperty("popup-completion", &v)
489 return v.GetBoolean()
490}
491
492// SetPropertyPopupSetWidth sets the "popup-set-width" property.
493// Determines whether the completions popup window will be
494// resized to the width of the entry.
495func (x *EntryCompletion) SetPropertyPopupSetWidth(value bool) {
496 var v gobject.Value
497 v.Init(gobject.TypeBooleanVal)
498 v.SetBoolean(value)
499 x.SetProperty("popup-set-width", &v)
500}
501
502// GetPropertyPopupSetWidth gets the "popup-set-width" property.
503// Determines whether the completions popup window will be
504// resized to the width of the entry.
505func (x *EntryCompletion) GetPropertyPopupSetWidth() bool {
506 var v gobject.Value
507 x.GetProperty("popup-set-width", &v)
508 return v.GetBoolean()
509}
510
511// SetPropertyPopupSingleMatch sets the "popup-single-match" property.
512// Determines whether the completions popup window will shown
513// for a single possible completion.
514//
515// You probably want to set this to %FALSE if you are using
516// [property@Gtk.EntryCompletion:inline-completion].
517func (x *EntryCompletion) SetPropertyPopupSingleMatch(value bool) {
518 var v gobject.Value
519 v.Init(gobject.TypeBooleanVal)
520 v.SetBoolean(value)
521 x.SetProperty("popup-single-match", &v)
522}
523
524// GetPropertyPopupSingleMatch gets the "popup-single-match" property.
525// Determines whether the completions popup window will shown
526// for a single possible completion.
527//
528// You probably want to set this to %FALSE if you are using
529// [property@Gtk.EntryCompletion:inline-completion].
530func (x *EntryCompletion) GetPropertyPopupSingleMatch() bool {
531 var v gobject.Value
532 x.GetProperty("popup-single-match", &v)
533 return v.GetBoolean()
534}
535
536// SetPropertyTextColumn sets the "text-column" property.
537// The column of the model containing the strings.
538//
539// Note that the strings must be UTF-8.
540func (x *EntryCompletion) SetPropertyTextColumn(value int) {
541 var v gobject.Value
542 v.Init(gobject.TypeIntVal)
543 v.SetInt(value)
544 x.SetProperty("text-column", &v)
545}
546
547// GetPropertyTextColumn gets the "text-column" property.
548// The column of the model containing the strings.
549//
550// Note that the strings must be UTF-8.
551func (x *EntryCompletion) GetPropertyTextColumn() int {
552 var v gobject.Value
553 x.GetProperty("text-column", &v)
554 return v.GetInt()
555}
556
557// Emitted when a match from the cursor is on a match of the list.
558//
559// The default behaviour is to replace the contents
560// of the entry with the contents of the text column in the row
561// pointed to by @iter.
562//
563// Note that @model is the model that was passed to
564// [method@Gtk.EntryCompletion.set_model].
565func (x *EntryCompletion) ConnectCursorOnMatch(cb *func(EntryCompletion, uintptr, uintptr) bool) uint {
566 cbPtr := uintptr(unsafe.Pointer(cb))
567 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
568 handlerID := gobject.SignalConnect(x.GoPointer(), "cursor-on-match", cbRefPtr)
569 glib.SaveHandlerMapping(handlerID, cbPtr)
570 return handlerID
571 }
572
573 fcb := func(clsPtr uintptr, ModelVarp uintptr, IterVarp uintptr) bool {
574 fa := EntryCompletion{}
575 fa.Ptr = clsPtr
576 cbFn := *cb
577
578 return cbFn(fa, ModelVarp, IterVarp)
579
580 }
581 cbRefPtr := purego.NewCallback(fcb)
582 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
583 handlerID := gobject.SignalConnect(x.GoPointer(), "cursor-on-match", cbRefPtr)
584 glib.SaveHandlerMapping(handlerID, cbPtr)
585 return handlerID
586}
587
588// Emitted when the inline autocompletion is triggered.
589//
590// The default behaviour is to make the entry display the
591// whole prefix and select the newly inserted part.
592//
593// Applications may connect to this signal in order to insert only a
594// smaller part of the @prefix into the entry - e.g. the entry used in
595// the `GtkFileChooser` inserts only the part of the prefix up to the
596// next '/'.
597func (x *EntryCompletion) ConnectInsertPrefix(cb *func(EntryCompletion, string) bool) uint {
598 cbPtr := uintptr(unsafe.Pointer(cb))
599 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
600 handlerID := gobject.SignalConnect(x.GoPointer(), "insert-prefix", cbRefPtr)
601 glib.SaveHandlerMapping(handlerID, cbPtr)
602 return handlerID
603 }
604
605 fcb := func(clsPtr uintptr, PrefixVarp uintptr) bool {
606 fa := EntryCompletion{}
607 fa.Ptr = clsPtr
608 cbFn := *cb
609
610 return cbFn(fa, core.GoString(PrefixVarp))
611
612 }
613 cbRefPtr := purego.NewCallback(fcb)
614 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
615 handlerID := gobject.SignalConnect(x.GoPointer(), "insert-prefix", cbRefPtr)
616 glib.SaveHandlerMapping(handlerID, cbPtr)
617 return handlerID
618}
619
620// Emitted when a match from the list is selected.
621//
622// The default behaviour is to replace the contents of the
623// entry with the contents of the text column in the row
624// pointed to by @iter.
625//
626// Note that @model is the model that was passed to
627// [method@Gtk.EntryCompletion.set_model].
628func (x *EntryCompletion) ConnectMatchSelected(cb *func(EntryCompletion, uintptr, uintptr) bool) uint {
629 cbPtr := uintptr(unsafe.Pointer(cb))
630 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
631 handlerID := gobject.SignalConnect(x.GoPointer(), "match-selected", cbRefPtr)
632 glib.SaveHandlerMapping(handlerID, cbPtr)
633 return handlerID
634 }
635
636 fcb := func(clsPtr uintptr, ModelVarp uintptr, IterVarp uintptr) bool {
637 fa := EntryCompletion{}
638 fa.Ptr = clsPtr
639 cbFn := *cb
640
641 return cbFn(fa, ModelVarp, IterVarp)
642
643 }
644 cbRefPtr := purego.NewCallback(fcb)
645 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
646 handlerID := gobject.SignalConnect(x.GoPointer(), "match-selected", cbRefPtr)
647 glib.SaveHandlerMapping(handlerID, cbPtr)
648 return handlerID
649}
650
651// Emitted when the filter model has zero
652// number of rows in completion_complete method.
653//
654// In other words when `GtkEntryCompletion` is out of suggestions.
655func (x *EntryCompletion) ConnectNoMatches(cb *func(EntryCompletion)) uint {
656 cbPtr := uintptr(unsafe.Pointer(cb))
657 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
658 handlerID := gobject.SignalConnect(x.GoPointer(), "no-matches", cbRefPtr)
659 glib.SaveHandlerMapping(handlerID, cbPtr)
660 return handlerID
661 }
662
663 fcb := func(clsPtr uintptr) {
664 fa := EntryCompletion{}
665 fa.Ptr = clsPtr
666 cbFn := *cb
667
668 cbFn(fa)
669
670 }
671 cbRefPtr := purego.NewCallback(fcb)
672 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
673 handlerID := gobject.SignalConnect(x.GoPointer(), "no-matches", cbRefPtr)
674 glib.SaveHandlerMapping(handlerID, cbPtr)
675 return handlerID
676}
677
678// Gets the ID of the @buildable object.
679//
680// `GtkBuilder` sets the name based on the ID attribute
681// of the `<object>` tag used to construct the @buildable.
682func (x *EntryCompletion) GetBuildableId() string {
683
684 cret := XGtkBuildableGetBuildableId(x.GoPointer())
685 return cret
686}
687
688// Adds an attribute mapping to the list in @cell_layout.
689//
690// The @column is the column of the model to get a value from, and the
691// @attribute is the property on @cell to be set from that value. So for
692// example if column 2 of the model contains strings, you could have the
693// “text” attribute of a `GtkCellRendererText` get its values from column 2.
694// In this context "attribute" and "property" are used interchangeably.
695func (x *EntryCompletion) AddAttribute(CellVar *CellRenderer, AttributeVar string, ColumnVar int) {
696
697 XGtkCellLayoutAddAttribute(x.GoPointer(), CellVar.GoPointer(), AttributeVar, ColumnVar)
698
699}
700
701// Unsets all the mappings on all renderers on @cell_layout and
702// removes all renderers from @cell_layout.
703func (x *EntryCompletion) Clear() {
704
705 XGtkCellLayoutClear(x.GoPointer())
706
707}
708
709// Clears all existing attributes previously set with
710// gtk_cell_layout_set_attributes().
711func (x *EntryCompletion) ClearAttributes(CellVar *CellRenderer) {
712
713 XGtkCellLayoutClearAttributes(x.GoPointer(), CellVar.GoPointer())
714
715}
716
717// Returns the underlying `GtkCellArea` which might be @cell_layout
718// if called on a `GtkCellArea` or might be %NULL if no `GtkCellArea`
719// is used by @cell_layout.
720func (x *EntryCompletion) GetArea() *CellArea {
721 var cls *CellArea
722
723 cret := XGtkCellLayoutGetArea(x.GoPointer())
724
725 if cret == 0 {
726 return nil
727 }
728 gobject.IncreaseRef(cret)
729 cls = &CellArea{}
730 cls.Ptr = cret
731 return cls
732}
733
734// Returns the cell renderers which have been added to @cell_layout.
735func (x *EntryCompletion) GetCells() *glib.List {
736
737 cret := XGtkCellLayoutGetCells(x.GoPointer())
738 return cret
739}
740
741// Adds the @cell to the end of @cell_layout. If @expand is %FALSE, then the
742// @cell is allocated no more space than it needs. Any unused space is
743// divided evenly between cells for which @expand is %TRUE.
744//
745// Note that reusing the same cell renderer is not supported.
746func (x *EntryCompletion) PackEnd(CellVar *CellRenderer, ExpandVar bool) {
747
748 XGtkCellLayoutPackEnd(x.GoPointer(), CellVar.GoPointer(), ExpandVar)
749
750}
751
752// Packs the @cell into the beginning of @cell_layout. If @expand is %FALSE,
753// then the @cell is allocated no more space than it needs. Any unused space
754// is divided evenly between cells for which @expand is %TRUE.
755//
756// Note that reusing the same cell renderer is not supported.
757func (x *EntryCompletion) PackStart(CellVar *CellRenderer, ExpandVar bool) {
758
759 XGtkCellLayoutPackStart(x.GoPointer(), CellVar.GoPointer(), ExpandVar)
760
761}
762
763// Re-inserts @cell at @position.
764//
765// Note that @cell has already to be packed into @cell_layout
766// for this to function properly.
767func (x *EntryCompletion) Reorder(CellVar *CellRenderer, PositionVar int) {
768
769 XGtkCellLayoutReorder(x.GoPointer(), CellVar.GoPointer(), PositionVar)
770
771}
772
773// Sets the attributes in the parameter list as the attributes
774// of @cell_layout.
775//
776// See [method@Gtk.CellLayout.add_attribute] for more details.
777//
778// The attributes should be in attribute/column order, as in
779// gtk_cell_layout_add_attribute(). All existing attributes are
780// removed, and replaced with the new attributes.
781func (x *EntryCompletion) SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) {
782
783 XGtkCellLayoutSetAttributes(x.GoPointer(), CellVar.GoPointer(), varArgs...)
784
785}
786
787// Sets the `GtkCellLayout`DataFunc to use for @cell_layout.
788//
789// This function is used instead of the standard attributes mapping
790// for setting the column value, and should set the value of @cell_layout’s
791// cell renderer(s) as appropriate.
792//
793// @func may be %NULL to remove a previously set function.
794func (x *EntryCompletion) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) {
795
796 XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallbackNullable(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar))
797
798}
799
800func init() {
801 core.SetPackageName("GTK", "gtk4")
802 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
803 var libs []uintptr
804 for _, libPath := range core.GetPaths("GTK") {
805 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
806 if err != nil {
807 panic(err)
808 }
809 libs = append(libs, lib)
810 }
811
812 core.PuregoSafeRegister(&xEntryCompletionGLibType, libs, "gtk_entry_completion_get_type")
813
814 core.PuregoSafeRegister(&xNewEntryCompletion, libs, "gtk_entry_completion_new")
815 core.PuregoSafeRegister(&xNewEntryCompletionWithArea, libs, "gtk_entry_completion_new_with_area")
816
817 core.PuregoSafeRegister(&xEntryCompletionComplete, libs, "gtk_entry_completion_complete")
818 core.PuregoSafeRegister(&xEntryCompletionComputePrefix, libs, "gtk_entry_completion_compute_prefix")
819 core.PuregoSafeRegister(&xEntryCompletionGetCompletionPrefix, libs, "gtk_entry_completion_get_completion_prefix")
820 core.PuregoSafeRegister(&xEntryCompletionGetEntry, libs, "gtk_entry_completion_get_entry")
821 core.PuregoSafeRegister(&xEntryCompletionGetInlineCompletion, libs, "gtk_entry_completion_get_inline_completion")
822 core.PuregoSafeRegister(&xEntryCompletionGetInlineSelection, libs, "gtk_entry_completion_get_inline_selection")
823 core.PuregoSafeRegister(&xEntryCompletionGetMinimumKeyLength, libs, "gtk_entry_completion_get_minimum_key_length")
824 core.PuregoSafeRegister(&xEntryCompletionGetModel, libs, "gtk_entry_completion_get_model")
825 core.PuregoSafeRegister(&xEntryCompletionGetPopupCompletion, libs, "gtk_entry_completion_get_popup_completion")
826 core.PuregoSafeRegister(&xEntryCompletionGetPopupSetWidth, libs, "gtk_entry_completion_get_popup_set_width")
827 core.PuregoSafeRegister(&xEntryCompletionGetPopupSingleMatch, libs, "gtk_entry_completion_get_popup_single_match")
828 core.PuregoSafeRegister(&xEntryCompletionGetTextColumn, libs, "gtk_entry_completion_get_text_column")
829 core.PuregoSafeRegister(&xEntryCompletionInsertPrefix, libs, "gtk_entry_completion_insert_prefix")
830 core.PuregoSafeRegister(&xEntryCompletionSetInlineCompletion, libs, "gtk_entry_completion_set_inline_completion")
831 core.PuregoSafeRegister(&xEntryCompletionSetInlineSelection, libs, "gtk_entry_completion_set_inline_selection")
832 core.PuregoSafeRegister(&xEntryCompletionSetMatchFunc, libs, "gtk_entry_completion_set_match_func")
833 core.PuregoSafeRegister(&xEntryCompletionSetMinimumKeyLength, libs, "gtk_entry_completion_set_minimum_key_length")
834 core.PuregoSafeRegister(&xEntryCompletionSetModel, libs, "gtk_entry_completion_set_model")
835 core.PuregoSafeRegister(&xEntryCompletionSetPopupCompletion, libs, "gtk_entry_completion_set_popup_completion")
836 core.PuregoSafeRegister(&xEntryCompletionSetPopupSetWidth, libs, "gtk_entry_completion_set_popup_set_width")
837 core.PuregoSafeRegister(&xEntryCompletionSetPopupSingleMatch, libs, "gtk_entry_completion_set_popup_single_match")
838 core.PuregoSafeRegister(&xEntryCompletionSetTextColumn, libs, "gtk_entry_completion_set_text_column")
839
840}