1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type StringFilterClass struct {
16 _ structs.HostLayout
17
18 ParentClass FilterClass
19}
20
21func (x *StringFilterClass) GoPointer() uintptr {
22 return uintptr(unsafe.Pointer(x))
23}
24
25// Specifies how search strings are matched inside text.
26type StringFilterMatchMode int
27
28var xStringFilterMatchModeGLibType func() types.GType
29
30func StringFilterMatchModeGLibType() types.GType {
31 return xStringFilterMatchModeGLibType()
32}
33
34const (
35
36 // The search string and
37 // text must match exactly
38 StringFilterMatchModeExactValue StringFilterMatchMode = 0
39 // The search string
40 // must be contained as a substring inside the text
41 StringFilterMatchModeSubstringValue StringFilterMatchMode = 1
42 // The text must begin
43 // with the search string
44 StringFilterMatchModePrefixValue StringFilterMatchMode = 2
45)
46
47// Determines whether to include items by comparing strings to a fixed search term.
48//
49// The strings are obtained from the items by evaluating an expression
50// set with [method@Gtk.StringFilter.set_expression], and they are
51// compared against a search term set with [method@Gtk.StringFilter.set_search].
52//
53// `GtkStringFilter` has several different modes of comparison - it
54// can match the whole string, just a prefix, or any substring. Use
55// [method@Gtk.StringFilter.set_match_mode] choose a mode.
56//
57// It is also possible to make case-insensitive comparisons, with
58// [method@Gtk.StringFilter.set_ignore_case].
59type StringFilter struct {
60 Filter
61}
62
63var xStringFilterGLibType func() types.GType
64
65func StringFilterGLibType() types.GType {
66 return xStringFilterGLibType()
67}
68
69func StringFilterNewFromInternalPtr(ptr uintptr) *StringFilter {
70 cls := &StringFilter{}
71 cls.Ptr = ptr
72 return cls
73}
74
75var xNewStringFilter func(uintptr) uintptr
76
77// Creates a new string filter.
78//
79// You will want to set up the filter by providing a string to search for
80// and by providing a property to look up on the item.
81func NewStringFilter(ExpressionVar *Expression) *StringFilter {
82 var cls *StringFilter
83
84 cret := xNewStringFilter(ExpressionVar.GoPointer())
85
86 if cret == 0 {
87 return nil
88 }
89 cls = &StringFilter{}
90 cls.Ptr = cret
91 return cls
92}
93
94var xStringFilterGetExpression func(uintptr) uintptr
95
96// Gets the expression that the string filter uses to
97// obtain strings from items.
98func (x *StringFilter) GetExpression() *Expression {
99 var cls *Expression
100
101 cret := xStringFilterGetExpression(x.GoPointer())
102
103 if cret == 0 {
104 return nil
105 }
106 gobject.IncreaseRef(cret)
107 cls = &Expression{}
108 cls.Ptr = cret
109 return cls
110}
111
112var xStringFilterGetIgnoreCase func(uintptr) bool
113
114// Returns whether the filter ignores case differences.
115func (x *StringFilter) GetIgnoreCase() bool {
116
117 cret := xStringFilterGetIgnoreCase(x.GoPointer())
118 return cret
119}
120
121var xStringFilterGetMatchMode func(uintptr) StringFilterMatchMode
122
123// Returns the match mode that the filter is using.
124func (x *StringFilter) GetMatchMode() StringFilterMatchMode {
125
126 cret := xStringFilterGetMatchMode(x.GoPointer())
127 return cret
128}
129
130var xStringFilterGetSearch func(uintptr) string
131
132// Gets the search term.
133func (x *StringFilter) GetSearch() string {
134
135 cret := xStringFilterGetSearch(x.GoPointer())
136 return cret
137}
138
139var xStringFilterSetExpression func(uintptr, uintptr)
140
141// Sets the expression that the string filter uses to
142// obtain strings from items.
143//
144// The expression must have a value type of `G_TYPE_STRING`.
145func (x *StringFilter) SetExpression(ExpressionVar *Expression) {
146
147 xStringFilterSetExpression(x.GoPointer(), ExpressionVar.GoPointer())
148
149}
150
151var xStringFilterSetIgnoreCase func(uintptr, bool)
152
153// Sets whether the filter ignores case differences.
154func (x *StringFilter) SetIgnoreCase(IgnoreCaseVar bool) {
155
156 xStringFilterSetIgnoreCase(x.GoPointer(), IgnoreCaseVar)
157
158}
159
160var xStringFilterSetMatchMode func(uintptr, StringFilterMatchMode)
161
162// Sets the match mode for the filter.
163func (x *StringFilter) SetMatchMode(ModeVar StringFilterMatchMode) {
164
165 xStringFilterSetMatchMode(x.GoPointer(), ModeVar)
166
167}
168
169var xStringFilterSetSearch func(uintptr, uintptr)
170
171// Sets the string to search for.
172func (x *StringFilter) SetSearch(SearchVar *string) {
173
174 SearchVarPtr := core.GStrdupNullable(SearchVar)
175 defer core.GFreeNullable(SearchVarPtr)
176
177 xStringFilterSetSearch(x.GoPointer(), SearchVarPtr)
178
179}
180
181func (c *StringFilter) GoPointer() uintptr {
182 if c == nil {
183 return 0
184 }
185 return c.Ptr
186}
187
188func (c *StringFilter) SetGoPointer(ptr uintptr) {
189 c.Ptr = ptr
190}
191
192// SetPropertyIgnoreCase sets the "ignore-case" property.
193// If matching is case sensitive.
194func (x *StringFilter) SetPropertyIgnoreCase(value bool) {
195 var v gobject.Value
196 v.Init(gobject.TypeBooleanVal)
197 v.SetBoolean(value)
198 x.SetProperty("ignore-case", &v)
199}
200
201// GetPropertyIgnoreCase gets the "ignore-case" property.
202// If matching is case sensitive.
203func (x *StringFilter) GetPropertyIgnoreCase() bool {
204 var v gobject.Value
205 x.GetProperty("ignore-case", &v)
206 return v.GetBoolean()
207}
208
209// SetPropertySearch sets the "search" property.
210// The search term.
211func (x *StringFilter) SetPropertySearch(value string) {
212 var v gobject.Value
213 v.Init(gobject.TypeStringVal)
214 v.SetString(&value)
215 x.SetProperty("search", &v)
216}
217
218// GetPropertySearch gets the "search" property.
219// The search term.
220func (x *StringFilter) GetPropertySearch() string {
221 var v gobject.Value
222 x.GetProperty("search", &v)
223 return v.GetString()
224}
225
226func init() {
227 core.SetPackageName("GTK", "gtk4")
228 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
229 var libs []uintptr
230 for _, libPath := range core.GetPaths("GTK") {
231 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
232 if err != nil {
233 panic(err)
234 }
235 libs = append(libs, lib)
236 }
237
238 core.PuregoSafeRegister(&xStringFilterMatchModeGLibType, libs, "gtk_string_filter_match_mode_get_type")
239
240 core.PuregoSafeRegister(&xStringFilterGLibType, libs, "gtk_string_filter_get_type")
241
242 core.PuregoSafeRegister(&xNewStringFilter, libs, "gtk_string_filter_new")
243
244 core.PuregoSafeRegister(&xStringFilterGetExpression, libs, "gtk_string_filter_get_expression")
245 core.PuregoSafeRegister(&xStringFilterGetIgnoreCase, libs, "gtk_string_filter_get_ignore_case")
246 core.PuregoSafeRegister(&xStringFilterGetMatchMode, libs, "gtk_string_filter_get_match_mode")
247 core.PuregoSafeRegister(&xStringFilterGetSearch, libs, "gtk_string_filter_get_search")
248 core.PuregoSafeRegister(&xStringFilterSetExpression, libs, "gtk_string_filter_set_expression")
249 core.PuregoSafeRegister(&xStringFilterSetIgnoreCase, libs, "gtk_string_filter_set_ignore_case")
250 core.PuregoSafeRegister(&xStringFilterSetMatchMode, libs, "gtk_string_filter_set_match_mode")
251 core.PuregoSafeRegister(&xStringFilterSetSearch, libs, "gtk_string_filter_set_search")
252
253}