v0.2.1 c0399be

gtknoselection.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 NoSelectionClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20}
21
22func (x *NoSelectionClass) GoPointer() uintptr {
23	return uintptr(unsafe.Pointer(x))
24}
25
26// A selection model that does not allow selecting anything.
27//
28// This model is meant to be used as a simple wrapper around a `GListModel`
29// when a `GtkSelectionModel` is required.
30//
31// `GtkNoSelection` passes through sections from the underlying model.
32type NoSelection struct {
33	gobject.Object
34}
35
36var xNoSelectionGLibType func() types.GType
37
38func NoSelectionGLibType() types.GType {
39	return xNoSelectionGLibType()
40}
41
42func NoSelectionNewFromInternalPtr(ptr uintptr) *NoSelection {
43	cls := &NoSelection{}
44	cls.Ptr = ptr
45	return cls
46}
47
48var xNewNoSelection func(uintptr) uintptr
49
50// Creates a new selection to handle @model.
51func NewNoSelection(ModelVar gio.ListModel) *NoSelection {
52	var cls *NoSelection
53
54	cret := xNewNoSelection(ModelVar.GoPointer())
55
56	if cret == 0 {
57		return nil
58	}
59	cls = &NoSelection{}
60	cls.Ptr = cret
61	return cls
62}
63
64var xNoSelectionGetModel func(uintptr) uintptr
65
66// Gets the model that @self is wrapping.
67func (x *NoSelection) GetModel() *gio.ListModelBase {
68	var cls *gio.ListModelBase
69
70	cret := xNoSelectionGetModel(x.GoPointer())
71
72	if cret == 0 {
73		return nil
74	}
75	gobject.IncreaseRef(cret)
76	cls = &gio.ListModelBase{}
77	cls.Ptr = cret
78	return cls
79}
80
81var xNoSelectionSetModel func(uintptr, uintptr)
82
83// Sets the model that @self should wrap.
84//
85// If @model is %NULL, this model will be empty.
86func (x *NoSelection) SetModel(ModelVar gio.ListModel) {
87
88	xNoSelectionSetModel(x.GoPointer(), ModelVar.GoPointer())
89
90}
91
92func (c *NoSelection) GoPointer() uintptr {
93	if c == nil {
94		return 0
95	}
96	return c.Ptr
97}
98
99func (c *NoSelection) SetGoPointer(ptr uintptr) {
100	c.Ptr = ptr
101}
102
103// GetPropertyNItems gets the "n-items" property.
104// The number of items. See [method@Gio.ListModel.get_n_items].
105func (x *NoSelection) GetPropertyNItems() uint {
106	var v gobject.Value
107	x.GetProperty("n-items", &v)
108	return v.GetUint()
109}
110
111// Get the item at @position.
112//
113// If @position is greater than the number of items in @list, %NULL is
114// returned.
115//
116// %NULL is never returned for an index that is smaller than the length
117// of the list.
118//
119// See also: g_list_model_get_n_items()
120func (x *NoSelection) GetItem(PositionVar uint) uintptr {
121
122	cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
123	return cret
124}
125
126// Gets the type of the items in @list.
127//
128// All items returned from g_list_model_get_item() are of the type
129// returned by this function, or a subtype, or if the type is an
130// interface, they are an implementation of that interface.
131//
132// The item type of a #GListModel can not change during the life of the
133// model.
134func (x *NoSelection) GetItemType() types.GType {
135
136	cret := gio.XGListModelGetItemType(x.GoPointer())
137	return cret
138}
139
140// Gets the number of items in @list.
141//
142// Depending on the model implementation, calling this function may be
143// less efficient than iterating the list with increasing values for
144// @position until g_list_model_get_item() returns %NULL.
145func (x *NoSelection) GetNItems() uint {
146
147	cret := gio.XGListModelGetNItems(x.GoPointer())
148	return cret
149}
150
151// Get the item at @position.
152//
153// If @position is greater than the number of items in @list, %NULL is
154// returned.
155//
156// %NULL is never returned for an index that is smaller than the length
157// of the list.
158//
159// This function is meant to be used by language bindings in place
160// of g_list_model_get_item().
161//
162// See also: g_list_model_get_n_items()
163func (x *NoSelection) GetObject(PositionVar uint) *gobject.Object {
164	var cls *gobject.Object
165
166	cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
167
168	if cret == 0 {
169		return nil
170	}
171	cls = &gobject.Object{}
172	cls.Ptr = cret
173	return cls
174}
175
176// Emits the #GListModel::items-changed signal on @list.
177//
178// This function should only be called by classes implementing
179// #GListModel. It has to be called after the internal representation
180// of @list has been updated, because handlers connected to this signal
181// might query the new state of the list.
182//
183// Implementations must only make changes to the model (as visible to
184// its consumer) in places that will not cause problems for that
185// consumer.  For models that are driven directly by a write API (such
186// as #GListStore), changes can be reported in response to uses of that
187// API.  For models that represent remote data, changes should only be
188// made from a fresh mainloop dispatch.  It is particularly not
189// permitted to make changes in response to a call to the #GListModel
190// consumer API.
191//
192// Stated another way: in general, it is assumed that code making a
193// series of accesses to the model via the API, without returning to the
194// mainloop, and without calling other code, will continue to view the
195// same contents of the model.
196func (x *NoSelection) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
197
198	gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
199
200}
201
202// Query the section that covers the given position. The number of
203// items in the section can be computed by `out_end - out_start`.
204//
205// If the position is larger than the number of items, a single
206// range from n_items to G_MAXUINT will be returned.
207func (x *NoSelection) GetSection(PositionVar uint, OutStartVar *uint, OutEndVar *uint) {
208
209	XGtkSectionModelGetSection(x.GoPointer(), PositionVar, OutStartVar, OutEndVar)
210
211}
212
213// This function emits the [signal@Gtk.SectionModel::sections-changed]
214// signal to notify about changes to sections.
215//
216// It must cover all positions that used to be a section start or that
217// are now a section start. It does not have to cover all positions for
218// which the section has changed.
219//
220// The [signal@Gio.ListModel::items-changed] implies the effect of the
221// [signal@Gtk.SectionModel::sections-changed] signal for all the items
222// it covers.
223//
224// It is recommended that when changes to the items cause section changes
225// in a larger range, that the larger range is included in the emission
226// of the [signal@Gio.ListModel::items-changed] instead of emitting
227// two signals.
228func (x *NoSelection) SectionsChanged(PositionVar uint, NItemsVar uint) {
229
230	XGtkSectionModelSectionsChanged(x.GoPointer(), PositionVar, NItemsVar)
231
232}
233
234// Gets the set containing all currently selected items in the model.
235//
236// This function may be slow, so if you are only interested in single item,
237// consider using [method@Gtk.SelectionModel.is_selected] or if you are only
238// interested in a few, consider [method@Gtk.SelectionModel.get_selection_in_range].
239func (x *NoSelection) GetSelection() *Bitset {
240
241	cret := XGtkSelectionModelGetSelection(x.GoPointer())
242	return cret
243}
244
245// Gets the set of selected items in a range.
246//
247// This function is an optimization for
248// [method@Gtk.SelectionModel.get_selection] when you are only
249// interested in part of the model's selected state. A common use
250// case is in response to the [signal@Gtk.SelectionModel::selection-changed]
251// signal.
252func (x *NoSelection) GetSelectionInRange(PositionVar uint, NItemsVar uint) *Bitset {
253
254	cret := XGtkSelectionModelGetSelectionInRange(x.GoPointer(), PositionVar, NItemsVar)
255	return cret
256}
257
258// Checks if the given item is selected.
259func (x *NoSelection) IsSelected(PositionVar uint) bool {
260
261	cret := XGtkSelectionModelIsSelected(x.GoPointer(), PositionVar)
262	return cret
263}
264
265// Requests to select all items in the model.
266func (x *NoSelection) SelectAll() bool {
267
268	cret := XGtkSelectionModelSelectAll(x.GoPointer())
269	return cret
270}
271
272// Requests to select an item in the model.
273func (x *NoSelection) SelectItem(PositionVar uint, UnselectRestVar bool) bool {
274
275	cret := XGtkSelectionModelSelectItem(x.GoPointer(), PositionVar, UnselectRestVar)
276	return cret
277}
278
279// Requests to select a range of items in the model.
280func (x *NoSelection) SelectRange(PositionVar uint, NItemsVar uint, UnselectRestVar bool) bool {
281
282	cret := XGtkSelectionModelSelectRange(x.GoPointer(), PositionVar, NItemsVar, UnselectRestVar)
283	return cret
284}
285
286// Helper function for implementations of `GtkSelectionModel`.
287//
288// Call this when the selection changes to emit the
289// [signal@Gtk.SelectionModel::selection-changed] signal.
290func (x *NoSelection) SelectionChanged(PositionVar uint, NItemsVar uint) {
291
292	XGtkSelectionModelSelectionChanged(x.GoPointer(), PositionVar, NItemsVar)
293
294}
295
296// Make selection changes.
297//
298// This is the most advanced selection updating method that allows
299// the most fine-grained control over selection changes. If you can,
300// you should try the simpler versions, as implementations are more
301// likely to implement support for those.
302//
303// Requests that the selection state of all positions set in @mask
304// be updated to the respective value in the @selected bitmask.
305//
306// In pseudocode, it would look something like this:
307//
308// ```c
309// for (i = 0; i < n_items; i++)
310//
311//	{
312//	  // don't change values not in the mask
313//	  if (!gtk_bitset_contains (mask, i))
314//	    continue;
315//
316//	  if (gtk_bitset_contains (selected, i))
317//	    select_item (i);
318//	  else
319//	    unselect_item (i);
320//	}
321//
322// gtk_selection_model_selection_changed (model,
323//
324//	first_changed_item,
325//	n_changed_items);
326//
327// ```
328//
329// @mask and @selected must not be modified. They may refer to the
330// same bitset, which would mean that every item in the set should
331// be selected.
332func (x *NoSelection) SetSelection(SelectedVar *Bitset, MaskVar *Bitset) bool {
333
334	cret := XGtkSelectionModelSetSelection(x.GoPointer(), SelectedVar, MaskVar)
335	return cret
336}
337
338// Requests to unselect all items in the model.
339func (x *NoSelection) UnselectAll() bool {
340
341	cret := XGtkSelectionModelUnselectAll(x.GoPointer())
342	return cret
343}
344
345// Requests to unselect an item in the model.
346func (x *NoSelection) UnselectItem(PositionVar uint) bool {
347
348	cret := XGtkSelectionModelUnselectItem(x.GoPointer(), PositionVar)
349	return cret
350}
351
352// Requests to unselect a range of items in the model.
353func (x *NoSelection) UnselectRange(PositionVar uint, NItemsVar uint) bool {
354
355	cret := XGtkSelectionModelUnselectRange(x.GoPointer(), PositionVar, NItemsVar)
356	return cret
357}
358
359func init() {
360	core.SetPackageName("GTK", "gtk4")
361	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
362	var libs []uintptr
363	for _, libPath := range core.GetPaths("GTK") {
364		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
365		if err != nil {
366			panic(err)
367		}
368		libs = append(libs, lib)
369	}
370
371	core.PuregoSafeRegister(&xNoSelectionGLibType, libs, "gtk_no_selection_get_type")
372
373	core.PuregoSafeRegister(&xNewNoSelection, libs, "gtk_no_selection_new")
374
375	core.PuregoSafeRegister(&xNoSelectionGetModel, libs, "gtk_no_selection_get_model")
376	core.PuregoSafeRegister(&xNoSelectionSetModel, libs, "gtk_no_selection_set_model")
377
378}

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