1// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package adw
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/gio"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type EnumListItemClass struct {
17 _ structs.HostLayout
18
19 ParentClass gobject.ObjectClass
20}
21
22func (x *EnumListItemClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26type EnumListModelClass struct {
27 _ structs.HostLayout
28
29 ParentClass gobject.ObjectClass
30}
31
32func (x *EnumListModelClass) GoPointer() uintptr {
33 return uintptr(unsafe.Pointer(x))
34}
35
36// `AdwEnumListItem` is the type of items in a [class@EnumListModel].
37type EnumListItem struct {
38 gobject.Object
39}
40
41var xEnumListItemGLibType func() types.GType
42
43func EnumListItemGLibType() types.GType {
44 return xEnumListItemGLibType()
45}
46
47func EnumListItemNewFromInternalPtr(ptr uintptr) *EnumListItem {
48 cls := &EnumListItem{}
49 cls.Ptr = ptr
50 return cls
51}
52
53var xEnumListItemGetName func(uintptr) string
54
55// Gets the enum value name.
56func (x *EnumListItem) GetName() string {
57
58 cret := xEnumListItemGetName(x.GoPointer())
59 return cret
60}
61
62var xEnumListItemGetNick func(uintptr) string
63
64// Gets the enum value nick.
65func (x *EnumListItem) GetNick() string {
66
67 cret := xEnumListItemGetNick(x.GoPointer())
68 return cret
69}
70
71var xEnumListItemGetValue func(uintptr) int
72
73// Gets the enum value.
74func (x *EnumListItem) GetValue() int {
75
76 cret := xEnumListItemGetValue(x.GoPointer())
77 return cret
78}
79
80func (c *EnumListItem) GoPointer() uintptr {
81 if c == nil {
82 return 0
83 }
84 return c.Ptr
85}
86
87func (c *EnumListItem) SetGoPointer(ptr uintptr) {
88 c.Ptr = ptr
89}
90
91// GetPropertyName gets the "name" property.
92// The enum value name.
93func (x *EnumListItem) GetPropertyName() string {
94 var v gobject.Value
95 x.GetProperty("name", &v)
96 return v.GetString()
97}
98
99// GetPropertyNick gets the "nick" property.
100// The enum value nick.
101func (x *EnumListItem) GetPropertyNick() string {
102 var v gobject.Value
103 x.GetProperty("nick", &v)
104 return v.GetString()
105}
106
107// GetPropertyValue gets the "value" property.
108// The enum value.
109func (x *EnumListItem) GetPropertyValue() int {
110 var v gobject.Value
111 x.GetProperty("value", &v)
112 return v.GetInt()
113}
114
115// A [iface@Gio.ListModel] representing values of a given enum.
116//
117// `AdwEnumListModel` contains objects of type [class@EnumListItem].
118type EnumListModel struct {
119 gobject.Object
120}
121
122var xEnumListModelGLibType func() types.GType
123
124func EnumListModelGLibType() types.GType {
125 return xEnumListModelGLibType()
126}
127
128func EnumListModelNewFromInternalPtr(ptr uintptr) *EnumListModel {
129 cls := &EnumListModel{}
130 cls.Ptr = ptr
131 return cls
132}
133
134var xNewEnumListModel func(types.GType) uintptr
135
136// Creates a new `AdwEnumListModel` for @enum_type.
137func NewEnumListModel(EnumTypeVar types.GType) *EnumListModel {
138 var cls *EnumListModel
139
140 cret := xNewEnumListModel(EnumTypeVar)
141
142 if cret == 0 {
143 return nil
144 }
145 cls = &EnumListModel{}
146 cls.Ptr = cret
147 return cls
148}
149
150var xEnumListModelFindPosition func(uintptr, int) uint
151
152// Finds the position of a given enum value in @self.
153//
154// If the value is not found, `GTK_INVALID_LIST_POSITION` is returned.
155func (x *EnumListModel) FindPosition(ValueVar int) uint {
156
157 cret := xEnumListModelFindPosition(x.GoPointer(), ValueVar)
158 return cret
159}
160
161var xEnumListModelGetEnumType func(uintptr) types.GType
162
163// Gets the type of the enum represented by @self.
164func (x *EnumListModel) GetEnumType() types.GType {
165
166 cret := xEnumListModelGetEnumType(x.GoPointer())
167 return cret
168}
169
170func (c *EnumListModel) GoPointer() uintptr {
171 if c == nil {
172 return 0
173 }
174 return c.Ptr
175}
176
177func (c *EnumListModel) SetGoPointer(ptr uintptr) {
178 c.Ptr = ptr
179}
180
181// Get the item at @position.
182//
183// If @position is greater than the number of items in @list, %NULL is
184// returned.
185//
186// %NULL is never returned for an index that is smaller than the length
187// of the list.
188//
189// See also: g_list_model_get_n_items()
190func (x *EnumListModel) GetItem(PositionVar uint) uintptr {
191
192 cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
193 return cret
194}
195
196// Gets the type of the items in @list.
197//
198// All items returned from g_list_model_get_item() are of the type
199// returned by this function, or a subtype, or if the type is an
200// interface, they are an implementation of that interface.
201//
202// The item type of a #GListModel can not change during the life of the
203// model.
204func (x *EnumListModel) GetItemType() types.GType {
205
206 cret := gio.XGListModelGetItemType(x.GoPointer())
207 return cret
208}
209
210// Gets the number of items in @list.
211//
212// Depending on the model implementation, calling this function may be
213// less efficient than iterating the list with increasing values for
214// @position until g_list_model_get_item() returns %NULL.
215func (x *EnumListModel) GetNItems() uint {
216
217 cret := gio.XGListModelGetNItems(x.GoPointer())
218 return cret
219}
220
221// Get the item at @position.
222//
223// If @position is greater than the number of items in @list, %NULL is
224// returned.
225//
226// %NULL is never returned for an index that is smaller than the length
227// of the list.
228//
229// This function is meant to be used by language bindings in place
230// of g_list_model_get_item().
231//
232// See also: g_list_model_get_n_items()
233func (x *EnumListModel) GetObject(PositionVar uint) *gobject.Object {
234 var cls *gobject.Object
235
236 cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
237
238 if cret == 0 {
239 return nil
240 }
241 cls = &gobject.Object{}
242 cls.Ptr = cret
243 return cls
244}
245
246// Emits the #GListModel::items-changed signal on @list.
247//
248// This function should only be called by classes implementing
249// #GListModel. It has to be called after the internal representation
250// of @list has been updated, because handlers connected to this signal
251// might query the new state of the list.
252//
253// Implementations must only make changes to the model (as visible to
254// its consumer) in places that will not cause problems for that
255// consumer. For models that are driven directly by a write API (such
256// as #GListStore), changes can be reported in response to uses of that
257// API. For models that represent remote data, changes should only be
258// made from a fresh mainloop dispatch. It is particularly not
259// permitted to make changes in response to a call to the #GListModel
260// consumer API.
261//
262// Stated another way: in general, it is assumed that code making a
263// series of accesses to the model via the API, without returning to the
264// mainloop, and without calling other code, will continue to view the
265// same contents of the model.
266func (x *EnumListModel) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
267
268 gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
269
270}
271
272func init() {
273 core.SetPackageName("ADW", "libadwaita-1")
274 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
275 var libs []uintptr
276 for _, libPath := range core.GetPaths("ADW") {
277 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
278 if err != nil {
279 panic(err)
280 }
281 libs = append(libs, lib)
282 }
283
284 core.PuregoSafeRegister(&xEnumListItemGLibType, libs, "adw_enum_list_item_get_type")
285
286 core.PuregoSafeRegister(&xEnumListItemGetName, libs, "adw_enum_list_item_get_name")
287 core.PuregoSafeRegister(&xEnumListItemGetNick, libs, "adw_enum_list_item_get_nick")
288 core.PuregoSafeRegister(&xEnumListItemGetValue, libs, "adw_enum_list_item_get_value")
289
290 core.PuregoSafeRegister(&xEnumListModelGLibType, libs, "adw_enum_list_model_get_type")
291
292 core.PuregoSafeRegister(&xNewEnumListModel, libs, "adw_enum_list_model_new")
293
294 core.PuregoSafeRegister(&xEnumListModelFindPosition, libs, "adw_enum_list_model_find_position")
295 core.PuregoSafeRegister(&xEnumListModelGetEnumType, libs, "adw_enum_list_model_get_enum_type")
296
297}