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)
10
11var xAcceleratorGetDefaultModMask func() gdk.ModifierType
12
13// Gets the modifier mask.
14//
15// The modifier mask determines which modifiers are considered significant
16// for keyboard accelerators. This includes all keyboard modifiers except
17// for `GDK_LOCK_MASK`.
18func AcceleratorGetDefaultModMask() gdk.ModifierType {
19
20 cret := xAcceleratorGetDefaultModMask()
21 return cret
22}
23
24var xAcceleratorGetLabel func(uint, gdk.ModifierType) string
25
26// Converts an accelerator keyval and modifier mask into a string
27// which can be used to represent the accelerator to the user.
28func AcceleratorGetLabel(AcceleratorKeyVar uint, AcceleratorModsVar gdk.ModifierType) string {
29
30 cret := xAcceleratorGetLabel(AcceleratorKeyVar, AcceleratorModsVar)
31 return cret
32}
33
34var xAcceleratorGetLabelWithKeycode func(uintptr, uint, uint, gdk.ModifierType) string
35
36// Converts an accelerator keyval and modifier mask
37// into a string that can be displayed to the user.
38//
39// The string may be translated.
40//
41// This function is similar to [func@Gtk.accelerator_get_label],
42// but handling keycodes. This is only useful for system-level
43// components, applications should use [func@Gtk.accelerator_get_label]
44// instead.
45func AcceleratorGetLabelWithKeycode(DisplayVar *gdk.Display, AcceleratorKeyVar uint, KeycodeVar uint, AcceleratorModsVar gdk.ModifierType) string {
46
47 cret := xAcceleratorGetLabelWithKeycode(DisplayVar.GoPointer(), AcceleratorKeyVar, KeycodeVar, AcceleratorModsVar)
48 return cret
49}
50
51var xAcceleratorName func(uint, gdk.ModifierType) string
52
53// Converts an accelerator keyval and modifier mask into a string
54// that can be parsed by [func@Gtk.accelerator_parse].
55//
56// For example, if you pass in `GDK_KEY_q` and `GDK_CONTROL_MASK`,
57// this function returns `<Control>q`.
58//
59// If you need to display accelerators in the user interface,
60// see [func@Gtk.accelerator_get_label].
61func AcceleratorName(AcceleratorKeyVar uint, AcceleratorModsVar gdk.ModifierType) string {
62
63 cret := xAcceleratorName(AcceleratorKeyVar, AcceleratorModsVar)
64 return cret
65}
66
67var xAcceleratorNameWithKeycode func(uintptr, uint, uint, gdk.ModifierType) string
68
69// Converts an accelerator keyval and modifier mask
70// into a string that can be parsed by [func@Gtk.accelerator_parse_with_keycode].
71//
72// This is similar to [func@Gtk.accelerator_name] but handling keycodes.
73// This is only useful for system-level components, applications
74// should use [func@Gtk.accelerator_name] instead.
75func AcceleratorNameWithKeycode(DisplayVar *gdk.Display, AcceleratorKeyVar uint, KeycodeVar uint, AcceleratorModsVar gdk.ModifierType) string {
76
77 cret := xAcceleratorNameWithKeycode(DisplayVar.GoPointer(), AcceleratorKeyVar, KeycodeVar, AcceleratorModsVar)
78 return cret
79}
80
81var xAcceleratorParse func(string, *uint, *gdk.ModifierType) bool
82
83// Parses a string representing an accelerator.
84//
85// The format looks like “`<Control>a`” or “`<Shift><Alt>F1`”.
86//
87// The parser is fairly liberal and allows lower or upper case, and also
88// abbreviations such as “`<Ctl>`” and “`<Ctrl>`”.
89//
90// Key names are parsed using [func@Gdk.keyval_from_name]. For character keys
91// the name is not the symbol, but the lowercase name, e.g. one would use
92// “`<Ctrl>minus`” instead of “`<Ctrl>-`”.
93//
94// Modifiers are enclosed in angular brackets `<>`, and match the
95// [flags@Gdk.ModifierType] mask:
96//
97// - `<Shift>` for `GDK_SHIFT_MASK`
98// - `<Ctrl>` for `GDK_CONTROL_MASK`
99// - `<Alt>` for `GDK_ALT_MASK`
100// - `<Meta>` for `GDK_META_MASK`
101// - `<Super>` for `GDK_SUPER_MASK`
102// - `<Hyper>` for `GDK_HYPER_MASK`
103//
104// If the parse operation fails, @accelerator_key and @accelerator_mods will
105// be set to 0 (zero).
106func AcceleratorParse(AcceleratorVar string, AcceleratorKeyVar *uint, AcceleratorModsVar *gdk.ModifierType) bool {
107
108 cret := xAcceleratorParse(AcceleratorVar, AcceleratorKeyVar, AcceleratorModsVar)
109 return cret
110}
111
112var xAcceleratorParseWithKeycode func(string, uintptr, *uint, *[]uint, *gdk.ModifierType) bool
113
114// Parses a string representing an accelerator.
115//
116// This is similar to [func@Gtk.accelerator_parse] but handles keycodes as
117// well. This is only useful for system-level components, applications should
118// use [func@Gtk.accelerator_parse] instead.
119//
120// If @accelerator_codes is given and the result stored in it is non-%NULL,
121// the result must be freed with g_free().
122//
123// If a keycode is present in the accelerator and no @accelerator_codes
124// is given, the parse will fail.
125//
126// If the parse fails, @accelerator_key, @accelerator_mods and
127// @accelerator_codes will be set to 0 (zero).
128func AcceleratorParseWithKeycode(AcceleratorVar string, DisplayVar *gdk.Display, AcceleratorKeyVar *uint, AcceleratorCodesVar *[]uint, AcceleratorModsVar *gdk.ModifierType) bool {
129
130 cret := xAcceleratorParseWithKeycode(AcceleratorVar, DisplayVar.GoPointer(), AcceleratorKeyVar, AcceleratorCodesVar, AcceleratorModsVar)
131 return cret
132}
133
134var xAcceleratorValid func(uint, gdk.ModifierType) bool
135
136// Determines whether a given keyval and modifier mask constitute
137// a valid keyboard accelerator.
138//
139// For example, the `GDK_KEY_a` keyval plus `GDK_CONTROL_MASK` mask is valid,
140// and matches the “Ctrl+a” accelerator. But, you can't, for instance, use
141// the `GDK_KEY_Control_L` keyval as an accelerator.
142func AcceleratorValid(KeyvalVar uint, ModifiersVar gdk.ModifierType) bool {
143
144 cret := xAcceleratorValid(KeyvalVar, ModifiersVar)
145 return cret
146}
147
148func init() {
149 core.SetPackageName("GTK", "gtk4")
150 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
151 var libs []uintptr
152 for _, libPath := range core.GetPaths("GTK") {
153 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
154 if err != nil {
155 panic(err)
156 }
157 libs = append(libs, lib)
158 }
159
160 core.PuregoSafeRegister(&xAcceleratorGetDefaultModMask, libs, "gtk_accelerator_get_default_mod_mask")
161 core.PuregoSafeRegister(&xAcceleratorGetLabel, libs, "gtk_accelerator_get_label")
162 core.PuregoSafeRegister(&xAcceleratorGetLabelWithKeycode, libs, "gtk_accelerator_get_label_with_keycode")
163 core.PuregoSafeRegister(&xAcceleratorName, libs, "gtk_accelerator_name")
164 core.PuregoSafeRegister(&xAcceleratorNameWithKeycode, libs, "gtk_accelerator_name_with_keycode")
165 core.PuregoSafeRegister(&xAcceleratorParse, libs, "gtk_accelerator_parse")
166 core.PuregoSafeRegister(&xAcceleratorParseWithKeycode, libs, "gtk_accelerator_parse_with_keycode")
167 core.PuregoSafeRegister(&xAcceleratorValid, libs, "gtk_accelerator_valid")
168
169}