1// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gobject
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/types"
12)
13
14// The class of an enumeration type holds information about its
15// possible values.
16type EnumClass struct {
17 _ structs.HostLayout
18
19 GTypeClass uintptr
20
21 Minimum int32
22
23 Maximum int32
24
25 NValues uint
26
27 Values *EnumValue
28}
29
30func (x *EnumClass) GoPointer() uintptr {
31 return uintptr(unsafe.Pointer(x))
32}
33
34// A structure which contains a single enum value, its name, and its
35// nickname.
36type EnumValue struct {
37 _ structs.HostLayout
38
39 Value int32
40
41 ValueName uintptr
42
43 ValueNick uintptr
44}
45
46func (x *EnumValue) GoPointer() uintptr {
47 return uintptr(unsafe.Pointer(x))
48}
49
50// The class of a flags type holds information about its
51// possible values.
52type FlagsClass struct {
53 _ structs.HostLayout
54
55 GTypeClass uintptr
56
57 Mask uint
58
59 NValues uint
60
61 Values *FlagsValue
62}
63
64func (x *FlagsClass) GoPointer() uintptr {
65 return uintptr(unsafe.Pointer(x))
66}
67
68// A structure which contains a single flags value, its name, and its
69// nickname.
70type FlagsValue struct {
71 _ structs.HostLayout
72
73 Value uint
74
75 ValueName uintptr
76
77 ValueNick uintptr
78}
79
80func (x *FlagsValue) GoPointer() uintptr {
81 return uintptr(unsafe.Pointer(x))
82}
83
84var xEnumCompleteTypeInfo func(types.GType, *TypeInfo, []EnumValue)
85
86// This function is meant to be called from the `complete_type_info`
87// function of a #GTypePlugin implementation, as in the following
88// example:
89//
90// |[<!-- language="C" -->
91// static void
92// my_enum_complete_type_info (GTypePlugin *plugin,
93//
94// GType g_type,
95// GTypeInfo *info,
96// GTypeValueTable *value_table)
97//
98// {
99// static const GEnumValue values[] = {
100// { MY_ENUM_FOO, "MY_ENUM_FOO", "foo" },
101// { MY_ENUM_BAR, "MY_ENUM_BAR", "bar" },
102// { 0, NULL, NULL }
103// };
104//
105// g_enum_complete_type_info (type, info, values);
106// }
107//
108// ]|
109func EnumCompleteTypeInfo(GEnumTypeVar types.GType, InfoVar *TypeInfo, ConstValuesVar []EnumValue) {
110
111 xEnumCompleteTypeInfo(GEnumTypeVar, InfoVar, ConstValuesVar)
112
113}
114
115var xEnumGetValue func(*EnumClass, int) *EnumValue
116
117// Returns the #GEnumValue for a value.
118func EnumGetValue(EnumClassVar *EnumClass, ValueVar int) *EnumValue {
119
120 cret := xEnumGetValue(EnumClassVar, ValueVar)
121 return cret
122}
123
124var xEnumGetValueByName func(*EnumClass, string) *EnumValue
125
126// Looks up a #GEnumValue by name.
127func EnumGetValueByName(EnumClassVar *EnumClass, NameVar string) *EnumValue {
128
129 cret := xEnumGetValueByName(EnumClassVar, NameVar)
130 return cret
131}
132
133var xEnumGetValueByNick func(*EnumClass, string) *EnumValue
134
135// Looks up a #GEnumValue by nickname.
136func EnumGetValueByNick(EnumClassVar *EnumClass, NickVar string) *EnumValue {
137
138 cret := xEnumGetValueByNick(EnumClassVar, NickVar)
139 return cret
140}
141
142var xEnumRegisterStatic func(string, []EnumValue) types.GType
143
144// Registers a new static enumeration type with the name @name.
145//
146// It is normally more convenient to let [glib-mkenums][glib-mkenums],
147// generate a my_enum_get_type() function from a usual C enumeration
148// definition than to write one yourself using g_enum_register_static().
149func EnumRegisterStatic(NameVar string, ConstStaticValuesVar []EnumValue) types.GType {
150
151 cret := xEnumRegisterStatic(NameVar, ConstStaticValuesVar)
152 return cret
153}
154
155var xEnumToString func(types.GType, int) string
156
157// Pretty-prints @value in the form of the enum’s name.
158//
159// This is intended to be used for debugging purposes. The format of the output
160// may change in the future.
161func EnumToString(GEnumTypeVar types.GType, ValueVar int) string {
162
163 cret := xEnumToString(GEnumTypeVar, ValueVar)
164 return cret
165}
166
167var xFlagsCompleteTypeInfo func(types.GType, *TypeInfo, []FlagsValue)
168
169// This function is meant to be called from the complete_type_info()
170// function of a #GTypePlugin implementation, see the example for
171// g_enum_complete_type_info() above.
172func FlagsCompleteTypeInfo(GFlagsTypeVar types.GType, InfoVar *TypeInfo, ConstValuesVar []FlagsValue) {
173
174 xFlagsCompleteTypeInfo(GFlagsTypeVar, InfoVar, ConstValuesVar)
175
176}
177
178var xFlagsGetFirstValue func(*FlagsClass, uint) *FlagsValue
179
180// Returns the first #GFlagsValue which is set in @value.
181func FlagsGetFirstValue(FlagsClassVar *FlagsClass, ValueVar uint) *FlagsValue {
182
183 cret := xFlagsGetFirstValue(FlagsClassVar, ValueVar)
184 return cret
185}
186
187var xFlagsGetValueByName func(*FlagsClass, string) *FlagsValue
188
189// Looks up a #GFlagsValue by name.
190func FlagsGetValueByName(FlagsClassVar *FlagsClass, NameVar string) *FlagsValue {
191
192 cret := xFlagsGetValueByName(FlagsClassVar, NameVar)
193 return cret
194}
195
196var xFlagsGetValueByNick func(*FlagsClass, string) *FlagsValue
197
198// Looks up a #GFlagsValue by nickname.
199func FlagsGetValueByNick(FlagsClassVar *FlagsClass, NickVar string) *FlagsValue {
200
201 cret := xFlagsGetValueByNick(FlagsClassVar, NickVar)
202 return cret
203}
204
205var xFlagsRegisterStatic func(string, []FlagsValue) types.GType
206
207// Registers a new static flags type with the name @name.
208//
209// It is normally more convenient to let [glib-mkenums][glib-mkenums]
210// generate a my_flags_get_type() function from a usual C enumeration
211// definition than to write one yourself using g_flags_register_static().
212func FlagsRegisterStatic(NameVar string, ConstStaticValuesVar []FlagsValue) types.GType {
213
214 cret := xFlagsRegisterStatic(NameVar, ConstStaticValuesVar)
215 return cret
216}
217
218var xFlagsToString func(types.GType, uint) string
219
220// Pretty-prints @value in the form of the flag names separated by ` | ` and
221// sorted. Any extra bits will be shown at the end as a hexadecimal number.
222//
223// This is intended to be used for debugging purposes. The format of the output
224// may change in the future.
225func FlagsToString(FlagsTypeVar types.GType, ValueVar uint) string {
226
227 cret := xFlagsToString(FlagsTypeVar, ValueVar)
228 return cret
229}
230
231func init() {
232 core.SetPackageName("GOBJECT", "gobject-2.0")
233 core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"})
234 var libs []uintptr
235 for _, libPath := range core.GetPaths("GOBJECT") {
236 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
237 if err != nil {
238 panic(err)
239 }
240 libs = append(libs, lib)
241 }
242
243 core.PuregoSafeRegister(&xEnumCompleteTypeInfo, libs, "g_enum_complete_type_info")
244 core.PuregoSafeRegister(&xEnumGetValue, libs, "g_enum_get_value")
245 core.PuregoSafeRegister(&xEnumGetValueByName, libs, "g_enum_get_value_by_name")
246 core.PuregoSafeRegister(&xEnumGetValueByNick, libs, "g_enum_get_value_by_nick")
247 core.PuregoSafeRegister(&xEnumRegisterStatic, libs, "g_enum_register_static")
248 core.PuregoSafeRegister(&xEnumToString, libs, "g_enum_to_string")
249 core.PuregoSafeRegister(&xFlagsCompleteTypeInfo, libs, "g_flags_complete_type_info")
250 core.PuregoSafeRegister(&xFlagsGetFirstValue, libs, "g_flags_get_first_value")
251 core.PuregoSafeRegister(&xFlagsGetValueByName, libs, "g_flags_get_value_by_name")
252 core.PuregoSafeRegister(&xFlagsGetValueByNick, libs, "g_flags_get_value_by_nick")
253 core.PuregoSafeRegister(&xFlagsRegisterStatic, libs, "g_flags_register_static")
254 core.PuregoSafeRegister(&xFlagsToString, libs, "g_flags_to_string")
255
256}