v0.2.1 c0399be

gtksectionmodel.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/gobject/types"
12)
13
14// The list of virtual functions for the `GtkSectionModel` interface.
15// No function must be implemented, but unless `GtkSectionModel::get_section()`
16// is implemented, the whole model will just be a single section.
17type SectionModelInterface struct {
18	_ structs.HostLayout
19
20	GIface uintptr
21
22	xGetSection uintptr
23}
24
25func (x *SectionModelInterface) GoPointer() uintptr {
26	return uintptr(unsafe.Pointer(x))
27}
28
29// OverrideGetSection sets the "get_section" callback function.
30// Return the section that covers the given position. If
31//
32//	the position is outside the number of items, returns a single range from
33//	n_items to G_MAXUINT
34func (x *SectionModelInterface) OverrideGetSection(cb func(SectionModel, uint, *uint, *uint)) {
35	if cb == nil {
36		x.xGetSection = 0
37	} else {
38		x.xGetSection = purego.NewCallback(func(SelfVarp uintptr, PositionVarp uint, OutStartVarp *uint, OutEndVarp *uint) {
39			cb(&SectionModelBase{Ptr: SelfVarp}, PositionVarp, OutStartVarp, OutEndVarp)
40		})
41	}
42}
43
44// GetGetSection gets the "get_section" callback function.
45// Return the section that covers the given position. If
46//
47//	the position is outside the number of items, returns a single range from
48//	n_items to G_MAXUINT
49func (x *SectionModelInterface) GetGetSection() func(SectionModel, uint, *uint, *uint) {
50	if x.xGetSection == 0 {
51		return nil
52	}
53	var rawCallback func(SelfVarp uintptr, PositionVarp uint, OutStartVarp *uint, OutEndVarp *uint)
54	purego.RegisterFunc(&rawCallback, x.xGetSection)
55	return func(SelfVar SectionModel, PositionVar uint, OutStartVar *uint, OutEndVar *uint) {
56		rawCallback(SelfVar.GoPointer(), PositionVar, OutStartVar, OutEndVar)
57	}
58}
59
60// An interface that adds support for sections to list models.
61//
62// A `GtkSectionModel` groups successive items into so-called sections. List widgets
63// like `GtkListView` and `GtkGridView` then allow displaying section headers for
64// these sections by installing a header factory.
65//
66// Many GTK list models support sections inherently, or they pass through the sections
67// of a model they are wrapping.
68//
69// When the section groupings of a model change, the model will emit the
70// [signal@Gtk.SectionModel::sections-changed] signal by calling the
71// [method@Gtk.SectionModel.sections_changed] function. All sections in the given range
72// then need to be queried again.
73// The [signal@Gio.ListModel::items-changed] signal has the same effect, all sections in
74// that range are invalidated, too.
75type SectionModel interface {
76	GoPointer() uintptr
77	SetGoPointer(uintptr)
78	GetSection(PositionVar uint, OutStartVar *uint, OutEndVar *uint)
79	SectionsChanged(PositionVar uint, NItemsVar uint)
80}
81
82var xSectionModelGLibType func() types.GType
83
84func SectionModelGLibType() types.GType {
85	return xSectionModelGLibType()
86}
87
88type SectionModelBase struct {
89	Ptr uintptr
90}
91
92func (x *SectionModelBase) GoPointer() uintptr {
93	if x == nil {
94		return 0
95	}
96	return x.Ptr
97}
98
99func (x *SectionModelBase) SetGoPointer(ptr uintptr) {
100	x.Ptr = ptr
101}
102
103// Query the section that covers the given position. The number of
104// items in the section can be computed by `out_end - out_start`.
105//
106// If the position is larger than the number of items, a single
107// range from n_items to G_MAXUINT will be returned.
108func (x *SectionModelBase) GetSection(PositionVar uint, OutStartVar *uint, OutEndVar *uint) {
109
110	XGtkSectionModelGetSection(x.GoPointer(), PositionVar, OutStartVar, OutEndVar)
111
112}
113
114// This function emits the [signal@Gtk.SectionModel::sections-changed]
115// signal to notify about changes to sections.
116//
117// It must cover all positions that used to be a section start or that
118// are now a section start. It does not have to cover all positions for
119// which the section has changed.
120//
121// The [signal@Gio.ListModel::items-changed] implies the effect of the
122// [signal@Gtk.SectionModel::sections-changed] signal for all the items
123// it covers.
124//
125// It is recommended that when changes to the items cause section changes
126// in a larger range, that the larger range is included in the emission
127// of the [signal@Gio.ListModel::items-changed] instead of emitting
128// two signals.
129func (x *SectionModelBase) SectionsChanged(PositionVar uint, NItemsVar uint) {
130
131	XGtkSectionModelSectionsChanged(x.GoPointer(), PositionVar, NItemsVar)
132
133}
134
135var XGtkSectionModelGetSection func(uintptr, uint, *uint, *uint)
136var XGtkSectionModelSectionsChanged func(uintptr, uint, uint)
137
138func init() {
139	core.SetPackageName("GTK", "gtk4")
140	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
141	var libs []uintptr
142	for _, libPath := range core.GetPaths("GTK") {
143		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
144		if err != nil {
145			panic(err)
146		}
147		libs = append(libs, lib)
148	}
149
150	core.PuregoSafeRegister(&xSectionModelGLibType, libs, "gtk_section_model_get_type")
151
152	core.PuregoSafeRegister(&XGtkSectionModelGetSection, libs, "gtk_section_model_get_section")
153	core.PuregoSafeRegister(&XGtkSectionModelSectionsChanged, libs, "gtk_section_model_sections_changed")
154
155}

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