// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gdk" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" "github.com/bnema/puregotk/v4/gsk" ) type NativeInterface struct { _ structs.HostLayout } func (x *NativeInterface) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // An interface for widgets that have their own [class@Gdk.Surface]. // // The obvious example of a `GtkNative` is `GtkWindow`. // // Every widget that is not itself a `GtkNative` is contained in one, // and you can get it with [method@Gtk.Widget.get_native]. // // To get the surface of a `GtkNative`, use [method@Gtk.Native.get_surface]. // It is also possible to find the `GtkNative` to which a surface // belongs, with [func@Gtk.Native.get_for_surface]. // // In addition to a [class@Gdk.Surface], a `GtkNative` also provides // a [class@Gsk.Renderer] for rendering on that surface. To get the // renderer, use [method@Gtk.Native.get_renderer]. type Native interface { GoPointer() uintptr SetGoPointer(uintptr) GetRenderer() *gsk.Renderer GetSurface() *gdk.Surface GetSurfaceTransform(XVar *float64, YVar *float64) Realize() Unrealize() } var xNativeGLibType func() types.GType func NativeGLibType() types.GType { return xNativeGLibType() } type NativeBase struct { Ptr uintptr } func (x *NativeBase) GoPointer() uintptr { if x == nil { return 0 } return x.Ptr } func (x *NativeBase) SetGoPointer(ptr uintptr) { x.Ptr = ptr } // Returns the renderer that is used for this `GtkNative`. func (x *NativeBase) GetRenderer() *gsk.Renderer { var cls *gsk.Renderer cret := XGtkNativeGetRenderer(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &gsk.Renderer{} cls.Ptr = cret return cls } // Returns the surface of this `GtkNative`. func (x *NativeBase) GetSurface() *gdk.Surface { var cls *gdk.Surface cret := XGtkNativeGetSurface(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &gdk.Surface{} cls.Ptr = cret return cls } // Retrieves the surface transform of @self. // // This is the translation from @self's surface coordinates into // @self's widget coordinates. func (x *NativeBase) GetSurfaceTransform(XVar *float64, YVar *float64) { XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar) } // Realizes a `GtkNative`. // // This should only be used by subclasses. func (x *NativeBase) Realize() { XGtkNativeRealize(x.GoPointer()) } // Unrealizes a `GtkNative`. // // This should only be used by subclasses. func (x *NativeBase) Unrealize() { XGtkNativeUnrealize(x.GoPointer()) } var XGtkNativeGetRenderer func(uintptr) uintptr var XGtkNativeGetSurface func(uintptr) uintptr var XGtkNativeGetSurfaceTransform func(uintptr, *float64, *float64) var XGtkNativeRealize func(uintptr) var XGtkNativeUnrealize func(uintptr) var xNativeGetForSurface func(uintptr) uintptr // Finds the `GtkNative` associated with the surface. func NativeGetForSurface(SurfaceVar *gdk.Surface) *NativeBase { var cls *NativeBase cret := xNativeGetForSurface(SurfaceVar.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &NativeBase{} cls.Ptr = cret return cls } func init() { core.SetPackageName("GTK", "gtk4") core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GTK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xNativeGetForSurface, libs, "gtk_native_get_for_surface") core.PuregoSafeRegister(&xNativeGLibType, libs, "gtk_native_get_type") core.PuregoSafeRegister(&XGtkNativeGetRenderer, libs, "gtk_native_get_renderer") core.PuregoSafeRegister(&XGtkNativeGetSurface, libs, "gtk_native_get_surface") core.PuregoSafeRegister(&XGtkNativeGetSurfaceTransform, libs, "gtk_native_get_surface_transform") core.PuregoSafeRegister(&XGtkNativeRealize, libs, "gtk_native_realize") core.PuregoSafeRegister(&XGtkNativeUnrealize, libs, "gtk_native_unrealize") }