v0.2.1 c0399be

gtkslicelistmodel.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/gio"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type SliceListModelClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20}
21
22func (x *SliceListModelClass) GoPointer() uintptr {
23	return uintptr(unsafe.Pointer(x))
24}
25
26// A list model that presents a slice of another model.
27//
28// This is useful when implementing paging by setting the size to the number
29// of elements per page and updating the offset whenever a different page is
30// opened.
31//
32// `GtkSliceListModel` passes through sections from the underlying model.
33type SliceListModel struct {
34	gobject.Object
35}
36
37var xSliceListModelGLibType func() types.GType
38
39func SliceListModelGLibType() types.GType {
40	return xSliceListModelGLibType()
41}
42
43func SliceListModelNewFromInternalPtr(ptr uintptr) *SliceListModel {
44	cls := &SliceListModel{}
45	cls.Ptr = ptr
46	return cls
47}
48
49var xNewSliceListModel func(uintptr, uint, uint) uintptr
50
51// Creates a new slice model.
52//
53// It presents the slice from @offset to offset + @size
54// of the given @model.
55func NewSliceListModel(ModelVar gio.ListModel, OffsetVar uint, SizeVar uint) *SliceListModel {
56	var cls *SliceListModel
57
58	cret := xNewSliceListModel(ModelVar.GoPointer(), OffsetVar, SizeVar)
59
60	if cret == 0 {
61		return nil
62	}
63	cls = &SliceListModel{}
64	cls.Ptr = cret
65	return cls
66}
67
68var xSliceListModelGetModel func(uintptr) uintptr
69
70// Gets the model that is currently being used or %NULL if none.
71func (x *SliceListModel) GetModel() *gio.ListModelBase {
72	var cls *gio.ListModelBase
73
74	cret := xSliceListModelGetModel(x.GoPointer())
75
76	if cret == 0 {
77		return nil
78	}
79	gobject.IncreaseRef(cret)
80	cls = &gio.ListModelBase{}
81	cls.Ptr = cret
82	return cls
83}
84
85var xSliceListModelGetOffset func(uintptr) uint
86
87// Gets the offset set via gtk_slice_list_model_set_offset().
88func (x *SliceListModel) GetOffset() uint {
89
90	cret := xSliceListModelGetOffset(x.GoPointer())
91	return cret
92}
93
94var xSliceListModelGetSize func(uintptr) uint
95
96// Gets the size set via gtk_slice_list_model_set_size().
97func (x *SliceListModel) GetSize() uint {
98
99	cret := xSliceListModelGetSize(x.GoPointer())
100	return cret
101}
102
103var xSliceListModelSetModel func(uintptr, uintptr)
104
105// Sets the model to show a slice of.
106//
107// The model's item type must conform to @self's item type.
108func (x *SliceListModel) SetModel(ModelVar gio.ListModel) {
109
110	xSliceListModelSetModel(x.GoPointer(), ModelVar.GoPointer())
111
112}
113
114var xSliceListModelSetOffset func(uintptr, uint)
115
116// Sets the offset into the original model for this slice.
117//
118// If the offset is too large for the sliced model,
119// @self will end up empty.
120func (x *SliceListModel) SetOffset(OffsetVar uint) {
121
122	xSliceListModelSetOffset(x.GoPointer(), OffsetVar)
123
124}
125
126var xSliceListModelSetSize func(uintptr, uint)
127
128// Sets the maximum size. @self will never have more items
129// than @size.
130//
131// It can however have fewer items if the offset is too large
132// or the model sliced from doesn't have enough items.
133func (x *SliceListModel) SetSize(SizeVar uint) {
134
135	xSliceListModelSetSize(x.GoPointer(), SizeVar)
136
137}
138
139func (c *SliceListModel) GoPointer() uintptr {
140	if c == nil {
141		return 0
142	}
143	return c.Ptr
144}
145
146func (c *SliceListModel) SetGoPointer(ptr uintptr) {
147	c.Ptr = ptr
148}
149
150// GetPropertyNItems gets the "n-items" property.
151// The number of items. See [method@Gio.ListModel.get_n_items].
152func (x *SliceListModel) GetPropertyNItems() uint {
153	var v gobject.Value
154	x.GetProperty("n-items", &v)
155	return v.GetUint()
156}
157
158// SetPropertyOffset sets the "offset" property.
159// Offset of slice.
160func (x *SliceListModel) SetPropertyOffset(value uint) {
161	var v gobject.Value
162	v.Init(gobject.TypeUintVal)
163	v.SetUint(value)
164	x.SetProperty("offset", &v)
165}
166
167// GetPropertyOffset gets the "offset" property.
168// Offset of slice.
169func (x *SliceListModel) GetPropertyOffset() uint {
170	var v gobject.Value
171	x.GetProperty("offset", &v)
172	return v.GetUint()
173}
174
175// SetPropertySize sets the "size" property.
176// Maximum size of slice.
177func (x *SliceListModel) SetPropertySize(value uint) {
178	var v gobject.Value
179	v.Init(gobject.TypeUintVal)
180	v.SetUint(value)
181	x.SetProperty("size", &v)
182}
183
184// GetPropertySize gets the "size" property.
185// Maximum size of slice.
186func (x *SliceListModel) GetPropertySize() uint {
187	var v gobject.Value
188	x.GetProperty("size", &v)
189	return v.GetUint()
190}
191
192// Get the item at @position.
193//
194// If @position is greater than the number of items in @list, %NULL is
195// returned.
196//
197// %NULL is never returned for an index that is smaller than the length
198// of the list.
199//
200// See also: g_list_model_get_n_items()
201func (x *SliceListModel) GetItem(PositionVar uint) uintptr {
202
203	cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
204	return cret
205}
206
207// Gets the type of the items in @list.
208//
209// All items returned from g_list_model_get_item() are of the type
210// returned by this function, or a subtype, or if the type is an
211// interface, they are an implementation of that interface.
212//
213// The item type of a #GListModel can not change during the life of the
214// model.
215func (x *SliceListModel) GetItemType() types.GType {
216
217	cret := gio.XGListModelGetItemType(x.GoPointer())
218	return cret
219}
220
221// Gets the number of items in @list.
222//
223// Depending on the model implementation, calling this function may be
224// less efficient than iterating the list with increasing values for
225// @position until g_list_model_get_item() returns %NULL.
226func (x *SliceListModel) GetNItems() uint {
227
228	cret := gio.XGListModelGetNItems(x.GoPointer())
229	return cret
230}
231
232// Get the item at @position.
233//
234// If @position is greater than the number of items in @list, %NULL is
235// returned.
236//
237// %NULL is never returned for an index that is smaller than the length
238// of the list.
239//
240// This function is meant to be used by language bindings in place
241// of g_list_model_get_item().
242//
243// See also: g_list_model_get_n_items()
244func (x *SliceListModel) GetObject(PositionVar uint) *gobject.Object {
245	var cls *gobject.Object
246
247	cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
248
249	if cret == 0 {
250		return nil
251	}
252	cls = &gobject.Object{}
253	cls.Ptr = cret
254	return cls
255}
256
257// Emits the #GListModel::items-changed signal on @list.
258//
259// This function should only be called by classes implementing
260// #GListModel. It has to be called after the internal representation
261// of @list has been updated, because handlers connected to this signal
262// might query the new state of the list.
263//
264// Implementations must only make changes to the model (as visible to
265// its consumer) in places that will not cause problems for that
266// consumer.  For models that are driven directly by a write API (such
267// as #GListStore), changes can be reported in response to uses of that
268// API.  For models that represent remote data, changes should only be
269// made from a fresh mainloop dispatch.  It is particularly not
270// permitted to make changes in response to a call to the #GListModel
271// consumer API.
272//
273// Stated another way: in general, it is assumed that code making a
274// series of accesses to the model via the API, without returning to the
275// mainloop, and without calling other code, will continue to view the
276// same contents of the model.
277func (x *SliceListModel) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
278
279	gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
280
281}
282
283// Query the section that covers the given position. The number of
284// items in the section can be computed by `out_end - out_start`.
285//
286// If the position is larger than the number of items, a single
287// range from n_items to G_MAXUINT will be returned.
288func (x *SliceListModel) GetSection(PositionVar uint, OutStartVar *uint, OutEndVar *uint) {
289
290	XGtkSectionModelGetSection(x.GoPointer(), PositionVar, OutStartVar, OutEndVar)
291
292}
293
294// This function emits the [signal@Gtk.SectionModel::sections-changed]
295// signal to notify about changes to sections.
296//
297// It must cover all positions that used to be a section start or that
298// are now a section start. It does not have to cover all positions for
299// which the section has changed.
300//
301// The [signal@Gio.ListModel::items-changed] implies the effect of the
302// [signal@Gtk.SectionModel::sections-changed] signal for all the items
303// it covers.
304//
305// It is recommended that when changes to the items cause section changes
306// in a larger range, that the larger range is included in the emission
307// of the [signal@Gio.ListModel::items-changed] instead of emitting
308// two signals.
309func (x *SliceListModel) SectionsChanged(PositionVar uint, NItemsVar uint) {
310
311	XGtkSectionModelSectionsChanged(x.GoPointer(), PositionVar, NItemsVar)
312
313}
314
315func init() {
316	core.SetPackageName("GTK", "gtk4")
317	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
318	var libs []uintptr
319	for _, libPath := range core.GetPaths("GTK") {
320		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
321		if err != nil {
322			panic(err)
323		}
324		libs = append(libs, lib)
325	}
326
327	core.PuregoSafeRegister(&xSliceListModelGLibType, libs, "gtk_slice_list_model_get_type")
328
329	core.PuregoSafeRegister(&xNewSliceListModel, libs, "gtk_slice_list_model_new")
330
331	core.PuregoSafeRegister(&xSliceListModelGetModel, libs, "gtk_slice_list_model_get_model")
332	core.PuregoSafeRegister(&xSliceListModelGetOffset, libs, "gtk_slice_list_model_get_offset")
333	core.PuregoSafeRegister(&xSliceListModelGetSize, libs, "gtk_slice_list_model_get_size")
334	core.PuregoSafeRegister(&xSliceListModelSetModel, libs, "gtk_slice_list_model_set_model")
335	core.PuregoSafeRegister(&xSliceListModelSetOffset, libs, "gtk_slice_list_model_set_offset")
336	core.PuregoSafeRegister(&xSliceListModelSetSize, libs, "gtk_slice_list_model_set_size")
337
338}

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