v0.2.1 c0399be

gtknative.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/gdk"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14	"github.com/bnema/puregotk/v4/gsk"
15)
16
17type NativeInterface struct {
18	_ structs.HostLayout
19}
20
21func (x *NativeInterface) GoPointer() uintptr {
22	return uintptr(unsafe.Pointer(x))
23}
24
25// An interface for widgets that have their own [class@Gdk.Surface].
26//
27// The obvious example of a `GtkNative` is `GtkWindow`.
28//
29// Every widget that is not itself a `GtkNative` is contained in one,
30// and you can get it with [method@Gtk.Widget.get_native].
31//
32// To get the surface of a `GtkNative`, use [method@Gtk.Native.get_surface].
33// It is also possible to find the `GtkNative` to which a surface
34// belongs, with [func@Gtk.Native.get_for_surface].
35//
36// In addition to a [class@Gdk.Surface], a `GtkNative` also provides
37// a [class@Gsk.Renderer] for rendering on that surface. To get the
38// renderer, use [method@Gtk.Native.get_renderer].
39type Native interface {
40	GoPointer() uintptr
41	SetGoPointer(uintptr)
42	GetRenderer() *gsk.Renderer
43	GetSurface() *gdk.Surface
44	GetSurfaceTransform(XVar *float64, YVar *float64)
45	Realize()
46	Unrealize()
47}
48
49var xNativeGLibType func() types.GType
50
51func NativeGLibType() types.GType {
52	return xNativeGLibType()
53}
54
55type NativeBase struct {
56	Ptr uintptr
57}
58
59func (x *NativeBase) GoPointer() uintptr {
60	if x == nil {
61		return 0
62	}
63	return x.Ptr
64}
65
66func (x *NativeBase) SetGoPointer(ptr uintptr) {
67	x.Ptr = ptr
68}
69
70// Returns the renderer that is used for this `GtkNative`.
71func (x *NativeBase) GetRenderer() *gsk.Renderer {
72	var cls *gsk.Renderer
73
74	cret := XGtkNativeGetRenderer(x.GoPointer())
75
76	if cret == 0 {
77		return nil
78	}
79	gobject.IncreaseRef(cret)
80	cls = &gsk.Renderer{}
81	cls.Ptr = cret
82	return cls
83}
84
85// Returns the surface of this `GtkNative`.
86func (x *NativeBase) GetSurface() *gdk.Surface {
87	var cls *gdk.Surface
88
89	cret := XGtkNativeGetSurface(x.GoPointer())
90
91	if cret == 0 {
92		return nil
93	}
94	gobject.IncreaseRef(cret)
95	cls = &gdk.Surface{}
96	cls.Ptr = cret
97	return cls
98}
99
100// Retrieves the surface transform of @self.
101//
102// This is the translation from @self's surface coordinates into
103// @self's widget coordinates.
104func (x *NativeBase) GetSurfaceTransform(XVar *float64, YVar *float64) {
105
106	XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
107
108}
109
110// Realizes a `GtkNative`.
111//
112// This should only be used by subclasses.
113func (x *NativeBase) Realize() {
114
115	XGtkNativeRealize(x.GoPointer())
116
117}
118
119// Unrealizes a `GtkNative`.
120//
121// This should only be used by subclasses.
122func (x *NativeBase) Unrealize() {
123
124	XGtkNativeUnrealize(x.GoPointer())
125
126}
127
128var XGtkNativeGetRenderer func(uintptr) uintptr
129var XGtkNativeGetSurface func(uintptr) uintptr
130var XGtkNativeGetSurfaceTransform func(uintptr, *float64, *float64)
131var XGtkNativeRealize func(uintptr)
132var XGtkNativeUnrealize func(uintptr)
133
134var xNativeGetForSurface func(uintptr) uintptr
135
136// Finds the `GtkNative` associated with the surface.
137func NativeGetForSurface(SurfaceVar *gdk.Surface) *NativeBase {
138	var cls *NativeBase
139
140	cret := xNativeGetForSurface(SurfaceVar.GoPointer())
141
142	if cret == 0 {
143		return nil
144	}
145	gobject.IncreaseRef(cret)
146	cls = &NativeBase{}
147	cls.Ptr = cret
148	return cls
149}
150
151func init() {
152	core.SetPackageName("GTK", "gtk4")
153	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
154	var libs []uintptr
155	for _, libPath := range core.GetPaths("GTK") {
156		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
157		if err != nil {
158			panic(err)
159		}
160		libs = append(libs, lib)
161	}
162
163	core.PuregoSafeRegister(&xNativeGetForSurface, libs, "gtk_native_get_for_surface")
164
165	core.PuregoSafeRegister(&xNativeGLibType, libs, "gtk_native_get_type")
166
167	core.PuregoSafeRegister(&XGtkNativeGetRenderer, libs, "gtk_native_get_renderer")
168	core.PuregoSafeRegister(&XGtkNativeGetSurface, libs, "gtk_native_get_surface")
169	core.PuregoSafeRegister(&XGtkNativeGetSurfaceTransform, libs, "gtk_native_get_surface_transform")
170	core.PuregoSafeRegister(&XGtkNativeRealize, libs, "gtk_native_realize")
171	core.PuregoSafeRegister(&XGtkNativeUnrealize, libs, "gtk_native_unrealize")
172
173}

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