v0.2.1 c0399be

adw-shortcut-label.go RawHistoryFolder

1// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package adw
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/gobject"
12	"github.com/bnema/puregotk/v4/gobject/types"
13	"github.com/bnema/puregotk/v4/gtk"
14)
15
16type ShortcutLabelClass struct {
17	_ structs.HostLayout
18
19	ParentClass gtk.WidgetClass
20}
21
22func (x *ShortcutLabelClass) GoPointer() uintptr {
23	return uintptr(unsafe.Pointer(x))
24}
25
26// A widget that displays a keyboard shortcut.
27//
28// <picture>
29//
30//	<source srcset="shortcut-label-dark.png" media="(prefers-color-scheme: dark)">
31//	<img src="shortcut-label.png" alt="shortcut-label">
32//
33// </picture>
34//
35// The shown shortcut can be set using the [property@ShortcutLabel:accelerator]
36// property.
37//
38// Optionally, if no shortcut is set, `AdwShortcutLabel` will display a
39// placeholder set with the [property@ShortcutLabel:disabled-text] property.
40//
41// The following types of shortcuts can be displayed:
42//
43// - A single shortcut in [func@Gtk.accelerator_parse] format, e.g. `<Control>C`:
44//
45//	<picture>
46//	  <source srcset="shortcut-label-single-dark.png" media="(prefers-color-scheme: dark)">
47//	  <img src="shortcut-label-single.png" alt="shortcut-label-single">
48//	</picture>
49//
50// - Multiple alternative shortcuts, separated with spaces, e.g. `<Shift>A Home`:
51//
52//	<picture>
53//	  <source srcset="shortcut-label-alternative-dark.png" media="(prefers-color-scheme: dark)">
54//	  <img src="shortcut-label-alternative.png" alt="shortcut-label-alternative">
55//	</picture>
56//
57// - A range of shortcuts, separated with `...`, e.g. `<Alt>1...9`:
58//
59//	<picture>
60//	  <source srcset="shortcut-label-range-dark.png" media="(prefers-color-scheme: dark)">
61//	  <img src="shortcut-label-range.png" alt="shortcut-label-range">
62//	</picture>
63//
64// - Multiple keys pressed at once, separated with `&`, e.g. `Control_L&Control_R`:
65//
66//	<picture>
67//	  <source srcset="shortcut-label-multiple-dark.png" media="(prefers-color-scheme: dark)">
68//	  <img src="shortcut-label-multiple.png" alt="shortcut-label-multiple">
69//	</picture>
70//
71// - Multiple shortcuts or keys, pressed sequentially, separated with `+`, e.g. `<Control>C+<Control>X`:
72//
73//	<picture>
74//	  <source srcset="shortcut-label-sequence-dark.png" media="(prefers-color-scheme: dark)">
75//	  <img src="shortcut-label-sequence.png" alt="shortcut-label-sequence">
76//	</picture>
77//
78// ::: note
79//
80//	`<`, `>` and `&` need to be escaped as `<`, `>` and `&` when used in UI files.
81//
82// ## CSS nodes
83//
84// `AdwShortcutLabel` has a single CSS node with name `shortcut-label`. The
85// individual keycap labels each have the `.keycap` style class, while the
86// labels separating them have the `.dimmed` style class.
87//
88// ## Accessibility
89//
90// `AdwShortcutLabel` uses the `GTK_ACCESSIBLE_ROLE_GENERIC` role.
91//
92// See also: [class@ShortcutsDialog].
93type ShortcutLabel struct {
94	gtk.Widget
95}
96
97var xShortcutLabelGLibType func() types.GType
98
99func ShortcutLabelGLibType() types.GType {
100	return xShortcutLabelGLibType()
101}
102
103func ShortcutLabelNewFromInternalPtr(ptr uintptr) *ShortcutLabel {
104	cls := &ShortcutLabel{}
105	cls.Ptr = ptr
106	return cls
107}
108
109var xNewShortcutLabel func(string) uintptr
110
111// Creates a new `AdwShortcutLabel` showing @accelerator.
112func NewShortcutLabel(AcceleratorVar string) *ShortcutLabel {
113	var cls *ShortcutLabel
114
115	cret := xNewShortcutLabel(AcceleratorVar)
116
117	if cret == 0 {
118		return nil
119	}
120	gobject.IncreaseRef(cret)
121	cls = &ShortcutLabel{}
122	cls.Ptr = cret
123	return cls
124}
125
126var xShortcutLabelGetAccelerator func(uintptr) string
127
128// Gets the accelerator displayed by @self.
129func (x *ShortcutLabel) GetAccelerator() string {
130
131	cret := xShortcutLabelGetAccelerator(x.GoPointer())
132	return cret
133}
134
135var xShortcutLabelGetDisabledText func(uintptr) string
136
137// Gets the text displayed by @self when no accelerator is set.
138func (x *ShortcutLabel) GetDisabledText() string {
139
140	cret := xShortcutLabelGetDisabledText(x.GoPointer())
141	return cret
142}
143
144var xShortcutLabelSetAccelerator func(uintptr, string)
145
146// Sets the accelerator to be displayed by @self.
147func (x *ShortcutLabel) SetAccelerator(AcceleratorVar string) {
148
149	xShortcutLabelSetAccelerator(x.GoPointer(), AcceleratorVar)
150
151}
152
153var xShortcutLabelSetDisabledText func(uintptr, string)
154
155// Sets the text to be displayed by @self when no accelerator is set.
156func (x *ShortcutLabel) SetDisabledText(DisabledTextVar string) {
157
158	xShortcutLabelSetDisabledText(x.GoPointer(), DisabledTextVar)
159
160}
161
162func (c *ShortcutLabel) GoPointer() uintptr {
163	if c == nil {
164		return 0
165	}
166	return c.Ptr
167}
168
169func (c *ShortcutLabel) SetGoPointer(ptr uintptr) {
170	c.Ptr = ptr
171}
172
173// SetPropertyAccelerator sets the "accelerator" property.
174// The displayed accelerator.
175func (x *ShortcutLabel) SetPropertyAccelerator(value string) {
176	var v gobject.Value
177	v.Init(gobject.TypeStringVal)
178	v.SetString(&value)
179	x.SetProperty("accelerator", &v)
180}
181
182// GetPropertyAccelerator gets the "accelerator" property.
183// The displayed accelerator.
184func (x *ShortcutLabel) GetPropertyAccelerator() string {
185	var v gobject.Value
186	x.GetProperty("accelerator", &v)
187	return v.GetString()
188}
189
190// SetPropertyDisabledText sets the "disabled-text" property.
191// The text displayed when no accelerator is set.
192func (x *ShortcutLabel) SetPropertyDisabledText(value string) {
193	var v gobject.Value
194	v.Init(gobject.TypeStringVal)
195	v.SetString(&value)
196	x.SetProperty("disabled-text", &v)
197}
198
199// GetPropertyDisabledText gets the "disabled-text" property.
200// The text displayed when no accelerator is set.
201func (x *ShortcutLabel) GetPropertyDisabledText() string {
202	var v gobject.Value
203	x.GetProperty("disabled-text", &v)
204	return v.GetString()
205}
206
207// Requests the user's screen reader to announce the given message.
208//
209// This kind of notification is useful for messages that
210// either have only a visual representation or that are not
211// exposed visually at all, e.g. a notification about a
212// successful operation.
213//
214// Also, by using this API, you can ensure that the message
215// does not interrupts the user's current screen reader output.
216func (x *ShortcutLabel) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
217
218	gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
219
220}
221
222// Retrieves the accessible parent for an accessible object.
223//
224// This function returns `NULL` for top level widgets.
225func (x *ShortcutLabel) GetAccessibleParent() *gtk.AccessibleBase {
226	var cls *gtk.AccessibleBase
227
228	cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
229
230	if cret == 0 {
231		return nil
232	}
233	cls = &gtk.AccessibleBase{}
234	cls.Ptr = cret
235	return cls
236}
237
238// Retrieves the accessible role of an accessible object.
239func (x *ShortcutLabel) GetAccessibleRole() gtk.AccessibleRole {
240
241	cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
242	return cret
243}
244
245// Retrieves the implementation for the given accessible object.
246func (x *ShortcutLabel) GetAtContext() *gtk.ATContext {
247	var cls *gtk.ATContext
248
249	cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
250
251	if cret == 0 {
252		return nil
253	}
254	cls = &gtk.ATContext{}
255	cls.Ptr = cret
256	return cls
257}
258
259// Queries the coordinates and dimensions of this accessible
260//
261// This functionality can be overridden by `GtkAccessible`
262// implementations, e.g. to get the bounds from an ignored
263// child widget.
264func (x *ShortcutLabel) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
265
266	cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
267	return cret
268}
269
270// Retrieves the first accessible child of an accessible object.
271func (x *ShortcutLabel) GetFirstAccessibleChild() *gtk.AccessibleBase {
272	var cls *gtk.AccessibleBase
273
274	cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
275
276	if cret == 0 {
277		return nil
278	}
279	cls = &gtk.AccessibleBase{}
280	cls.Ptr = cret
281	return cls
282}
283
284// Retrieves the next accessible sibling of an accessible object
285func (x *ShortcutLabel) GetNextAccessibleSibling() *gtk.AccessibleBase {
286	var cls *gtk.AccessibleBase
287
288	cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
289
290	if cret == 0 {
291		return nil
292	}
293	cls = &gtk.AccessibleBase{}
294	cls.Ptr = cret
295	return cls
296}
297
298// Queries a platform state, such as focus.
299//
300// This functionality can be overridden by `GtkAccessible`
301// implementations, e.g. to get platform state from an ignored
302// child widget, as is the case for `GtkText` wrappers.
303func (x *ShortcutLabel) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
304
305	cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
306	return cret
307}
308
309// Resets the accessible property to its default value.
310func (x *ShortcutLabel) ResetProperty(PropertyVar gtk.AccessibleProperty) {
311
312	gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
313
314}
315
316// Resets the accessible relation to its default value.
317func (x *ShortcutLabel) ResetRelation(RelationVar gtk.AccessibleRelation) {
318
319	gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
320
321}
322
323// Resets the accessible state to its default value.
324func (x *ShortcutLabel) ResetState(StateVar gtk.AccessibleState) {
325
326	gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
327
328}
329
330// Sets the parent and sibling of an accessible object.
331//
332// This function is meant to be used by accessible implementations that are
333// not part of the widget hierarchy, and but act as a logical bridge between
334// widgets. For instance, if a widget creates an object that holds metadata
335// for each child, and you want that object to implement the `GtkAccessible`
336// interface, you will use this function to ensure that the parent of each
337// child widget is the metadata object, and the parent of each metadata
338// object is the container widget.
339func (x *ShortcutLabel) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
340
341	gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
342
343}
344
345// Updates the next accessible sibling.
346//
347// That might be useful when a new child of a custom accessible
348// is created, and it needs to be linked to a previous child.
349func (x *ShortcutLabel) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
350
351	gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
352
353}
354
355// Informs ATs that the platform state has changed.
356//
357// This function should be used by `GtkAccessible` implementations that
358// have a platform state but are not widgets. Widgets handle platform
359// states automatically.
360func (x *ShortcutLabel) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
361
362	gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
363
364}
365
366// Updates a list of accessible properties.
367//
368// See the [enum@Gtk.AccessibleProperty] documentation for the
369// value types of accessible properties.
370//
371// This function should be called by `GtkWidget` types whenever
372// an accessible property change must be communicated to assistive
373// technologies.
374//
375// Example:
376// ```c
377// value = gtk_adjustment_get_value (adjustment);
378// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
379//
380//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
381//	-1);
382//
383// ```
384func (x *ShortcutLabel) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
385
386	gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
387
388}
389
390// Updates an array of accessible properties.
391//
392// This function should be called by `GtkWidget` types whenever an accessible
393// property change must be communicated to assistive technologies.
394//
395// This function is meant to be used by language bindings.
396func (x *ShortcutLabel) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
397
398	gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
399
400}
401
402// Updates a list of accessible relations.
403//
404// This function should be called by `GtkWidget` types whenever an accessible
405// relation change must be communicated to assistive technologies.
406//
407// If the [enum@Gtk.AccessibleRelation] requires a list of references,
408// you should pass each reference individually, followed by `NULL`, e.g.
409//
410// ```c
411// gtk_accessible_update_relation (accessible,
412//
413//	GTK_ACCESSIBLE_RELATION_CONTROLS,
414//	  ref1, NULL,
415//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
416//	  ref1, ref2, ref3, NULL,
417//	-1);
418//
419// ```
420func (x *ShortcutLabel) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
421
422	gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
423
424}
425
426// Updates an array of accessible relations.
427//
428// This function should be called by `GtkWidget` types whenever an accessible
429// relation change must be communicated to assistive technologies.
430//
431// This function is meant to be used by language bindings.
432func (x *ShortcutLabel) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
433
434	gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
435
436}
437
438// Updates a list of accessible states.
439//
440// See the [enum@Gtk.AccessibleState] documentation for the
441// value types of accessible states.
442//
443// This function should be called by `GtkWidget` types whenever
444// an accessible state change must be communicated to assistive
445// technologies.
446//
447// Example:
448//
449// ```c
450// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
451// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
452//
453//	GTK_ACCESSIBLE_STATE_CHECKED, value,
454//	-1);
455//
456// ```
457func (x *ShortcutLabel) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
458
459	gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
460
461}
462
463// Updates an array of accessible states.
464//
465// This function should be called by `GtkWidget` types whenever an accessible
466// state change must be communicated to assistive technologies.
467//
468// This function is meant to be used by language bindings.
469func (x *ShortcutLabel) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
470
471	gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
472
473}
474
475// Gets the ID of the @buildable object.
476//
477// `GtkBuilder` sets the name based on the ID attribute
478// of the `<object>` tag used to construct the @buildable.
479func (x *ShortcutLabel) GetBuildableId() string {
480
481	cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
482	return cret
483}
484
485func init() {
486	core.SetPackageName("ADW", "libadwaita-1")
487	core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
488	var libs []uintptr
489	for _, libPath := range core.GetPaths("ADW") {
490		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
491		if err != nil {
492			panic(err)
493		}
494		libs = append(libs, lib)
495	}
496
497	core.PuregoSafeRegister(&xShortcutLabelGLibType, libs, "adw_shortcut_label_get_type")
498
499	core.PuregoSafeRegister(&xNewShortcutLabel, libs, "adw_shortcut_label_new")
500
501	core.PuregoSafeRegister(&xShortcutLabelGetAccelerator, libs, "adw_shortcut_label_get_accelerator")
502	core.PuregoSafeRegister(&xShortcutLabelGetDisabledText, libs, "adw_shortcut_label_get_disabled_text")
503	core.PuregoSafeRegister(&xShortcutLabelSetAccelerator, libs, "adw_shortcut_label_set_accelerator")
504	core.PuregoSafeRegister(&xShortcutLabelSetDisabledText, libs, "adw_shortcut_label_set_disabled_text")
505
506}

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