v0.2.1 c0399be

gtkshortcutaction.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/pkg/core"
11	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// Type for shortcuts based on user callbacks.
17type ShortcutFunc func(uintptr, *glib.Variant, uintptr) bool
18
19type ActivateActionClass struct {
20	_ structs.HostLayout
21}
22
23func (x *ActivateActionClass) GoPointer() uintptr {
24	return uintptr(unsafe.Pointer(x))
25}
26
27type CallbackActionClass struct {
28	_ structs.HostLayout
29}
30
31func (x *CallbackActionClass) GoPointer() uintptr {
32	return uintptr(unsafe.Pointer(x))
33}
34
35type MnemonicActionClass struct {
36	_ structs.HostLayout
37}
38
39func (x *MnemonicActionClass) GoPointer() uintptr {
40	return uintptr(unsafe.Pointer(x))
41}
42
43type NamedActionClass struct {
44	_ structs.HostLayout
45}
46
47func (x *NamedActionClass) GoPointer() uintptr {
48	return uintptr(unsafe.Pointer(x))
49}
50
51type NothingActionClass struct {
52	_ structs.HostLayout
53}
54
55func (x *NothingActionClass) GoPointer() uintptr {
56	return uintptr(unsafe.Pointer(x))
57}
58
59type ShortcutActionClass struct {
60	_ structs.HostLayout
61}
62
63func (x *ShortcutActionClass) GoPointer() uintptr {
64	return uintptr(unsafe.Pointer(x))
65}
66
67type SignalActionClass struct {
68	_ structs.HostLayout
69}
70
71func (x *SignalActionClass) GoPointer() uintptr {
72	return uintptr(unsafe.Pointer(x))
73}
74
75// Flags that can be passed to action activation.
76//
77// More flags may be added in the future.
78type ShortcutActionFlags int
79
80var xShortcutActionFlagsGLibType func() types.GType
81
82func ShortcutActionFlagsGLibType() types.GType {
83	return xShortcutActionFlagsGLibType()
84}
85
86const (
87
88	// The action is the only
89	//   action that can be activated. If this flag is not set,
90	//   a future activation may select a different action.
91	ShortcutActionExclusiveValue ShortcutActionFlags = 1
92)
93
94// Activates a widget.
95//
96// Widgets are activated by calling [method@Gtk.Widget.activate].
97type ActivateAction struct {
98	ShortcutAction
99}
100
101var xActivateActionGLibType func() types.GType
102
103func ActivateActionGLibType() types.GType {
104	return xActivateActionGLibType()
105}
106
107func ActivateActionNewFromInternalPtr(ptr uintptr) *ActivateAction {
108	cls := &ActivateAction{}
109	cls.Ptr = ptr
110	return cls
111}
112
113func (c *ActivateAction) GoPointer() uintptr {
114	if c == nil {
115		return 0
116	}
117	return c.Ptr
118}
119
120func (c *ActivateAction) SetGoPointer(ptr uintptr) {
121	c.Ptr = ptr
122}
123
124var xActivateActionGet func() uintptr
125
126// Gets the activate action.
127//
128// This is an action that calls gtk_widget_activate()
129// on the given widget upon activation.
130func ActivateActionGet() *ActivateAction {
131	var cls *ActivateAction
132
133	cret := xActivateActionGet()
134
135	if cret == 0 {
136		return nil
137	}
138	gobject.IncreaseRef(cret)
139	cls = &ActivateAction{}
140	cls.Ptr = cret
141	return cls
142}
143
144// Invokes a callback.
145type CallbackAction struct {
146	ShortcutAction
147}
148
149var xCallbackActionGLibType func() types.GType
150
151func CallbackActionGLibType() types.GType {
152	return xCallbackActionGLibType()
153}
154
155func CallbackActionNewFromInternalPtr(ptr uintptr) *CallbackAction {
156	cls := &CallbackAction{}
157	cls.Ptr = ptr
158	return cls
159}
160
161var xNewCallbackAction func(uintptr, uintptr, uintptr) uintptr
162
163// Create a custom action that calls the given @callback when
164// activated.
165func NewCallbackAction(CallbackVar *ShortcutFunc, DataVar uintptr, DestroyVar *glib.DestroyNotify) *CallbackAction {
166	var cls *CallbackAction
167
168	var CallbackVarRef uintptr
169	if CallbackVar != nil {
170		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
171		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
172			CallbackVarRef = cbRefPtr
173		} else {
174			fcb := func(arg0 uintptr, arg1 *glib.Variant, arg2 uintptr) bool {
175				cbFn := *CallbackVar
176				return cbFn(arg0, arg1, arg2)
177			}
178			CallbackVarRef = purego.NewCallback(fcb)
179			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
180		}
181	}
182
183	var DestroyVarRef uintptr
184	if DestroyVar != nil {
185		DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
186		if cbRefPtr, ok := glib.GetCallback(DestroyVarPtr); ok {
187			DestroyVarRef = cbRefPtr
188		} else {
189			fcb := func(arg0 uintptr) {
190				cbFn := *DestroyVar
191				cbFn(arg0)
192			}
193			DestroyVarRef = purego.NewCallback(fcb)
194			glib.SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
195		}
196	}
197
198	cret := xNewCallbackAction(CallbackVarRef, DataVar, DestroyVarRef)
199
200	if cret == 0 {
201		return nil
202	}
203	cls = &CallbackAction{}
204	cls.Ptr = cret
205	return cls
206}
207
208func (c *CallbackAction) GoPointer() uintptr {
209	if c == nil {
210		return 0
211	}
212	return c.Ptr
213}
214
215func (c *CallbackAction) SetGoPointer(ptr uintptr) {
216	c.Ptr = ptr
217}
218
219// Activates a widget with a mnemonic.
220//
221// This means that [method@Gtk.Widget.mnemonic_activate] is called.
222type MnemonicAction struct {
223	ShortcutAction
224}
225
226var xMnemonicActionGLibType func() types.GType
227
228func MnemonicActionGLibType() types.GType {
229	return xMnemonicActionGLibType()
230}
231
232func MnemonicActionNewFromInternalPtr(ptr uintptr) *MnemonicAction {
233	cls := &MnemonicAction{}
234	cls.Ptr = ptr
235	return cls
236}
237
238func (c *MnemonicAction) GoPointer() uintptr {
239	if c == nil {
240		return 0
241	}
242	return c.Ptr
243}
244
245func (c *MnemonicAction) SetGoPointer(ptr uintptr) {
246	c.Ptr = ptr
247}
248
249var xMnemonicActionGet func() uintptr
250
251// Gets the mnemonic action.
252//
253// This is an action that calls gtk_widget_mnemonic_activate()
254// on the given widget upon activation.
255func MnemonicActionGet() *MnemonicAction {
256	var cls *MnemonicAction
257
258	cret := xMnemonicActionGet()
259
260	if cret == 0 {
261		return nil
262	}
263	gobject.IncreaseRef(cret)
264	cls = &MnemonicAction{}
265	cls.Ptr = cret
266	return cls
267}
268
269// Activates a named action.
270//
271// See [method@Gtk.WidgetClass.install_action] and
272// [method@Gtk.Widget.insert_action_group] for ways
273// to associate named actions with widgets.
274type NamedAction struct {
275	ShortcutAction
276}
277
278var xNamedActionGLibType func() types.GType
279
280func NamedActionGLibType() types.GType {
281	return xNamedActionGLibType()
282}
283
284func NamedActionNewFromInternalPtr(ptr uintptr) *NamedAction {
285	cls := &NamedAction{}
286	cls.Ptr = ptr
287	return cls
288}
289
290var xNewNamedAction func(string) uintptr
291
292// Creates an action that when activated, activates
293// the named action on the widget.
294//
295// It also passes the given arguments to it.
296//
297// See [method@Gtk.Widget.insert_action_group] for
298// how to add actions to widgets.
299func NewNamedAction(NameVar string) *NamedAction {
300	var cls *NamedAction
301
302	cret := xNewNamedAction(NameVar)
303
304	if cret == 0 {
305		return nil
306	}
307	cls = &NamedAction{}
308	cls.Ptr = cret
309	return cls
310}
311
312var xNamedActionGetActionName func(uintptr) string
313
314// Returns the name of the action that will be activated.
315func (x *NamedAction) GetActionName() string {
316
317	cret := xNamedActionGetActionName(x.GoPointer())
318	return cret
319}
320
321func (c *NamedAction) GoPointer() uintptr {
322	if c == nil {
323		return 0
324	}
325	return c.Ptr
326}
327
328func (c *NamedAction) SetGoPointer(ptr uintptr) {
329	c.Ptr = ptr
330}
331
332// SetPropertyActionName sets the "action-name" property.
333// The name of the action to activate.
334func (x *NamedAction) SetPropertyActionName(value string) {
335	var v gobject.Value
336	v.Init(gobject.TypeStringVal)
337	v.SetString(&value)
338	x.SetProperty("action-name", &v)
339}
340
341// GetPropertyActionName gets the "action-name" property.
342// The name of the action to activate.
343func (x *NamedAction) GetPropertyActionName() string {
344	var v gobject.Value
345	x.GetProperty("action-name", &v)
346	return v.GetString()
347}
348
349// Does nothing.
350type NothingAction struct {
351	ShortcutAction
352}
353
354var xNothingActionGLibType func() types.GType
355
356func NothingActionGLibType() types.GType {
357	return xNothingActionGLibType()
358}
359
360func NothingActionNewFromInternalPtr(ptr uintptr) *NothingAction {
361	cls := &NothingAction{}
362	cls.Ptr = ptr
363	return cls
364}
365
366func (c *NothingAction) GoPointer() uintptr {
367	if c == nil {
368		return 0
369	}
370	return c.Ptr
371}
372
373func (c *NothingAction) SetGoPointer(ptr uintptr) {
374	c.Ptr = ptr
375}
376
377var xNothingActionGet func() uintptr
378
379// Gets the nothing action.
380//
381// This is an action that does nothing and where
382// activating it always fails.
383func NothingActionGet() *NothingAction {
384	var cls *NothingAction
385
386	cret := xNothingActionGet()
387
388	if cret == 0 {
389		return nil
390	}
391	gobject.IncreaseRef(cret)
392	cls = &NothingAction{}
393	cls.Ptr = cret
394	return cls
395}
396
397// Encodes an action that can be triggered by a keyboard shortcut.
398//
399// `GtkShortcutActions` contain functions that allow easy presentation
400// to end users as well as being printed for debugging.
401//
402// All `GtkShortcutActions` are immutable, you can only specify their
403// properties during construction. If you want to change a action, you
404// have to replace it with a new one. If you need to pass arguments to
405// an action, these are specified by the higher-level `GtkShortcut` object.
406//
407// To activate a `GtkShortcutAction` manually, [method@Gtk.ShortcutAction.activate]
408// can be called.
409//
410// GTK provides various actions:
411//
412//   - [class@Gtk.MnemonicAction]: a shortcut action that calls
413//     gtk_widget_mnemonic_activate()
414//   - [class@Gtk.CallbackAction]: a shortcut action that invokes
415//     a given callback
416//   - [class@Gtk.SignalAction]: a shortcut action that emits a
417//     given signal
418//   - [class@Gtk.ActivateAction]: a shortcut action that calls
419//     gtk_widget_activate()
420//   - [class@Gtk.NamedAction]: a shortcut action that calls
421//     gtk_widget_activate_action()
422//   - [class@Gtk.NothingAction]: a shortcut action that does nothing
423type ShortcutAction struct {
424	gobject.Object
425}
426
427var xShortcutActionGLibType func() types.GType
428
429func ShortcutActionGLibType() types.GType {
430	return xShortcutActionGLibType()
431}
432
433func ShortcutActionNewFromInternalPtr(ptr uintptr) *ShortcutAction {
434	cls := &ShortcutAction{}
435	cls.Ptr = ptr
436	return cls
437}
438
439var xShortcutActionParseString func(string) uintptr
440
441// Tries to parse the given string into an action.
442//
443// On success, the parsed action is returned. When parsing
444// failed, %NULL is returned.
445//
446// The accepted strings are:
447//
448// - `nothing`, for `GtkNothingAction`
449// - `activate`, for `GtkActivateAction`
450// - `mnemonic-activate`, for `GtkMnemonicAction`
451// - `action(NAME)`, for a `GtkNamedAction` for the action named `NAME`
452// - `signal(NAME)`, for a `GtkSignalAction` for the signal `NAME`
453func ShortcutActionParseString(StringVar string) *ShortcutAction {
454	var cls *ShortcutAction
455
456	cret := xShortcutActionParseString(StringVar)
457
458	if cret == 0 {
459		return nil
460	}
461	cls = &ShortcutAction{}
462	cls.Ptr = cret
463	return cls
464}
465
466var xShortcutActionActivate func(uintptr, ShortcutActionFlags, uintptr, *glib.Variant) bool
467
468// Activates the action on the @widget with the given @args.
469//
470// Note that some actions ignore the passed in @flags, @widget or @args.
471//
472// Activation of an action can fail for various reasons. If the action
473// is not supported by the @widget, if the @args don't match the action
474// or if the activation otherwise had no effect, %FALSE will be returned.
475func (x *ShortcutAction) Activate(FlagsVar ShortcutActionFlags, WidgetVar *Widget, ArgsVar *glib.Variant) bool {
476
477	cret := xShortcutActionActivate(x.GoPointer(), FlagsVar, WidgetVar.GoPointer(), ArgsVar)
478	return cret
479}
480
481var xShortcutActionPrint func(uintptr, *glib.String)
482
483// Prints the given action into a string for the developer.
484//
485// This is meant for debugging and logging.
486//
487// The form of the representation may change at any time and is
488// not guaranteed to stay identical.
489func (x *ShortcutAction) Print(StringVar *glib.String) {
490
491	xShortcutActionPrint(x.GoPointer(), StringVar)
492
493}
494
495var xShortcutActionToString func(uintptr) string
496
497// Prints the given action into a human-readable string.
498//
499// This is a small wrapper around [method@Gtk.ShortcutAction.print]
500// to help when debugging.
501func (x *ShortcutAction) ToString() string {
502
503	cret := xShortcutActionToString(x.GoPointer())
504	return cret
505}
506
507func (c *ShortcutAction) GoPointer() uintptr {
508	if c == nil {
509		return 0
510	}
511	return c.Ptr
512}
513
514func (c *ShortcutAction) SetGoPointer(ptr uintptr) {
515	c.Ptr = ptr
516}
517
518// Emits a signal on a widget.
519//
520// Signals that are used in this way are referred to as keybinding signals,
521// and they are expected to be defined with the `G_SIGNAL_ACTION` flag.
522type SignalAction struct {
523	ShortcutAction
524}
525
526var xSignalActionGLibType func() types.GType
527
528func SignalActionGLibType() types.GType {
529	return xSignalActionGLibType()
530}
531
532func SignalActionNewFromInternalPtr(ptr uintptr) *SignalAction {
533	cls := &SignalAction{}
534	cls.Ptr = ptr
535	return cls
536}
537
538var xNewSignalAction func(string) uintptr
539
540// Creates an action that when activated, emits the given action signal
541// on the provided widget.
542//
543// It will also unpack the args into arguments passed to the signal.
544func NewSignalAction(SignalNameVar string) *SignalAction {
545	var cls *SignalAction
546
547	cret := xNewSignalAction(SignalNameVar)
548
549	if cret == 0 {
550		return nil
551	}
552	cls = &SignalAction{}
553	cls.Ptr = cret
554	return cls
555}
556
557var xSignalActionGetSignalName func(uintptr) string
558
559// Returns the name of the signal that will be emitted.
560func (x *SignalAction) GetSignalName() string {
561
562	cret := xSignalActionGetSignalName(x.GoPointer())
563	return cret
564}
565
566func (c *SignalAction) GoPointer() uintptr {
567	if c == nil {
568		return 0
569	}
570	return c.Ptr
571}
572
573func (c *SignalAction) SetGoPointer(ptr uintptr) {
574	c.Ptr = ptr
575}
576
577// SetPropertySignalName sets the "signal-name" property.
578// The name of the signal to emit.
579func (x *SignalAction) SetPropertySignalName(value string) {
580	var v gobject.Value
581	v.Init(gobject.TypeStringVal)
582	v.SetString(&value)
583	x.SetProperty("signal-name", &v)
584}
585
586// GetPropertySignalName gets the "signal-name" property.
587// The name of the signal to emit.
588func (x *SignalAction) GetPropertySignalName() string {
589	var v gobject.Value
590	x.GetProperty("signal-name", &v)
591	return v.GetString()
592}
593
594func init() {
595	core.SetPackageName("GTK", "gtk4")
596	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
597	var libs []uintptr
598	for _, libPath := range core.GetPaths("GTK") {
599		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
600		if err != nil {
601			panic(err)
602		}
603		libs = append(libs, lib)
604	}
605
606	core.PuregoSafeRegister(&xShortcutActionFlagsGLibType, libs, "gtk_shortcut_action_flags_get_type")
607
608	core.PuregoSafeRegister(&xActivateActionGLibType, libs, "gtk_activate_action_get_type")
609
610	core.PuregoSafeRegister(&xActivateActionGet, libs, "gtk_activate_action_get")
611
612	core.PuregoSafeRegister(&xCallbackActionGLibType, libs, "gtk_callback_action_get_type")
613
614	core.PuregoSafeRegister(&xNewCallbackAction, libs, "gtk_callback_action_new")
615
616	core.PuregoSafeRegister(&xMnemonicActionGLibType, libs, "gtk_mnemonic_action_get_type")
617
618	core.PuregoSafeRegister(&xMnemonicActionGet, libs, "gtk_mnemonic_action_get")
619
620	core.PuregoSafeRegister(&xNamedActionGLibType, libs, "gtk_named_action_get_type")
621
622	core.PuregoSafeRegister(&xNewNamedAction, libs, "gtk_named_action_new")
623
624	core.PuregoSafeRegister(&xNamedActionGetActionName, libs, "gtk_named_action_get_action_name")
625
626	core.PuregoSafeRegister(&xNothingActionGLibType, libs, "gtk_nothing_action_get_type")
627
628	core.PuregoSafeRegister(&xNothingActionGet, libs, "gtk_nothing_action_get")
629
630	core.PuregoSafeRegister(&xShortcutActionGLibType, libs, "gtk_shortcut_action_get_type")
631
632	core.PuregoSafeRegister(&xShortcutActionParseString, libs, "gtk_shortcut_action_parse_string")
633
634	core.PuregoSafeRegister(&xShortcutActionActivate, libs, "gtk_shortcut_action_activate")
635	core.PuregoSafeRegister(&xShortcutActionPrint, libs, "gtk_shortcut_action_print")
636	core.PuregoSafeRegister(&xShortcutActionToString, libs, "gtk_shortcut_action_to_string")
637
638	core.PuregoSafeRegister(&xSignalActionGLibType, libs, "gtk_signal_action_get_type")
639
640	core.PuregoSafeRegister(&xNewSignalAction, libs, "gtk_signal_action_new")
641
642	core.PuregoSafeRegister(&xSignalActionGetSignalName, libs, "gtk_signal_action_get_signal_name")
643
644}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close