// 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/v4/gobject/types" ) // The list of functions that can be implemented for the `GtkShortcutManager` // interface. // // Note that no function is mandatory to implement, the default implementation // will work fine. type ShortcutManagerInterface struct { _ structs.HostLayout GIface uintptr xAddController uintptr xRemoveController uintptr } func (x *ShortcutManagerInterface) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideAddController sets the "add_controller" callback function. // Add a `GtkShortcutController` to be managed. func (x *ShortcutManagerInterface) OverrideAddController(cb func(ShortcutManager, *ShortcutController)) { if cb == nil { x.xAddController = 0 } else { x.xAddController = purego.NewCallback(func(SelfVarp uintptr, ControllerVarp uintptr) { cb(&ShortcutManagerBase{Ptr: SelfVarp}, ShortcutControllerNewFromInternalPtr(ControllerVarp)) }) } } // GetAddController gets the "add_controller" callback function. // Add a `GtkShortcutController` to be managed. func (x *ShortcutManagerInterface) GetAddController() func(ShortcutManager, *ShortcutController) { if x.xAddController == 0 { return nil } var rawCallback func(SelfVarp uintptr, ControllerVarp uintptr) purego.RegisterFunc(&rawCallback, x.xAddController) return func(SelfVar ShortcutManager, ControllerVar *ShortcutController) { rawCallback(SelfVar.GoPointer(), ControllerVar.GoPointer()) } } // OverrideRemoveController sets the "remove_controller" callback function. // Remove a `GtkShortcutController` that had previously // // been added func (x *ShortcutManagerInterface) OverrideRemoveController(cb func(ShortcutManager, *ShortcutController)) { if cb == nil { x.xRemoveController = 0 } else { x.xRemoveController = purego.NewCallback(func(SelfVarp uintptr, ControllerVarp uintptr) { cb(&ShortcutManagerBase{Ptr: SelfVarp}, ShortcutControllerNewFromInternalPtr(ControllerVarp)) }) } } // GetRemoveController gets the "remove_controller" callback function. // Remove a `GtkShortcutController` that had previously // // been added func (x *ShortcutManagerInterface) GetRemoveController() func(ShortcutManager, *ShortcutController) { if x.xRemoveController == 0 { return nil } var rawCallback func(SelfVarp uintptr, ControllerVarp uintptr) purego.RegisterFunc(&rawCallback, x.xRemoveController) return func(SelfVar ShortcutManager, ControllerVar *ShortcutController) { rawCallback(SelfVar.GoPointer(), ControllerVar.GoPointer()) } } // An interface that is used to implement shortcut scopes. // // This is important for [iface@Gtk.Native] widgets that have their // own surface, since the event controllers that are used to implement // managed and global scopes are limited to the same native. // // Examples for widgets implementing `GtkShortcutManager` are // [class@Gtk.Window] and [class@Gtk.Popover]. // // Every widget that implements `GtkShortcutManager` will be used as a // `GTK_SHORTCUT_SCOPE_MANAGED`. type ShortcutManager interface { GoPointer() uintptr SetGoPointer(uintptr) } var xShortcutManagerGLibType func() types.GType func ShortcutManagerGLibType() types.GType { return xShortcutManagerGLibType() } type ShortcutManagerBase struct { Ptr uintptr } func (x *ShortcutManagerBase) GoPointer() uintptr { if x == nil { return 0 } return x.Ptr } func (x *ShortcutManagerBase) SetGoPointer(ptr uintptr) { x.Ptr = ptr }