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)
14
15type FrameClass struct {
16 _ structs.HostLayout
17
18 ParentClass WidgetClass
19
20 xComputeChildAllocation uintptr
21
22 Padding [8]uintptr
23}
24
25func (x *FrameClass) GoPointer() uintptr {
26 return uintptr(unsafe.Pointer(x))
27}
28
29// OverrideComputeChildAllocation sets the "compute_child_allocation" callback function.
30func (x *FrameClass) OverrideComputeChildAllocation(cb func(*Frame, *Allocation)) {
31 if cb == nil {
32 x.xComputeChildAllocation = 0
33 } else {
34 x.xComputeChildAllocation = purego.NewCallback(func(FrameVarp uintptr, AllocationVarp *Allocation) {
35 cb(FrameNewFromInternalPtr(FrameVarp), AllocationVarp)
36 })
37 }
38}
39
40// GetComputeChildAllocation gets the "compute_child_allocation" callback function.
41func (x *FrameClass) GetComputeChildAllocation() func(*Frame, *Allocation) {
42 if x.xComputeChildAllocation == 0 {
43 return nil
44 }
45 var rawCallback func(FrameVarp uintptr, AllocationVarp *Allocation)
46 purego.RegisterFunc(&rawCallback, x.xComputeChildAllocation)
47 return func(FrameVar *Frame, AllocationVar *Allocation) {
48 rawCallback(FrameVar.GoPointer(), AllocationVar)
49 }
50}
51
52// Surrounds its child with a decorative frame and an optional label.
53//
54// <picture>
55//
56// <source srcset="frame-dark.png" media="(prefers-color-scheme: dark)">
57// <img alt="An example GtkFrame" src="frame.png">
58//
59// </picture>
60//
61// If present, the label is drawn inside the top edge of the frame.
62// The horizontal position of the label can be controlled with
63// [method@Gtk.Frame.set_label_align].
64//
65// `GtkFrame` clips its child. You can use this to add rounded corners
66// to widgets, but be aware that it also cuts off shadows.
67//
68// # GtkFrame as GtkBuildable
69//
70// An example of a UI definition fragment with GtkFrame:
71//
72// ```xml
73// <object class="GtkFrame">
74//
75// <property name="label-widget">
76// <object class="GtkLabel" id="frame_label"/>
77// </property>
78// <property name="child">
79// <object class="GtkEntry" id="frame_content"/>
80// </property>
81//
82// </object>
83// ```
84//
85// # CSS nodes
86//
87// ```
88// frame
89// ├── <label widget>
90// ╰── <child>
91// ```
92//
93// `GtkFrame` has a main CSS node with name “frame”, which is used to draw the
94// visible border. You can set the appearance of the border using CSS properties
95// like “border-style” on this node.
96//
97// # Accessibility
98//
99// `GtkFrame` uses the [enum@Gtk.AccessibleRole.group] role.
100type Frame struct {
101 Widget
102}
103
104var xFrameGLibType func() types.GType
105
106func FrameGLibType() types.GType {
107 return xFrameGLibType()
108}
109
110func FrameNewFromInternalPtr(ptr uintptr) *Frame {
111 cls := &Frame{}
112 cls.Ptr = ptr
113 return cls
114}
115
116var xNewFrame func(uintptr) uintptr
117
118// Creates a new `GtkFrame`, with optional label @label.
119//
120// If @label is %NULL, the label is omitted.
121func NewFrame(LabelVar *string) *Frame {
122 var cls *Frame
123
124 LabelVarPtr := core.GStrdupNullable(LabelVar)
125 defer core.GFreeNullable(LabelVarPtr)
126
127 cret := xNewFrame(LabelVarPtr)
128
129 if cret == 0 {
130 return nil
131 }
132 gobject.IncreaseRef(cret)
133 cls = &Frame{}
134 cls.Ptr = cret
135 return cls
136}
137
138var xFrameGetChild func(uintptr) uintptr
139
140// Gets the child widget of @frame.
141func (x *Frame) GetChild() *Widget {
142 var cls *Widget
143
144 cret := xFrameGetChild(x.GoPointer())
145
146 if cret == 0 {
147 return nil
148 }
149 gobject.IncreaseRef(cret)
150 cls = &Widget{}
151 cls.Ptr = cret
152 return cls
153}
154
155var xFrameGetLabel func(uintptr) string
156
157// Returns the frame labels text.
158//
159// If the frame's label widget is not a `GtkLabel`, %NULL
160// is returned.
161func (x *Frame) GetLabel() string {
162
163 cret := xFrameGetLabel(x.GoPointer())
164 return cret
165}
166
167var xFrameGetLabelAlign func(uintptr) float32
168
169// Retrieves the X alignment of the frame’s label.
170func (x *Frame) GetLabelAlign() float32 {
171
172 cret := xFrameGetLabelAlign(x.GoPointer())
173 return cret
174}
175
176var xFrameGetLabelWidget func(uintptr) uintptr
177
178// Retrieves the label widget for the frame.
179func (x *Frame) GetLabelWidget() *Widget {
180 var cls *Widget
181
182 cret := xFrameGetLabelWidget(x.GoPointer())
183
184 if cret == 0 {
185 return nil
186 }
187 gobject.IncreaseRef(cret)
188 cls = &Widget{}
189 cls.Ptr = cret
190 return cls
191}
192
193var xFrameSetChild func(uintptr, uintptr)
194
195// Sets the child widget of @frame.
196func (x *Frame) SetChild(ChildVar *Widget) {
197
198 xFrameSetChild(x.GoPointer(), ChildVar.GoPointer())
199
200}
201
202var xFrameSetLabel func(uintptr, uintptr)
203
204// Creates a new `GtkLabel` with the @label and sets it as the frame's
205// label widget.
206func (x *Frame) SetLabel(LabelVar *string) {
207
208 LabelVarPtr := core.GStrdupNullable(LabelVar)
209 defer core.GFreeNullable(LabelVarPtr)
210
211 xFrameSetLabel(x.GoPointer(), LabelVarPtr)
212
213}
214
215var xFrameSetLabelAlign func(uintptr, float32)
216
217// Sets the X alignment of the frame widget’s label.
218//
219// The default value for a newly created frame is 0.0.
220func (x *Frame) SetLabelAlign(XalignVar float32) {
221
222 xFrameSetLabelAlign(x.GoPointer(), XalignVar)
223
224}
225
226var xFrameSetLabelWidget func(uintptr, uintptr)
227
228// Sets the label widget for the frame.
229//
230// This is the widget that will appear embedded in the top edge
231// of the frame as a title.
232func (x *Frame) SetLabelWidget(LabelWidgetVar *Widget) {
233
234 xFrameSetLabelWidget(x.GoPointer(), LabelWidgetVar.GoPointer())
235
236}
237
238func (c *Frame) GoPointer() uintptr {
239 if c == nil {
240 return 0
241 }
242 return c.Ptr
243}
244
245func (c *Frame) SetGoPointer(ptr uintptr) {
246 c.Ptr = ptr
247}
248
249// SetPropertyLabel sets the "label" property.
250// Text of the frame's label.
251func (x *Frame) SetPropertyLabel(value string) {
252 var v gobject.Value
253 v.Init(gobject.TypeStringVal)
254 v.SetString(&value)
255 x.SetProperty("label", &v)
256}
257
258// GetPropertyLabel gets the "label" property.
259// Text of the frame's label.
260func (x *Frame) GetPropertyLabel() string {
261 var v gobject.Value
262 x.GetProperty("label", &v)
263 return v.GetString()
264}
265
266// SetPropertyLabelXalign sets the "label-xalign" property.
267// The horizontal alignment of the label.
268func (x *Frame) SetPropertyLabelXalign(value float32) {
269 var v gobject.Value
270 v.Init(gobject.TypeFloatVal)
271 v.SetFloat(value)
272 x.SetProperty("label-xalign", &v)
273}
274
275// GetPropertyLabelXalign gets the "label-xalign" property.
276// The horizontal alignment of the label.
277func (x *Frame) GetPropertyLabelXalign() float32 {
278 var v gobject.Value
279 x.GetProperty("label-xalign", &v)
280 return v.GetFloat()
281}
282
283// Requests the user's screen reader to announce the given message.
284//
285// This kind of notification is useful for messages that
286// either have only a visual representation or that are not
287// exposed visually at all, e.g. a notification about a
288// successful operation.
289//
290// Also, by using this API, you can ensure that the message
291// does not interrupts the user's current screen reader output.
292func (x *Frame) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
293
294 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
295
296}
297
298// Retrieves the accessible parent for an accessible object.
299//
300// This function returns `NULL` for top level widgets.
301func (x *Frame) GetAccessibleParent() *AccessibleBase {
302 var cls *AccessibleBase
303
304 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
305
306 if cret == 0 {
307 return nil
308 }
309 cls = &AccessibleBase{}
310 cls.Ptr = cret
311 return cls
312}
313
314// Retrieves the accessible role of an accessible object.
315func (x *Frame) GetAccessibleRole() AccessibleRole {
316
317 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
318 return cret
319}
320
321// Retrieves the implementation for the given accessible object.
322func (x *Frame) GetAtContext() *ATContext {
323 var cls *ATContext
324
325 cret := XGtkAccessibleGetAtContext(x.GoPointer())
326
327 if cret == 0 {
328 return nil
329 }
330 cls = &ATContext{}
331 cls.Ptr = cret
332 return cls
333}
334
335// Queries the coordinates and dimensions of this accessible
336//
337// This functionality can be overridden by `GtkAccessible`
338// implementations, e.g. to get the bounds from an ignored
339// child widget.
340func (x *Frame) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
341
342 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
343 return cret
344}
345
346// Retrieves the first accessible child of an accessible object.
347func (x *Frame) GetFirstAccessibleChild() *AccessibleBase {
348 var cls *AccessibleBase
349
350 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
351
352 if cret == 0 {
353 return nil
354 }
355 cls = &AccessibleBase{}
356 cls.Ptr = cret
357 return cls
358}
359
360// Retrieves the next accessible sibling of an accessible object
361func (x *Frame) GetNextAccessibleSibling() *AccessibleBase {
362 var cls *AccessibleBase
363
364 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
365
366 if cret == 0 {
367 return nil
368 }
369 cls = &AccessibleBase{}
370 cls.Ptr = cret
371 return cls
372}
373
374// Queries a platform state, such as focus.
375//
376// This functionality can be overridden by `GtkAccessible`
377// implementations, e.g. to get platform state from an ignored
378// child widget, as is the case for `GtkText` wrappers.
379func (x *Frame) GetPlatformState(StateVar AccessiblePlatformState) bool {
380
381 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
382 return cret
383}
384
385// Resets the accessible property to its default value.
386func (x *Frame) ResetProperty(PropertyVar AccessibleProperty) {
387
388 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
389
390}
391
392// Resets the accessible relation to its default value.
393func (x *Frame) ResetRelation(RelationVar AccessibleRelation) {
394
395 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
396
397}
398
399// Resets the accessible state to its default value.
400func (x *Frame) ResetState(StateVar AccessibleState) {
401
402 XGtkAccessibleResetState(x.GoPointer(), StateVar)
403
404}
405
406// Sets the parent and sibling of an accessible object.
407//
408// This function is meant to be used by accessible implementations that are
409// not part of the widget hierarchy, and but act as a logical bridge between
410// widgets. For instance, if a widget creates an object that holds metadata
411// for each child, and you want that object to implement the `GtkAccessible`
412// interface, you will use this function to ensure that the parent of each
413// child widget is the metadata object, and the parent of each metadata
414// object is the container widget.
415func (x *Frame) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
416
417 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
418
419}
420
421// Updates the next accessible sibling.
422//
423// That might be useful when a new child of a custom accessible
424// is created, and it needs to be linked to a previous child.
425func (x *Frame) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
426
427 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
428
429}
430
431// Informs ATs that the platform state has changed.
432//
433// This function should be used by `GtkAccessible` implementations that
434// have a platform state but are not widgets. Widgets handle platform
435// states automatically.
436func (x *Frame) UpdatePlatformState(StateVar AccessiblePlatformState) {
437
438 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
439
440}
441
442// Updates a list of accessible properties.
443//
444// See the [enum@Gtk.AccessibleProperty] documentation for the
445// value types of accessible properties.
446//
447// This function should be called by `GtkWidget` types whenever
448// an accessible property change must be communicated to assistive
449// technologies.
450//
451// Example:
452// ```c
453// value = gtk_adjustment_get_value (adjustment);
454// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
455//
456// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
457// -1);
458//
459// ```
460func (x *Frame) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
461
462 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
463
464}
465
466// Updates an array of accessible properties.
467//
468// This function should be called by `GtkWidget` types whenever an accessible
469// property change must be communicated to assistive technologies.
470//
471// This function is meant to be used by language bindings.
472func (x *Frame) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
473
474 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
475
476}
477
478// Updates a list of accessible relations.
479//
480// This function should be called by `GtkWidget` types whenever an accessible
481// relation change must be communicated to assistive technologies.
482//
483// If the [enum@Gtk.AccessibleRelation] requires a list of references,
484// you should pass each reference individually, followed by `NULL`, e.g.
485//
486// ```c
487// gtk_accessible_update_relation (accessible,
488//
489// GTK_ACCESSIBLE_RELATION_CONTROLS,
490// ref1, NULL,
491// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
492// ref1, ref2, ref3, NULL,
493// -1);
494//
495// ```
496func (x *Frame) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
497
498 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
499
500}
501
502// Updates an array of accessible relations.
503//
504// This function should be called by `GtkWidget` types whenever an accessible
505// relation change must be communicated to assistive technologies.
506//
507// This function is meant to be used by language bindings.
508func (x *Frame) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
509
510 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
511
512}
513
514// Updates a list of accessible states.
515//
516// See the [enum@Gtk.AccessibleState] documentation for the
517// value types of accessible states.
518//
519// This function should be called by `GtkWidget` types whenever
520// an accessible state change must be communicated to assistive
521// technologies.
522//
523// Example:
524//
525// ```c
526// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
527// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
528//
529// GTK_ACCESSIBLE_STATE_CHECKED, value,
530// -1);
531//
532// ```
533func (x *Frame) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
534
535 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
536
537}
538
539// Updates an array of accessible states.
540//
541// This function should be called by `GtkWidget` types whenever an accessible
542// state change must be communicated to assistive technologies.
543//
544// This function is meant to be used by language bindings.
545func (x *Frame) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
546
547 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
548
549}
550
551// Gets the ID of the @buildable object.
552//
553// `GtkBuilder` sets the name based on the ID attribute
554// of the `<object>` tag used to construct the @buildable.
555func (x *Frame) GetBuildableId() string {
556
557 cret := XGtkBuildableGetBuildableId(x.GoPointer())
558 return cret
559}
560
561func init() {
562 core.SetPackageName("GTK", "gtk4")
563 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
564 var libs []uintptr
565 for _, libPath := range core.GetPaths("GTK") {
566 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
567 if err != nil {
568 panic(err)
569 }
570 libs = append(libs, lib)
571 }
572
573 core.PuregoSafeRegister(&xFrameGLibType, libs, "gtk_frame_get_type")
574
575 core.PuregoSafeRegister(&xNewFrame, libs, "gtk_frame_new")
576
577 core.PuregoSafeRegister(&xFrameGetChild, libs, "gtk_frame_get_child")
578 core.PuregoSafeRegister(&xFrameGetLabel, libs, "gtk_frame_get_label")
579 core.PuregoSafeRegister(&xFrameGetLabelAlign, libs, "gtk_frame_get_label_align")
580 core.PuregoSafeRegister(&xFrameGetLabelWidget, libs, "gtk_frame_get_label_widget")
581 core.PuregoSafeRegister(&xFrameSetChild, libs, "gtk_frame_set_child")
582 core.PuregoSafeRegister(&xFrameSetLabel, libs, "gtk_frame_set_label")
583 core.PuregoSafeRegister(&xFrameSetLabelAlign, libs, "gtk_frame_set_label_align")
584 core.PuregoSafeRegister(&xFrameSetLabelWidget, libs, "gtk_frame_set_label_widget")
585
586}