v0.2.1 c0399be

gtktreednd.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/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type TreeDragDestIface struct {
17	_ structs.HostLayout
18
19	GIface uintptr
20
21	xDragDataReceived uintptr
22
23	xRowDropPossible uintptr
24}
25
26func (x *TreeDragDestIface) GoPointer() uintptr {
27	return uintptr(unsafe.Pointer(x))
28}
29
30// OverrideDragDataReceived sets the "drag_data_received" callback function.
31// Asks the `GtkTreeDragDest` to insert a row
32//
33//	before the path dest, deriving the contents of the row from
34//	selection_data.
35func (x *TreeDragDestIface) OverrideDragDataReceived(cb func(TreeDragDest, *TreePath, *gobject.Value) bool) {
36	if cb == nil {
37		x.xDragDataReceived = 0
38	} else {
39		x.xDragDataReceived = purego.NewCallback(func(DragDestVarp uintptr, DestVarp *TreePath, ValueVarp *gobject.Value) bool {
40			return cb(&TreeDragDestBase{Ptr: DragDestVarp}, DestVarp, ValueVarp)
41		})
42	}
43}
44
45// GetDragDataReceived gets the "drag_data_received" callback function.
46// Asks the `GtkTreeDragDest` to insert a row
47//
48//	before the path dest, deriving the contents of the row from
49//	selection_data.
50func (x *TreeDragDestIface) GetDragDataReceived() func(TreeDragDest, *TreePath, *gobject.Value) bool {
51	if x.xDragDataReceived == 0 {
52		return nil
53	}
54	var rawCallback func(DragDestVarp uintptr, DestVarp *TreePath, ValueVarp *gobject.Value) bool
55	purego.RegisterFunc(&rawCallback, x.xDragDataReceived)
56	return func(DragDestVar TreeDragDest, DestVar *TreePath, ValueVar *gobject.Value) bool {
57		return rawCallback(DragDestVar.GoPointer(), DestVar, ValueVar)
58	}
59}
60
61// OverrideRowDropPossible sets the "row_drop_possible" callback function.
62// Determines whether a drop is possible before
63//
64//	the given dest_path, at the same depth as dest_path.
65func (x *TreeDragDestIface) OverrideRowDropPossible(cb func(TreeDragDest, *TreePath, *gobject.Value) bool) {
66	if cb == nil {
67		x.xRowDropPossible = 0
68	} else {
69		x.xRowDropPossible = purego.NewCallback(func(DragDestVarp uintptr, DestPathVarp *TreePath, ValueVarp *gobject.Value) bool {
70			return cb(&TreeDragDestBase{Ptr: DragDestVarp}, DestPathVarp, ValueVarp)
71		})
72	}
73}
74
75// GetRowDropPossible gets the "row_drop_possible" callback function.
76// Determines whether a drop is possible before
77//
78//	the given dest_path, at the same depth as dest_path.
79func (x *TreeDragDestIface) GetRowDropPossible() func(TreeDragDest, *TreePath, *gobject.Value) bool {
80	if x.xRowDropPossible == 0 {
81		return nil
82	}
83	var rawCallback func(DragDestVarp uintptr, DestPathVarp *TreePath, ValueVarp *gobject.Value) bool
84	purego.RegisterFunc(&rawCallback, x.xRowDropPossible)
85	return func(DragDestVar TreeDragDest, DestPathVar *TreePath, ValueVar *gobject.Value) bool {
86		return rawCallback(DragDestVar.GoPointer(), DestPathVar, ValueVar)
87	}
88}
89
90type TreeDragSourceIface struct {
91	_ structs.HostLayout
92
93	GIface uintptr
94
95	xRowDraggable uintptr
96
97	xDragDataGet uintptr
98
99	xDragDataDelete uintptr
100}
101
102func (x *TreeDragSourceIface) GoPointer() uintptr {
103	return uintptr(unsafe.Pointer(x))
104}
105
106// OverrideRowDraggable sets the "row_draggable" callback function.
107// Asks the `GtkTreeDragSource` whether a particular
108//
109//	row can be used as the source of a DND operation.
110func (x *TreeDragSourceIface) OverrideRowDraggable(cb func(TreeDragSource, *TreePath) bool) {
111	if cb == nil {
112		x.xRowDraggable = 0
113	} else {
114		x.xRowDraggable = purego.NewCallback(func(DragSourceVarp uintptr, PathVarp *TreePath) bool {
115			return cb(&TreeDragSourceBase{Ptr: DragSourceVarp}, PathVarp)
116		})
117	}
118}
119
120// GetRowDraggable gets the "row_draggable" callback function.
121// Asks the `GtkTreeDragSource` whether a particular
122//
123//	row can be used as the source of a DND operation.
124func (x *TreeDragSourceIface) GetRowDraggable() func(TreeDragSource, *TreePath) bool {
125	if x.xRowDraggable == 0 {
126		return nil
127	}
128	var rawCallback func(DragSourceVarp uintptr, PathVarp *TreePath) bool
129	purego.RegisterFunc(&rawCallback, x.xRowDraggable)
130	return func(DragSourceVar TreeDragSource, PathVar *TreePath) bool {
131		return rawCallback(DragSourceVar.GoPointer(), PathVar)
132	}
133}
134
135// OverrideDragDataGet sets the "drag_data_get" callback function.
136// Asks the `GtkTreeDragSource` to fill in
137//
138//	selection_data with a representation of the row at path.
139func (x *TreeDragSourceIface) OverrideDragDataGet(cb func(TreeDragSource, *TreePath) *gdk.ContentProvider) {
140	if cb == nil {
141		x.xDragDataGet = 0
142	} else {
143		x.xDragDataGet = purego.NewCallback(func(DragSourceVarp uintptr, PathVarp *TreePath) uintptr {
144			ret := cb(&TreeDragSourceBase{Ptr: DragSourceVarp}, PathVarp)
145			if ret == nil {
146				return 0
147			}
148			return ret.GoPointer()
149		})
150	}
151}
152
153// GetDragDataGet gets the "drag_data_get" callback function.
154// Asks the `GtkTreeDragSource` to fill in
155//
156//	selection_data with a representation of the row at path.
157func (x *TreeDragSourceIface) GetDragDataGet() func(TreeDragSource, *TreePath) *gdk.ContentProvider {
158	if x.xDragDataGet == 0 {
159		return nil
160	}
161	var rawCallback func(DragSourceVarp uintptr, PathVarp *TreePath) uintptr
162	purego.RegisterFunc(&rawCallback, x.xDragDataGet)
163	return func(DragSourceVar TreeDragSource, PathVar *TreePath) *gdk.ContentProvider {
164		rawRet := rawCallback(DragSourceVar.GoPointer(), PathVar)
165		if rawRet == 0 {
166			return nil
167		}
168		ret := &gdk.ContentProvider{}
169		ret.Ptr = rawRet
170		return ret
171	}
172}
173
174// OverrideDragDataDelete sets the "drag_data_delete" callback function.
175// Asks the `GtkTreeDragSource` to delete the row at
176//
177//	path, because it was moved somewhere else via drag-and-drop.
178func (x *TreeDragSourceIface) OverrideDragDataDelete(cb func(TreeDragSource, *TreePath) bool) {
179	if cb == nil {
180		x.xDragDataDelete = 0
181	} else {
182		x.xDragDataDelete = purego.NewCallback(func(DragSourceVarp uintptr, PathVarp *TreePath) bool {
183			return cb(&TreeDragSourceBase{Ptr: DragSourceVarp}, PathVarp)
184		})
185	}
186}
187
188// GetDragDataDelete gets the "drag_data_delete" callback function.
189// Asks the `GtkTreeDragSource` to delete the row at
190//
191//	path, because it was moved somewhere else via drag-and-drop.
192func (x *TreeDragSourceIface) GetDragDataDelete() func(TreeDragSource, *TreePath) bool {
193	if x.xDragDataDelete == 0 {
194		return nil
195	}
196	var rawCallback func(DragSourceVarp uintptr, PathVarp *TreePath) bool
197	purego.RegisterFunc(&rawCallback, x.xDragDataDelete)
198	return func(DragSourceVar TreeDragSource, PathVar *TreePath) bool {
199		return rawCallback(DragSourceVar.GoPointer(), PathVar)
200	}
201}
202
203// Interface for Drag-and-Drop destinations in `GtkTreeView`.
204type TreeDragDest interface {
205	GoPointer() uintptr
206	SetGoPointer(uintptr)
207	DragDataReceived(DestVar *TreePath, ValueVar *gobject.Value) bool
208	RowDropPossible(DestPathVar *TreePath, ValueVar *gobject.Value) bool
209}
210
211var xTreeDragDestGLibType func() types.GType
212
213func TreeDragDestGLibType() types.GType {
214	return xTreeDragDestGLibType()
215}
216
217type TreeDragDestBase struct {
218	Ptr uintptr
219}
220
221func (x *TreeDragDestBase) GoPointer() uintptr {
222	if x == nil {
223		return 0
224	}
225	return x.Ptr
226}
227
228func (x *TreeDragDestBase) SetGoPointer(ptr uintptr) {
229	x.Ptr = ptr
230}
231
232// Asks the `GtkTreeDragDest` to insert a row before the path @dest,
233// deriving the contents of the row from @value. If @dest is
234// outside the tree so that inserting before it is impossible, %FALSE
235// will be returned. Also, %FALSE may be returned if the new row is
236// not created for some model-specific reason.  Should robustly handle
237// a @dest no longer found in the model!
238func (x *TreeDragDestBase) DragDataReceived(DestVar *TreePath, ValueVar *gobject.Value) bool {
239
240	cret := XGtkTreeDragDestDragDataReceived(x.GoPointer(), DestVar, ValueVar)
241	return cret
242}
243
244// Determines whether a drop is possible before the given @dest_path,
245// at the same depth as @dest_path. i.e., can we drop the data in
246// @value at that location. @dest_path does not have to
247// exist; the return value will almost certainly be %FALSE if the
248// parent of @dest_path doesn’t exist, though.
249func (x *TreeDragDestBase) RowDropPossible(DestPathVar *TreePath, ValueVar *gobject.Value) bool {
250
251	cret := XGtkTreeDragDestRowDropPossible(x.GoPointer(), DestPathVar, ValueVar)
252	return cret
253}
254
255var XGtkTreeDragDestDragDataReceived func(uintptr, *TreePath, *gobject.Value) bool
256var XGtkTreeDragDestRowDropPossible func(uintptr, *TreePath, *gobject.Value) bool
257
258// Interface for Drag-and-Drop destinations in `GtkTreeView`.
259type TreeDragSource interface {
260	GoPointer() uintptr
261	SetGoPointer(uintptr)
262	DragDataDelete(PathVar *TreePath) bool
263	DragDataGet(PathVar *TreePath) *gdk.ContentProvider
264	RowDraggable(PathVar *TreePath) bool
265}
266
267var xTreeDragSourceGLibType func() types.GType
268
269func TreeDragSourceGLibType() types.GType {
270	return xTreeDragSourceGLibType()
271}
272
273type TreeDragSourceBase struct {
274	Ptr uintptr
275}
276
277func (x *TreeDragSourceBase) GoPointer() uintptr {
278	if x == nil {
279		return 0
280	}
281	return x.Ptr
282}
283
284func (x *TreeDragSourceBase) SetGoPointer(ptr uintptr) {
285	x.Ptr = ptr
286}
287
288// Asks the `GtkTreeDragSource` to delete the row at @path, because
289// it was moved somewhere else via drag-and-drop. Returns %FALSE
290// if the deletion fails because @path no longer exists, or for
291// some model-specific reason. Should robustly handle a @path no
292// longer found in the model!
293func (x *TreeDragSourceBase) DragDataDelete(PathVar *TreePath) bool {
294
295	cret := XGtkTreeDragSourceDragDataDelete(x.GoPointer(), PathVar)
296	return cret
297}
298
299// Asks the `GtkTreeDragSource` to return a `GdkContentProvider` representing
300// the row at @path. Should robustly handle a @path no
301// longer found in the model!
302func (x *TreeDragSourceBase) DragDataGet(PathVar *TreePath) *gdk.ContentProvider {
303	var cls *gdk.ContentProvider
304
305	cret := XGtkTreeDragSourceDragDataGet(x.GoPointer(), PathVar)
306
307	if cret == 0 {
308		return nil
309	}
310	cls = &gdk.ContentProvider{}
311	cls.Ptr = cret
312	return cls
313}
314
315// Asks the `GtkTreeDragSource` whether a particular row can be used as
316// the source of a DND operation. If the source doesn’t implement
317// this interface, the row is assumed draggable.
318func (x *TreeDragSourceBase) RowDraggable(PathVar *TreePath) bool {
319
320	cret := XGtkTreeDragSourceRowDraggable(x.GoPointer(), PathVar)
321	return cret
322}
323
324var XGtkTreeDragSourceDragDataDelete func(uintptr, *TreePath) bool
325var XGtkTreeDragSourceDragDataGet func(uintptr, *TreePath) uintptr
326var XGtkTreeDragSourceRowDraggable func(uintptr, *TreePath) bool
327
328var xTreeCreateRowDragContent func(uintptr, *TreePath) uintptr
329
330// Creates a content provider for dragging @path from @tree_model.
331func TreeCreateRowDragContent(TreeModelVar TreeModel, PathVar *TreePath) *gdk.ContentProvider {
332	var cls *gdk.ContentProvider
333
334	cret := xTreeCreateRowDragContent(TreeModelVar.GoPointer(), PathVar)
335
336	if cret == 0 {
337		return nil
338	}
339	cls = &gdk.ContentProvider{}
340	cls.Ptr = cret
341	return cls
342}
343
344var xTreeGetRowDragData func(*gobject.Value, **TreeModel, **TreePath) bool
345
346// Obtains a @tree_model and @path from value of target type
347// %GTK_TYPE_TREE_ROW_DATA.
348//
349// The returned path must be freed with gtk_tree_path_free().
350func TreeGetRowDragData(ValueVar *gobject.Value, TreeModelVar **TreeModel, PathVar **TreePath) bool {
351
352	cret := xTreeGetRowDragData(ValueVar, TreeModelVar, PathVar)
353	return cret
354}
355
356func init() {
357	core.SetPackageName("GTK", "gtk4")
358	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
359	var libs []uintptr
360	for _, libPath := range core.GetPaths("GTK") {
361		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
362		if err != nil {
363			panic(err)
364		}
365		libs = append(libs, lib)
366	}
367
368	core.PuregoSafeRegister(&xTreeCreateRowDragContent, libs, "gtk_tree_create_row_drag_content")
369	core.PuregoSafeRegister(&xTreeGetRowDragData, libs, "gtk_tree_get_row_drag_data")
370
371	core.PuregoSafeRegister(&xTreeDragDestGLibType, libs, "gtk_tree_drag_dest_get_type")
372
373	core.PuregoSafeRegister(&XGtkTreeDragDestDragDataReceived, libs, "gtk_tree_drag_dest_drag_data_received")
374	core.PuregoSafeRegister(&XGtkTreeDragDestRowDropPossible, libs, "gtk_tree_drag_dest_row_drop_possible")
375
376	core.PuregoSafeRegister(&xTreeDragSourceGLibType, libs, "gtk_tree_drag_source_get_type")
377
378	core.PuregoSafeRegister(&XGtkTreeDragSourceDragDataDelete, libs, "gtk_tree_drag_source_drag_data_delete")
379	core.PuregoSafeRegister(&XGtkTreeDragSourceDragDataGet, libs, "gtk_tree_drag_source_drag_data_get")
380	core.PuregoSafeRegister(&XGtkTreeDragSourceRowDraggable, libs, "gtk_tree_drag_source_row_draggable")
381
382}

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