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/gdk"
12 "github.com/bnema/puregotk/v4/gio"
13 "github.com/bnema/puregotk/v4/gobject"
14 "github.com/bnema/puregotk/v4/gobject/types"
15 "github.com/bnema/puregotk/v4/gsk"
16 "github.com/bnema/puregotk/v4/gtk"
17)
18
19type WindowClass struct {
20 _ structs.HostLayout
21
22 ParentClass gtk.WindowClass
23
24 Padding [4]uintptr
25}
26
27func (x *WindowClass) GoPointer() uintptr {
28 return uintptr(unsafe.Pointer(x))
29}
30
31// A freeform window.
32//
33// <picture>
34//
35// <source srcset="window-dark.png" media="(prefers-color-scheme: dark)">
36// <img src="window.png" alt="window">
37//
38// </picture>
39//
40// The `AdwWindow` widget is a subclass of [class@Gtk.Window] which has no
41// titlebar area. Instead, [class@ToolbarView] can be used together with
42// [class@HeaderBar] or [class@Gtk.HeaderBar] as follows:
43//
44// ```xml
45// <object class="AdwWindow">
46//
47// <property name="content">
48// <object class="AdwToolbarView">
49// <child type="top">
50// <object class="AdwHeaderBar"/>
51// </child>
52// <property name="content">
53// <!-- ... -->
54// </property>
55// </object>
56// </property>
57//
58// </object>
59// ```
60//
61// Using [property@Gtk.Window:titlebar] or [property@Gtk.Window:child]
62// is not supported and will result in a crash. Use [property@Window:content]
63// instead.
64//
65// ## Dialogs
66//
67// `AdwWindow` can contain [class@Dialog]. Use [method@Dialog.present] with the
68// window or a widget within a window to show a dialog.
69//
70// ## Breakpoints
71//
72// `AdwWindow` can be used with [class@Breakpoint] the same way as
73// [class@BreakpointBin]. Refer to that widget's documentation for details.
74//
75// Example:
76//
77// ```xml
78// <object class="AdwWindow">
79//
80// <property name="content">
81// <object class="AdwToolbarView">
82// <child type="top">
83// <object class="AdwHeaderBar"/>
84// </child>
85// <property name="content">
86// <!-- ... -->
87// </property>
88// <child type="bottom">
89// <object class="GtkActionBar" id="bottom_bar">
90// <property name="revealed">True</property>
91// <property name="visible">False</property>
92// </object>
93// </child>
94// </object>
95// </property>
96// <child>
97// <object class="AdwBreakpoint">
98// <condition>max-width: 500px</condition>
99// <setter object="bottom_bar" property="visible">True</setter>
100// </object>
101// </child>
102//
103// </object>
104// ```
105//
106// When breakpoints are used, the minimum size must be larger than the smallest
107// UI state. `AdwWindow` defaults to the minimum size of 360×200 px. If that's
108// too small, set the [property@Gtk.Widget:width-request] and
109// [property@Gtk.Widget:height-request] properties manually.
110//
111// ## Adaptive Preview
112//
113// `AdwWindow` has a debug tool called adaptive preview. It can be opened from
114// GTK Inspector or by pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd>,
115// and controlled via the [property@Window:adaptive-preview] property.
116type Window struct {
117 gtk.Window
118}
119
120var xWindowGLibType func() types.GType
121
122func WindowGLibType() types.GType {
123 return xWindowGLibType()
124}
125
126func WindowNewFromInternalPtr(ptr uintptr) *Window {
127 cls := &Window{}
128 cls.Ptr = ptr
129 return cls
130}
131
132var xNewWindow func() uintptr
133
134// Creates a new `AdwWindow`.
135func NewWindow() *Window {
136 var cls *Window
137
138 cret := xNewWindow()
139
140 if cret == 0 {
141 return nil
142 }
143 gobject.IncreaseRef(cret)
144 cls = &Window{}
145 cls.Ptr = cret
146 return cls
147}
148
149var xWindowAddBreakpoint func(uintptr, uintptr)
150
151// Adds @breakpoint to @self.
152func (x *Window) AddBreakpoint(BreakpointVar *Breakpoint) {
153
154 xWindowAddBreakpoint(x.GoPointer(), BreakpointVar.GoPointer())
155
156}
157
158var xWindowGetAdaptivePreview func(uintptr) bool
159
160// Gets whether adaptive preview for @self is currently open.
161func (x *Window) GetAdaptivePreview() bool {
162
163 cret := xWindowGetAdaptivePreview(x.GoPointer())
164 return cret
165}
166
167var xWindowGetContent func(uintptr) uintptr
168
169// Gets the content widget of @self.
170//
171// This method should always be used instead of [method@Gtk.Window.get_child].
172func (x *Window) GetContent() *gtk.Widget {
173 var cls *gtk.Widget
174
175 cret := xWindowGetContent(x.GoPointer())
176
177 if cret == 0 {
178 return nil
179 }
180 gobject.IncreaseRef(cret)
181 cls = >k.Widget{}
182 cls.Ptr = cret
183 return cls
184}
185
186var xWindowGetCurrentBreakpoint func(uintptr) uintptr
187
188// Gets the current breakpoint.
189func (x *Window) GetCurrentBreakpoint() *Breakpoint {
190 var cls *Breakpoint
191
192 cret := xWindowGetCurrentBreakpoint(x.GoPointer())
193
194 if cret == 0 {
195 return nil
196 }
197 gobject.IncreaseRef(cret)
198 cls = &Breakpoint{}
199 cls.Ptr = cret
200 return cls
201}
202
203var xWindowGetDialogs func(uintptr) uintptr
204
205// Returns a [iface@Gio.ListModel] that contains the open dialogs of @self.
206//
207// This can be used to keep an up-to-date view.
208func (x *Window) GetDialogs() *gio.ListModelBase {
209 var cls *gio.ListModelBase
210
211 cret := xWindowGetDialogs(x.GoPointer())
212
213 if cret == 0 {
214 return nil
215 }
216 cls = &gio.ListModelBase{}
217 cls.Ptr = cret
218 return cls
219}
220
221var xWindowGetVisibleDialog func(uintptr) uintptr
222
223// Returns the currently visible dialog in @self, if there's one.
224func (x *Window) GetVisibleDialog() *Dialog {
225 var cls *Dialog
226
227 cret := xWindowGetVisibleDialog(x.GoPointer())
228
229 if cret == 0 {
230 return nil
231 }
232 gobject.IncreaseRef(cret)
233 cls = &Dialog{}
234 cls.Ptr = cret
235 return cls
236}
237
238var xWindowSetAdaptivePreview func(uintptr, bool)
239
240// Sets whether adaptive preview for @self is currently open.
241//
242// Adaptive preview is a debugging tool used for testing the window
243// contents at specific screen sizes, simulating mobile environment.
244//
245// Adaptive preview can always be accessed from inspector. This function
246// allows applications to open it manually.
247//
248// Most applications should not use this function.
249func (x *Window) SetAdaptivePreview(AdaptivePreviewVar bool) {
250
251 xWindowSetAdaptivePreview(x.GoPointer(), AdaptivePreviewVar)
252
253}
254
255var xWindowSetContent func(uintptr, uintptr)
256
257// Sets the content widget of @self.
258//
259// This method should always be used instead of [method@Gtk.Window.set_child].
260func (x *Window) SetContent(ContentVar *gtk.Widget) {
261
262 xWindowSetContent(x.GoPointer(), ContentVar.GoPointer())
263
264}
265
266func (c *Window) GoPointer() uintptr {
267 if c == nil {
268 return 0
269 }
270 return c.Ptr
271}
272
273func (c *Window) SetGoPointer(ptr uintptr) {
274 c.Ptr = ptr
275}
276
277// SetPropertyAdaptivePreview sets the "adaptive-preview" property.
278// Whether adaptive preview is currently open.
279//
280// Adaptive preview is a debugging tool used for testing the window
281// contents at specific screen sizes, simulating mobile environment.
282//
283// Adaptive preview can always be accessed from inspector. This function
284// allows applications to open it manually.
285//
286// Most applications should not use this property.
287func (x *Window) SetPropertyAdaptivePreview(value bool) {
288 var v gobject.Value
289 v.Init(gobject.TypeBooleanVal)
290 v.SetBoolean(value)
291 x.SetProperty("adaptive-preview", &v)
292}
293
294// GetPropertyAdaptivePreview gets the "adaptive-preview" property.
295// Whether adaptive preview is currently open.
296//
297// Adaptive preview is a debugging tool used for testing the window
298// contents at specific screen sizes, simulating mobile environment.
299//
300// Adaptive preview can always be accessed from inspector. This function
301// allows applications to open it manually.
302//
303// Most applications should not use this property.
304func (x *Window) GetPropertyAdaptivePreview() bool {
305 var v gobject.Value
306 x.GetProperty("adaptive-preview", &v)
307 return v.GetBoolean()
308}
309
310// Requests the user's screen reader to announce the given message.
311//
312// This kind of notification is useful for messages that
313// either have only a visual representation or that are not
314// exposed visually at all, e.g. a notification about a
315// successful operation.
316//
317// Also, by using this API, you can ensure that the message
318// does not interrupts the user's current screen reader output.
319func (x *Window) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
320
321 gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
322
323}
324
325// Retrieves the accessible parent for an accessible object.
326//
327// This function returns `NULL` for top level widgets.
328func (x *Window) GetAccessibleParent() *gtk.AccessibleBase {
329 var cls *gtk.AccessibleBase
330
331 cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
332
333 if cret == 0 {
334 return nil
335 }
336 cls = >k.AccessibleBase{}
337 cls.Ptr = cret
338 return cls
339}
340
341// Retrieves the accessible role of an accessible object.
342func (x *Window) GetAccessibleRole() gtk.AccessibleRole {
343
344 cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
345 return cret
346}
347
348// Retrieves the implementation for the given accessible object.
349func (x *Window) GetAtContext() *gtk.ATContext {
350 var cls *gtk.ATContext
351
352 cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
353
354 if cret == 0 {
355 return nil
356 }
357 cls = >k.ATContext{}
358 cls.Ptr = cret
359 return cls
360}
361
362// Queries the coordinates and dimensions of this accessible
363//
364// This functionality can be overridden by `GtkAccessible`
365// implementations, e.g. to get the bounds from an ignored
366// child widget.
367func (x *Window) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
368
369 cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
370 return cret
371}
372
373// Retrieves the first accessible child of an accessible object.
374func (x *Window) GetFirstAccessibleChild() *gtk.AccessibleBase {
375 var cls *gtk.AccessibleBase
376
377 cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
378
379 if cret == 0 {
380 return nil
381 }
382 cls = >k.AccessibleBase{}
383 cls.Ptr = cret
384 return cls
385}
386
387// Retrieves the next accessible sibling of an accessible object
388func (x *Window) GetNextAccessibleSibling() *gtk.AccessibleBase {
389 var cls *gtk.AccessibleBase
390
391 cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
392
393 if cret == 0 {
394 return nil
395 }
396 cls = >k.AccessibleBase{}
397 cls.Ptr = cret
398 return cls
399}
400
401// Queries a platform state, such as focus.
402//
403// This functionality can be overridden by `GtkAccessible`
404// implementations, e.g. to get platform state from an ignored
405// child widget, as is the case for `GtkText` wrappers.
406func (x *Window) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
407
408 cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
409 return cret
410}
411
412// Resets the accessible property to its default value.
413func (x *Window) ResetProperty(PropertyVar gtk.AccessibleProperty) {
414
415 gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
416
417}
418
419// Resets the accessible relation to its default value.
420func (x *Window) ResetRelation(RelationVar gtk.AccessibleRelation) {
421
422 gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
423
424}
425
426// Resets the accessible state to its default value.
427func (x *Window) ResetState(StateVar gtk.AccessibleState) {
428
429 gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
430
431}
432
433// Sets the parent and sibling of an accessible object.
434//
435// This function is meant to be used by accessible implementations that are
436// not part of the widget hierarchy, and but act as a logical bridge between
437// widgets. For instance, if a widget creates an object that holds metadata
438// for each child, and you want that object to implement the `GtkAccessible`
439// interface, you will use this function to ensure that the parent of each
440// child widget is the metadata object, and the parent of each metadata
441// object is the container widget.
442func (x *Window) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
443
444 gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
445
446}
447
448// Updates the next accessible sibling.
449//
450// That might be useful when a new child of a custom accessible
451// is created, and it needs to be linked to a previous child.
452func (x *Window) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
453
454 gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
455
456}
457
458// Informs ATs that the platform state has changed.
459//
460// This function should be used by `GtkAccessible` implementations that
461// have a platform state but are not widgets. Widgets handle platform
462// states automatically.
463func (x *Window) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
464
465 gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
466
467}
468
469// Updates a list of accessible properties.
470//
471// See the [enum@Gtk.AccessibleProperty] documentation for the
472// value types of accessible properties.
473//
474// This function should be called by `GtkWidget` types whenever
475// an accessible property change must be communicated to assistive
476// technologies.
477//
478// Example:
479// ```c
480// value = gtk_adjustment_get_value (adjustment);
481// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
482//
483// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
484// -1);
485//
486// ```
487func (x *Window) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
488
489 gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
490
491}
492
493// Updates an array of accessible properties.
494//
495// This function should be called by `GtkWidget` types whenever an accessible
496// property change must be communicated to assistive technologies.
497//
498// This function is meant to be used by language bindings.
499func (x *Window) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
500
501 gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
502
503}
504
505// Updates a list of accessible relations.
506//
507// This function should be called by `GtkWidget` types whenever an accessible
508// relation change must be communicated to assistive technologies.
509//
510// If the [enum@Gtk.AccessibleRelation] requires a list of references,
511// you should pass each reference individually, followed by `NULL`, e.g.
512//
513// ```c
514// gtk_accessible_update_relation (accessible,
515//
516// GTK_ACCESSIBLE_RELATION_CONTROLS,
517// ref1, NULL,
518// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
519// ref1, ref2, ref3, NULL,
520// -1);
521//
522// ```
523func (x *Window) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
524
525 gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
526
527}
528
529// Updates an array of accessible relations.
530//
531// This function should be called by `GtkWidget` types whenever an accessible
532// relation change must be communicated to assistive technologies.
533//
534// This function is meant to be used by language bindings.
535func (x *Window) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
536
537 gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
538
539}
540
541// Updates a list of accessible states.
542//
543// See the [enum@Gtk.AccessibleState] documentation for the
544// value types of accessible states.
545//
546// This function should be called by `GtkWidget` types whenever
547// an accessible state change must be communicated to assistive
548// technologies.
549//
550// Example:
551//
552// ```c
553// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
554// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
555//
556// GTK_ACCESSIBLE_STATE_CHECKED, value,
557// -1);
558//
559// ```
560func (x *Window) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
561
562 gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
563
564}
565
566// Updates an array of accessible states.
567//
568// This function should be called by `GtkWidget` types whenever an accessible
569// state change must be communicated to assistive technologies.
570//
571// This function is meant to be used by language bindings.
572func (x *Window) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
573
574 gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
575
576}
577
578// Gets the ID of the @buildable object.
579//
580// `GtkBuilder` sets the name based on the ID attribute
581// of the `<object>` tag used to construct the @buildable.
582func (x *Window) GetBuildableId() string {
583
584 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
585 return cret
586}
587
588// Returns the renderer that is used for this `GtkNative`.
589func (x *Window) GetRenderer() *gsk.Renderer {
590 var cls *gsk.Renderer
591
592 cret := gtk.XGtkNativeGetRenderer(x.GoPointer())
593
594 if cret == 0 {
595 return nil
596 }
597 gobject.IncreaseRef(cret)
598 cls = &gsk.Renderer{}
599 cls.Ptr = cret
600 return cls
601}
602
603// Returns the surface of this `GtkNative`.
604func (x *Window) GetSurface() *gdk.Surface {
605 var cls *gdk.Surface
606
607 cret := gtk.XGtkNativeGetSurface(x.GoPointer())
608
609 if cret == 0 {
610 return nil
611 }
612 gobject.IncreaseRef(cret)
613 cls = &gdk.Surface{}
614 cls.Ptr = cret
615 return cls
616}
617
618// Retrieves the surface transform of @self.
619//
620// This is the translation from @self's surface coordinates into
621// @self's widget coordinates.
622func (x *Window) GetSurfaceTransform(XVar *float64, YVar *float64) {
623
624 gtk.XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
625
626}
627
628// Realizes a `GtkNative`.
629//
630// This should only be used by subclasses.
631func (x *Window) Realize() {
632
633 gtk.XGtkNativeRealize(x.GoPointer())
634
635}
636
637// Unrealizes a `GtkNative`.
638//
639// This should only be used by subclasses.
640func (x *Window) Unrealize() {
641
642 gtk.XGtkNativeUnrealize(x.GoPointer())
643
644}
645
646// Returns the display that this `GtkRoot` is on.
647func (x *Window) GetDisplay() *gdk.Display {
648 var cls *gdk.Display
649
650 cret := gtk.XGtkRootGetDisplay(x.GoPointer())
651
652 if cret == 0 {
653 return nil
654 }
655 gobject.IncreaseRef(cret)
656 cls = &gdk.Display{}
657 cls.Ptr = cret
658 return cls
659}
660
661// Retrieves the current focused widget within the root.
662//
663// Note that this is the widget that would have the focus
664// if the root is active; if the root is not focused then
665// `gtk_widget_has_focus (widget)` will be %FALSE for the
666// widget.
667func (x *Window) GetFocus() *gtk.Widget {
668 var cls *gtk.Widget
669
670 cret := gtk.XGtkRootGetFocus(x.GoPointer())
671
672 if cret == 0 {
673 return nil
674 }
675 gobject.IncreaseRef(cret)
676 cls = >k.Widget{}
677 cls.Ptr = cret
678 return cls
679}
680
681// If @focus is not the current focus widget, and is focusable, sets
682// it as the focus widget for the root.
683//
684// If @focus is %NULL, unsets the focus widget for the root.
685//
686// To set the focus to a particular widget in the root, it is usually
687// more convenient to use [method@Gtk.Widget.grab_focus] instead of
688// this function.
689func (x *Window) SetFocus(FocusVar *gtk.Widget) {
690
691 gtk.XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer())
692
693}
694
695func init() {
696 core.SetPackageName("ADW", "libadwaita-1")
697 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
698 var libs []uintptr
699 for _, libPath := range core.GetPaths("ADW") {
700 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
701 if err != nil {
702 panic(err)
703 }
704 libs = append(libs, lib)
705 }
706
707 core.PuregoSafeRegister(&xWindowGLibType, libs, "adw_window_get_type")
708
709 core.PuregoSafeRegister(&xNewWindow, libs, "adw_window_new")
710
711 core.PuregoSafeRegister(&xWindowAddBreakpoint, libs, "adw_window_add_breakpoint")
712 core.PuregoSafeRegister(&xWindowGetAdaptivePreview, libs, "adw_window_get_adaptive_preview")
713 core.PuregoSafeRegister(&xWindowGetContent, libs, "adw_window_get_content")
714 core.PuregoSafeRegister(&xWindowGetCurrentBreakpoint, libs, "adw_window_get_current_breakpoint")
715 core.PuregoSafeRegister(&xWindowGetDialogs, libs, "adw_window_get_dialogs")
716 core.PuregoSafeRegister(&xWindowGetVisibleDialog, libs, "adw_window_get_visible_dialog")
717 core.PuregoSafeRegister(&xWindowSetAdaptivePreview, libs, "adw_window_set_adaptive_preview")
718 core.PuregoSafeRegister(&xWindowSetContent, libs, "adw_window_set_content")
719
720}