v0.2.1 c0399be

gtkshortcutswindow.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"unsafe"
6
7	"github.com/ebitengine/purego"
8
9	"github.com/bnema/puregotk/pkg/core"
10	"github.com/bnema/puregotk/v4/gdk"
11	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14	"github.com/bnema/puregotk/v4/gsk"
15)
16
17// A `GtkShortcutsWindow` shows information about the keyboard shortcuts
18// and gestures of an application.
19//
20// The shortcuts can be grouped, and you can have multiple sections in this
21// window, corresponding to the major modes of your application.
22//
23// Additionally, the shortcuts can be filtered by the current view, to avoid
24// showing information that is not relevant in the current application context.
25//
26// The recommended way to construct a `GtkShortcutsWindow` is with
27// [class@Gtk.Builder], by using the `<child>` tag to populate a
28// `GtkShortcutsWindow` with one or more [class@Gtk.ShortcutsSection] objects,
29// which contain one or more [class@Gtk.ShortcutsGroup] instances, which, in turn,
30// contain [class@Gtk.ShortcutsShortcut] instances.
31//
32// If you need to add a section programmatically, use [method@Gtk.ShortcutsWindow.add_section]
33// instead of [method@Gtk.Window.set_child], as the shortcuts window manages
34// its children directly.
35//
36// # A simple example:
37//
38// <picture>
39//
40//	<source srcset="gedit-shortcuts-dark.png" media="(prefers-color-scheme: dark)">
41//	<img alt="A simple example" src="gedit-shortcuts.png">
42//
43// </picture>
44//
45// This example has as single section. As you can see, the shortcut groups
46// are arranged in columns, and spread across several pages if there are too
47// many to find on a single page.
48//
49// The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-gedit.ui).
50//
51// # An example with multiple views:
52//
53// <picture>
54//
55//	<source srcset="clocks-shortcuts-dark.png" media="(prefers-color-scheme: dark)">
56//	<img alt="An example with multiple views" src="clocks-shortcuts.png">
57//
58// </picture>
59//
60// This example shows a `GtkShortcutsWindow` that has been configured to show only
61// the shortcuts relevant to the “Stopwatch” view.
62//
63// The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-clocks.ui).
64//
65// # An example with multiple sections:
66//
67// <picture>
68//
69//	<source srcset="builder-shortcuts-dark.png" media="(prefers-color-scheme: dark)">
70//	<img alt="An example with multiple sections" src="builder-shortcuts.png">
71//
72// </picture>
73//
74// This example shows a `GtkShortcutsWindow` with two sections, “Editor Shortcuts”
75// and “Terminal Shortcuts”.
76//
77// The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-builder.ui).
78//
79// # Shortcuts and Gestures
80//
81// The following signals have default keybindings:
82//
83// - [signal@Gtk.ShortcutsWindow::close]
84// - [signal@Gtk.ShortcutsWindow::search]
85//
86// # CSS nodes
87//
88// `GtkShortcutsWindow` has a single CSS node with the name `window` and style
89// class `.shortcuts`.
90type ShortcutsWindow struct {
91	Window
92}
93
94var xShortcutsWindowGLibType func() types.GType
95
96func ShortcutsWindowGLibType() types.GType {
97	return xShortcutsWindowGLibType()
98}
99
100func ShortcutsWindowNewFromInternalPtr(ptr uintptr) *ShortcutsWindow {
101	cls := &ShortcutsWindow{}
102	cls.Ptr = ptr
103	return cls
104}
105
106var xShortcutsWindowAddSection func(uintptr, uintptr)
107
108// Adds a section to the shortcuts window.
109//
110// This is the programmatic equivalent to using [class@Gtk.Builder] and a
111// `<child>` tag to add the child.
112//
113// Using [method@Gtk.Window.set_child] is not appropriate as the shortcuts
114// window manages its children internally.
115func (x *ShortcutsWindow) AddSection(SectionVar *ShortcutsSection) {
116
117	xShortcutsWindowAddSection(x.GoPointer(), SectionVar.GoPointer())
118
119}
120
121func (c *ShortcutsWindow) GoPointer() uintptr {
122	if c == nil {
123		return 0
124	}
125	return c.Ptr
126}
127
128func (c *ShortcutsWindow) SetGoPointer(ptr uintptr) {
129	c.Ptr = ptr
130}
131
132// SetPropertySectionName sets the "section-name" property.
133// The name of the section to show.
134//
135// This should be the section-name of one of the `GtkShortcutsSection`
136// objects that are in this shortcuts window.
137func (x *ShortcutsWindow) SetPropertySectionName(value string) {
138	var v gobject.Value
139	v.Init(gobject.TypeStringVal)
140	v.SetString(&value)
141	x.SetProperty("section-name", &v)
142}
143
144// GetPropertySectionName gets the "section-name" property.
145// The name of the section to show.
146//
147// This should be the section-name of one of the `GtkShortcutsSection`
148// objects that are in this shortcuts window.
149func (x *ShortcutsWindow) GetPropertySectionName() string {
150	var v gobject.Value
151	x.GetProperty("section-name", &v)
152	return v.GetString()
153}
154
155// SetPropertyViewName sets the "view-name" property.
156// The view name by which to filter the contents.
157//
158// This should correspond to the [property@Gtk.ShortcutsGroup:view]
159// property of some of the [class@Gtk.ShortcutsGroup] objects that
160// are inside this shortcuts window.
161//
162// Set this to %NULL to show all groups.
163func (x *ShortcutsWindow) SetPropertyViewName(value string) {
164	var v gobject.Value
165	v.Init(gobject.TypeStringVal)
166	v.SetString(&value)
167	x.SetProperty("view-name", &v)
168}
169
170// GetPropertyViewName gets the "view-name" property.
171// The view name by which to filter the contents.
172//
173// This should correspond to the [property@Gtk.ShortcutsGroup:view]
174// property of some of the [class@Gtk.ShortcutsGroup] objects that
175// are inside this shortcuts window.
176//
177// Set this to %NULL to show all groups.
178func (x *ShortcutsWindow) GetPropertyViewName() string {
179	var v gobject.Value
180	x.GetProperty("view-name", &v)
181	return v.GetString()
182}
183
184// Emitted when the user uses a keybinding to close the window.
185//
186// This is a [keybinding signal](class.SignalAction.html).
187//
188// The default binding for this signal is the <kbd>Escape</kbd> key.
189func (x *ShortcutsWindow) ConnectClose(cb *func(ShortcutsWindow)) uint {
190	cbPtr := uintptr(unsafe.Pointer(cb))
191	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
192		handlerID := gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr)
193		glib.SaveHandlerMapping(handlerID, cbPtr)
194		return handlerID
195	}
196
197	fcb := func(clsPtr uintptr) {
198		fa := ShortcutsWindow{}
199		fa.Ptr = clsPtr
200		cbFn := *cb
201
202		cbFn(fa)
203
204	}
205	cbRefPtr := purego.NewCallback(fcb)
206	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
207	handlerID := gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr)
208	glib.SaveHandlerMapping(handlerID, cbPtr)
209	return handlerID
210}
211
212// Emitted when the user uses a keybinding to start a search.
213//
214// This is a [keybinding signal](class.SignalAction.html).
215//
216// The default binding for this signal is <kbd>Control</kbd>+<kbd>F</kbd>.
217func (x *ShortcutsWindow) ConnectSearch(cb *func(ShortcutsWindow)) uint {
218	cbPtr := uintptr(unsafe.Pointer(cb))
219	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
220		handlerID := gobject.SignalConnect(x.GoPointer(), "search", cbRefPtr)
221		glib.SaveHandlerMapping(handlerID, cbPtr)
222		return handlerID
223	}
224
225	fcb := func(clsPtr uintptr) {
226		fa := ShortcutsWindow{}
227		fa.Ptr = clsPtr
228		cbFn := *cb
229
230		cbFn(fa)
231
232	}
233	cbRefPtr := purego.NewCallback(fcb)
234	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
235	handlerID := gobject.SignalConnect(x.GoPointer(), "search", cbRefPtr)
236	glib.SaveHandlerMapping(handlerID, cbPtr)
237	return handlerID
238}
239
240// Requests the user's screen reader to announce the given message.
241//
242// This kind of notification is useful for messages that
243// either have only a visual representation or that are not
244// exposed visually at all, e.g. a notification about a
245// successful operation.
246//
247// Also, by using this API, you can ensure that the message
248// does not interrupts the user's current screen reader output.
249func (x *ShortcutsWindow) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
250
251	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
252
253}
254
255// Retrieves the accessible parent for an accessible object.
256//
257// This function returns `NULL` for top level widgets.
258func (x *ShortcutsWindow) GetAccessibleParent() *AccessibleBase {
259	var cls *AccessibleBase
260
261	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
262
263	if cret == 0 {
264		return nil
265	}
266	cls = &AccessibleBase{}
267	cls.Ptr = cret
268	return cls
269}
270
271// Retrieves the accessible role of an accessible object.
272func (x *ShortcutsWindow) GetAccessibleRole() AccessibleRole {
273
274	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
275	return cret
276}
277
278// Retrieves the implementation for the given accessible object.
279func (x *ShortcutsWindow) GetAtContext() *ATContext {
280	var cls *ATContext
281
282	cret := XGtkAccessibleGetAtContext(x.GoPointer())
283
284	if cret == 0 {
285		return nil
286	}
287	cls = &ATContext{}
288	cls.Ptr = cret
289	return cls
290}
291
292// Queries the coordinates and dimensions of this accessible
293//
294// This functionality can be overridden by `GtkAccessible`
295// implementations, e.g. to get the bounds from an ignored
296// child widget.
297func (x *ShortcutsWindow) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
298
299	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
300	return cret
301}
302
303// Retrieves the first accessible child of an accessible object.
304func (x *ShortcutsWindow) GetFirstAccessibleChild() *AccessibleBase {
305	var cls *AccessibleBase
306
307	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
308
309	if cret == 0 {
310		return nil
311	}
312	cls = &AccessibleBase{}
313	cls.Ptr = cret
314	return cls
315}
316
317// Retrieves the next accessible sibling of an accessible object
318func (x *ShortcutsWindow) GetNextAccessibleSibling() *AccessibleBase {
319	var cls *AccessibleBase
320
321	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
322
323	if cret == 0 {
324		return nil
325	}
326	cls = &AccessibleBase{}
327	cls.Ptr = cret
328	return cls
329}
330
331// Queries a platform state, such as focus.
332//
333// This functionality can be overridden by `GtkAccessible`
334// implementations, e.g. to get platform state from an ignored
335// child widget, as is the case for `GtkText` wrappers.
336func (x *ShortcutsWindow) GetPlatformState(StateVar AccessiblePlatformState) bool {
337
338	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
339	return cret
340}
341
342// Resets the accessible property to its default value.
343func (x *ShortcutsWindow) ResetProperty(PropertyVar AccessibleProperty) {
344
345	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
346
347}
348
349// Resets the accessible relation to its default value.
350func (x *ShortcutsWindow) ResetRelation(RelationVar AccessibleRelation) {
351
352	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
353
354}
355
356// Resets the accessible state to its default value.
357func (x *ShortcutsWindow) ResetState(StateVar AccessibleState) {
358
359	XGtkAccessibleResetState(x.GoPointer(), StateVar)
360
361}
362
363// Sets the parent and sibling of an accessible object.
364//
365// This function is meant to be used by accessible implementations that are
366// not part of the widget hierarchy, and but act as a logical bridge between
367// widgets. For instance, if a widget creates an object that holds metadata
368// for each child, and you want that object to implement the `GtkAccessible`
369// interface, you will use this function to ensure that the parent of each
370// child widget is the metadata object, and the parent of each metadata
371// object is the container widget.
372func (x *ShortcutsWindow) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
373
374	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
375
376}
377
378// Updates the next accessible sibling.
379//
380// That might be useful when a new child of a custom accessible
381// is created, and it needs to be linked to a previous child.
382func (x *ShortcutsWindow) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
383
384	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
385
386}
387
388// Informs ATs that the platform state has changed.
389//
390// This function should be used by `GtkAccessible` implementations that
391// have a platform state but are not widgets. Widgets handle platform
392// states automatically.
393func (x *ShortcutsWindow) UpdatePlatformState(StateVar AccessiblePlatformState) {
394
395	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
396
397}
398
399// Updates a list of accessible properties.
400//
401// See the [enum@Gtk.AccessibleProperty] documentation for the
402// value types of accessible properties.
403//
404// This function should be called by `GtkWidget` types whenever
405// an accessible property change must be communicated to assistive
406// technologies.
407//
408// Example:
409// ```c
410// value = gtk_adjustment_get_value (adjustment);
411// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
412//
413//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
414//	-1);
415//
416// ```
417func (x *ShortcutsWindow) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
418
419	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
420
421}
422
423// Updates an array of accessible properties.
424//
425// This function should be called by `GtkWidget` types whenever an accessible
426// property change must be communicated to assistive technologies.
427//
428// This function is meant to be used by language bindings.
429func (x *ShortcutsWindow) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
430
431	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
432
433}
434
435// Updates a list of accessible relations.
436//
437// This function should be called by `GtkWidget` types whenever an accessible
438// relation change must be communicated to assistive technologies.
439//
440// If the [enum@Gtk.AccessibleRelation] requires a list of references,
441// you should pass each reference individually, followed by `NULL`, e.g.
442//
443// ```c
444// gtk_accessible_update_relation (accessible,
445//
446//	GTK_ACCESSIBLE_RELATION_CONTROLS,
447//	  ref1, NULL,
448//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
449//	  ref1, ref2, ref3, NULL,
450//	-1);
451//
452// ```
453func (x *ShortcutsWindow) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
454
455	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
456
457}
458
459// Updates an array of accessible relations.
460//
461// This function should be called by `GtkWidget` types whenever an accessible
462// relation change must be communicated to assistive technologies.
463//
464// This function is meant to be used by language bindings.
465func (x *ShortcutsWindow) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
466
467	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
468
469}
470
471// Updates a list of accessible states.
472//
473// See the [enum@Gtk.AccessibleState] documentation for the
474// value types of accessible states.
475//
476// This function should be called by `GtkWidget` types whenever
477// an accessible state change must be communicated to assistive
478// technologies.
479//
480// Example:
481//
482// ```c
483// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
484// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
485//
486//	GTK_ACCESSIBLE_STATE_CHECKED, value,
487//	-1);
488//
489// ```
490func (x *ShortcutsWindow) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
491
492	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
493
494}
495
496// Updates an array of accessible states.
497//
498// This function should be called by `GtkWidget` types whenever an accessible
499// state change must be communicated to assistive technologies.
500//
501// This function is meant to be used by language bindings.
502func (x *ShortcutsWindow) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
503
504	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
505
506}
507
508// Gets the ID of the @buildable object.
509//
510// `GtkBuilder` sets the name based on the ID attribute
511// of the `<object>` tag used to construct the @buildable.
512func (x *ShortcutsWindow) GetBuildableId() string {
513
514	cret := XGtkBuildableGetBuildableId(x.GoPointer())
515	return cret
516}
517
518// Returns the renderer that is used for this `GtkNative`.
519func (x *ShortcutsWindow) GetRenderer() *gsk.Renderer {
520	var cls *gsk.Renderer
521
522	cret := XGtkNativeGetRenderer(x.GoPointer())
523
524	if cret == 0 {
525		return nil
526	}
527	gobject.IncreaseRef(cret)
528	cls = &gsk.Renderer{}
529	cls.Ptr = cret
530	return cls
531}
532
533// Returns the surface of this `GtkNative`.
534func (x *ShortcutsWindow) GetSurface() *gdk.Surface {
535	var cls *gdk.Surface
536
537	cret := XGtkNativeGetSurface(x.GoPointer())
538
539	if cret == 0 {
540		return nil
541	}
542	gobject.IncreaseRef(cret)
543	cls = &gdk.Surface{}
544	cls.Ptr = cret
545	return cls
546}
547
548// Retrieves the surface transform of @self.
549//
550// This is the translation from @self's surface coordinates into
551// @self's widget coordinates.
552func (x *ShortcutsWindow) GetSurfaceTransform(XVar *float64, YVar *float64) {
553
554	XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
555
556}
557
558// Realizes a `GtkNative`.
559//
560// This should only be used by subclasses.
561func (x *ShortcutsWindow) Realize() {
562
563	XGtkNativeRealize(x.GoPointer())
564
565}
566
567// Unrealizes a `GtkNative`.
568//
569// This should only be used by subclasses.
570func (x *ShortcutsWindow) Unrealize() {
571
572	XGtkNativeUnrealize(x.GoPointer())
573
574}
575
576// Returns the display that this `GtkRoot` is on.
577func (x *ShortcutsWindow) GetDisplay() *gdk.Display {
578	var cls *gdk.Display
579
580	cret := XGtkRootGetDisplay(x.GoPointer())
581
582	if cret == 0 {
583		return nil
584	}
585	gobject.IncreaseRef(cret)
586	cls = &gdk.Display{}
587	cls.Ptr = cret
588	return cls
589}
590
591// Retrieves the current focused widget within the root.
592//
593// Note that this is the widget that would have the focus
594// if the root is active; if the root is not focused then
595// `gtk_widget_has_focus (widget)` will be %FALSE for the
596// widget.
597func (x *ShortcutsWindow) GetFocus() *Widget {
598	var cls *Widget
599
600	cret := XGtkRootGetFocus(x.GoPointer())
601
602	if cret == 0 {
603		return nil
604	}
605	gobject.IncreaseRef(cret)
606	cls = &Widget{}
607	cls.Ptr = cret
608	return cls
609}
610
611// If @focus is not the current focus widget, and is focusable, sets
612// it as the focus widget for the root.
613//
614// If @focus is %NULL, unsets the focus widget for the root.
615//
616// To set the focus to a particular widget in the root, it is usually
617// more convenient to use [method@Gtk.Widget.grab_focus] instead of
618// this function.
619func (x *ShortcutsWindow) SetFocus(FocusVar *Widget) {
620
621	XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer())
622
623}
624
625func init() {
626	core.SetPackageName("GTK", "gtk4")
627	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
628	var libs []uintptr
629	for _, libPath := range core.GetPaths("GTK") {
630		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
631		if err != nil {
632			panic(err)
633		}
634		libs = append(libs, lib)
635	}
636
637	core.PuregoSafeRegister(&xShortcutsWindowGLibType, libs, "gtk_shortcuts_window_get_type")
638
639	core.PuregoSafeRegister(&xShortcutsWindowAddSection, libs, "gtk_shortcuts_window_add_section")
640
641}

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