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/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type BuilderListItemFactoryClass struct {
17 _ structs.HostLayout
18}
19
20func (x *BuilderListItemFactoryClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24// Creates widgets by instantiating `GtkBuilder` UI templates.
25//
26// The templates must extend the class that the parent widget expects.
27// For example, a factory provided to [property@Gtk.ListView:factory] must have
28// a template that extends [class@Gtk.ListItem].
29//
30// Templates typically use [class@Gtk.Expression] to obtain data from the items
31// in the model.
32//
33// Example:
34// ```xml
35//
36// <interface>
37// <template class="GtkListItem">
38// <property name="child">
39// <object class="GtkLabel">
40// <property name="xalign">0</property>
41// <binding name="label">
42// <lookup name="name" type="SettingsKey">
43// <lookup name="item">GtkListItem</lookup>
44// </lookup>
45// </binding>
46// </object>
47// </property>
48// </template>
49// </interface>
50//
51// ```
52//
53// A common approach is to embed such templates as CDATA marked sections into
54// a surrounding UI file. Note that if you use this approach, extracting
55// translatable strings with xgettext will not work for strings inside the
56// marked section.
57type BuilderListItemFactory struct {
58 ListItemFactory
59}
60
61var xBuilderListItemFactoryGLibType func() types.GType
62
63func BuilderListItemFactoryGLibType() types.GType {
64 return xBuilderListItemFactoryGLibType()
65}
66
67func BuilderListItemFactoryNewFromInternalPtr(ptr uintptr) *BuilderListItemFactory {
68 cls := &BuilderListItemFactory{}
69 cls.Ptr = ptr
70 return cls
71}
72
73var xNewBuilderListItemFactoryFromBytes func(uintptr, *glib.Bytes) uintptr
74
75// Creates a new `GtkBuilderListItemFactory` that instantiates widgets
76// using @bytes as the data to pass to `GtkBuilder`.
77func NewBuilderListItemFactoryFromBytes(ScopeVar BuilderScope, BytesVar *glib.Bytes) *BuilderListItemFactory {
78 var cls *BuilderListItemFactory
79
80 cret := xNewBuilderListItemFactoryFromBytes(ScopeVar.GoPointer(), BytesVar)
81
82 if cret == 0 {
83 return nil
84 }
85 cls = &BuilderListItemFactory{}
86 cls.Ptr = cret
87 return cls
88}
89
90var xNewBuilderListItemFactoryFromResource func(uintptr, string) uintptr
91
92// Creates a new `GtkBuilderListItemFactory` that instantiates widgets
93// using data read from the given @resource_path to pass to `GtkBuilder`.
94func NewBuilderListItemFactoryFromResource(ScopeVar BuilderScope, ResourcePathVar string) *BuilderListItemFactory {
95 var cls *BuilderListItemFactory
96
97 cret := xNewBuilderListItemFactoryFromResource(ScopeVar.GoPointer(), ResourcePathVar)
98
99 if cret == 0 {
100 return nil
101 }
102 cls = &BuilderListItemFactory{}
103 cls.Ptr = cret
104 return cls
105}
106
107var xBuilderListItemFactoryGetBytes func(uintptr) *glib.Bytes
108
109// Gets the data used as the `GtkBuilder` UI template for constructing
110// listitems.
111func (x *BuilderListItemFactory) GetBytes() *glib.Bytes {
112
113 cret := xBuilderListItemFactoryGetBytes(x.GoPointer())
114 return cret
115}
116
117var xBuilderListItemFactoryGetResource func(uintptr) string
118
119// If the data references a resource, gets the path of that resource.
120func (x *BuilderListItemFactory) GetResource() string {
121
122 cret := xBuilderListItemFactoryGetResource(x.GoPointer())
123 return cret
124}
125
126var xBuilderListItemFactoryGetScope func(uintptr) uintptr
127
128// Gets the scope used when constructing listitems.
129func (x *BuilderListItemFactory) GetScope() *BuilderScopeBase {
130 var cls *BuilderScopeBase
131
132 cret := xBuilderListItemFactoryGetScope(x.GoPointer())
133
134 if cret == 0 {
135 return nil
136 }
137 gobject.IncreaseRef(cret)
138 cls = &BuilderScopeBase{}
139 cls.Ptr = cret
140 return cls
141}
142
143func (c *BuilderListItemFactory) GoPointer() uintptr {
144 if c == nil {
145 return 0
146 }
147 return c.Ptr
148}
149
150func (c *BuilderListItemFactory) SetGoPointer(ptr uintptr) {
151 c.Ptr = ptr
152}
153
154// SetPropertyBytes sets the "bytes" property.
155// `GBytes` containing the UI definition.
156func (x *BuilderListItemFactory) SetPropertyBytes(value uintptr) {
157 var v gobject.Value
158 v.Init(gobject.TypePointerVal)
159 v.SetPointer(value)
160 x.SetProperty("bytes", &v)
161}
162
163// GetPropertyBytes gets the "bytes" property.
164// `GBytes` containing the UI definition.
165func (x *BuilderListItemFactory) GetPropertyBytes() uintptr {
166 var v gobject.Value
167 x.GetProperty("bytes", &v)
168 return v.GetPointer()
169}
170
171// SetPropertyResource sets the "resource" property.
172// Path of the resource containing the UI definition.
173func (x *BuilderListItemFactory) SetPropertyResource(value string) {
174 var v gobject.Value
175 v.Init(gobject.TypeStringVal)
176 v.SetString(&value)
177 x.SetProperty("resource", &v)
178}
179
180// GetPropertyResource gets the "resource" property.
181// Path of the resource containing the UI definition.
182func (x *BuilderListItemFactory) GetPropertyResource() string {
183 var v gobject.Value
184 x.GetProperty("resource", &v)
185 return v.GetString()
186}
187
188func init() {
189 core.SetPackageName("GTK", "gtk4")
190 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
191 var libs []uintptr
192 for _, libPath := range core.GetPaths("GTK") {
193 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
194 if err != nil {
195 panic(err)
196 }
197 libs = append(libs, lib)
198 }
199
200 core.PuregoSafeRegister(&xBuilderListItemFactoryGLibType, libs, "gtk_builder_list_item_factory_get_type")
201
202 core.PuregoSafeRegister(&xNewBuilderListItemFactoryFromBytes, libs, "gtk_builder_list_item_factory_new_from_bytes")
203 core.PuregoSafeRegister(&xNewBuilderListItemFactoryFromResource, libs, "gtk_builder_list_item_factory_new_from_resource")
204
205 core.PuregoSafeRegister(&xBuilderListItemFactoryGetBytes, libs, "gtk_builder_list_item_factory_get_bytes")
206 core.PuregoSafeRegister(&xBuilderListItemFactoryGetResource, libs, "gtk_builder_list_item_factory_get_resource")
207 core.PuregoSafeRegister(&xBuilderListItemFactoryGetScope, libs, "gtk_builder_list_item_factory_get_scope")
208
209}