v0.2.1 c0399be

gtkcustomlayout.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/glib"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// A function to be used by `GtkCustomLayout` to allocate a widget.
16type CustomAllocateFunc func(uintptr, int, int, int)
17
18// A function to be used by `GtkCustomLayout` to measure a widget.
19type CustomMeasureFunc func(uintptr, Orientation, int, *int, *int, *int, *int)
20
21// Queries a widget for its preferred size request mode.
22type CustomRequestModeFunc func(uintptr) SizeRequestMode
23
24type CustomLayoutClass struct {
25	_ structs.HostLayout
26
27	ParentClass LayoutManagerClass
28}
29
30func (x *CustomLayoutClass) GoPointer() uintptr {
31	return uintptr(unsafe.Pointer(x))
32}
33
34// Uses closures for size negotiation.
35//
36// A `GtkCustomLayout` uses closures matching to the old `GtkWidget`
37// virtual functions for size negotiation, as a convenience API to
38// ease the porting towards the corresponding `GtkLayoutManager`
39// virtual functions.
40type CustomLayout struct {
41	LayoutManager
42}
43
44var xCustomLayoutGLibType func() types.GType
45
46func CustomLayoutGLibType() types.GType {
47	return xCustomLayoutGLibType()
48}
49
50func CustomLayoutNewFromInternalPtr(ptr uintptr) *CustomLayout {
51	cls := &CustomLayout{}
52	cls.Ptr = ptr
53	return cls
54}
55
56var xNewCustomLayout func(uintptr, uintptr, uintptr) uintptr
57
58// Creates a new legacy layout manager.
59//
60// Legacy layout managers map to the old `GtkWidget` size negotiation
61// virtual functions, and are meant to be used during the transition
62// from layout containers to layout manager delegates.
63func NewCustomLayout(RequestModeVar *CustomRequestModeFunc, MeasureVar *CustomMeasureFunc, AllocateVar *CustomAllocateFunc) *CustomLayout {
64	var cls *CustomLayout
65
66	var RequestModeVarRef uintptr
67	if RequestModeVar != nil {
68		RequestModeVarPtr := uintptr(unsafe.Pointer(RequestModeVar))
69		if cbRefPtr, ok := glib.GetCallback(RequestModeVarPtr); ok {
70			RequestModeVarRef = cbRefPtr
71		} else {
72			fcb := func(arg0 uintptr) SizeRequestMode {
73				cbFn := *RequestModeVar
74				return cbFn(arg0)
75			}
76			RequestModeVarRef = purego.NewCallback(fcb)
77			glib.SaveCallbackWithClosure(RequestModeVarPtr, RequestModeVarRef, RequestModeVar)
78		}
79	}
80
81	var MeasureVarRef uintptr
82	if MeasureVar != nil {
83		MeasureVarPtr := uintptr(unsafe.Pointer(MeasureVar))
84		if cbRefPtr, ok := glib.GetCallback(MeasureVarPtr); ok {
85			MeasureVarRef = cbRefPtr
86		} else {
87			fcb := func(arg0 uintptr, arg1 Orientation, arg2 int, arg3 *int, arg4 *int, arg5 *int, arg6 *int) {
88				cbFn := *MeasureVar
89				cbFn(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
90			}
91			MeasureVarRef = purego.NewCallback(fcb)
92			glib.SaveCallbackWithClosure(MeasureVarPtr, MeasureVarRef, MeasureVar)
93		}
94	}
95
96	var AllocateVarRef uintptr
97	if AllocateVar != nil {
98		AllocateVarPtr := uintptr(unsafe.Pointer(AllocateVar))
99		if cbRefPtr, ok := glib.GetCallback(AllocateVarPtr); ok {
100			AllocateVarRef = cbRefPtr
101		} else {
102			fcb := func(arg0 uintptr, arg1 int, arg2 int, arg3 int) {
103				cbFn := *AllocateVar
104				cbFn(arg0, arg1, arg2, arg3)
105			}
106			AllocateVarRef = purego.NewCallback(fcb)
107			glib.SaveCallbackWithClosure(AllocateVarPtr, AllocateVarRef, AllocateVar)
108		}
109	}
110
111	cret := xNewCustomLayout(RequestModeVarRef, MeasureVarRef, AllocateVarRef)
112
113	if cret == 0 {
114		return nil
115	}
116	cls = &CustomLayout{}
117	cls.Ptr = cret
118	return cls
119}
120
121func (c *CustomLayout) GoPointer() uintptr {
122	if c == nil {
123		return 0
124	}
125	return c.Ptr
126}
127
128func (c *CustomLayout) SetGoPointer(ptr uintptr) {
129	c.Ptr = ptr
130}
131
132func init() {
133	core.SetPackageName("GTK", "gtk4")
134	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
135	var libs []uintptr
136	for _, libPath := range core.GetPaths("GTK") {
137		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
138		if err != nil {
139			panic(err)
140		}
141		libs = append(libs, lib)
142	}
143
144	core.PuregoSafeRegister(&xCustomLayoutGLibType, libs, "gtk_custom_layout_get_type")
145
146	core.PuregoSafeRegister(&xNewCustomLayout, libs, "gtk_custom_layout_new")
147
148}

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