v0.2.1 c0399be

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

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