v0.2.1 c0399be

gtkpadcontroller.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/gio"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// Struct defining a pad action entry.
17type PadActionEntry struct {
18	_ structs.HostLayout
19
20	Type PadActionType
21
22	Index int
23
24	Mode int
25
26	Label uintptr
27
28	ActionName uintptr
29}
30
31func (x *PadActionEntry) GoPointer() uintptr {
32	return uintptr(unsafe.Pointer(x))
33}
34
35type PadControllerClass struct {
36	_ structs.HostLayout
37}
38
39func (x *PadControllerClass) GoPointer() uintptr {
40	return uintptr(unsafe.Pointer(x))
41}
42
43// The type of a pad action.
44type PadActionType int
45
46var xPadActionTypeGLibType func() types.GType
47
48func PadActionTypeGLibType() types.GType {
49	return xPadActionTypeGLibType()
50}
51
52const (
53
54	// Action is triggered by a pad button
55	PadActionButtonValue PadActionType = 0
56	// Action is triggered by a pad ring
57	PadActionRingValue PadActionType = 1
58	// Action is triggered by a pad strip
59	PadActionStripValue PadActionType = 2
60	// Action is triggered by a pad dial
61	PadActionDialValue PadActionType = 3
62)
63
64// Handles input from the pads found in drawing tablets.
65//
66// Pads are the collection of buttons and tactile sensors often found around
67// the stylus-sensitive area.
68//
69// These buttons and sensors have no implicit meaning, and by default they
70// perform no action. `GtkPadController` is provided to map those to
71// [iface@Gio.Action] objects, thus letting the application give them a more
72// semantic meaning.
73//
74// Buttons and sensors are not constrained to triggering a single action,
75// some %GDK_SOURCE_TABLET_PAD devices feature multiple "modes". All these
76// input elements have one current mode, which may determine the final action
77// being triggered.
78//
79// Pad devices often divide buttons and sensors into groups. All elements
80// in a group share the same current mode, but different groups may have
81// different modes. See [method@Gdk.DevicePad.get_n_groups] and
82// [method@Gdk.DevicePad.get_group_n_modes].
83//
84// Each of the actions that a given button/strip/ring performs for a given mode
85// is defined by a [struct@Gtk.PadActionEntry]. It contains an action name that
86// will be looked up in the given [iface@Gio.ActionGroup] and activated whenever
87// the specified input element and mode are triggered.
88//
89// A simple example of `GtkPadController` usage: Assigning button 1 in all
90// modes and pad devices to an "invert-selection" action:
91//
92// ```c
93//
94//	GtkPadActionEntry *pad_actions[] = {
95//	  { GTK_PAD_ACTION_BUTTON, 1, -1, "Invert selection", "pad-actions.invert-selection" },
96//	  …
97//	};
98//
99// …
100// action_group = g_simple_action_group_new ();
101// action = g_simple_action_new ("pad-actions.invert-selection", NULL);
102// g_signal_connect (action, "activate", on_invert_selection_activated, NULL);
103// g_action_map_add_action (G_ACTION_MAP (action_group), action);
104// …
105// pad_controller = gtk_pad_controller_new (action_group, NULL);
106// ```
107//
108// The actions belonging to rings/strips/dials will be activated with a parameter
109// of type %G_VARIANT_TYPE_DOUBLE bearing the value of the given axis, it
110// is required that those are made stateful and accepting this `GVariantType`.
111// For rings the value is the angle of the ring position in degrees with 0
112// facing up. For strips the value is the absolute position on the strip, normalized
113// to the [0.0, 1.0] range.
114// For dials the value is the relative movement of the dial, normalized so that the
115// value 120 represents one logical scroll wheel detent in the positive direction.
116// Devices that support high-resolution scrolling may send events with fractions of
117// 120 to signify a smaller motion.
118type PadController struct {
119	EventController
120}
121
122var xPadControllerGLibType func() types.GType
123
124func PadControllerGLibType() types.GType {
125	return xPadControllerGLibType()
126}
127
128func PadControllerNewFromInternalPtr(ptr uintptr) *PadController {
129	cls := &PadController{}
130	cls.Ptr = ptr
131	return cls
132}
133
134var xNewPadController func(uintptr, uintptr) uintptr
135
136// Creates a new `GtkPadController` that will associate events from @pad to
137// actions.
138//
139// A %NULL pad may be provided so the controller manages all pad devices
140// generically, it is discouraged to mix `GtkPadController` objects with
141// %NULL and non-%NULL @pad argument on the same toplevel window, as execution
142// order is not guaranteed.
143//
144// The `GtkPadController` is created with no mapped actions. In order to
145// map pad events to actions, use [method@Gtk.PadController.set_action_entries]
146// or [method@Gtk.PadController.set_action].
147//
148// Be aware that pad events will only be delivered to `GtkWindow`s, so adding
149// a pad controller to any other type of widget will not have an effect.
150func NewPadController(GroupVar gio.ActionGroup, PadVar *gdk.Device) *PadController {
151	var cls *PadController
152
153	cret := xNewPadController(GroupVar.GoPointer(), PadVar.GoPointer())
154
155	if cret == 0 {
156		return nil
157	}
158	cls = &PadController{}
159	cls.Ptr = cret
160	return cls
161}
162
163var xPadControllerSetAction func(uintptr, PadActionType, int, int, string, string)
164
165// Adds an individual action to @controller.
166//
167// This action will only be activated if the given button/ring/strip number
168// in @index is interacted while the current mode is @mode. -1 may be used
169// for simple cases, so the action is triggered on all modes.
170//
171// The given @label should be considered user-visible, so internationalization
172// rules apply. Some windowing systems may be able to use those for user
173// feedback.
174func (x *PadController) SetAction(TypeVar PadActionType, IndexVar int, ModeVar int, LabelVar string, ActionNameVar string) {
175
176	xPadControllerSetAction(x.GoPointer(), TypeVar, IndexVar, ModeVar, LabelVar, ActionNameVar)
177
178}
179
180var xPadControllerSetActionEntries func(uintptr, []PadActionEntry, int)
181
182// A convenience function to add a group of action entries on
183// @controller.
184//
185// See [struct@Gtk.PadActionEntry] and [method@Gtk.PadController.set_action].
186func (x *PadController) SetActionEntries(EntriesVar []PadActionEntry, NEntriesVar int) {
187
188	xPadControllerSetActionEntries(x.GoPointer(), EntriesVar, NEntriesVar)
189
190}
191
192func (c *PadController) GoPointer() uintptr {
193	if c == nil {
194		return 0
195	}
196	return c.Ptr
197}
198
199func (c *PadController) SetGoPointer(ptr uintptr) {
200	c.Ptr = ptr
201}
202
203func init() {
204	core.SetPackageName("GTK", "gtk4")
205	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
206	var libs []uintptr
207	for _, libPath := range core.GetPaths("GTK") {
208		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
209		if err != nil {
210			panic(err)
211		}
212		libs = append(libs, lib)
213	}
214
215	core.PuregoSafeRegister(&xPadActionTypeGLibType, libs, "gtk_pad_action_type_get_type")
216
217	core.PuregoSafeRegister(&xPadControllerGLibType, libs, "gtk_pad_controller_get_type")
218
219	core.PuregoSafeRegister(&xNewPadController, libs, "gtk_pad_controller_new")
220
221	core.PuregoSafeRegister(&xPadControllerSetAction, libs, "gtk_pad_controller_set_action")
222	core.PuregoSafeRegister(&xPadControllerSetActionEntries, libs, "gtk_pad_controller_set_action_entries")
223
224}

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