v0.2.2 9100209

adw-swipeable.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/gdk"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// An interface for swipeable widgets.
16type SwipeableInterface struct {
17	_ structs.HostLayout
18
19	Parent uintptr
20
21	xGetDistance uintptr
22
23	xGetSnapPoints uintptr
24
25	xGetProgress uintptr
26
27	xGetCancelProgress uintptr
28
29	xGetSwipeArea uintptr
30
31	Padding [4]uintptr
32}
33
34func (x *SwipeableInterface) GoPointer() uintptr {
35	return uintptr(unsafe.Pointer(x))
36}
37
38// OverrideGetDistance sets the "get_distance" callback function.
39// Gets the swipe distance.
40func (x *SwipeableInterface) OverrideGetDistance(cb func(Swipeable) float64) {
41	if cb == nil {
42		x.xGetDistance = 0
43	} else {
44		x.xGetDistance = purego.NewCallback(func(SelfVarp uintptr) float64 {
45			return cb(&SwipeableBase{Ptr: SelfVarp})
46		})
47	}
48}
49
50// GetGetDistance gets the "get_distance" callback function.
51// Gets the swipe distance.
52func (x *SwipeableInterface) GetGetDistance() func(Swipeable) float64 {
53	if x.xGetDistance == 0 {
54		return nil
55	}
56	var rawCallback func(SelfVarp uintptr) float64
57	purego.RegisterFunc(&rawCallback, x.xGetDistance)
58	return func(SelfVar Swipeable) float64 {
59		return rawCallback(SelfVar.GoPointer())
60	}
61}
62
63// OverrideGetSnapPoints sets the "get_snap_points" callback function.
64// Gets the snap points.
65func (x *SwipeableInterface) OverrideGetSnapPoints(cb func(Swipeable, *int) uintptr) {
66	if cb == nil {
67		x.xGetSnapPoints = 0
68	} else {
69		x.xGetSnapPoints = purego.NewCallback(func(SelfVarp uintptr, NSnapPointsVarp *int) uintptr {
70			return cb(&SwipeableBase{Ptr: SelfVarp}, NSnapPointsVarp)
71		})
72	}
73}
74
75// GetGetSnapPoints gets the "get_snap_points" callback function.
76// Gets the snap points.
77func (x *SwipeableInterface) GetGetSnapPoints() func(Swipeable, *int) uintptr {
78	if x.xGetSnapPoints == 0 {
79		return nil
80	}
81	var rawCallback func(SelfVarp uintptr, NSnapPointsVarp *int) uintptr
82	purego.RegisterFunc(&rawCallback, x.xGetSnapPoints)
83	return func(SelfVar Swipeable, NSnapPointsVar *int) uintptr {
84		return rawCallback(SelfVar.GoPointer(), NSnapPointsVar)
85	}
86}
87
88// OverrideGetProgress sets the "get_progress" callback function.
89// Gets the current progress.
90func (x *SwipeableInterface) OverrideGetProgress(cb func(Swipeable) float64) {
91	if cb == nil {
92		x.xGetProgress = 0
93	} else {
94		x.xGetProgress = purego.NewCallback(func(SelfVarp uintptr) float64 {
95			return cb(&SwipeableBase{Ptr: SelfVarp})
96		})
97	}
98}
99
100// GetGetProgress gets the "get_progress" callback function.
101// Gets the current progress.
102func (x *SwipeableInterface) GetGetProgress() func(Swipeable) float64 {
103	if x.xGetProgress == 0 {
104		return nil
105	}
106	var rawCallback func(SelfVarp uintptr) float64
107	purego.RegisterFunc(&rawCallback, x.xGetProgress)
108	return func(SelfVar Swipeable) float64 {
109		return rawCallback(SelfVar.GoPointer())
110	}
111}
112
113// OverrideGetCancelProgress sets the "get_cancel_progress" callback function.
114// Gets the cancel progress.
115func (x *SwipeableInterface) OverrideGetCancelProgress(cb func(Swipeable) float64) {
116	if cb == nil {
117		x.xGetCancelProgress = 0
118	} else {
119		x.xGetCancelProgress = purego.NewCallback(func(SelfVarp uintptr) float64 {
120			return cb(&SwipeableBase{Ptr: SelfVarp})
121		})
122	}
123}
124
125// GetGetCancelProgress gets the "get_cancel_progress" callback function.
126// Gets the cancel progress.
127func (x *SwipeableInterface) GetGetCancelProgress() func(Swipeable) float64 {
128	if x.xGetCancelProgress == 0 {
129		return nil
130	}
131	var rawCallback func(SelfVarp uintptr) float64
132	purego.RegisterFunc(&rawCallback, x.xGetCancelProgress)
133	return func(SelfVar Swipeable) float64 {
134		return rawCallback(SelfVar.GoPointer())
135	}
136}
137
138// OverrideGetSwipeArea sets the "get_swipe_area" callback function.
139// Gets the swipeable rectangle.
140func (x *SwipeableInterface) OverrideGetSwipeArea(cb func(Swipeable, NavigationDirection, bool, *gdk.Rectangle)) {
141	if cb == nil {
142		x.xGetSwipeArea = 0
143	} else {
144		x.xGetSwipeArea = purego.NewCallback(func(SelfVarp uintptr, NavigationDirectionVarp NavigationDirection, IsDragVarp bool, RectVarp *gdk.Rectangle) {
145			cb(&SwipeableBase{Ptr: SelfVarp}, NavigationDirectionVarp, IsDragVarp, RectVarp)
146		})
147	}
148}
149
150// GetGetSwipeArea gets the "get_swipe_area" callback function.
151// Gets the swipeable rectangle.
152func (x *SwipeableInterface) GetGetSwipeArea() func(Swipeable, NavigationDirection, bool, *gdk.Rectangle) {
153	if x.xGetSwipeArea == 0 {
154		return nil
155	}
156	var rawCallback func(SelfVarp uintptr, NavigationDirectionVarp NavigationDirection, IsDragVarp bool, RectVarp *gdk.Rectangle)
157	purego.RegisterFunc(&rawCallback, x.xGetSwipeArea)
158	return func(SelfVar Swipeable, NavigationDirectionVar NavigationDirection, IsDragVar bool, RectVar *gdk.Rectangle) {
159		rawCallback(SelfVar.GoPointer(), NavigationDirectionVar, IsDragVar, RectVar)
160	}
161}
162
163// An interface for swipeable widgets.
164//
165// The `AdwSwipeable` interface is implemented by all swipeable widgets.
166//
167// See [class@SwipeTracker] for details about implementing it.
168type Swipeable interface {
169	GoPointer() uintptr
170	SetGoPointer(uintptr)
171	GetCancelProgress() float64
172	GetDistance() float64
173	GetProgress() float64
174	GetSnapPoints(NSnapPointsVar *int) uintptr
175	GetSwipeArea(NavigationDirectionVar NavigationDirection, IsDragVar bool, RectVar *gdk.Rectangle)
176}
177
178var xSwipeableGLibType func() types.GType
179
180func SwipeableGLibType() types.GType {
181	return xSwipeableGLibType()
182}
183
184type SwipeableBase struct {
185	Ptr uintptr
186}
187
188func (x *SwipeableBase) GoPointer() uintptr {
189	if x == nil {
190		return 0
191	}
192	return x.Ptr
193}
194
195func (x *SwipeableBase) SetGoPointer(ptr uintptr) {
196	x.Ptr = ptr
197}
198
199// Gets the progress @self will snap back to after the gesture is canceled.
200func (x *SwipeableBase) GetCancelProgress() float64 {
201
202	cret := XAdwSwipeableGetCancelProgress(x.GoPointer())
203	return cret
204}
205
206// Gets the swipe distance of @self.
207//
208// This corresponds to how many pixels 1 unit represents.
209func (x *SwipeableBase) GetDistance() float64 {
210
211	cret := XAdwSwipeableGetDistance(x.GoPointer())
212	return cret
213}
214
215// Gets the current progress of @self.
216func (x *SwipeableBase) GetProgress() float64 {
217
218	cret := XAdwSwipeableGetProgress(x.GoPointer())
219	return cret
220}
221
222// Gets the snap points of @self.
223//
224// Each snap point represents a progress value that is considered acceptable to
225// end the swipe on.
226func (x *SwipeableBase) GetSnapPoints(NSnapPointsVar *int) uintptr {
227
228	cret := XAdwSwipeableGetSnapPoints(x.GoPointer(), NSnapPointsVar)
229	return cret
230}
231
232// Gets the area @self can start a swipe from for the given direction and
233// gesture type.
234//
235// This can be used to restrict swipes to only be possible from a certain area,
236// for example, to only allow edge swipes, or to have a draggable element and
237// ignore swipes elsewhere.
238//
239// If not implemented, the default implementation returns the allocation of
240// @self, allowing swipes from anywhere.
241func (x *SwipeableBase) GetSwipeArea(NavigationDirectionVar NavigationDirection, IsDragVar bool, RectVar *gdk.Rectangle) {
242
243	XAdwSwipeableGetSwipeArea(x.GoPointer(), NavigationDirectionVar, IsDragVar, RectVar)
244
245}
246
247var XAdwSwipeableGetCancelProgress func(uintptr) float64
248var XAdwSwipeableGetDistance func(uintptr) float64
249var XAdwSwipeableGetProgress func(uintptr) float64
250var XAdwSwipeableGetSnapPoints func(uintptr, *int) uintptr
251var XAdwSwipeableGetSwipeArea func(uintptr, NavigationDirection, bool, *gdk.Rectangle)
252
253func init() {
254	core.SetPackageName("ADW", "libadwaita-1")
255	core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
256	var libs []uintptr
257	for _, libPath := range core.GetPaths("ADW") {
258		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
259		if err != nil {
260			panic(err)
261		}
262		libs = append(libs, lib)
263	}
264
265	core.PuregoSafeRegister(&xSwipeableGLibType, libs, "adw_swipeable_get_type")
266
267	core.PuregoSafeRegister(&XAdwSwipeableGetCancelProgress, libs, "adw_swipeable_get_cancel_progress")
268	core.PuregoSafeRegister(&XAdwSwipeableGetDistance, libs, "adw_swipeable_get_distance")
269	core.PuregoSafeRegister(&XAdwSwipeableGetProgress, libs, "adw_swipeable_get_progress")
270	core.PuregoSafeRegister(&XAdwSwipeableGetSnapPoints, libs, "adw_swipeable_get_snap_points")
271	core.PuregoSafeRegister(&XAdwSwipeableGetSwipeArea, libs, "adw_swipeable_get_swipe_area")
272
273}

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