1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/gobject"
9 "github.com/bnema/puregotk/v4/gobject/types"
10)
11
12// Preserves the aspect ratio of its child.
13//
14// The frame can respect the aspect ratio of the child widget,
15// or use its own aspect ratio.
16//
17// # CSS nodes
18//
19// `GtkAspectFrame` uses a CSS node with name `aspectframe`.
20//
21// # Accessibility
22//
23// Until GTK 4.10, `GtkAspectFrame` used the [enum@Gtk.AccessibleRole.group] role.
24//
25// Starting from GTK 4.12, `GtkAspectFrame` uses the [enum@Gtk.AccessibleRole.generic] role.
26type AspectFrame struct {
27 Widget
28}
29
30var xAspectFrameGLibType func() types.GType
31
32func AspectFrameGLibType() types.GType {
33 return xAspectFrameGLibType()
34}
35
36func AspectFrameNewFromInternalPtr(ptr uintptr) *AspectFrame {
37 cls := &AspectFrame{}
38 cls.Ptr = ptr
39 return cls
40}
41
42var xNewAspectFrame func(float32, float32, float32, bool) uintptr
43
44// Create a new `GtkAspectFrame`.
45func NewAspectFrame(XalignVar float32, YalignVar float32, RatioVar float32, ObeyChildVar bool) *AspectFrame {
46 var cls *AspectFrame
47
48 cret := xNewAspectFrame(XalignVar, YalignVar, RatioVar, ObeyChildVar)
49
50 if cret == 0 {
51 return nil
52 }
53 gobject.IncreaseRef(cret)
54 cls = &AspectFrame{}
55 cls.Ptr = cret
56 return cls
57}
58
59var xAspectFrameGetChild func(uintptr) uintptr
60
61// Gets the child widget of @self.
62func (x *AspectFrame) GetChild() *Widget {
63 var cls *Widget
64
65 cret := xAspectFrameGetChild(x.GoPointer())
66
67 if cret == 0 {
68 return nil
69 }
70 gobject.IncreaseRef(cret)
71 cls = &Widget{}
72 cls.Ptr = cret
73 return cls
74}
75
76var xAspectFrameGetObeyChild func(uintptr) bool
77
78// Returns whether the child's size request should override
79// the set aspect ratio of the `GtkAspectFrame`.
80func (x *AspectFrame) GetObeyChild() bool {
81
82 cret := xAspectFrameGetObeyChild(x.GoPointer())
83 return cret
84}
85
86var xAspectFrameGetRatio func(uintptr) float32
87
88// Returns the desired aspect ratio of the child.
89func (x *AspectFrame) GetRatio() float32 {
90
91 cret := xAspectFrameGetRatio(x.GoPointer())
92 return cret
93}
94
95var xAspectFrameGetXalign func(uintptr) float32
96
97// Returns the horizontal alignment of the child within the
98// allocation of the `GtkAspectFrame`.
99func (x *AspectFrame) GetXalign() float32 {
100
101 cret := xAspectFrameGetXalign(x.GoPointer())
102 return cret
103}
104
105var xAspectFrameGetYalign func(uintptr) float32
106
107// Returns the vertical alignment of the child within the
108// allocation of the `GtkAspectFrame`.
109func (x *AspectFrame) GetYalign() float32 {
110
111 cret := xAspectFrameGetYalign(x.GoPointer())
112 return cret
113}
114
115var xAspectFrameSetChild func(uintptr, uintptr)
116
117// Sets the child widget of @self.
118func (x *AspectFrame) SetChild(ChildVar *Widget) {
119
120 xAspectFrameSetChild(x.GoPointer(), ChildVar.GoPointer())
121
122}
123
124var xAspectFrameSetObeyChild func(uintptr, bool)
125
126// Sets whether the aspect ratio of the child's size
127// request should override the set aspect ratio of
128// the `GtkAspectFrame`.
129func (x *AspectFrame) SetObeyChild(ObeyChildVar bool) {
130
131 xAspectFrameSetObeyChild(x.GoPointer(), ObeyChildVar)
132
133}
134
135var xAspectFrameSetRatio func(uintptr, float32)
136
137// Sets the desired aspect ratio of the child.
138func (x *AspectFrame) SetRatio(RatioVar float32) {
139
140 xAspectFrameSetRatio(x.GoPointer(), RatioVar)
141
142}
143
144var xAspectFrameSetXalign func(uintptr, float32)
145
146// Sets the horizontal alignment of the child within the allocation
147// of the `GtkAspectFrame`.
148func (x *AspectFrame) SetXalign(XalignVar float32) {
149
150 xAspectFrameSetXalign(x.GoPointer(), XalignVar)
151
152}
153
154var xAspectFrameSetYalign func(uintptr, float32)
155
156// Sets the vertical alignment of the child within the allocation
157// of the `GtkAspectFrame`.
158func (x *AspectFrame) SetYalign(YalignVar float32) {
159
160 xAspectFrameSetYalign(x.GoPointer(), YalignVar)
161
162}
163
164func (c *AspectFrame) GoPointer() uintptr {
165 if c == nil {
166 return 0
167 }
168 return c.Ptr
169}
170
171func (c *AspectFrame) SetGoPointer(ptr uintptr) {
172 c.Ptr = ptr
173}
174
175// SetPropertyObeyChild sets the "obey-child" property.
176// Whether the `GtkAspectFrame` should use the aspect ratio of its child.
177func (x *AspectFrame) SetPropertyObeyChild(value bool) {
178 var v gobject.Value
179 v.Init(gobject.TypeBooleanVal)
180 v.SetBoolean(value)
181 x.SetProperty("obey-child", &v)
182}
183
184// GetPropertyObeyChild gets the "obey-child" property.
185// Whether the `GtkAspectFrame` should use the aspect ratio of its child.
186func (x *AspectFrame) GetPropertyObeyChild() bool {
187 var v gobject.Value
188 x.GetProperty("obey-child", &v)
189 return v.GetBoolean()
190}
191
192// SetPropertyRatio sets the "ratio" property.
193// The aspect ratio to be used by the `GtkAspectFrame`.
194//
195// This property is only used if
196// [property@Gtk.AspectFrame:obey-child] is set to %FALSE.
197func (x *AspectFrame) SetPropertyRatio(value float32) {
198 var v gobject.Value
199 v.Init(gobject.TypeFloatVal)
200 v.SetFloat(value)
201 x.SetProperty("ratio", &v)
202}
203
204// GetPropertyRatio gets the "ratio" property.
205// The aspect ratio to be used by the `GtkAspectFrame`.
206//
207// This property is only used if
208// [property@Gtk.AspectFrame:obey-child] is set to %FALSE.
209func (x *AspectFrame) GetPropertyRatio() float32 {
210 var v gobject.Value
211 x.GetProperty("ratio", &v)
212 return v.GetFloat()
213}
214
215// SetPropertyXalign sets the "xalign" property.
216// The horizontal alignment of the child.
217func (x *AspectFrame) SetPropertyXalign(value float32) {
218 var v gobject.Value
219 v.Init(gobject.TypeFloatVal)
220 v.SetFloat(value)
221 x.SetProperty("xalign", &v)
222}
223
224// GetPropertyXalign gets the "xalign" property.
225// The horizontal alignment of the child.
226func (x *AspectFrame) GetPropertyXalign() float32 {
227 var v gobject.Value
228 x.GetProperty("xalign", &v)
229 return v.GetFloat()
230}
231
232// SetPropertyYalign sets the "yalign" property.
233// The vertical alignment of the child.
234func (x *AspectFrame) SetPropertyYalign(value float32) {
235 var v gobject.Value
236 v.Init(gobject.TypeFloatVal)
237 v.SetFloat(value)
238 x.SetProperty("yalign", &v)
239}
240
241// GetPropertyYalign gets the "yalign" property.
242// The vertical alignment of the child.
243func (x *AspectFrame) GetPropertyYalign() float32 {
244 var v gobject.Value
245 x.GetProperty("yalign", &v)
246 return v.GetFloat()
247}
248
249// Requests the user's screen reader to announce the given message.
250//
251// This kind of notification is useful for messages that
252// either have only a visual representation or that are not
253// exposed visually at all, e.g. a notification about a
254// successful operation.
255//
256// Also, by using this API, you can ensure that the message
257// does not interrupts the user's current screen reader output.
258func (x *AspectFrame) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
259
260 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
261
262}
263
264// Retrieves the accessible parent for an accessible object.
265//
266// This function returns `NULL` for top level widgets.
267func (x *AspectFrame) GetAccessibleParent() *AccessibleBase {
268 var cls *AccessibleBase
269
270 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
271
272 if cret == 0 {
273 return nil
274 }
275 cls = &AccessibleBase{}
276 cls.Ptr = cret
277 return cls
278}
279
280// Retrieves the accessible role of an accessible object.
281func (x *AspectFrame) GetAccessibleRole() AccessibleRole {
282
283 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
284 return cret
285}
286
287// Retrieves the implementation for the given accessible object.
288func (x *AspectFrame) GetAtContext() *ATContext {
289 var cls *ATContext
290
291 cret := XGtkAccessibleGetAtContext(x.GoPointer())
292
293 if cret == 0 {
294 return nil
295 }
296 cls = &ATContext{}
297 cls.Ptr = cret
298 return cls
299}
300
301// Queries the coordinates and dimensions of this accessible
302//
303// This functionality can be overridden by `GtkAccessible`
304// implementations, e.g. to get the bounds from an ignored
305// child widget.
306func (x *AspectFrame) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
307
308 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
309 return cret
310}
311
312// Retrieves the first accessible child of an accessible object.
313func (x *AspectFrame) GetFirstAccessibleChild() *AccessibleBase {
314 var cls *AccessibleBase
315
316 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
317
318 if cret == 0 {
319 return nil
320 }
321 cls = &AccessibleBase{}
322 cls.Ptr = cret
323 return cls
324}
325
326// Retrieves the next accessible sibling of an accessible object
327func (x *AspectFrame) GetNextAccessibleSibling() *AccessibleBase {
328 var cls *AccessibleBase
329
330 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
331
332 if cret == 0 {
333 return nil
334 }
335 cls = &AccessibleBase{}
336 cls.Ptr = cret
337 return cls
338}
339
340// Queries a platform state, such as focus.
341//
342// This functionality can be overridden by `GtkAccessible`
343// implementations, e.g. to get platform state from an ignored
344// child widget, as is the case for `GtkText` wrappers.
345func (x *AspectFrame) GetPlatformState(StateVar AccessiblePlatformState) bool {
346
347 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
348 return cret
349}
350
351// Resets the accessible property to its default value.
352func (x *AspectFrame) ResetProperty(PropertyVar AccessibleProperty) {
353
354 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
355
356}
357
358// Resets the accessible relation to its default value.
359func (x *AspectFrame) ResetRelation(RelationVar AccessibleRelation) {
360
361 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
362
363}
364
365// Resets the accessible state to its default value.
366func (x *AspectFrame) ResetState(StateVar AccessibleState) {
367
368 XGtkAccessibleResetState(x.GoPointer(), StateVar)
369
370}
371
372// Sets the parent and sibling of an accessible object.
373//
374// This function is meant to be used by accessible implementations that are
375// not part of the widget hierarchy, and but act as a logical bridge between
376// widgets. For instance, if a widget creates an object that holds metadata
377// for each child, and you want that object to implement the `GtkAccessible`
378// interface, you will use this function to ensure that the parent of each
379// child widget is the metadata object, and the parent of each metadata
380// object is the container widget.
381func (x *AspectFrame) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
382
383 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
384
385}
386
387// Updates the next accessible sibling.
388//
389// That might be useful when a new child of a custom accessible
390// is created, and it needs to be linked to a previous child.
391func (x *AspectFrame) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
392
393 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
394
395}
396
397// Informs ATs that the platform state has changed.
398//
399// This function should be used by `GtkAccessible` implementations that
400// have a platform state but are not widgets. Widgets handle platform
401// states automatically.
402func (x *AspectFrame) UpdatePlatformState(StateVar AccessiblePlatformState) {
403
404 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
405
406}
407
408// Updates a list of accessible properties.
409//
410// See the [enum@Gtk.AccessibleProperty] documentation for the
411// value types of accessible properties.
412//
413// This function should be called by `GtkWidget` types whenever
414// an accessible property change must be communicated to assistive
415// technologies.
416//
417// Example:
418// ```c
419// value = gtk_adjustment_get_value (adjustment);
420// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
421//
422// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
423// -1);
424//
425// ```
426func (x *AspectFrame) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
427
428 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
429
430}
431
432// Updates an array of accessible properties.
433//
434// This function should be called by `GtkWidget` types whenever an accessible
435// property change must be communicated to assistive technologies.
436//
437// This function is meant to be used by language bindings.
438func (x *AspectFrame) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
439
440 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
441
442}
443
444// Updates a list of accessible relations.
445//
446// This function should be called by `GtkWidget` types whenever an accessible
447// relation change must be communicated to assistive technologies.
448//
449// If the [enum@Gtk.AccessibleRelation] requires a list of references,
450// you should pass each reference individually, followed by `NULL`, e.g.
451//
452// ```c
453// gtk_accessible_update_relation (accessible,
454//
455// GTK_ACCESSIBLE_RELATION_CONTROLS,
456// ref1, NULL,
457// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
458// ref1, ref2, ref3, NULL,
459// -1);
460//
461// ```
462func (x *AspectFrame) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
463
464 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
465
466}
467
468// Updates an array of accessible relations.
469//
470// This function should be called by `GtkWidget` types whenever an accessible
471// relation change must be communicated to assistive technologies.
472//
473// This function is meant to be used by language bindings.
474func (x *AspectFrame) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
475
476 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
477
478}
479
480// Updates a list of accessible states.
481//
482// See the [enum@Gtk.AccessibleState] documentation for the
483// value types of accessible states.
484//
485// This function should be called by `GtkWidget` types whenever
486// an accessible state change must be communicated to assistive
487// technologies.
488//
489// Example:
490//
491// ```c
492// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
493// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
494//
495// GTK_ACCESSIBLE_STATE_CHECKED, value,
496// -1);
497//
498// ```
499func (x *AspectFrame) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
500
501 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
502
503}
504
505// Updates an array of accessible states.
506//
507// This function should be called by `GtkWidget` types whenever an accessible
508// state change must be communicated to assistive technologies.
509//
510// This function is meant to be used by language bindings.
511func (x *AspectFrame) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
512
513 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
514
515}
516
517// Gets the ID of the @buildable object.
518//
519// `GtkBuilder` sets the name based on the ID attribute
520// of the `<object>` tag used to construct the @buildable.
521func (x *AspectFrame) GetBuildableId() string {
522
523 cret := XGtkBuildableGetBuildableId(x.GoPointer())
524 return cret
525}
526
527func init() {
528 core.SetPackageName("GTK", "gtk4")
529 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
530 var libs []uintptr
531 for _, libPath := range core.GetPaths("GTK") {
532 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
533 if err != nil {
534 panic(err)
535 }
536 libs = append(libs, lib)
537 }
538
539 core.PuregoSafeRegister(&xAspectFrameGLibType, libs, "gtk_aspect_frame_get_type")
540
541 core.PuregoSafeRegister(&xNewAspectFrame, libs, "gtk_aspect_frame_new")
542
543 core.PuregoSafeRegister(&xAspectFrameGetChild, libs, "gtk_aspect_frame_get_child")
544 core.PuregoSafeRegister(&xAspectFrameGetObeyChild, libs, "gtk_aspect_frame_get_obey_child")
545 core.PuregoSafeRegister(&xAspectFrameGetRatio, libs, "gtk_aspect_frame_get_ratio")
546 core.PuregoSafeRegister(&xAspectFrameGetXalign, libs, "gtk_aspect_frame_get_xalign")
547 core.PuregoSafeRegister(&xAspectFrameGetYalign, libs, "gtk_aspect_frame_get_yalign")
548 core.PuregoSafeRegister(&xAspectFrameSetChild, libs, "gtk_aspect_frame_set_child")
549 core.PuregoSafeRegister(&xAspectFrameSetObeyChild, libs, "gtk_aspect_frame_set_obey_child")
550 core.PuregoSafeRegister(&xAspectFrameSetRatio, libs, "gtk_aspect_frame_set_ratio")
551 core.PuregoSafeRegister(&xAspectFrameSetXalign, libs, "gtk_aspect_frame_set_xalign")
552 core.PuregoSafeRegister(&xAspectFrameSetYalign, libs, "gtk_aspect_frame_set_yalign")
553
554}