// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gio" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // `GtkAppChooserWidget` is a widget for selecting applications. // // It is the main building block for [class@Gtk.AppChooserDialog]. // Most applications only need to use the latter; but you can use // this widget as part of a larger widget if you have special needs. // // `GtkAppChooserWidget` offers detailed control over what applications // are shown, using the // [property@Gtk.AppChooserWidget:show-default], // [property@Gtk.AppChooserWidget:show-recommended], // [property@Gtk.AppChooserWidget:show-fallback], // [property@Gtk.AppChooserWidget:show-other] and // [property@Gtk.AppChooserWidget:show-all] properties. See the // [iface@Gtk.AppChooser] documentation for more information about these // groups of applications. // // To keep track of the selected application, use the // [signal@Gtk.AppChooserWidget::application-selected] and // [signal@Gtk.AppChooserWidget::application-activated] signals. // // ## CSS nodes // // `GtkAppChooserWidget` has a single CSS node with name appchooser. type AppChooserWidget struct { Widget } var xAppChooserWidgetGLibType func() types.GType func AppChooserWidgetGLibType() types.GType { return xAppChooserWidgetGLibType() } func AppChooserWidgetNewFromInternalPtr(ptr uintptr) *AppChooserWidget { cls := &AppChooserWidget{} cls.Ptr = ptr return cls } var xNewAppChooserWidget func(string) uintptr // Creates a new `GtkAppChooserWidget` for applications // that can handle content of the given type. func NewAppChooserWidget(ContentTypeVar string) *AppChooserWidget { var cls *AppChooserWidget cret := xNewAppChooserWidget(ContentTypeVar) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &AppChooserWidget{} cls.Ptr = cret return cls } var xAppChooserWidgetGetDefaultText func(uintptr) string // Returns the text that is shown if there are not applications // that can handle the content type. func (x *AppChooserWidget) GetDefaultText() string { cret := xAppChooserWidgetGetDefaultText(x.GoPointer()) return cret } var xAppChooserWidgetGetShowAll func(uintptr) bool // Gets whether the app chooser should show all applications // in a flat list. func (x *AppChooserWidget) GetShowAll() bool { cret := xAppChooserWidgetGetShowAll(x.GoPointer()) return cret } var xAppChooserWidgetGetShowDefault func(uintptr) bool // Gets whether the app chooser should show the default handler // for the content type in a separate section. func (x *AppChooserWidget) GetShowDefault() bool { cret := xAppChooserWidgetGetShowDefault(x.GoPointer()) return cret } var xAppChooserWidgetGetShowFallback func(uintptr) bool // Gets whether the app chooser should show related applications // for the content type in a separate section. func (x *AppChooserWidget) GetShowFallback() bool { cret := xAppChooserWidgetGetShowFallback(x.GoPointer()) return cret } var xAppChooserWidgetGetShowOther func(uintptr) bool // Gets whether the app chooser should show applications // which are unrelated to the content type. func (x *AppChooserWidget) GetShowOther() bool { cret := xAppChooserWidgetGetShowOther(x.GoPointer()) return cret } var xAppChooserWidgetGetShowRecommended func(uintptr) bool // Gets whether the app chooser should show recommended applications // for the content type in a separate section. func (x *AppChooserWidget) GetShowRecommended() bool { cret := xAppChooserWidgetGetShowRecommended(x.GoPointer()) return cret } var xAppChooserWidgetSetDefaultText func(uintptr, string) // Sets the text that is shown if there are not applications // that can handle the content type. func (x *AppChooserWidget) SetDefaultText(TextVar string) { xAppChooserWidgetSetDefaultText(x.GoPointer(), TextVar) } var xAppChooserWidgetSetShowAll func(uintptr, bool) // Sets whether the app chooser should show all applications // in a flat list. func (x *AppChooserWidget) SetShowAll(SettingVar bool) { xAppChooserWidgetSetShowAll(x.GoPointer(), SettingVar) } var xAppChooserWidgetSetShowDefault func(uintptr, bool) // Sets whether the app chooser should show the default handler // for the content type in a separate section. func (x *AppChooserWidget) SetShowDefault(SettingVar bool) { xAppChooserWidgetSetShowDefault(x.GoPointer(), SettingVar) } var xAppChooserWidgetSetShowFallback func(uintptr, bool) // Sets whether the app chooser should show related applications // for the content type in a separate section. func (x *AppChooserWidget) SetShowFallback(SettingVar bool) { xAppChooserWidgetSetShowFallback(x.GoPointer(), SettingVar) } var xAppChooserWidgetSetShowOther func(uintptr, bool) // Sets whether the app chooser should show applications // which are unrelated to the content type. func (x *AppChooserWidget) SetShowOther(SettingVar bool) { xAppChooserWidgetSetShowOther(x.GoPointer(), SettingVar) } var xAppChooserWidgetSetShowRecommended func(uintptr, bool) // Sets whether the app chooser should show recommended applications // for the content type in a separate section. func (x *AppChooserWidget) SetShowRecommended(SettingVar bool) { xAppChooserWidgetSetShowRecommended(x.GoPointer(), SettingVar) } func (c *AppChooserWidget) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *AppChooserWidget) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyDefaultText sets the "default-text" property. // The text that appears in the widget when there are no applications // for the given content type. func (x *AppChooserWidget) SetPropertyDefaultText(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("default-text", &v) } // GetPropertyDefaultText gets the "default-text" property. // The text that appears in the widget when there are no applications // for the given content type. func (x *AppChooserWidget) GetPropertyDefaultText() string { var v gobject.Value x.GetProperty("default-text", &v) return v.GetString() } // SetPropertyShowAll sets the "show-all" property. // If %TRUE, the app chooser presents all applications // in a single list, without subsections for default, // recommended or related applications. func (x *AppChooserWidget) SetPropertyShowAll(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("show-all", &v) } // GetPropertyShowAll gets the "show-all" property. // If %TRUE, the app chooser presents all applications // in a single list, without subsections for default, // recommended or related applications. func (x *AppChooserWidget) GetPropertyShowAll() bool { var v gobject.Value x.GetProperty("show-all", &v) return v.GetBoolean() } // SetPropertyShowDefault sets the "show-default" property. // Determines whether the app chooser should show the default // handler for the content type in a separate section. // // If %FALSE, the default handler is listed among the recommended // applications. func (x *AppChooserWidget) SetPropertyShowDefault(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("show-default", &v) } // GetPropertyShowDefault gets the "show-default" property. // Determines whether the app chooser should show the default // handler for the content type in a separate section. // // If %FALSE, the default handler is listed among the recommended // applications. func (x *AppChooserWidget) GetPropertyShowDefault() bool { var v gobject.Value x.GetProperty("show-default", &v) return v.GetBoolean() } // SetPropertyShowFallback sets the "show-fallback" property. // Determines whether the app chooser should show a section // for fallback applications. // // If %FALSE, the fallback applications are listed among the // other applications. func (x *AppChooserWidget) SetPropertyShowFallback(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("show-fallback", &v) } // GetPropertyShowFallback gets the "show-fallback" property. // Determines whether the app chooser should show a section // for fallback applications. // // If %FALSE, the fallback applications are listed among the // other applications. func (x *AppChooserWidget) GetPropertyShowFallback() bool { var v gobject.Value x.GetProperty("show-fallback", &v) return v.GetBoolean() } // SetPropertyShowOther sets the "show-other" property. // Determines whether the app chooser should show a section // for other applications. func (x *AppChooserWidget) SetPropertyShowOther(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("show-other", &v) } // GetPropertyShowOther gets the "show-other" property. // Determines whether the app chooser should show a section // for other applications. func (x *AppChooserWidget) GetPropertyShowOther() bool { var v gobject.Value x.GetProperty("show-other", &v) return v.GetBoolean() } // SetPropertyShowRecommended sets the "show-recommended" property. // Determines whether the app chooser should show a section // for recommended applications. // // If %FALSE, the recommended applications are listed // among the other applications. func (x *AppChooserWidget) SetPropertyShowRecommended(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("show-recommended", &v) } // GetPropertyShowRecommended gets the "show-recommended" property. // Determines whether the app chooser should show a section // for recommended applications. // // If %FALSE, the recommended applications are listed // among the other applications. func (x *AppChooserWidget) GetPropertyShowRecommended() bool { var v gobject.Value x.GetProperty("show-recommended", &v) return v.GetBoolean() } // Emitted when an application item is activated from the widget's list. // // This usually happens when the user double clicks an item, or an item // is selected and the user presses one of the keys Space, Shift+Space, // Return or Enter. func (x *AppChooserWidget) ConnectApplicationActivated(cb *func(AppChooserWidget, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "application-activated", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, ApplicationVarp uintptr) { fa := AppChooserWidget{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, ApplicationVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "application-activated", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when an application item is selected from the widget's list. func (x *AppChooserWidget) ConnectApplicationSelected(cb *func(AppChooserWidget, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "application-selected", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, ApplicationVarp uintptr) { fa := AppChooserWidget{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, ApplicationVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "application-selected", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Requests the user's screen reader to announce the given message. // // This kind of notification is useful for messages that // either have only a visual representation or that are not // exposed visually at all, e.g. a notification about a // successful operation. // // Also, by using this API, you can ensure that the message // does not interrupts the user's current screen reader output. func (x *AppChooserWidget) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) { XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar) } // Retrieves the accessible parent for an accessible object. // // This function returns `NULL` for top level widgets. func (x *AppChooserWidget) GetAccessibleParent() *AccessibleBase { var cls *AccessibleBase cret := XGtkAccessibleGetAccessibleParent(x.GoPointer()) if cret == 0 { return nil } cls = &AccessibleBase{} cls.Ptr = cret return cls } // Retrieves the accessible role of an accessible object. func (x *AppChooserWidget) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *AppChooserWidget) GetAtContext() *ATContext { var cls *ATContext cret := XGtkAccessibleGetAtContext(x.GoPointer()) if cret == 0 { return nil } cls = &ATContext{} cls.Ptr = cret return cls } // Queries the coordinates and dimensions of this accessible // // This functionality can be overridden by `GtkAccessible` // implementations, e.g. to get the bounds from an ignored // child widget. func (x *AppChooserWidget) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool { cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar) return cret } // Retrieves the first accessible child of an accessible object. func (x *AppChooserWidget) GetFirstAccessibleChild() *AccessibleBase { var cls *AccessibleBase cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer()) if cret == 0 { return nil } cls = &AccessibleBase{} cls.Ptr = cret return cls } // Retrieves the next accessible sibling of an accessible object func (x *AppChooserWidget) GetNextAccessibleSibling() *AccessibleBase { var cls *AccessibleBase cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer()) if cret == 0 { return nil } cls = &AccessibleBase{} cls.Ptr = cret return cls } // Queries a platform state, such as focus. // // This functionality can be overridden by `GtkAccessible` // implementations, e.g. to get platform state from an ignored // child widget, as is the case for `GtkText` wrappers. func (x *AppChooserWidget) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *AppChooserWidget) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *AppChooserWidget) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *AppChooserWidget) ResetState(StateVar AccessibleState) { XGtkAccessibleResetState(x.GoPointer(), StateVar) } // Sets the parent and sibling of an accessible object. // // This function is meant to be used by accessible implementations that are // not part of the widget hierarchy, and but act as a logical bridge between // widgets. For instance, if a widget creates an object that holds metadata // for each child, and you want that object to implement the `GtkAccessible` // interface, you will use this function to ensure that the parent of each // child widget is the metadata object, and the parent of each metadata // object is the container widget. func (x *AppChooserWidget) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) { XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer()) } // Updates the next accessible sibling. // // That might be useful when a new child of a custom accessible // is created, and it needs to be linked to a previous child. func (x *AppChooserWidget) UpdateNextAccessibleSibling(NewSiblingVar Accessible) { XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer()) } // Informs ATs that the platform state has changed. // // This function should be used by `GtkAccessible` implementations that // have a platform state but are not widgets. Widgets handle platform // states automatically. func (x *AppChooserWidget) UpdatePlatformState(StateVar AccessiblePlatformState) { XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar) } // Updates a list of accessible properties. // // See the [enum@Gtk.AccessibleProperty] documentation for the // value types of accessible properties. // // This function should be called by `GtkWidget` types whenever // an accessible property change must be communicated to assistive // technologies. // // Example: // ```c // value = gtk_adjustment_get_value (adjustment); // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), // // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, // -1); // // ``` func (x *AppChooserWidget) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) { XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) } // Updates an array of accessible properties. // // This function should be called by `GtkWidget` types whenever an accessible // property change must be communicated to assistive technologies. // // This function is meant to be used by language bindings. func (x *AppChooserWidget) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) { XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) } // Updates a list of accessible relations. // // This function should be called by `GtkWidget` types whenever an accessible // relation change must be communicated to assistive technologies. // // If the [enum@Gtk.AccessibleRelation] requires a list of references, // you should pass each reference individually, followed by `NULL`, e.g. // // ```c // gtk_accessible_update_relation (accessible, // // GTK_ACCESSIBLE_RELATION_CONTROLS, // ref1, NULL, // GTK_ACCESSIBLE_RELATION_LABELLED_BY, // ref1, ref2, ref3, NULL, // -1); // // ``` func (x *AppChooserWidget) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) { XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) } // Updates an array of accessible relations. // // This function should be called by `GtkWidget` types whenever an accessible // relation change must be communicated to assistive technologies. // // This function is meant to be used by language bindings. func (x *AppChooserWidget) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) { XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) } // Updates a list of accessible states. // // See the [enum@Gtk.AccessibleState] documentation for the // value types of accessible states. // // This function should be called by `GtkWidget` types whenever // an accessible state change must be communicated to assistive // technologies. // // Example: // // ```c // value = GTK_ACCESSIBLE_TRISTATE_MIXED; // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), // // GTK_ACCESSIBLE_STATE_CHECKED, value, // -1); // // ``` func (x *AppChooserWidget) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) { XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) } // Updates an array of accessible states. // // This function should be called by `GtkWidget` types whenever an accessible // state change must be communicated to assistive technologies. // // This function is meant to be used by language bindings. func (x *AppChooserWidget) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) { XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) } // Returns the currently selected application. func (x *AppChooserWidget) GetAppInfo() *gio.AppInfoBase { var cls *gio.AppInfoBase cret := XGtkAppChooserGetAppInfo(x.GoPointer()) if cret == 0 { return nil } cls = &gio.AppInfoBase{} cls.Ptr = cret return cls } // Returns the content type for which the `GtkAppChooser` // shows applications. func (x *AppChooserWidget) GetContentType() string { cret := XGtkAppChooserGetContentType(x.GoPointer()) return cret } // Reloads the list of applications. func (x *AppChooserWidget) Refresh() { XGtkAppChooserRefresh(x.GoPointer()) } // Gets the ID of the @buildable object. // // `GtkBuilder` sets the name based on the ID attribute // of the `<object>` tag used to construct the @buildable. func (x *AppChooserWidget) GetBuildableId() string { cret := XGtkBuildableGetBuildableId(x.GoPointer()) return cret } func init() { core.SetPackageName("GTK", "gtk4") core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GTK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xAppChooserWidgetGLibType, libs, "gtk_app_chooser_widget_get_type") core.PuregoSafeRegister(&xNewAppChooserWidget, libs, "gtk_app_chooser_widget_new") core.PuregoSafeRegister(&xAppChooserWidgetGetDefaultText, libs, "gtk_app_chooser_widget_get_default_text") core.PuregoSafeRegister(&xAppChooserWidgetGetShowAll, libs, "gtk_app_chooser_widget_get_show_all") core.PuregoSafeRegister(&xAppChooserWidgetGetShowDefault, libs, "gtk_app_chooser_widget_get_show_default") core.PuregoSafeRegister(&xAppChooserWidgetGetShowFallback, libs, "gtk_app_chooser_widget_get_show_fallback") core.PuregoSafeRegister(&xAppChooserWidgetGetShowOther, libs, "gtk_app_chooser_widget_get_show_other") core.PuregoSafeRegister(&xAppChooserWidgetGetShowRecommended, libs, "gtk_app_chooser_widget_get_show_recommended") core.PuregoSafeRegister(&xAppChooserWidgetSetDefaultText, libs, "gtk_app_chooser_widget_set_default_text") core.PuregoSafeRegister(&xAppChooserWidgetSetShowAll, libs, "gtk_app_chooser_widget_set_show_all") core.PuregoSafeRegister(&xAppChooserWidgetSetShowDefault, libs, "gtk_app_chooser_widget_set_show_default") core.PuregoSafeRegister(&xAppChooserWidgetSetShowFallback, libs, "gtk_app_chooser_widget_set_show_fallback") core.PuregoSafeRegister(&xAppChooserWidgetSetShowOther, libs, "gtk_app_chooser_widget_set_show_other") core.PuregoSafeRegister(&xAppChooserWidgetSetShowRecommended, libs, "gtk_app_chooser_widget_set_show_recommended") }