gtkshortcutmanager.go RawHistoryFolder
1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/v4/gobject/types"
11)
12
13// The list of functions that can be implemented for the `GtkShortcutManager`
14// interface.
15//
16// Note that no function is mandatory to implement, the default implementation
17// will work fine.
18type ShortcutManagerInterface struct {
19 _ structs.HostLayout
20
21 GIface uintptr
22
23 xAddController uintptr
24
25 xRemoveController uintptr
26}
27
28func (x *ShortcutManagerInterface) GoPointer() uintptr {
29 return uintptr(unsafe.Pointer(x))
30}
31
32// OverrideAddController sets the "add_controller" callback function.
33// Add a `GtkShortcutController` to be managed.
34func (x *ShortcutManagerInterface) OverrideAddController(cb func(ShortcutManager, *ShortcutController)) {
35 if cb == nil {
36 x.xAddController = 0
37 } else {
38 x.xAddController = purego.NewCallback(func(SelfVarp uintptr, ControllerVarp uintptr) {
39 cb(&ShortcutManagerBase{Ptr: SelfVarp}, ShortcutControllerNewFromInternalPtr(ControllerVarp))
40 })
41 }
42}
43
44// GetAddController gets the "add_controller" callback function.
45// Add a `GtkShortcutController` to be managed.
46func (x *ShortcutManagerInterface) GetAddController() func(ShortcutManager, *ShortcutController) {
47 if x.xAddController == 0 {
48 return nil
49 }
50 var rawCallback func(SelfVarp uintptr, ControllerVarp uintptr)
51 purego.RegisterFunc(&rawCallback, x.xAddController)
52 return func(SelfVar ShortcutManager, ControllerVar *ShortcutController) {
53 rawCallback(SelfVar.GoPointer(), ControllerVar.GoPointer())
54 }
55}
56
57// OverrideRemoveController sets the "remove_controller" callback function.
58// Remove a `GtkShortcutController` that had previously
59//
60// been added
61func (x *ShortcutManagerInterface) OverrideRemoveController(cb func(ShortcutManager, *ShortcutController)) {
62 if cb == nil {
63 x.xRemoveController = 0
64 } else {
65 x.xRemoveController = purego.NewCallback(func(SelfVarp uintptr, ControllerVarp uintptr) {
66 cb(&ShortcutManagerBase{Ptr: SelfVarp}, ShortcutControllerNewFromInternalPtr(ControllerVarp))
67 })
68 }
69}
70
71// GetRemoveController gets the "remove_controller" callback function.
72// Remove a `GtkShortcutController` that had previously
73//
74// been added
75func (x *ShortcutManagerInterface) GetRemoveController() func(ShortcutManager, *ShortcutController) {
76 if x.xRemoveController == 0 {
77 return nil
78 }
79 var rawCallback func(SelfVarp uintptr, ControllerVarp uintptr)
80 purego.RegisterFunc(&rawCallback, x.xRemoveController)
81 return func(SelfVar ShortcutManager, ControllerVar *ShortcutController) {
82 rawCallback(SelfVar.GoPointer(), ControllerVar.GoPointer())
83 }
84}
85
86// An interface that is used to implement shortcut scopes.
87//
88// This is important for [iface@Gtk.Native] widgets that have their
89// own surface, since the event controllers that are used to implement
90// managed and global scopes are limited to the same native.
91//
92// Examples for widgets implementing `GtkShortcutManager` are
93// [class@Gtk.Window] and [class@Gtk.Popover].
94//
95// Every widget that implements `GtkShortcutManager` will be used as a
96// `GTK_SHORTCUT_SCOPE_MANAGED`.
97type ShortcutManager interface {
98 GoPointer() uintptr
99 SetGoPointer(uintptr)
100}
101
102var xShortcutManagerGLibType func() types.GType
103
104func ShortcutManagerGLibType() types.GType {
105 return xShortcutManagerGLibType()
106}
107
108type ShortcutManagerBase struct {
109 Ptr uintptr
110}
111
112func (x *ShortcutManagerBase) GoPointer() uintptr {
113 if x == nil {
114 return 0
115 }
116 return x.Ptr
117}
118
119func (x *ShortcutManagerBase) SetGoPointer(ptr uintptr) {
120 x.Ptr = ptr
121}