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/gdk"
9 "github.com/bnema/puregotk/v4/gio"
10 "github.com/bnema/puregotk/v4/gobject"
11 "github.com/bnema/puregotk/v4/gobject/types"
12 "github.com/bnema/puregotk/v4/gsk"
13)
14
15// `GtkAppChooserDialog` shows a `GtkAppChooserWidget` inside a `GtkDialog`.
16//
17// <picture>
18//
19// <source srcset="appchooserdialog-dark.png" media="(prefers-color-scheme: dark)">
20// <img alt="An example GtkAppChooserDialog" src="appchooserdialog.png">
21//
22// </picture>
23//
24// Note that `GtkAppChooserDialog` does not have any interesting methods
25// of its own. Instead, you should get the embedded `GtkAppChooserWidget`
26// using [method@Gtk.AppChooserDialog.get_widget] and call its methods if
27// the generic [iface@Gtk.AppChooser] interface is not sufficient for
28// your needs.
29//
30// To set the heading that is shown above the `GtkAppChooserWidget`,
31// use [method@Gtk.AppChooserDialog.set_heading].
32//
33// ## CSS nodes
34//
35// `GtkAppChooserDialog` has a single CSS node with the name `window` and style
36// class `.appchooser`.
37type AppChooserDialog struct {
38 Dialog
39}
40
41var xAppChooserDialogGLibType func() types.GType
42
43func AppChooserDialogGLibType() types.GType {
44 return xAppChooserDialogGLibType()
45}
46
47func AppChooserDialogNewFromInternalPtr(ptr uintptr) *AppChooserDialog {
48 cls := &AppChooserDialog{}
49 cls.Ptr = ptr
50 return cls
51}
52
53var xNewAppChooserDialog func(uintptr, DialogFlags, uintptr) uintptr
54
55// Creates a new `GtkAppChooserDialog` for the provided `GFile`.
56//
57// The dialog will show applications that can open the file.
58func NewAppChooserDialog(ParentVar *Window, FlagsVar DialogFlags, FileVar gio.File) *AppChooserDialog {
59 var cls *AppChooserDialog
60
61 cret := xNewAppChooserDialog(ParentVar.GoPointer(), FlagsVar, FileVar.GoPointer())
62
63 if cret == 0 {
64 return nil
65 }
66 gobject.IncreaseRef(cret)
67 cls = &AppChooserDialog{}
68 cls.Ptr = cret
69 return cls
70}
71
72var xNewAppChooserDialogForContentType func(uintptr, DialogFlags, string) uintptr
73
74// Creates a new `GtkAppChooserDialog` for the provided content type.
75//
76// The dialog will show applications that can open the content type.
77func NewAppChooserDialogForContentType(ParentVar *Window, FlagsVar DialogFlags, ContentTypeVar string) *AppChooserDialog {
78 var cls *AppChooserDialog
79
80 cret := xNewAppChooserDialogForContentType(ParentVar.GoPointer(), FlagsVar, ContentTypeVar)
81
82 if cret == 0 {
83 return nil
84 }
85 gobject.IncreaseRef(cret)
86 cls = &AppChooserDialog{}
87 cls.Ptr = cret
88 return cls
89}
90
91var xAppChooserDialogGetHeading func(uintptr) string
92
93// Returns the text to display at the top of the dialog.
94func (x *AppChooserDialog) GetHeading() string {
95
96 cret := xAppChooserDialogGetHeading(x.GoPointer())
97 return cret
98}
99
100var xAppChooserDialogGetWidget func(uintptr) uintptr
101
102// Returns the `GtkAppChooserWidget` of this dialog.
103func (x *AppChooserDialog) GetWidget() *Widget {
104 var cls *Widget
105
106 cret := xAppChooserDialogGetWidget(x.GoPointer())
107
108 if cret == 0 {
109 return nil
110 }
111 gobject.IncreaseRef(cret)
112 cls = &Widget{}
113 cls.Ptr = cret
114 return cls
115}
116
117var xAppChooserDialogSetHeading func(uintptr, string)
118
119// Sets the text to display at the top of the dialog.
120//
121// If the heading is not set, the dialog displays a default text.
122func (x *AppChooserDialog) SetHeading(HeadingVar string) {
123
124 xAppChooserDialogSetHeading(x.GoPointer(), HeadingVar)
125
126}
127
128func (c *AppChooserDialog) GoPointer() uintptr {
129 if c == nil {
130 return 0
131 }
132 return c.Ptr
133}
134
135func (c *AppChooserDialog) SetGoPointer(ptr uintptr) {
136 c.Ptr = ptr
137}
138
139// SetPropertyHeading sets the "heading" property.
140// The text to show at the top of the dialog.
141//
142// The string may contain Pango markup.
143func (x *AppChooserDialog) SetPropertyHeading(value string) {
144 var v gobject.Value
145 v.Init(gobject.TypeStringVal)
146 v.SetString(&value)
147 x.SetProperty("heading", &v)
148}
149
150// GetPropertyHeading gets the "heading" property.
151// The text to show at the top of the dialog.
152//
153// The string may contain Pango markup.
154func (x *AppChooserDialog) GetPropertyHeading() string {
155 var v gobject.Value
156 x.GetProperty("heading", &v)
157 return v.GetString()
158}
159
160// Requests the user's screen reader to announce the given message.
161//
162// This kind of notification is useful for messages that
163// either have only a visual representation or that are not
164// exposed visually at all, e.g. a notification about a
165// successful operation.
166//
167// Also, by using this API, you can ensure that the message
168// does not interrupts the user's current screen reader output.
169func (x *AppChooserDialog) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
170
171 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
172
173}
174
175// Retrieves the accessible parent for an accessible object.
176//
177// This function returns `NULL` for top level widgets.
178func (x *AppChooserDialog) GetAccessibleParent() *AccessibleBase {
179 var cls *AccessibleBase
180
181 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
182
183 if cret == 0 {
184 return nil
185 }
186 cls = &AccessibleBase{}
187 cls.Ptr = cret
188 return cls
189}
190
191// Retrieves the accessible role of an accessible object.
192func (x *AppChooserDialog) GetAccessibleRole() AccessibleRole {
193
194 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
195 return cret
196}
197
198// Retrieves the implementation for the given accessible object.
199func (x *AppChooserDialog) GetAtContext() *ATContext {
200 var cls *ATContext
201
202 cret := XGtkAccessibleGetAtContext(x.GoPointer())
203
204 if cret == 0 {
205 return nil
206 }
207 cls = &ATContext{}
208 cls.Ptr = cret
209 return cls
210}
211
212// Queries the coordinates and dimensions of this accessible
213//
214// This functionality can be overridden by `GtkAccessible`
215// implementations, e.g. to get the bounds from an ignored
216// child widget.
217func (x *AppChooserDialog) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
218
219 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
220 return cret
221}
222
223// Retrieves the first accessible child of an accessible object.
224func (x *AppChooserDialog) GetFirstAccessibleChild() *AccessibleBase {
225 var cls *AccessibleBase
226
227 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
228
229 if cret == 0 {
230 return nil
231 }
232 cls = &AccessibleBase{}
233 cls.Ptr = cret
234 return cls
235}
236
237// Retrieves the next accessible sibling of an accessible object
238func (x *AppChooserDialog) GetNextAccessibleSibling() *AccessibleBase {
239 var cls *AccessibleBase
240
241 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
242
243 if cret == 0 {
244 return nil
245 }
246 cls = &AccessibleBase{}
247 cls.Ptr = cret
248 return cls
249}
250
251// Queries a platform state, such as focus.
252//
253// This functionality can be overridden by `GtkAccessible`
254// implementations, e.g. to get platform state from an ignored
255// child widget, as is the case for `GtkText` wrappers.
256func (x *AppChooserDialog) GetPlatformState(StateVar AccessiblePlatformState) bool {
257
258 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
259 return cret
260}
261
262// Resets the accessible property to its default value.
263func (x *AppChooserDialog) ResetProperty(PropertyVar AccessibleProperty) {
264
265 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
266
267}
268
269// Resets the accessible relation to its default value.
270func (x *AppChooserDialog) ResetRelation(RelationVar AccessibleRelation) {
271
272 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
273
274}
275
276// Resets the accessible state to its default value.
277func (x *AppChooserDialog) ResetState(StateVar AccessibleState) {
278
279 XGtkAccessibleResetState(x.GoPointer(), StateVar)
280
281}
282
283// Sets the parent and sibling of an accessible object.
284//
285// This function is meant to be used by accessible implementations that are
286// not part of the widget hierarchy, and but act as a logical bridge between
287// widgets. For instance, if a widget creates an object that holds metadata
288// for each child, and you want that object to implement the `GtkAccessible`
289// interface, you will use this function to ensure that the parent of each
290// child widget is the metadata object, and the parent of each metadata
291// object is the container widget.
292func (x *AppChooserDialog) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
293
294 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
295
296}
297
298// Updates the next accessible sibling.
299//
300// That might be useful when a new child of a custom accessible
301// is created, and it needs to be linked to a previous child.
302func (x *AppChooserDialog) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
303
304 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
305
306}
307
308// Informs ATs that the platform state has changed.
309//
310// This function should be used by `GtkAccessible` implementations that
311// have a platform state but are not widgets. Widgets handle platform
312// states automatically.
313func (x *AppChooserDialog) UpdatePlatformState(StateVar AccessiblePlatformState) {
314
315 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
316
317}
318
319// Updates a list of accessible properties.
320//
321// See the [enum@Gtk.AccessibleProperty] documentation for the
322// value types of accessible properties.
323//
324// This function should be called by `GtkWidget` types whenever
325// an accessible property change must be communicated to assistive
326// technologies.
327//
328// Example:
329// ```c
330// value = gtk_adjustment_get_value (adjustment);
331// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
332//
333// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
334// -1);
335//
336// ```
337func (x *AppChooserDialog) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
338
339 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
340
341}
342
343// Updates an array of accessible properties.
344//
345// This function should be called by `GtkWidget` types whenever an accessible
346// property change must be communicated to assistive technologies.
347//
348// This function is meant to be used by language bindings.
349func (x *AppChooserDialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
350
351 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
352
353}
354
355// Updates a list of accessible relations.
356//
357// This function should be called by `GtkWidget` types whenever an accessible
358// relation change must be communicated to assistive technologies.
359//
360// If the [enum@Gtk.AccessibleRelation] requires a list of references,
361// you should pass each reference individually, followed by `NULL`, e.g.
362//
363// ```c
364// gtk_accessible_update_relation (accessible,
365//
366// GTK_ACCESSIBLE_RELATION_CONTROLS,
367// ref1, NULL,
368// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
369// ref1, ref2, ref3, NULL,
370// -1);
371//
372// ```
373func (x *AppChooserDialog) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
374
375 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
376
377}
378
379// Updates an array of accessible relations.
380//
381// This function should be called by `GtkWidget` types whenever an accessible
382// relation change must be communicated to assistive technologies.
383//
384// This function is meant to be used by language bindings.
385func (x *AppChooserDialog) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
386
387 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
388
389}
390
391// Updates a list of accessible states.
392//
393// See the [enum@Gtk.AccessibleState] documentation for the
394// value types of accessible states.
395//
396// This function should be called by `GtkWidget` types whenever
397// an accessible state change must be communicated to assistive
398// technologies.
399//
400// Example:
401//
402// ```c
403// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
404// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
405//
406// GTK_ACCESSIBLE_STATE_CHECKED, value,
407// -1);
408//
409// ```
410func (x *AppChooserDialog) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
411
412 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
413
414}
415
416// Updates an array of accessible states.
417//
418// This function should be called by `GtkWidget` types whenever an accessible
419// state change must be communicated to assistive technologies.
420//
421// This function is meant to be used by language bindings.
422func (x *AppChooserDialog) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
423
424 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
425
426}
427
428// Returns the currently selected application.
429func (x *AppChooserDialog) GetAppInfo() *gio.AppInfoBase {
430 var cls *gio.AppInfoBase
431
432 cret := XGtkAppChooserGetAppInfo(x.GoPointer())
433
434 if cret == 0 {
435 return nil
436 }
437 cls = &gio.AppInfoBase{}
438 cls.Ptr = cret
439 return cls
440}
441
442// Returns the content type for which the `GtkAppChooser`
443// shows applications.
444func (x *AppChooserDialog) GetContentType() string {
445
446 cret := XGtkAppChooserGetContentType(x.GoPointer())
447 return cret
448}
449
450// Reloads the list of applications.
451func (x *AppChooserDialog) Refresh() {
452
453 XGtkAppChooserRefresh(x.GoPointer())
454
455}
456
457// Gets the ID of the @buildable object.
458//
459// `GtkBuilder` sets the name based on the ID attribute
460// of the `<object>` tag used to construct the @buildable.
461func (x *AppChooserDialog) GetBuildableId() string {
462
463 cret := XGtkBuildableGetBuildableId(x.GoPointer())
464 return cret
465}
466
467// Returns the renderer that is used for this `GtkNative`.
468func (x *AppChooserDialog) GetRenderer() *gsk.Renderer {
469 var cls *gsk.Renderer
470
471 cret := XGtkNativeGetRenderer(x.GoPointer())
472
473 if cret == 0 {
474 return nil
475 }
476 gobject.IncreaseRef(cret)
477 cls = &gsk.Renderer{}
478 cls.Ptr = cret
479 return cls
480}
481
482// Returns the surface of this `GtkNative`.
483func (x *AppChooserDialog) GetSurface() *gdk.Surface {
484 var cls *gdk.Surface
485
486 cret := XGtkNativeGetSurface(x.GoPointer())
487
488 if cret == 0 {
489 return nil
490 }
491 gobject.IncreaseRef(cret)
492 cls = &gdk.Surface{}
493 cls.Ptr = cret
494 return cls
495}
496
497// Retrieves the surface transform of @self.
498//
499// This is the translation from @self's surface coordinates into
500// @self's widget coordinates.
501func (x *AppChooserDialog) GetSurfaceTransform(XVar *float64, YVar *float64) {
502
503 XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
504
505}
506
507// Realizes a `GtkNative`.
508//
509// This should only be used by subclasses.
510func (x *AppChooserDialog) Realize() {
511
512 XGtkNativeRealize(x.GoPointer())
513
514}
515
516// Unrealizes a `GtkNative`.
517//
518// This should only be used by subclasses.
519func (x *AppChooserDialog) Unrealize() {
520
521 XGtkNativeUnrealize(x.GoPointer())
522
523}
524
525// Returns the display that this `GtkRoot` is on.
526func (x *AppChooserDialog) GetDisplay() *gdk.Display {
527 var cls *gdk.Display
528
529 cret := XGtkRootGetDisplay(x.GoPointer())
530
531 if cret == 0 {
532 return nil
533 }
534 gobject.IncreaseRef(cret)
535 cls = &gdk.Display{}
536 cls.Ptr = cret
537 return cls
538}
539
540// Retrieves the current focused widget within the root.
541//
542// Note that this is the widget that would have the focus
543// if the root is active; if the root is not focused then
544// `gtk_widget_has_focus (widget)` will be %FALSE for the
545// widget.
546func (x *AppChooserDialog) GetFocus() *Widget {
547 var cls *Widget
548
549 cret := XGtkRootGetFocus(x.GoPointer())
550
551 if cret == 0 {
552 return nil
553 }
554 gobject.IncreaseRef(cret)
555 cls = &Widget{}
556 cls.Ptr = cret
557 return cls
558}
559
560// If @focus is not the current focus widget, and is focusable, sets
561// it as the focus widget for the root.
562//
563// If @focus is %NULL, unsets the focus widget for the root.
564//
565// To set the focus to a particular widget in the root, it is usually
566// more convenient to use [method@Gtk.Widget.grab_focus] instead of
567// this function.
568func (x *AppChooserDialog) SetFocus(FocusVar *Widget) {
569
570 XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer())
571
572}
573
574func init() {
575 core.SetPackageName("GTK", "gtk4")
576 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
577 var libs []uintptr
578 for _, libPath := range core.GetPaths("GTK") {
579 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
580 if err != nil {
581 panic(err)
582 }
583 libs = append(libs, lib)
584 }
585
586 core.PuregoSafeRegister(&xAppChooserDialogGLibType, libs, "gtk_app_chooser_dialog_get_type")
587
588 core.PuregoSafeRegister(&xNewAppChooserDialog, libs, "gtk_app_chooser_dialog_new")
589 core.PuregoSafeRegister(&xNewAppChooserDialogForContentType, libs, "gtk_app_chooser_dialog_new_for_content_type")
590
591 core.PuregoSafeRegister(&xAppChooserDialogGetHeading, libs, "gtk_app_chooser_dialog_get_heading")
592 core.PuregoSafeRegister(&xAppChooserDialogGetWidget, libs, "gtk_app_chooser_dialog_get_widget")
593 core.PuregoSafeRegister(&xAppChooserDialogSetHeading, libs, "gtk_app_chooser_dialog_set_heading")
594
595}