v0.2.1 c0399be

gtktypes.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// A set of unsigned integers.
15//
16// Another name for this data structure is “bitmap”.
17//
18// The current implementation is based on [roaring bitmaps](https://roaringbitmap.org/).
19//
20// A bitset allows adding a set of integers and provides support for set operations
21// like unions, intersections and checks for equality or if a value is contained
22// in the set. `GtkBitset` also contains various functions to query metadata about
23// the bitset, such as the minimum or maximum values or its size.
24//
25// The fastest way to iterate values in a bitset is [struct@Gtk.BitsetIter].
26//
27// The main use case for `GtkBitset` is implementing complex selections for
28// [iface@Gtk.SelectionModel].
29type Bitset struct {
30	_ structs.HostLayout
31}
32
33var xBitsetGLibType func() types.GType
34
35func BitsetGLibType() types.GType {
36	return xBitsetGLibType()
37}
38
39func (x *Bitset) GoPointer() uintptr {
40	return uintptr(unsafe.Pointer(x))
41}
42
43var xNewBitsetEmpty func() *Bitset
44
45// Creates a new empty bitset.
46func NewBitsetEmpty() *Bitset {
47
48	cret := xNewBitsetEmpty()
49	return cret
50}
51
52var xNewBitsetRange func(uint, uint) *Bitset
53
54// Creates a bitset with the given range set.
55func NewBitsetRange(StartVar uint, NItemsVar uint) *Bitset {
56
57	cret := xNewBitsetRange(StartVar, NItemsVar)
58	return cret
59}
60
61var xBitsetAdd func(uintptr, uint) bool
62
63// Adds @value to @self if it wasn't part of it before.
64func (x *Bitset) Add(ValueVar uint) bool {
65
66	cret := xBitsetAdd(x.GoPointer(), ValueVar)
67	return cret
68}
69
70var xBitsetAddRange func(uintptr, uint, uint)
71
72// Adds all values from @start (inclusive) to @start + @n_items
73// (exclusive) in @self.
74func (x *Bitset) AddRange(StartVar uint, NItemsVar uint) {
75
76	xBitsetAddRange(x.GoPointer(), StartVar, NItemsVar)
77
78}
79
80var xBitsetAddRangeClosed func(uintptr, uint, uint)
81
82// Adds the closed range [@first, @last], so @first, @last and all
83// values in between. @first must be smaller than @last.
84func (x *Bitset) AddRangeClosed(FirstVar uint, LastVar uint) {
85
86	xBitsetAddRangeClosed(x.GoPointer(), FirstVar, LastVar)
87
88}
89
90var xBitsetAddRectangle func(uintptr, uint, uint, uint, uint)
91
92// Interprets the values as a 2-dimensional boolean grid with the given @stride
93// and inside that grid, adds a rectangle with the given @width and @height.
94func (x *Bitset) AddRectangle(StartVar uint, WidthVar uint, HeightVar uint, StrideVar uint) {
95
96	xBitsetAddRectangle(x.GoPointer(), StartVar, WidthVar, HeightVar, StrideVar)
97
98}
99
100var xBitsetContains func(uintptr, uint) bool
101
102// Checks if the given @value has been added to @self
103func (x *Bitset) Contains(ValueVar uint) bool {
104
105	cret := xBitsetContains(x.GoPointer(), ValueVar)
106	return cret
107}
108
109var xBitsetCopy func(uintptr) *Bitset
110
111// Creates a copy of @self.
112func (x *Bitset) Copy() *Bitset {
113
114	cret := xBitsetCopy(x.GoPointer())
115	return cret
116}
117
118var xBitsetDifference func(uintptr, *Bitset)
119
120// Sets @self to be the symmetric difference of @self and @other.
121//
122// The symmetric difference is set @self to contain all values that
123// were either contained in @self or in @other, but not in both.
124// This operation is also called an XOR.
125//
126// It is allowed for @self and @other to be the same bitset. The bitset
127// will be emptied in that case.
128func (x *Bitset) Difference(OtherVar *Bitset) {
129
130	xBitsetDifference(x.GoPointer(), OtherVar)
131
132}
133
134var xBitsetEquals func(uintptr, *Bitset) bool
135
136// Returns %TRUE if @self and @other contain the same values.
137func (x *Bitset) Equals(OtherVar *Bitset) bool {
138
139	cret := xBitsetEquals(x.GoPointer(), OtherVar)
140	return cret
141}
142
143var xBitsetGetMaximum func(uintptr) uint
144
145// Returns the largest value in @self.
146//
147// If @self is empty, 0 is returned.
148func (x *Bitset) GetMaximum() uint {
149
150	cret := xBitsetGetMaximum(x.GoPointer())
151	return cret
152}
153
154var xBitsetGetMinimum func(uintptr) uint
155
156// Returns the smallest value in @self.
157//
158// If @self is empty, `G_MAXUINT` is returned.
159func (x *Bitset) GetMinimum() uint {
160
161	cret := xBitsetGetMinimum(x.GoPointer())
162	return cret
163}
164
165var xBitsetGetNth func(uintptr, uint) uint
166
167// Returns the value of the @nth item in self.
168//
169// If @nth is >= the size of @self, 0 is returned.
170func (x *Bitset) GetNth(NthVar uint) uint {
171
172	cret := xBitsetGetNth(x.GoPointer(), NthVar)
173	return cret
174}
175
176var xBitsetGetSize func(uintptr) uint64
177
178// Gets the number of values that were added to the set.
179//
180// For example, if the set is empty, 0 is returned.
181//
182// Note that this function returns a `guint64`, because when all
183// values are set, the return value is `G_MAXUINT + 1`. Unless you
184// are sure this cannot happen (it can't with `GListModel`), be sure
185// to use a 64bit type.
186func (x *Bitset) GetSize() uint64 {
187
188	cret := xBitsetGetSize(x.GoPointer())
189	return cret
190}
191
192var xBitsetGetSizeInRange func(uintptr, uint, uint) uint64
193
194// Gets the number of values that are part of the set from @first to @last
195// (inclusive).
196//
197// Note that this function returns a `guint64`, because when all values are
198// set, the return value is `G_MAXUINT + 1`. Unless you are sure this cannot
199// happen (it can't with `GListModel`), be sure to use a 64bit type.
200func (x *Bitset) GetSizeInRange(FirstVar uint, LastVar uint) uint64 {
201
202	cret := xBitsetGetSizeInRange(x.GoPointer(), FirstVar, LastVar)
203	return cret
204}
205
206var xBitsetIntersect func(uintptr, *Bitset)
207
208// Sets @self to be the intersection of @self and @other.
209//
210// In other words, remove all values from @self that are not part of @other.
211//
212// It is allowed for @self and @other to be the same bitset. Nothing will
213// happen in that case.
214func (x *Bitset) Intersect(OtherVar *Bitset) {
215
216	xBitsetIntersect(x.GoPointer(), OtherVar)
217
218}
219
220var xBitsetIsEmpty func(uintptr) bool
221
222// Check if no value is contained in bitset.
223func (x *Bitset) IsEmpty() bool {
224
225	cret := xBitsetIsEmpty(x.GoPointer())
226	return cret
227}
228
229var xBitsetRef func(uintptr) *Bitset
230
231// Acquires a reference on the given `GtkBitset`.
232func (x *Bitset) Ref() *Bitset {
233
234	cret := xBitsetRef(x.GoPointer())
235	return cret
236}
237
238var xBitsetRemove func(uintptr, uint) bool
239
240// Removes @value from @self if it was part of it before.
241func (x *Bitset) Remove(ValueVar uint) bool {
242
243	cret := xBitsetRemove(x.GoPointer(), ValueVar)
244	return cret
245}
246
247var xBitsetRemoveAll func(uintptr)
248
249// Removes all values from the bitset so that it is empty again.
250func (x *Bitset) RemoveAll() {
251
252	xBitsetRemoveAll(x.GoPointer())
253
254}
255
256var xBitsetRemoveRange func(uintptr, uint, uint)
257
258// Removes all values from @start (inclusive) to @start + @n_items (exclusive)
259// in @self.
260func (x *Bitset) RemoveRange(StartVar uint, NItemsVar uint) {
261
262	xBitsetRemoveRange(x.GoPointer(), StartVar, NItemsVar)
263
264}
265
266var xBitsetRemoveRangeClosed func(uintptr, uint, uint)
267
268// Removes the closed range [@first, @last], so @first, @last and all
269// values in between. @first must be smaller than @last.
270func (x *Bitset) RemoveRangeClosed(FirstVar uint, LastVar uint) {
271
272	xBitsetRemoveRangeClosed(x.GoPointer(), FirstVar, LastVar)
273
274}
275
276var xBitsetRemoveRectangle func(uintptr, uint, uint, uint, uint)
277
278// Interprets the values as a 2-dimensional boolean grid with the given @stride
279// and inside that grid, removes a rectangle with the given @width and @height.
280func (x *Bitset) RemoveRectangle(StartVar uint, WidthVar uint, HeightVar uint, StrideVar uint) {
281
282	xBitsetRemoveRectangle(x.GoPointer(), StartVar, WidthVar, HeightVar, StrideVar)
283
284}
285
286var xBitsetShiftLeft func(uintptr, uint)
287
288// Shifts all values in @self to the left by @amount.
289//
290// Values smaller than @amount are discarded.
291func (x *Bitset) ShiftLeft(AmountVar uint) {
292
293	xBitsetShiftLeft(x.GoPointer(), AmountVar)
294
295}
296
297var xBitsetShiftRight func(uintptr, uint)
298
299// Shifts all values in @self to the right by @amount.
300//
301// Values that end up too large to be held in a #guint are discarded.
302func (x *Bitset) ShiftRight(AmountVar uint) {
303
304	xBitsetShiftRight(x.GoPointer(), AmountVar)
305
306}
307
308var xBitsetSplice func(uintptr, uint, uint, uint)
309
310// This is a support function for `GListModel` handling, by mirroring
311// the `GlistModel::items-changed` signal.
312//
313// First, it "cuts" the values from @position to @removed from
314// the bitset. That is, it removes all those values and shifts
315// all larger values to the left by @removed places.
316//
317// Then, it "pastes" new room into the bitset by shifting all values
318// larger than @position by @added spaces to the right. This frees
319// up space that can then be filled.
320func (x *Bitset) Splice(PositionVar uint, RemovedVar uint, AddedVar uint) {
321
322	xBitsetSplice(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
323
324}
325
326var xBitsetSubtract func(uintptr, *Bitset)
327
328// Sets @self to be the subtraction of @other from @self.
329//
330// In other words, remove all values from @self that are part of @other.
331//
332// It is allowed for @self and @other to be the same bitset. The bitset
333// will be emptied in that case.
334func (x *Bitset) Subtract(OtherVar *Bitset) {
335
336	xBitsetSubtract(x.GoPointer(), OtherVar)
337
338}
339
340var xBitsetUnion func(uintptr, *Bitset)
341
342// Sets @self to be the union of @self and @other.
343//
344// That is, add all values from @other into @self that weren't part of it.
345//
346// It is allowed for @self and @other to be the same bitset. Nothing will
347// happen in that case.
348func (x *Bitset) Union(OtherVar *Bitset) {
349
350	xBitsetUnion(x.GoPointer(), OtherVar)
351
352}
353
354var xBitsetUnref func(uintptr)
355
356// Releases a reference on the given `GtkBitset`.
357//
358// If the reference was the last, the resources associated to the @self are
359// freed.
360func (x *Bitset) Unref() {
361
362	xBitsetUnref(x.GoPointer())
363
364}
365
366// A CSS style change.
367type CssStyleChange struct {
368	_ structs.HostLayout
369}
370
371func (x *CssStyleChange) GoPointer() uintptr {
372	return uintptr(unsafe.Pointer(x))
373}
374
375// Provides detailed information on how a scroll operation should be performed.
376//
377// Scrolling functions usually allow passing a `NULL` scroll info which will
378// cause the default values to be used and just scroll the element into view.
379type ScrollInfo struct {
380	_ structs.HostLayout
381}
382
383var xScrollInfoGLibType func() types.GType
384
385func ScrollInfoGLibType() types.GType {
386	return xScrollInfoGLibType()
387}
388
389func (x *ScrollInfo) GoPointer() uintptr {
390	return uintptr(unsafe.Pointer(x))
391}
392
393var xNewScrollInfo func() *ScrollInfo
394
395// Creates a new scroll info for scrolling an element into view.
396func NewScrollInfo() *ScrollInfo {
397
398	cret := xNewScrollInfo()
399	return cret
400}
401
402var xScrollInfoGetEnableHorizontal func(uintptr) bool
403
404// Checks if horizontal scrolling is enabled.
405func (x *ScrollInfo) GetEnableHorizontal() bool {
406
407	cret := xScrollInfoGetEnableHorizontal(x.GoPointer())
408	return cret
409}
410
411var xScrollInfoGetEnableVertical func(uintptr) bool
412
413// Checks if vertical scrolling is enabled.
414func (x *ScrollInfo) GetEnableVertical() bool {
415
416	cret := xScrollInfoGetEnableVertical(x.GoPointer())
417	return cret
418}
419
420var xScrollInfoRef func(uintptr) *ScrollInfo
421
422// Increases the reference count of a `GtkScrollInfo` by one.
423func (x *ScrollInfo) Ref() *ScrollInfo {
424
425	cret := xScrollInfoRef(x.GoPointer())
426	return cret
427}
428
429var xScrollInfoSetEnableHorizontal func(uintptr, bool)
430
431// Turns horizontal scrolling on or off.
432func (x *ScrollInfo) SetEnableHorizontal(HorizontalVar bool) {
433
434	xScrollInfoSetEnableHorizontal(x.GoPointer(), HorizontalVar)
435
436}
437
438var xScrollInfoSetEnableVertical func(uintptr, bool)
439
440// Turns vertical scrolling on or off.
441func (x *ScrollInfo) SetEnableVertical(VerticalVar bool) {
442
443	xScrollInfoSetEnableVertical(x.GoPointer(), VerticalVar)
444
445}
446
447var xScrollInfoUnref func(uintptr)
448
449// Decreases the reference count of a `GtkScrollInfo` by one.
450//
451// If the resulting reference count is zero, frees the self.
452func (x *ScrollInfo) Unref() {
453
454	xScrollInfoUnref(x.GoPointer())
455
456}
457
458const (
459	// The value used to refer to a guaranteed invalid position
460	// in a `GListModel`.
461	//
462	// This value may be returned from some functions, others may
463	// accept it as input. Its interpretation may differ for different
464	// functions.
465	//
466	// Refer to each function's documentation for if this value is
467	// allowed and what it does.
468	INVALID_LIST_POSITION uint = 4294967295
469)
470
471func init() {
472	core.SetPackageName("GTK", "gtk4")
473	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
474	var libs []uintptr
475	for _, libPath := range core.GetPaths("GTK") {
476		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
477		if err != nil {
478			panic(err)
479		}
480		libs = append(libs, lib)
481	}
482
483	core.PuregoSafeRegister(&xBitsetGLibType, libs, "gtk_bitset_get_type")
484
485	core.PuregoSafeRegister(&xNewBitsetEmpty, libs, "gtk_bitset_new_empty")
486	core.PuregoSafeRegister(&xNewBitsetRange, libs, "gtk_bitset_new_range")
487
488	core.PuregoSafeRegister(&xBitsetAdd, libs, "gtk_bitset_add")
489	core.PuregoSafeRegister(&xBitsetAddRange, libs, "gtk_bitset_add_range")
490	core.PuregoSafeRegister(&xBitsetAddRangeClosed, libs, "gtk_bitset_add_range_closed")
491	core.PuregoSafeRegister(&xBitsetAddRectangle, libs, "gtk_bitset_add_rectangle")
492	core.PuregoSafeRegister(&xBitsetContains, libs, "gtk_bitset_contains")
493	core.PuregoSafeRegister(&xBitsetCopy, libs, "gtk_bitset_copy")
494	core.PuregoSafeRegister(&xBitsetDifference, libs, "gtk_bitset_difference")
495	core.PuregoSafeRegister(&xBitsetEquals, libs, "gtk_bitset_equals")
496	core.PuregoSafeRegister(&xBitsetGetMaximum, libs, "gtk_bitset_get_maximum")
497	core.PuregoSafeRegister(&xBitsetGetMinimum, libs, "gtk_bitset_get_minimum")
498	core.PuregoSafeRegister(&xBitsetGetNth, libs, "gtk_bitset_get_nth")
499	core.PuregoSafeRegister(&xBitsetGetSize, libs, "gtk_bitset_get_size")
500	core.PuregoSafeRegister(&xBitsetGetSizeInRange, libs, "gtk_bitset_get_size_in_range")
501	core.PuregoSafeRegister(&xBitsetIntersect, libs, "gtk_bitset_intersect")
502	core.PuregoSafeRegister(&xBitsetIsEmpty, libs, "gtk_bitset_is_empty")
503	core.PuregoSafeRegister(&xBitsetRef, libs, "gtk_bitset_ref")
504	core.PuregoSafeRegister(&xBitsetRemove, libs, "gtk_bitset_remove")
505	core.PuregoSafeRegister(&xBitsetRemoveAll, libs, "gtk_bitset_remove_all")
506	core.PuregoSafeRegister(&xBitsetRemoveRange, libs, "gtk_bitset_remove_range")
507	core.PuregoSafeRegister(&xBitsetRemoveRangeClosed, libs, "gtk_bitset_remove_range_closed")
508	core.PuregoSafeRegister(&xBitsetRemoveRectangle, libs, "gtk_bitset_remove_rectangle")
509	core.PuregoSafeRegister(&xBitsetShiftLeft, libs, "gtk_bitset_shift_left")
510	core.PuregoSafeRegister(&xBitsetShiftRight, libs, "gtk_bitset_shift_right")
511	core.PuregoSafeRegister(&xBitsetSplice, libs, "gtk_bitset_splice")
512	core.PuregoSafeRegister(&xBitsetSubtract, libs, "gtk_bitset_subtract")
513	core.PuregoSafeRegister(&xBitsetUnion, libs, "gtk_bitset_union")
514	core.PuregoSafeRegister(&xBitsetUnref, libs, "gtk_bitset_unref")
515
516	core.PuregoSafeRegister(&xScrollInfoGLibType, libs, "gtk_scroll_info_get_type")
517
518	core.PuregoSafeRegister(&xNewScrollInfo, libs, "gtk_scroll_info_new")
519
520	core.PuregoSafeRegister(&xScrollInfoGetEnableHorizontal, libs, "gtk_scroll_info_get_enable_horizontal")
521	core.PuregoSafeRegister(&xScrollInfoGetEnableVertical, libs, "gtk_scroll_info_get_enable_vertical")
522	core.PuregoSafeRegister(&xScrollInfoRef, libs, "gtk_scroll_info_ref")
523	core.PuregoSafeRegister(&xScrollInfoSetEnableHorizontal, libs, "gtk_scroll_info_set_enable_horizontal")
524	core.PuregoSafeRegister(&xScrollInfoSetEnableVertical, libs, "gtk_scroll_info_set_enable_vertical")
525	core.PuregoSafeRegister(&xScrollInfoUnref, libs, "gtk_scroll_info_unref")
526
527}

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