// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type ShortcutClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass } func (x *ShortcutClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Describes a keyboard shortcut. // // It contains a description of how to trigger the shortcut via a // [class@Gtk.ShortcutTrigger] and a way to activate the shortcut // on a widget via a [class@Gtk.ShortcutAction]. // // The actual work is usually done via [class@Gtk.ShortcutController], // which decides if and when to activate a shortcut. Using that controller // directly however is rarely necessary as various higher level // convenience APIs exist on `GtkWidget`s that make it easier to use // shortcuts in GTK. // // `GtkShortcut` does provide functionality to make it easy for users // to work with shortcuts, either by providing informational strings // for display purposes or by allowing shortcuts to be configured. type Shortcut struct { gobject.Object } var xShortcutGLibType func() types.GType func ShortcutGLibType() types.GType { return xShortcutGLibType() } func ShortcutNewFromInternalPtr(ptr uintptr) *Shortcut { cls := &Shortcut{} cls.Ptr = ptr return cls } var xNewShortcut func(uintptr, uintptr) uintptr // Creates a new `GtkShortcut` that is triggered by // @trigger and then activates @action. func NewShortcut(TriggerVar *ShortcutTrigger, ActionVar *ShortcutAction) *Shortcut { var cls *Shortcut cret := xNewShortcut(TriggerVar.GoPointer(), ActionVar.GoPointer()) if cret == 0 { return nil } cls = &Shortcut{} cls.Ptr = cret return cls } var xNewShortcutWithArguments func(uintptr, uintptr, uintptr, ...interface{}) uintptr // Creates a new `GtkShortcut` that is triggered by @trigger and then activates // @action with arguments given by @format_string. func NewShortcutWithArguments(TriggerVar *ShortcutTrigger, ActionVar *ShortcutAction, FormatStringVar *string, varArgs ...interface{}) *Shortcut { var cls *Shortcut FormatStringVarPtr := core.GStrdupNullable(FormatStringVar) defer core.GFreeNullable(FormatStringVarPtr) cret := xNewShortcutWithArguments(TriggerVar.GoPointer(), ActionVar.GoPointer(), FormatStringVarPtr, varArgs...) if cret == 0 { return nil } cls = &Shortcut{} cls.Ptr = cret return cls } var xShortcutGetAction func(uintptr) uintptr // Gets the action that is activated by this shortcut. func (x *Shortcut) GetAction() *ShortcutAction { var cls *ShortcutAction cret := xShortcutGetAction(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ShortcutAction{} cls.Ptr = cret return cls } var xShortcutGetArguments func(uintptr) *glib.Variant // Gets the arguments that are passed when activating the shortcut. func (x *Shortcut) GetArguments() *glib.Variant { cret := xShortcutGetArguments(x.GoPointer()) return cret } var xShortcutGetTrigger func(uintptr) uintptr // Gets the trigger used to trigger @self. func (x *Shortcut) GetTrigger() *ShortcutTrigger { var cls *ShortcutTrigger cret := xShortcutGetTrigger(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ShortcutTrigger{} cls.Ptr = cret return cls } var xShortcutSetAction func(uintptr, uintptr) // Sets the new action for @self to be @action. func (x *Shortcut) SetAction(ActionVar *ShortcutAction) { xShortcutSetAction(x.GoPointer(), ActionVar.GoPointer()) } var xShortcutSetArguments func(uintptr, *glib.Variant) // Sets the arguments to pass when activating the shortcut. func (x *Shortcut) SetArguments(ArgsVar *glib.Variant) { xShortcutSetArguments(x.GoPointer(), ArgsVar) } var xShortcutSetTrigger func(uintptr, uintptr) // Sets the new trigger for @self to be @trigger. func (x *Shortcut) SetTrigger(TriggerVar *ShortcutTrigger) { xShortcutSetTrigger(x.GoPointer(), TriggerVar.GoPointer()) } func (c *Shortcut) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Shortcut) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyArguments sets the "arguments" property. // Arguments passed to activation. func (x *Shortcut) SetPropertyArguments(value uintptr) { var v gobject.Value v.Init(gobject.TypePointerVal) v.SetPointer(value) x.SetProperty("arguments", &v) } // GetPropertyArguments gets the "arguments" property. // Arguments passed to activation. func (x *Shortcut) GetPropertyArguments() uintptr { var v gobject.Value x.GetProperty("arguments", &v) return v.GetPointer() } 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(&xShortcutGLibType, libs, "gtk_shortcut_get_type") core.PuregoSafeRegister(&xNewShortcut, libs, "gtk_shortcut_new") core.PuregoSafeRegister(&xNewShortcutWithArguments, libs, "gtk_shortcut_new_with_arguments") core.PuregoSafeRegister(&xShortcutGetAction, libs, "gtk_shortcut_get_action") core.PuregoSafeRegister(&xShortcutGetArguments, libs, "gtk_shortcut_get_arguments") core.PuregoSafeRegister(&xShortcutGetTrigger, libs, "gtk_shortcut_get_trigger") core.PuregoSafeRegister(&xShortcutSetAction, libs, "gtk_shortcut_set_action") core.PuregoSafeRegister(&xShortcutSetArguments, libs, "gtk_shortcut_set_arguments") core.PuregoSafeRegister(&xShortcutSetTrigger, libs, "gtk_shortcut_set_trigger") }