v0.2.1 c0399be

gtkoverlay.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"unsafe"
6
7	"github.com/ebitengine/purego"
8
9	"github.com/bnema/puregotk/pkg/core"
10	"github.com/bnema/puregotk/v4/glib"
11	"github.com/bnema/puregotk/v4/gobject"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// Places “overlay” widgets on top of a single main child.
16//
17// <picture>
18//
19//	<source srcset="overlay-dark.png" media="(prefers-color-scheme: dark)">
20//	<img alt="An example GtkOverlay" src="overlay.png">
21//
22// </picture>
23//
24// The position of each overlay widget is determined by its
25// [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign]
26// properties. E.g. a widget with both alignments set to %GTK_ALIGN_START
27// will be placed at the top left corner of the `GtkOverlay` container,
28// whereas an overlay with halign set to %GTK_ALIGN_CENTER and valign set
29// to %GTK_ALIGN_END will be placed a the bottom edge of the `GtkOverlay`,
30// horizontally centered. The position can be adjusted by setting the margin
31// properties of the child to non-zero values.
32//
33// More complicated placement of overlays is possible by connecting
34// to the [signal@Gtk.Overlay::get-child-position] signal.
35//
36// An overlay’s minimum and natural sizes are those of its main child.
37// The sizes of overlay children are not considered when measuring these
38// preferred sizes.
39//
40// # GtkOverlay as GtkBuildable
41//
42// The `GtkOverlay` implementation of the `GtkBuildable` interface
43// supports placing a child as an overlay by specifying “overlay” as
44// the “type” attribute of a `<child>` element.
45//
46// # CSS nodes
47//
48// `GtkOverlay` has a single CSS node with the name “overlay”. Overlay children
49// whose alignments cause them to be positioned at an edge get the style classes
50// “.left”, “.right”, “.top”, and/or “.bottom” according to their position.
51type Overlay struct {
52	Widget
53}
54
55var xOverlayGLibType func() types.GType
56
57func OverlayGLibType() types.GType {
58	return xOverlayGLibType()
59}
60
61func OverlayNewFromInternalPtr(ptr uintptr) *Overlay {
62	cls := &Overlay{}
63	cls.Ptr = ptr
64	return cls
65}
66
67var xNewOverlay func() uintptr
68
69// Creates a new `GtkOverlay`.
70func NewOverlay() *Overlay {
71	var cls *Overlay
72
73	cret := xNewOverlay()
74
75	if cret == 0 {
76		return nil
77	}
78	gobject.IncreaseRef(cret)
79	cls = &Overlay{}
80	cls.Ptr = cret
81	return cls
82}
83
84var xOverlayAddOverlay func(uintptr, uintptr)
85
86// Adds @widget to @overlay.
87//
88// The widget will be stacked on top of the main widget
89// added with [method@Gtk.Overlay.set_child].
90//
91// The position at which @widget is placed is determined
92// from its [property@Gtk.Widget:halign] and
93// [property@Gtk.Widget:valign] properties.
94func (x *Overlay) AddOverlay(WidgetVar *Widget) {
95
96	xOverlayAddOverlay(x.GoPointer(), WidgetVar.GoPointer())
97
98}
99
100var xOverlayGetChild func(uintptr) uintptr
101
102// Gets the child widget of @overlay.
103func (x *Overlay) GetChild() *Widget {
104	var cls *Widget
105
106	cret := xOverlayGetChild(x.GoPointer())
107
108	if cret == 0 {
109		return nil
110	}
111	gobject.IncreaseRef(cret)
112	cls = &Widget{}
113	cls.Ptr = cret
114	return cls
115}
116
117var xOverlayGetClipOverlay func(uintptr, uintptr) bool
118
119// Gets whether @widget should be clipped within the parent.
120func (x *Overlay) GetClipOverlay(WidgetVar *Widget) bool {
121
122	cret := xOverlayGetClipOverlay(x.GoPointer(), WidgetVar.GoPointer())
123	return cret
124}
125
126var xOverlayGetMeasureOverlay func(uintptr, uintptr) bool
127
128// Gets whether @widget's size is included in the measurement of
129// @overlay.
130func (x *Overlay) GetMeasureOverlay(WidgetVar *Widget) bool {
131
132	cret := xOverlayGetMeasureOverlay(x.GoPointer(), WidgetVar.GoPointer())
133	return cret
134}
135
136var xOverlayRemoveOverlay func(uintptr, uintptr)
137
138// Removes an overlay that was added with gtk_overlay_add_overlay().
139func (x *Overlay) RemoveOverlay(WidgetVar *Widget) {
140
141	xOverlayRemoveOverlay(x.GoPointer(), WidgetVar.GoPointer())
142
143}
144
145var xOverlaySetChild func(uintptr, uintptr)
146
147// Sets the child widget of @overlay.
148func (x *Overlay) SetChild(ChildVar *Widget) {
149
150	xOverlaySetChild(x.GoPointer(), ChildVar.GoPointer())
151
152}
153
154var xOverlaySetClipOverlay func(uintptr, uintptr, bool)
155
156// Sets whether @widget should be clipped within the parent.
157func (x *Overlay) SetClipOverlay(WidgetVar *Widget, ClipOverlayVar bool) {
158
159	xOverlaySetClipOverlay(x.GoPointer(), WidgetVar.GoPointer(), ClipOverlayVar)
160
161}
162
163var xOverlaySetMeasureOverlay func(uintptr, uintptr, bool)
164
165// Sets whether @widget is included in the measured size of @overlay.
166//
167// The overlay will request the size of the largest child that has
168// this property set to %TRUE. Children who are not included may
169// be drawn outside of @overlay's allocation if they are too large.
170func (x *Overlay) SetMeasureOverlay(WidgetVar *Widget, MeasureVar bool) {
171
172	xOverlaySetMeasureOverlay(x.GoPointer(), WidgetVar.GoPointer(), MeasureVar)
173
174}
175
176func (c *Overlay) GoPointer() uintptr {
177	if c == nil {
178		return 0
179	}
180	return c.Ptr
181}
182
183func (c *Overlay) SetGoPointer(ptr uintptr) {
184	c.Ptr = ptr
185}
186
187// Emitted to determine the position and size of any overlay
188// child widgets.
189//
190// A handler for this signal should fill @allocation with
191// the desired position and size for @widget, relative to
192// the 'main' child of @overlay.
193//
194// The default handler for this signal uses the @widget's
195// halign and valign properties to determine the position
196// and gives the widget its natural size (except that an
197// alignment of %GTK_ALIGN_FILL will cause the overlay to
198// be full-width/height). If the main child is a
199// `GtkScrolledWindow`, the overlays are placed relative
200// to its contents.
201func (x *Overlay) ConnectGetChildPosition(cb *func(Overlay, uintptr, *uintptr) bool) uint {
202	cbPtr := uintptr(unsafe.Pointer(cb))
203	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
204		handlerID := gobject.SignalConnect(x.GoPointer(), "get-child-position", cbRefPtr)
205		glib.SaveHandlerMapping(handlerID, cbPtr)
206		return handlerID
207	}
208
209	fcb := func(clsPtr uintptr, WidgetVarp uintptr, AllocationVarp *uintptr) bool {
210		fa := Overlay{}
211		fa.Ptr = clsPtr
212		cbFn := *cb
213
214		return cbFn(fa, WidgetVarp, AllocationVarp)
215
216	}
217	cbRefPtr := purego.NewCallback(fcb)
218	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
219	handlerID := gobject.SignalConnect(x.GoPointer(), "get-child-position", cbRefPtr)
220	glib.SaveHandlerMapping(handlerID, cbPtr)
221	return handlerID
222}
223
224// Requests the user's screen reader to announce the given message.
225//
226// This kind of notification is useful for messages that
227// either have only a visual representation or that are not
228// exposed visually at all, e.g. a notification about a
229// successful operation.
230//
231// Also, by using this API, you can ensure that the message
232// does not interrupts the user's current screen reader output.
233func (x *Overlay) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
234
235	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
236
237}
238
239// Retrieves the accessible parent for an accessible object.
240//
241// This function returns `NULL` for top level widgets.
242func (x *Overlay) GetAccessibleParent() *AccessibleBase {
243	var cls *AccessibleBase
244
245	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
246
247	if cret == 0 {
248		return nil
249	}
250	cls = &AccessibleBase{}
251	cls.Ptr = cret
252	return cls
253}
254
255// Retrieves the accessible role of an accessible object.
256func (x *Overlay) GetAccessibleRole() AccessibleRole {
257
258	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
259	return cret
260}
261
262// Retrieves the implementation for the given accessible object.
263func (x *Overlay) GetAtContext() *ATContext {
264	var cls *ATContext
265
266	cret := XGtkAccessibleGetAtContext(x.GoPointer())
267
268	if cret == 0 {
269		return nil
270	}
271	cls = &ATContext{}
272	cls.Ptr = cret
273	return cls
274}
275
276// Queries the coordinates and dimensions of this accessible
277//
278// This functionality can be overridden by `GtkAccessible`
279// implementations, e.g. to get the bounds from an ignored
280// child widget.
281func (x *Overlay) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
282
283	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
284	return cret
285}
286
287// Retrieves the first accessible child of an accessible object.
288func (x *Overlay) GetFirstAccessibleChild() *AccessibleBase {
289	var cls *AccessibleBase
290
291	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
292
293	if cret == 0 {
294		return nil
295	}
296	cls = &AccessibleBase{}
297	cls.Ptr = cret
298	return cls
299}
300
301// Retrieves the next accessible sibling of an accessible object
302func (x *Overlay) GetNextAccessibleSibling() *AccessibleBase {
303	var cls *AccessibleBase
304
305	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
306
307	if cret == 0 {
308		return nil
309	}
310	cls = &AccessibleBase{}
311	cls.Ptr = cret
312	return cls
313}
314
315// Queries a platform state, such as focus.
316//
317// This functionality can be overridden by `GtkAccessible`
318// implementations, e.g. to get platform state from an ignored
319// child widget, as is the case for `GtkText` wrappers.
320func (x *Overlay) GetPlatformState(StateVar AccessiblePlatformState) bool {
321
322	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
323	return cret
324}
325
326// Resets the accessible property to its default value.
327func (x *Overlay) ResetProperty(PropertyVar AccessibleProperty) {
328
329	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
330
331}
332
333// Resets the accessible relation to its default value.
334func (x *Overlay) ResetRelation(RelationVar AccessibleRelation) {
335
336	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
337
338}
339
340// Resets the accessible state to its default value.
341func (x *Overlay) ResetState(StateVar AccessibleState) {
342
343	XGtkAccessibleResetState(x.GoPointer(), StateVar)
344
345}
346
347// Sets the parent and sibling of an accessible object.
348//
349// This function is meant to be used by accessible implementations that are
350// not part of the widget hierarchy, and but act as a logical bridge between
351// widgets. For instance, if a widget creates an object that holds metadata
352// for each child, and you want that object to implement the `GtkAccessible`
353// interface, you will use this function to ensure that the parent of each
354// child widget is the metadata object, and the parent of each metadata
355// object is the container widget.
356func (x *Overlay) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
357
358	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
359
360}
361
362// Updates the next accessible sibling.
363//
364// That might be useful when a new child of a custom accessible
365// is created, and it needs to be linked to a previous child.
366func (x *Overlay) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
367
368	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
369
370}
371
372// Informs ATs that the platform state has changed.
373//
374// This function should be used by `GtkAccessible` implementations that
375// have a platform state but are not widgets. Widgets handle platform
376// states automatically.
377func (x *Overlay) UpdatePlatformState(StateVar AccessiblePlatformState) {
378
379	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
380
381}
382
383// Updates a list of accessible properties.
384//
385// See the [enum@Gtk.AccessibleProperty] documentation for the
386// value types of accessible properties.
387//
388// This function should be called by `GtkWidget` types whenever
389// an accessible property change must be communicated to assistive
390// technologies.
391//
392// Example:
393// ```c
394// value = gtk_adjustment_get_value (adjustment);
395// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
396//
397//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
398//	-1);
399//
400// ```
401func (x *Overlay) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
402
403	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
404
405}
406
407// Updates an array of accessible properties.
408//
409// This function should be called by `GtkWidget` types whenever an accessible
410// property change must be communicated to assistive technologies.
411//
412// This function is meant to be used by language bindings.
413func (x *Overlay) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
414
415	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
416
417}
418
419// Updates a list of accessible relations.
420//
421// This function should be called by `GtkWidget` types whenever an accessible
422// relation change must be communicated to assistive technologies.
423//
424// If the [enum@Gtk.AccessibleRelation] requires a list of references,
425// you should pass each reference individually, followed by `NULL`, e.g.
426//
427// ```c
428// gtk_accessible_update_relation (accessible,
429//
430//	GTK_ACCESSIBLE_RELATION_CONTROLS,
431//	  ref1, NULL,
432//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
433//	  ref1, ref2, ref3, NULL,
434//	-1);
435//
436// ```
437func (x *Overlay) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
438
439	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
440
441}
442
443// Updates an array of accessible relations.
444//
445// This function should be called by `GtkWidget` types whenever an accessible
446// relation change must be communicated to assistive technologies.
447//
448// This function is meant to be used by language bindings.
449func (x *Overlay) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
450
451	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
452
453}
454
455// Updates a list of accessible states.
456//
457// See the [enum@Gtk.AccessibleState] documentation for the
458// value types of accessible states.
459//
460// This function should be called by `GtkWidget` types whenever
461// an accessible state change must be communicated to assistive
462// technologies.
463//
464// Example:
465//
466// ```c
467// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
468// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
469//
470//	GTK_ACCESSIBLE_STATE_CHECKED, value,
471//	-1);
472//
473// ```
474func (x *Overlay) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
475
476	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
477
478}
479
480// Updates an array of accessible states.
481//
482// This function should be called by `GtkWidget` types whenever an accessible
483// state change must be communicated to assistive technologies.
484//
485// This function is meant to be used by language bindings.
486func (x *Overlay) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
487
488	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
489
490}
491
492// Gets the ID of the @buildable object.
493//
494// `GtkBuilder` sets the name based on the ID attribute
495// of the `<object>` tag used to construct the @buildable.
496func (x *Overlay) GetBuildableId() string {
497
498	cret := XGtkBuildableGetBuildableId(x.GoPointer())
499	return cret
500}
501
502func init() {
503	core.SetPackageName("GTK", "gtk4")
504	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
505	var libs []uintptr
506	for _, libPath := range core.GetPaths("GTK") {
507		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
508		if err != nil {
509			panic(err)
510		}
511		libs = append(libs, lib)
512	}
513
514	core.PuregoSafeRegister(&xOverlayGLibType, libs, "gtk_overlay_get_type")
515
516	core.PuregoSafeRegister(&xNewOverlay, libs, "gtk_overlay_new")
517
518	core.PuregoSafeRegister(&xOverlayAddOverlay, libs, "gtk_overlay_add_overlay")
519	core.PuregoSafeRegister(&xOverlayGetChild, libs, "gtk_overlay_get_child")
520	core.PuregoSafeRegister(&xOverlayGetClipOverlay, libs, "gtk_overlay_get_clip_overlay")
521	core.PuregoSafeRegister(&xOverlayGetMeasureOverlay, libs, "gtk_overlay_get_measure_overlay")
522	core.PuregoSafeRegister(&xOverlayRemoveOverlay, libs, "gtk_overlay_remove_overlay")
523	core.PuregoSafeRegister(&xOverlaySetChild, libs, "gtk_overlay_set_child")
524	core.PuregoSafeRegister(&xOverlaySetClipOverlay, libs, "gtk_overlay_set_clip_overlay")
525	core.PuregoSafeRegister(&xOverlaySetMeasureOverlay, libs, "gtk_overlay_set_measure_overlay")
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