v0.2.1 c0399be

gtkshortcuttrigger.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/gdk"
12	"github.com/bnema/puregotk/v4/glib"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15)
16
17type AlternativeTriggerClass struct {
18	_ structs.HostLayout
19}
20
21func (x *AlternativeTriggerClass) GoPointer() uintptr {
22	return uintptr(unsafe.Pointer(x))
23}
24
25type KeyvalTriggerClass struct {
26	_ structs.HostLayout
27}
28
29func (x *KeyvalTriggerClass) GoPointer() uintptr {
30	return uintptr(unsafe.Pointer(x))
31}
32
33type MnemonicTriggerClass struct {
34	_ structs.HostLayout
35}
36
37func (x *MnemonicTriggerClass) GoPointer() uintptr {
38	return uintptr(unsafe.Pointer(x))
39}
40
41type NeverTriggerClass struct {
42	_ structs.HostLayout
43}
44
45func (x *NeverTriggerClass) GoPointer() uintptr {
46	return uintptr(unsafe.Pointer(x))
47}
48
49type ShortcutTriggerClass struct {
50	_ structs.HostLayout
51}
52
53func (x *ShortcutTriggerClass) GoPointer() uintptr {
54	return uintptr(unsafe.Pointer(x))
55}
56
57// Combines two shortcut triggers.
58//
59// The `GtkAlternativeTrigger` triggers when either of the two trigger.
60//
61// This can be cascaded to combine more than two triggers.
62type AlternativeTrigger struct {
63	ShortcutTrigger
64}
65
66var xAlternativeTriggerGLibType func() types.GType
67
68func AlternativeTriggerGLibType() types.GType {
69	return xAlternativeTriggerGLibType()
70}
71
72func AlternativeTriggerNewFromInternalPtr(ptr uintptr) *AlternativeTrigger {
73	cls := &AlternativeTrigger{}
74	cls.Ptr = ptr
75	return cls
76}
77
78var xNewAlternativeTrigger func(uintptr, uintptr) uintptr
79
80// Creates a `GtkShortcutTrigger` that will trigger whenever
81// either of the two given triggers gets triggered.
82//
83// Note that nesting is allowed, so if you want more than two
84// alternative, create a new alternative trigger for each option.
85func NewAlternativeTrigger(FirstVar *ShortcutTrigger, SecondVar *ShortcutTrigger) *AlternativeTrigger {
86	var cls *AlternativeTrigger
87
88	cret := xNewAlternativeTrigger(FirstVar.GoPointer(), SecondVar.GoPointer())
89
90	if cret == 0 {
91		return nil
92	}
93	cls = &AlternativeTrigger{}
94	cls.Ptr = cret
95	return cls
96}
97
98var xAlternativeTriggerGetFirst func(uintptr) uintptr
99
100// Gets the first of the two alternative triggers that may
101// trigger @self.
102//
103// [method@Gtk.AlternativeTrigger.get_second] will return
104// the other one.
105func (x *AlternativeTrigger) GetFirst() *ShortcutTrigger {
106	var cls *ShortcutTrigger
107
108	cret := xAlternativeTriggerGetFirst(x.GoPointer())
109
110	if cret == 0 {
111		return nil
112	}
113	gobject.IncreaseRef(cret)
114	cls = &ShortcutTrigger{}
115	cls.Ptr = cret
116	return cls
117}
118
119var xAlternativeTriggerGetSecond func(uintptr) uintptr
120
121// Gets the second of the two alternative triggers that may
122// trigger @self.
123//
124// [method@Gtk.AlternativeTrigger.get_first] will return
125// the other one.
126func (x *AlternativeTrigger) GetSecond() *ShortcutTrigger {
127	var cls *ShortcutTrigger
128
129	cret := xAlternativeTriggerGetSecond(x.GoPointer())
130
131	if cret == 0 {
132		return nil
133	}
134	gobject.IncreaseRef(cret)
135	cls = &ShortcutTrigger{}
136	cls.Ptr = cret
137	return cls
138}
139
140func (c *AlternativeTrigger) GoPointer() uintptr {
141	if c == nil {
142		return 0
143	}
144	return c.Ptr
145}
146
147func (c *AlternativeTrigger) SetGoPointer(ptr uintptr) {
148	c.Ptr = ptr
149}
150
151// Triggers when a specific keyval and modifiers are pressed.
152type KeyvalTrigger struct {
153	ShortcutTrigger
154}
155
156var xKeyvalTriggerGLibType func() types.GType
157
158func KeyvalTriggerGLibType() types.GType {
159	return xKeyvalTriggerGLibType()
160}
161
162func KeyvalTriggerNewFromInternalPtr(ptr uintptr) *KeyvalTrigger {
163	cls := &KeyvalTrigger{}
164	cls.Ptr = ptr
165	return cls
166}
167
168var xNewKeyvalTrigger func(uint, gdk.ModifierType) uintptr
169
170// Creates a `GtkShortcutTrigger` that will trigger whenever
171// the key with the given @keyval and @modifiers is pressed.
172func NewKeyvalTrigger(KeyvalVar uint, ModifiersVar gdk.ModifierType) *KeyvalTrigger {
173	var cls *KeyvalTrigger
174
175	cret := xNewKeyvalTrigger(KeyvalVar, ModifiersVar)
176
177	if cret == 0 {
178		return nil
179	}
180	cls = &KeyvalTrigger{}
181	cls.Ptr = cret
182	return cls
183}
184
185var xKeyvalTriggerGetKeyval func(uintptr) uint
186
187// Gets the keyval that must be pressed to succeed
188// triggering @self.
189func (x *KeyvalTrigger) GetKeyval() uint {
190
191	cret := xKeyvalTriggerGetKeyval(x.GoPointer())
192	return cret
193}
194
195var xKeyvalTriggerGetModifiers func(uintptr) gdk.ModifierType
196
197// Gets the modifiers that must be present to succeed
198// triggering @self.
199func (x *KeyvalTrigger) GetModifiers() gdk.ModifierType {
200
201	cret := xKeyvalTriggerGetModifiers(x.GoPointer())
202	return cret
203}
204
205func (c *KeyvalTrigger) GoPointer() uintptr {
206	if c == nil {
207		return 0
208	}
209	return c.Ptr
210}
211
212func (c *KeyvalTrigger) SetGoPointer(ptr uintptr) {
213	c.Ptr = ptr
214}
215
216// SetPropertyKeyval sets the "keyval" property.
217// The key value for the trigger.
218func (x *KeyvalTrigger) SetPropertyKeyval(value uint) {
219	var v gobject.Value
220	v.Init(gobject.TypeUintVal)
221	v.SetUint(value)
222	x.SetProperty("keyval", &v)
223}
224
225// GetPropertyKeyval gets the "keyval" property.
226// The key value for the trigger.
227func (x *KeyvalTrigger) GetPropertyKeyval() uint {
228	var v gobject.Value
229	x.GetProperty("keyval", &v)
230	return v.GetUint()
231}
232
233// Triggers when a specific mnemonic is pressed.
234//
235// Mnemonics require a *mnemonic modifier* (typically <kbd>Alt</kbd>) to be
236// pressed together with the mnemonic key.
237type MnemonicTrigger struct {
238	ShortcutTrigger
239}
240
241var xMnemonicTriggerGLibType func() types.GType
242
243func MnemonicTriggerGLibType() types.GType {
244	return xMnemonicTriggerGLibType()
245}
246
247func MnemonicTriggerNewFromInternalPtr(ptr uintptr) *MnemonicTrigger {
248	cls := &MnemonicTrigger{}
249	cls.Ptr = ptr
250	return cls
251}
252
253var xNewMnemonicTrigger func(uint) uintptr
254
255// Creates a `GtkShortcutTrigger` that will trigger whenever the key with
256// the given @keyval is pressed and mnemonics have been activated.
257//
258// Mnemonics are activated by calling code when a key event with the right
259// modifiers is detected.
260func NewMnemonicTrigger(KeyvalVar uint) *MnemonicTrigger {
261	var cls *MnemonicTrigger
262
263	cret := xNewMnemonicTrigger(KeyvalVar)
264
265	if cret == 0 {
266		return nil
267	}
268	cls = &MnemonicTrigger{}
269	cls.Ptr = cret
270	return cls
271}
272
273var xMnemonicTriggerGetKeyval func(uintptr) uint
274
275// Gets the keyval that must be pressed to succeed triggering @self.
276func (x *MnemonicTrigger) GetKeyval() uint {
277
278	cret := xMnemonicTriggerGetKeyval(x.GoPointer())
279	return cret
280}
281
282func (c *MnemonicTrigger) GoPointer() uintptr {
283	if c == nil {
284		return 0
285	}
286	return c.Ptr
287}
288
289func (c *MnemonicTrigger) SetGoPointer(ptr uintptr) {
290	c.Ptr = ptr
291}
292
293// SetPropertyKeyval sets the "keyval" property.
294// The key value for the trigger.
295func (x *MnemonicTrigger) SetPropertyKeyval(value uint) {
296	var v gobject.Value
297	v.Init(gobject.TypeUintVal)
298	v.SetUint(value)
299	x.SetProperty("keyval", &v)
300}
301
302// GetPropertyKeyval gets the "keyval" property.
303// The key value for the trigger.
304func (x *MnemonicTrigger) GetPropertyKeyval() uint {
305	var v gobject.Value
306	x.GetProperty("keyval", &v)
307	return v.GetUint()
308}
309
310// A `GtkShortcutTrigger` that never triggers.
311type NeverTrigger struct {
312	ShortcutTrigger
313}
314
315var xNeverTriggerGLibType func() types.GType
316
317func NeverTriggerGLibType() types.GType {
318	return xNeverTriggerGLibType()
319}
320
321func NeverTriggerNewFromInternalPtr(ptr uintptr) *NeverTrigger {
322	cls := &NeverTrigger{}
323	cls.Ptr = ptr
324	return cls
325}
326
327func (c *NeverTrigger) GoPointer() uintptr {
328	if c == nil {
329		return 0
330	}
331	return c.Ptr
332}
333
334func (c *NeverTrigger) SetGoPointer(ptr uintptr) {
335	c.Ptr = ptr
336}
337
338var xNeverTriggerGet func() uintptr
339
340// Gets the never trigger.
341//
342// This is a singleton for a trigger that never triggers.
343// Use this trigger instead of %NULL because it implements
344// all virtual functions.
345func NeverTriggerGet() *NeverTrigger {
346	var cls *NeverTrigger
347
348	cret := xNeverTriggerGet()
349
350	if cret == 0 {
351		return nil
352	}
353	gobject.IncreaseRef(cret)
354	cls = &NeverTrigger{}
355	cls.Ptr = cret
356	return cls
357}
358
359// Tracks how a `GtkShortcut` can be activated.
360//
361// To find out if a `GtkShortcutTrigger` triggers, you can call
362// [method@Gtk.ShortcutTrigger.trigger] on a `GdkEvent`.
363//
364// `GtkShortcutTriggers` contain functions that allow easy presentation
365// to end users as well as being printed for debugging.
366//
367// All `GtkShortcutTriggers` are immutable, you can only specify their
368// properties during construction. If you want to change a trigger, you
369// have to replace it with a new one.
370type ShortcutTrigger struct {
371	gobject.Object
372}
373
374var xShortcutTriggerGLibType func() types.GType
375
376func ShortcutTriggerGLibType() types.GType {
377	return xShortcutTriggerGLibType()
378}
379
380func ShortcutTriggerNewFromInternalPtr(ptr uintptr) *ShortcutTrigger {
381	cls := &ShortcutTrigger{}
382	cls.Ptr = ptr
383	return cls
384}
385
386var xShortcutTriggerParseString func(string) uintptr
387
388// Tries to parse the given string into a trigger.
389//
390// On success, the parsed trigger is returned.
391// When parsing failed, %NULL is returned.
392//
393// The accepted strings are:
394//
395//   - `never`, for `GtkNeverTrigger`
396//   - a string parsed by gtk_accelerator_parse(), for a `GtkKeyvalTrigger`, e.g. `<Control>C`
397//   - underscore, followed by a single character, for `GtkMnemonicTrigger`, e.g. `_l`
398//   - two valid trigger strings, separated by a `|` character, for a
399//     `GtkAlternativeTrigger`: `<Control>q|<Control>w`
400//
401// Note that you will have to escape the `<` and `>` characters when specifying
402// triggers in XML files, such as GtkBuilder ui files. Use `<` instead of
403// `<` and `>` instead of `>`.
404func ShortcutTriggerParseString(StringVar string) *ShortcutTrigger {
405	var cls *ShortcutTrigger
406
407	cret := xShortcutTriggerParseString(StringVar)
408
409	if cret == 0 {
410		return nil
411	}
412	cls = &ShortcutTrigger{}
413	cls.Ptr = cret
414	return cls
415}
416
417var xShortcutTriggerCompare func(uintptr, uintptr) int
418
419// The types of @trigger1 and @trigger2 are `gconstpointer` only to allow
420// use of this function as a `GCompareFunc`.
421//
422// They must each be a `GtkShortcutTrigger`.
423func (x *ShortcutTrigger) Compare(Trigger2Var uintptr) int {
424
425	cret := xShortcutTriggerCompare(x.GoPointer(), Trigger2Var)
426	return cret
427}
428
429var xShortcutTriggerEqual func(uintptr, uintptr) bool
430
431// Checks if @trigger1 and @trigger2 trigger under the same conditions.
432//
433// The types of @one and @two are `gconstpointer` only to allow use of this
434// function with `GHashTable`. They must each be a `GtkShortcutTrigger`.
435func (x *ShortcutTrigger) Equal(Trigger2Var uintptr) bool {
436
437	cret := xShortcutTriggerEqual(x.GoPointer(), Trigger2Var)
438	return cret
439}
440
441var xShortcutTriggerHash func(uintptr) uint
442
443// Generates a hash value for a `GtkShortcutTrigger`.
444//
445// The output of this function is guaranteed to be the same for a given
446// value only per-process. It may change between different processor
447// architectures or even different versions of GTK. Do not use this
448// function as a basis for building protocols or file formats.
449//
450// The types of @trigger is `gconstpointer` only to allow use of this
451// function with `GHashTable`. They must each be a `GtkShortcutTrigger`.
452func (x *ShortcutTrigger) Hash() uint {
453
454	cret := xShortcutTriggerHash(x.GoPointer())
455	return cret
456}
457
458var xShortcutTriggerPrint func(uintptr, *glib.String)
459
460// Prints the given trigger into a string for the developer.
461// This is meant for debugging and logging.
462//
463// The form of the representation may change at any time
464// and is not guaranteed to stay identical.
465func (x *ShortcutTrigger) Print(StringVar *glib.String) {
466
467	xShortcutTriggerPrint(x.GoPointer(), StringVar)
468
469}
470
471var xShortcutTriggerPrintLabel func(uintptr, uintptr, *glib.String) bool
472
473// Prints the given trigger into a string.
474//
475// This function is returning a translated string for presentation
476// to end users for example in menu items or in help texts.
477//
478// The @display in use may influence the resulting string in
479// various forms, such as resolving hardware keycodes or by
480// causing display-specific modifier names.
481//
482// The form of the representation may change at any time and is
483// not guaranteed to stay identical.
484func (x *ShortcutTrigger) PrintLabel(DisplayVar *gdk.Display, StringVar *glib.String) bool {
485
486	cret := xShortcutTriggerPrintLabel(x.GoPointer(), DisplayVar.GoPointer(), StringVar)
487	return cret
488}
489
490var xShortcutTriggerToLabel func(uintptr, uintptr) string
491
492// Gets textual representation for the given trigger.
493//
494// This function is returning a translated string for
495// presentation to end users for example in menu items
496// or in help texts.
497//
498// The @display in use may influence the resulting string in
499// various forms, such as resolving hardware keycodes or by
500// causing display-specific modifier names.
501//
502// The form of the representation may change at any time and is
503// not guaranteed to stay identical.
504func (x *ShortcutTrigger) ToLabel(DisplayVar *gdk.Display) string {
505
506	cret := xShortcutTriggerToLabel(x.GoPointer(), DisplayVar.GoPointer())
507	return cret
508}
509
510var xShortcutTriggerToString func(uintptr) string
511
512// Prints the given trigger into a human-readable string.
513//
514// This is a small wrapper around [method@Gtk.ShortcutTrigger.print]
515// to help when debugging.
516func (x *ShortcutTrigger) ToString() string {
517
518	cret := xShortcutTriggerToString(x.GoPointer())
519	return cret
520}
521
522var xShortcutTriggerTrigger func(uintptr, uintptr, bool) gdk.KeyMatch
523
524// Checks if the given @event triggers @self.
525func (x *ShortcutTrigger) Trigger(EventVar *gdk.Event, EnableMnemonicsVar bool) gdk.KeyMatch {
526
527	cret := xShortcutTriggerTrigger(x.GoPointer(), EventVar.GoPointer(), EnableMnemonicsVar)
528	return cret
529}
530
531func (c *ShortcutTrigger) GoPointer() uintptr {
532	if c == nil {
533		return 0
534	}
535	return c.Ptr
536}
537
538func (c *ShortcutTrigger) SetGoPointer(ptr uintptr) {
539	c.Ptr = ptr
540}
541
542func init() {
543	core.SetPackageName("GTK", "gtk4")
544	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
545	var libs []uintptr
546	for _, libPath := range core.GetPaths("GTK") {
547		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
548		if err != nil {
549			panic(err)
550		}
551		libs = append(libs, lib)
552	}
553
554	core.PuregoSafeRegister(&xAlternativeTriggerGLibType, libs, "gtk_alternative_trigger_get_type")
555
556	core.PuregoSafeRegister(&xNewAlternativeTrigger, libs, "gtk_alternative_trigger_new")
557
558	core.PuregoSafeRegister(&xAlternativeTriggerGetFirst, libs, "gtk_alternative_trigger_get_first")
559	core.PuregoSafeRegister(&xAlternativeTriggerGetSecond, libs, "gtk_alternative_trigger_get_second")
560
561	core.PuregoSafeRegister(&xKeyvalTriggerGLibType, libs, "gtk_keyval_trigger_get_type")
562
563	core.PuregoSafeRegister(&xNewKeyvalTrigger, libs, "gtk_keyval_trigger_new")
564
565	core.PuregoSafeRegister(&xKeyvalTriggerGetKeyval, libs, "gtk_keyval_trigger_get_keyval")
566	core.PuregoSafeRegister(&xKeyvalTriggerGetModifiers, libs, "gtk_keyval_trigger_get_modifiers")
567
568	core.PuregoSafeRegister(&xMnemonicTriggerGLibType, libs, "gtk_mnemonic_trigger_get_type")
569
570	core.PuregoSafeRegister(&xNewMnemonicTrigger, libs, "gtk_mnemonic_trigger_new")
571
572	core.PuregoSafeRegister(&xMnemonicTriggerGetKeyval, libs, "gtk_mnemonic_trigger_get_keyval")
573
574	core.PuregoSafeRegister(&xNeverTriggerGLibType, libs, "gtk_never_trigger_get_type")
575
576	core.PuregoSafeRegister(&xNeverTriggerGet, libs, "gtk_never_trigger_get")
577
578	core.PuregoSafeRegister(&xShortcutTriggerGLibType, libs, "gtk_shortcut_trigger_get_type")
579
580	core.PuregoSafeRegister(&xShortcutTriggerParseString, libs, "gtk_shortcut_trigger_parse_string")
581
582	core.PuregoSafeRegister(&xShortcutTriggerCompare, libs, "gtk_shortcut_trigger_compare")
583	core.PuregoSafeRegister(&xShortcutTriggerEqual, libs, "gtk_shortcut_trigger_equal")
584	core.PuregoSafeRegister(&xShortcutTriggerHash, libs, "gtk_shortcut_trigger_hash")
585	core.PuregoSafeRegister(&xShortcutTriggerPrint, libs, "gtk_shortcut_trigger_print")
586	core.PuregoSafeRegister(&xShortcutTriggerPrintLabel, libs, "gtk_shortcut_trigger_print_label")
587	core.PuregoSafeRegister(&xShortcutTriggerToLabel, libs, "gtk_shortcut_trigger_to_label")
588	core.PuregoSafeRegister(&xShortcutTriggerToString, libs, "gtk_shortcut_trigger_to_string")
589	core.PuregoSafeRegister(&xShortcutTriggerTrigger, libs, "gtk_shortcut_trigger_trigger")
590
591}

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