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 "github.com/bnema/puregotk/v4/gsk"
14)
15
16type FixedClass struct {
17 _ structs.HostLayout
18
19 ParentClass WidgetClass
20
21 Padding [8]uintptr
22}
23
24func (x *FixedClass) GoPointer() uintptr {
25 return uintptr(unsafe.Pointer(x))
26}
27
28// Places its child widgets at fixed positions and with fixed sizes.
29//
30// `GtkFixed` performs no automatic layout management.
31//
32// For most applications, you should not use this container! It keeps
33// you from having to learn about the other GTK containers, but it
34// results in broken applications. With `GtkFixed`, the following
35// things will result in truncated text, overlapping widgets, and
36// other display bugs:
37//
38// - Themes, which may change widget sizes.
39//
40// - Fonts other than the one you used to write the app will of course
41// change the size of widgets containing text; keep in mind that
42// users may use a larger font because of difficulty reading the
43// default, or they may be using a different OS that provides different fonts.
44//
45// - Translation of text into other languages changes its size. Also,
46// display of non-English text will use a different font in many
47// cases.
48//
49// In addition, `GtkFixed` does not pay attention to text direction and
50// thus may produce unwanted results if your app is run under right-to-left
51// languages such as Hebrew or Arabic. That is: normally GTK will order
52// containers appropriately for the text direction, e.g. to put labels to
53// the right of the thing they label when using an RTL language, but it can’t
54// do that with `GtkFixed`. So if you need to reorder widgets depending on
55// the text direction, you would need to manually detect it and adjust child
56// positions accordingly.
57//
58// Finally, fixed positioning makes it kind of annoying to add/remove
59// UI elements, since you have to reposition all the other elements. This
60// is a long-term maintenance problem for your application.
61//
62// If you know none of these things are an issue for your application,
63// and prefer the simplicity of `GtkFixed`, by all means use the
64// widget. But you should be aware of the tradeoffs.
65type Fixed struct {
66 Widget
67}
68
69var xFixedGLibType func() types.GType
70
71func FixedGLibType() types.GType {
72 return xFixedGLibType()
73}
74
75func FixedNewFromInternalPtr(ptr uintptr) *Fixed {
76 cls := &Fixed{}
77 cls.Ptr = ptr
78 return cls
79}
80
81var xNewFixed func() uintptr
82
83// Creates a new `GtkFixed`.
84func NewFixed() *Fixed {
85 var cls *Fixed
86
87 cret := xNewFixed()
88
89 if cret == 0 {
90 return nil
91 }
92 gobject.IncreaseRef(cret)
93 cls = &Fixed{}
94 cls.Ptr = cret
95 return cls
96}
97
98var xFixedGetChildPosition func(uintptr, uintptr, *float64, *float64)
99
100// Retrieves the translation transformation of the
101// given child `GtkWidget` in the `GtkFixed`.
102//
103// See also: [method@Gtk.Fixed.get_child_transform].
104func (x *Fixed) GetChildPosition(WidgetVar *Widget, XVar *float64, YVar *float64) {
105
106 xFixedGetChildPosition(x.GoPointer(), WidgetVar.GoPointer(), XVar, YVar)
107
108}
109
110var xFixedGetChildTransform func(uintptr, uintptr) *gsk.Transform
111
112// Retrieves the transformation for @widget set using
113// gtk_fixed_set_child_transform().
114func (x *Fixed) GetChildTransform(WidgetVar *Widget) *gsk.Transform {
115
116 cret := xFixedGetChildTransform(x.GoPointer(), WidgetVar.GoPointer())
117 return cret
118}
119
120var xFixedMove func(uintptr, uintptr, float64, float64)
121
122// Sets a translation transformation to the given @x and @y
123// coordinates to the child @widget of the `GtkFixed`.
124func (x *Fixed) Move(WidgetVar *Widget, XVar float64, YVar float64) {
125
126 xFixedMove(x.GoPointer(), WidgetVar.GoPointer(), XVar, YVar)
127
128}
129
130var xFixedPut func(uintptr, uintptr, float64, float64)
131
132// Adds a widget to a `GtkFixed` at the given position.
133func (x *Fixed) Put(WidgetVar *Widget, XVar float64, YVar float64) {
134
135 xFixedPut(x.GoPointer(), WidgetVar.GoPointer(), XVar, YVar)
136
137}
138
139var xFixedRemove func(uintptr, uintptr)
140
141// Removes a child from @fixed.
142func (x *Fixed) Remove(WidgetVar *Widget) {
143
144 xFixedRemove(x.GoPointer(), WidgetVar.GoPointer())
145
146}
147
148var xFixedSetChildTransform func(uintptr, uintptr, *gsk.Transform)
149
150// Sets the transformation for @widget.
151//
152// This is a convenience function that retrieves the
153// [class@Gtk.FixedLayoutChild] instance associated to
154// @widget and calls [method@Gtk.FixedLayoutChild.set_transform].
155func (x *Fixed) SetChildTransform(WidgetVar *Widget, TransformVar *gsk.Transform) {
156
157 xFixedSetChildTransform(x.GoPointer(), WidgetVar.GoPointer(), TransformVar)
158
159}
160
161func (c *Fixed) GoPointer() uintptr {
162 if c == nil {
163 return 0
164 }
165 return c.Ptr
166}
167
168func (c *Fixed) SetGoPointer(ptr uintptr) {
169 c.Ptr = ptr
170}
171
172// Requests the user's screen reader to announce the given message.
173//
174// This kind of notification is useful for messages that
175// either have only a visual representation or that are not
176// exposed visually at all, e.g. a notification about a
177// successful operation.
178//
179// Also, by using this API, you can ensure that the message
180// does not interrupts the user's current screen reader output.
181func (x *Fixed) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
182
183 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
184
185}
186
187// Retrieves the accessible parent for an accessible object.
188//
189// This function returns `NULL` for top level widgets.
190func (x *Fixed) GetAccessibleParent() *AccessibleBase {
191 var cls *AccessibleBase
192
193 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
194
195 if cret == 0 {
196 return nil
197 }
198 cls = &AccessibleBase{}
199 cls.Ptr = cret
200 return cls
201}
202
203// Retrieves the accessible role of an accessible object.
204func (x *Fixed) GetAccessibleRole() AccessibleRole {
205
206 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
207 return cret
208}
209
210// Retrieves the implementation for the given accessible object.
211func (x *Fixed) GetAtContext() *ATContext {
212 var cls *ATContext
213
214 cret := XGtkAccessibleGetAtContext(x.GoPointer())
215
216 if cret == 0 {
217 return nil
218 }
219 cls = &ATContext{}
220 cls.Ptr = cret
221 return cls
222}
223
224// Queries the coordinates and dimensions of this accessible
225//
226// This functionality can be overridden by `GtkAccessible`
227// implementations, e.g. to get the bounds from an ignored
228// child widget.
229func (x *Fixed) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
230
231 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
232 return cret
233}
234
235// Retrieves the first accessible child of an accessible object.
236func (x *Fixed) GetFirstAccessibleChild() *AccessibleBase {
237 var cls *AccessibleBase
238
239 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
240
241 if cret == 0 {
242 return nil
243 }
244 cls = &AccessibleBase{}
245 cls.Ptr = cret
246 return cls
247}
248
249// Retrieves the next accessible sibling of an accessible object
250func (x *Fixed) GetNextAccessibleSibling() *AccessibleBase {
251 var cls *AccessibleBase
252
253 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
254
255 if cret == 0 {
256 return nil
257 }
258 cls = &AccessibleBase{}
259 cls.Ptr = cret
260 return cls
261}
262
263// Queries a platform state, such as focus.
264//
265// This functionality can be overridden by `GtkAccessible`
266// implementations, e.g. to get platform state from an ignored
267// child widget, as is the case for `GtkText` wrappers.
268func (x *Fixed) GetPlatformState(StateVar AccessiblePlatformState) bool {
269
270 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
271 return cret
272}
273
274// Resets the accessible property to its default value.
275func (x *Fixed) ResetProperty(PropertyVar AccessibleProperty) {
276
277 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
278
279}
280
281// Resets the accessible relation to its default value.
282func (x *Fixed) ResetRelation(RelationVar AccessibleRelation) {
283
284 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
285
286}
287
288// Resets the accessible state to its default value.
289func (x *Fixed) ResetState(StateVar AccessibleState) {
290
291 XGtkAccessibleResetState(x.GoPointer(), StateVar)
292
293}
294
295// Sets the parent and sibling of an accessible object.
296//
297// This function is meant to be used by accessible implementations that are
298// not part of the widget hierarchy, and but act as a logical bridge between
299// widgets. For instance, if a widget creates an object that holds metadata
300// for each child, and you want that object to implement the `GtkAccessible`
301// interface, you will use this function to ensure that the parent of each
302// child widget is the metadata object, and the parent of each metadata
303// object is the container widget.
304func (x *Fixed) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
305
306 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
307
308}
309
310// Updates the next accessible sibling.
311//
312// That might be useful when a new child of a custom accessible
313// is created, and it needs to be linked to a previous child.
314func (x *Fixed) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
315
316 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
317
318}
319
320// Informs ATs that the platform state has changed.
321//
322// This function should be used by `GtkAccessible` implementations that
323// have a platform state but are not widgets. Widgets handle platform
324// states automatically.
325func (x *Fixed) UpdatePlatformState(StateVar AccessiblePlatformState) {
326
327 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
328
329}
330
331// Updates a list of accessible properties.
332//
333// See the [enum@Gtk.AccessibleProperty] documentation for the
334// value types of accessible properties.
335//
336// This function should be called by `GtkWidget` types whenever
337// an accessible property change must be communicated to assistive
338// technologies.
339//
340// Example:
341// ```c
342// value = gtk_adjustment_get_value (adjustment);
343// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
344//
345// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
346// -1);
347//
348// ```
349func (x *Fixed) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
350
351 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
352
353}
354
355// Updates an array of accessible properties.
356//
357// This function should be called by `GtkWidget` types whenever an accessible
358// property change must be communicated to assistive technologies.
359//
360// This function is meant to be used by language bindings.
361func (x *Fixed) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
362
363 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
364
365}
366
367// Updates a list of accessible relations.
368//
369// This function should be called by `GtkWidget` types whenever an accessible
370// relation change must be communicated to assistive technologies.
371//
372// If the [enum@Gtk.AccessibleRelation] requires a list of references,
373// you should pass each reference individually, followed by `NULL`, e.g.
374//
375// ```c
376// gtk_accessible_update_relation (accessible,
377//
378// GTK_ACCESSIBLE_RELATION_CONTROLS,
379// ref1, NULL,
380// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
381// ref1, ref2, ref3, NULL,
382// -1);
383//
384// ```
385func (x *Fixed) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
386
387 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
388
389}
390
391// Updates an array of accessible relations.
392//
393// This function should be called by `GtkWidget` types whenever an accessible
394// relation change must be communicated to assistive technologies.
395//
396// This function is meant to be used by language bindings.
397func (x *Fixed) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
398
399 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
400
401}
402
403// Updates a list of accessible states.
404//
405// See the [enum@Gtk.AccessibleState] documentation for the
406// value types of accessible states.
407//
408// This function should be called by `GtkWidget` types whenever
409// an accessible state change must be communicated to assistive
410// technologies.
411//
412// Example:
413//
414// ```c
415// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
416// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
417//
418// GTK_ACCESSIBLE_STATE_CHECKED, value,
419// -1);
420//
421// ```
422func (x *Fixed) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
423
424 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
425
426}
427
428// Updates an array of accessible states.
429//
430// This function should be called by `GtkWidget` types whenever an accessible
431// state change must be communicated to assistive technologies.
432//
433// This function is meant to be used by language bindings.
434func (x *Fixed) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
435
436 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
437
438}
439
440// Gets the ID of the @buildable object.
441//
442// `GtkBuilder` sets the name based on the ID attribute
443// of the `<object>` tag used to construct the @buildable.
444func (x *Fixed) GetBuildableId() string {
445
446 cret := XGtkBuildableGetBuildableId(x.GoPointer())
447 return cret
448}
449
450func init() {
451 core.SetPackageName("GTK", "gtk4")
452 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
453 var libs []uintptr
454 for _, libPath := range core.GetPaths("GTK") {
455 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
456 if err != nil {
457 panic(err)
458 }
459 libs = append(libs, lib)
460 }
461
462 core.PuregoSafeRegister(&xFixedGLibType, libs, "gtk_fixed_get_type")
463
464 core.PuregoSafeRegister(&xNewFixed, libs, "gtk_fixed_new")
465
466 core.PuregoSafeRegister(&xFixedGetChildPosition, libs, "gtk_fixed_get_child_position")
467 core.PuregoSafeRegister(&xFixedGetChildTransform, libs, "gtk_fixed_get_child_transform")
468 core.PuregoSafeRegister(&xFixedMove, libs, "gtk_fixed_move")
469 core.PuregoSafeRegister(&xFixedPut, libs, "gtk_fixed_put")
470 core.PuregoSafeRegister(&xFixedRemove, libs, "gtk_fixed_remove")
471 core.PuregoSafeRegister(&xFixedSetChildTransform, libs, "gtk_fixed_set_child_transform")
472
473}