v0.2.1 c0399be

gtkviewport.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"github.com/ebitengine/purego"
6
7	"github.com/bnema/puregotk/pkg/core"
8	"github.com/bnema/puregotk/v4/gobject"
9	"github.com/bnema/puregotk/v4/gobject/types"
10)
11
12// Implements scrollability for widgets that don't support scrolling
13// on their own.
14//
15// Use `GtkViewport` to scroll child widgets such as `GtkGrid`,
16// `GtkBox`, and so on.
17//
18// The `GtkViewport` will start scrolling content only if allocated
19// less than the child widget’s minimum size in a given orientation.
20//
21// # CSS nodes
22//
23// `GtkViewport` has a single CSS node with name `viewport`.
24//
25// # Accessibility
26//
27// Until GTK 4.10, `GtkViewport` used the [enum@Gtk.AccessibleRole.group] role.
28//
29// Starting from GTK 4.12, `GtkViewport` uses the [enum@Gtk.AccessibleRole.generic] role.
30type Viewport struct {
31	Widget
32}
33
34var xViewportGLibType func() types.GType
35
36func ViewportGLibType() types.GType {
37	return xViewportGLibType()
38}
39
40func ViewportNewFromInternalPtr(ptr uintptr) *Viewport {
41	cls := &Viewport{}
42	cls.Ptr = ptr
43	return cls
44}
45
46var xNewViewport func(uintptr, uintptr) uintptr
47
48// Creates a new `GtkViewport`.
49//
50// The new viewport uses the given adjustments, or default
51// adjustments if none are given.
52func NewViewport(HadjustmentVar *Adjustment, VadjustmentVar *Adjustment) *Viewport {
53	var cls *Viewport
54
55	cret := xNewViewport(HadjustmentVar.GoPointer(), VadjustmentVar.GoPointer())
56
57	if cret == 0 {
58		return nil
59	}
60	gobject.IncreaseRef(cret)
61	cls = &Viewport{}
62	cls.Ptr = cret
63	return cls
64}
65
66var xViewportGetChild func(uintptr) uintptr
67
68// Gets the child widget of @viewport.
69func (x *Viewport) GetChild() *Widget {
70	var cls *Widget
71
72	cret := xViewportGetChild(x.GoPointer())
73
74	if cret == 0 {
75		return nil
76	}
77	gobject.IncreaseRef(cret)
78	cls = &Widget{}
79	cls.Ptr = cret
80	return cls
81}
82
83var xViewportGetScrollToFocus func(uintptr) bool
84
85// Gets whether the viewport is scrolling to keep the focused
86// child in view.
87func (x *Viewport) GetScrollToFocus() bool {
88
89	cret := xViewportGetScrollToFocus(x.GoPointer())
90	return cret
91}
92
93var xViewportScrollTo func(uintptr, uintptr, *ScrollInfo)
94
95// Scrolls a descendant of the viewport into view.
96//
97// The viewport and the descendant must be visible and mapped for
98// this function to work, otherwise no scrolling will be performed.
99func (x *Viewport) ScrollTo(DescendantVar *Widget, ScrollVar *ScrollInfo) {
100
101	xViewportScrollTo(x.GoPointer(), DescendantVar.GoPointer(), ScrollVar)
102
103}
104
105var xViewportSetChild func(uintptr, uintptr)
106
107// Sets the child widget of @viewport.
108func (x *Viewport) SetChild(ChildVar *Widget) {
109
110	xViewportSetChild(x.GoPointer(), ChildVar.GoPointer())
111
112}
113
114var xViewportSetScrollToFocus func(uintptr, bool)
115
116// Sets whether the viewport should automatically scroll
117// to keep the focused child in view.
118func (x *Viewport) SetScrollToFocus(ScrollToFocusVar bool) {
119
120	xViewportSetScrollToFocus(x.GoPointer(), ScrollToFocusVar)
121
122}
123
124func (c *Viewport) GoPointer() uintptr {
125	if c == nil {
126		return 0
127	}
128	return c.Ptr
129}
130
131func (c *Viewport) SetGoPointer(ptr uintptr) {
132	c.Ptr = ptr
133}
134
135// SetPropertyScrollToFocus sets the "scroll-to-focus" property.
136// Whether to scroll when the focus changes.
137//
138// Before 4.6.2, this property was mistakenly defaulting to FALSE, so if your
139// code needs to work with older versions, consider setting it explicitly to
140// TRUE.
141func (x *Viewport) SetPropertyScrollToFocus(value bool) {
142	var v gobject.Value
143	v.Init(gobject.TypeBooleanVal)
144	v.SetBoolean(value)
145	x.SetProperty("scroll-to-focus", &v)
146}
147
148// GetPropertyScrollToFocus gets the "scroll-to-focus" property.
149// Whether to scroll when the focus changes.
150//
151// Before 4.6.2, this property was mistakenly defaulting to FALSE, so if your
152// code needs to work with older versions, consider setting it explicitly to
153// TRUE.
154func (x *Viewport) GetPropertyScrollToFocus() bool {
155	var v gobject.Value
156	x.GetProperty("scroll-to-focus", &v)
157	return v.GetBoolean()
158}
159
160// Requests the user's screen reader to announce the given message.
161//
162// This kind of notification is useful for messages that
163// either have only a visual representation or that are not
164// exposed visually at all, e.g. a notification about a
165// successful operation.
166//
167// Also, by using this API, you can ensure that the message
168// does not interrupts the user's current screen reader output.
169func (x *Viewport) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
170
171	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
172
173}
174
175// Retrieves the accessible parent for an accessible object.
176//
177// This function returns `NULL` for top level widgets.
178func (x *Viewport) GetAccessibleParent() *AccessibleBase {
179	var cls *AccessibleBase
180
181	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
182
183	if cret == 0 {
184		return nil
185	}
186	cls = &AccessibleBase{}
187	cls.Ptr = cret
188	return cls
189}
190
191// Retrieves the accessible role of an accessible object.
192func (x *Viewport) GetAccessibleRole() AccessibleRole {
193
194	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
195	return cret
196}
197
198// Retrieves the implementation for the given accessible object.
199func (x *Viewport) GetAtContext() *ATContext {
200	var cls *ATContext
201
202	cret := XGtkAccessibleGetAtContext(x.GoPointer())
203
204	if cret == 0 {
205		return nil
206	}
207	cls = &ATContext{}
208	cls.Ptr = cret
209	return cls
210}
211
212// Queries the coordinates and dimensions of this accessible
213//
214// This functionality can be overridden by `GtkAccessible`
215// implementations, e.g. to get the bounds from an ignored
216// child widget.
217func (x *Viewport) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
218
219	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
220	return cret
221}
222
223// Retrieves the first accessible child of an accessible object.
224func (x *Viewport) GetFirstAccessibleChild() *AccessibleBase {
225	var cls *AccessibleBase
226
227	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
228
229	if cret == 0 {
230		return nil
231	}
232	cls = &AccessibleBase{}
233	cls.Ptr = cret
234	return cls
235}
236
237// Retrieves the next accessible sibling of an accessible object
238func (x *Viewport) GetNextAccessibleSibling() *AccessibleBase {
239	var cls *AccessibleBase
240
241	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
242
243	if cret == 0 {
244		return nil
245	}
246	cls = &AccessibleBase{}
247	cls.Ptr = cret
248	return cls
249}
250
251// Queries a platform state, such as focus.
252//
253// This functionality can be overridden by `GtkAccessible`
254// implementations, e.g. to get platform state from an ignored
255// child widget, as is the case for `GtkText` wrappers.
256func (x *Viewport) GetPlatformState(StateVar AccessiblePlatformState) bool {
257
258	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
259	return cret
260}
261
262// Resets the accessible property to its default value.
263func (x *Viewport) ResetProperty(PropertyVar AccessibleProperty) {
264
265	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
266
267}
268
269// Resets the accessible relation to its default value.
270func (x *Viewport) ResetRelation(RelationVar AccessibleRelation) {
271
272	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
273
274}
275
276// Resets the accessible state to its default value.
277func (x *Viewport) ResetState(StateVar AccessibleState) {
278
279	XGtkAccessibleResetState(x.GoPointer(), StateVar)
280
281}
282
283// Sets the parent and sibling of an accessible object.
284//
285// This function is meant to be used by accessible implementations that are
286// not part of the widget hierarchy, and but act as a logical bridge between
287// widgets. For instance, if a widget creates an object that holds metadata
288// for each child, and you want that object to implement the `GtkAccessible`
289// interface, you will use this function to ensure that the parent of each
290// child widget is the metadata object, and the parent of each metadata
291// object is the container widget.
292func (x *Viewport) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
293
294	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
295
296}
297
298// Updates the next accessible sibling.
299//
300// That might be useful when a new child of a custom accessible
301// is created, and it needs to be linked to a previous child.
302func (x *Viewport) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
303
304	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
305
306}
307
308// Informs ATs that the platform state has changed.
309//
310// This function should be used by `GtkAccessible` implementations that
311// have a platform state but are not widgets. Widgets handle platform
312// states automatically.
313func (x *Viewport) UpdatePlatformState(StateVar AccessiblePlatformState) {
314
315	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
316
317}
318
319// Updates a list of accessible properties.
320//
321// See the [enum@Gtk.AccessibleProperty] documentation for the
322// value types of accessible properties.
323//
324// This function should be called by `GtkWidget` types whenever
325// an accessible property change must be communicated to assistive
326// technologies.
327//
328// Example:
329// ```c
330// value = gtk_adjustment_get_value (adjustment);
331// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
332//
333//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
334//	-1);
335//
336// ```
337func (x *Viewport) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
338
339	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
340
341}
342
343// Updates an array of accessible properties.
344//
345// This function should be called by `GtkWidget` types whenever an accessible
346// property change must be communicated to assistive technologies.
347//
348// This function is meant to be used by language bindings.
349func (x *Viewport) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
350
351	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
352
353}
354
355// Updates a list of accessible relations.
356//
357// This function should be called by `GtkWidget` types whenever an accessible
358// relation change must be communicated to assistive technologies.
359//
360// If the [enum@Gtk.AccessibleRelation] requires a list of references,
361// you should pass each reference individually, followed by `NULL`, e.g.
362//
363// ```c
364// gtk_accessible_update_relation (accessible,
365//
366//	GTK_ACCESSIBLE_RELATION_CONTROLS,
367//	  ref1, NULL,
368//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
369//	  ref1, ref2, ref3, NULL,
370//	-1);
371//
372// ```
373func (x *Viewport) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
374
375	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
376
377}
378
379// Updates an array of accessible relations.
380//
381// This function should be called by `GtkWidget` types whenever an accessible
382// relation change must be communicated to assistive technologies.
383//
384// This function is meant to be used by language bindings.
385func (x *Viewport) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
386
387	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
388
389}
390
391// Updates a list of accessible states.
392//
393// See the [enum@Gtk.AccessibleState] documentation for the
394// value types of accessible states.
395//
396// This function should be called by `GtkWidget` types whenever
397// an accessible state change must be communicated to assistive
398// technologies.
399//
400// Example:
401//
402// ```c
403// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
404// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
405//
406//	GTK_ACCESSIBLE_STATE_CHECKED, value,
407//	-1);
408//
409// ```
410func (x *Viewport) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
411
412	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
413
414}
415
416// Updates an array of accessible states.
417//
418// This function should be called by `GtkWidget` types whenever an accessible
419// state change must be communicated to assistive technologies.
420//
421// This function is meant to be used by language bindings.
422func (x *Viewport) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
423
424	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
425
426}
427
428// Gets the ID of the @buildable object.
429//
430// `GtkBuilder` sets the name based on the ID attribute
431// of the `<object>` tag used to construct the @buildable.
432func (x *Viewport) GetBuildableId() string {
433
434	cret := XGtkBuildableGetBuildableId(x.GoPointer())
435	return cret
436}
437
438// Returns the size of a non-scrolling border around the
439// outside of the scrollable.
440//
441// An example for this would be treeview headers. GTK can use
442// this information to display overlaid graphics, like the
443// overshoot indication, at the right position.
444func (x *Viewport) GetBorder(BorderVar *Border) bool {
445
446	cret := XGtkScrollableGetBorder(x.GoPointer(), BorderVar)
447	return cret
448}
449
450// Retrieves the `GtkAdjustment` used for horizontal scrolling.
451func (x *Viewport) GetHadjustment() *Adjustment {
452	var cls *Adjustment
453
454	cret := XGtkScrollableGetHadjustment(x.GoPointer())
455
456	if cret == 0 {
457		return nil
458	}
459	gobject.IncreaseRef(cret)
460	cls = &Adjustment{}
461	cls.Ptr = cret
462	return cls
463}
464
465// Gets the horizontal `GtkScrollablePolicy`.
466func (x *Viewport) GetHscrollPolicy() ScrollablePolicy {
467
468	cret := XGtkScrollableGetHscrollPolicy(x.GoPointer())
469	return cret
470}
471
472// Retrieves the `GtkAdjustment` used for vertical scrolling.
473func (x *Viewport) GetVadjustment() *Adjustment {
474	var cls *Adjustment
475
476	cret := XGtkScrollableGetVadjustment(x.GoPointer())
477
478	if cret == 0 {
479		return nil
480	}
481	gobject.IncreaseRef(cret)
482	cls = &Adjustment{}
483	cls.Ptr = cret
484	return cls
485}
486
487// Gets the vertical `GtkScrollablePolicy`.
488func (x *Viewport) GetVscrollPolicy() ScrollablePolicy {
489
490	cret := XGtkScrollableGetVscrollPolicy(x.GoPointer())
491	return cret
492}
493
494// Sets the horizontal adjustment of the `GtkScrollable`.
495func (x *Viewport) SetHadjustment(HadjustmentVar *Adjustment) {
496
497	XGtkScrollableSetHadjustment(x.GoPointer(), HadjustmentVar.GoPointer())
498
499}
500
501// Sets the `GtkScrollablePolicy`.
502//
503// The policy determines whether horizontal scrolling should start
504// below the minimum width or below the natural width.
505func (x *Viewport) SetHscrollPolicy(PolicyVar ScrollablePolicy) {
506
507	XGtkScrollableSetHscrollPolicy(x.GoPointer(), PolicyVar)
508
509}
510
511// Sets the vertical adjustment of the `GtkScrollable`.
512func (x *Viewport) SetVadjustment(VadjustmentVar *Adjustment) {
513
514	XGtkScrollableSetVadjustment(x.GoPointer(), VadjustmentVar.GoPointer())
515
516}
517
518// Sets the `GtkScrollablePolicy`.
519//
520// The policy determines whether vertical scrolling should start
521// below the minimum height or below the natural height.
522func (x *Viewport) SetVscrollPolicy(PolicyVar ScrollablePolicy) {
523
524	XGtkScrollableSetVscrollPolicy(x.GoPointer(), PolicyVar)
525
526}
527
528func init() {
529	core.SetPackageName("GTK", "gtk4")
530	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
531	var libs []uintptr
532	for _, libPath := range core.GetPaths("GTK") {
533		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
534		if err != nil {
535			panic(err)
536		}
537		libs = append(libs, lib)
538	}
539
540	core.PuregoSafeRegister(&xViewportGLibType, libs, "gtk_viewport_get_type")
541
542	core.PuregoSafeRegister(&xNewViewport, libs, "gtk_viewport_new")
543
544	core.PuregoSafeRegister(&xViewportGetChild, libs, "gtk_viewport_get_child")
545	core.PuregoSafeRegister(&xViewportGetScrollToFocus, libs, "gtk_viewport_get_scroll_to_focus")
546	core.PuregoSafeRegister(&xViewportScrollTo, libs, "gtk_viewport_scroll_to")
547	core.PuregoSafeRegister(&xViewportSetChild, libs, "gtk_viewport_set_child")
548	core.PuregoSafeRegister(&xViewportSetScrollToFocus, libs, "gtk_viewport_set_scroll_to_focus")
549
550}

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