// Package gdk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gdk import ( "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/cairo" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // Base class for objects implementing different rendering methods. // // `GdkDrawContext` is the base object used by contexts implementing different // rendering methods, such as [class@Gdk.CairoContext] or [class@Gdk.GLContext]. // It provides shared functionality between those contexts. // // You will always interact with one of those subclasses. // // A `GdkDrawContext` is always associated with a single toplevel surface. type DrawContext struct { gobject.Object } var xDrawContextGLibType func() types.GType func DrawContextGLibType() types.GType { return xDrawContextGLibType() } func DrawContextNewFromInternalPtr(ptr uintptr) *DrawContext { cls := &DrawContext{} cls.Ptr = ptr return cls } var xDrawContextBeginFrame func(uintptr, *cairo.Region) // Indicates that you are beginning the process of redrawing @region // on the @context's surface. // // Calling this function begins a drawing operation using @context on the // surface that @context was created from. The actual requirements and // guarantees for the drawing operation vary for different implementations // of drawing, so a [class@Gdk.CairoContext] and a [class@Gdk.GLContext] // need to be treated differently. // // A call to this function is a requirement for drawing and must be // followed by a call to [method@Gdk.DrawContext.end_frame], which will // complete the drawing operation and ensure the contents become visible // on screen. // // Note that the @region passed to this function is the minimum region that // needs to be drawn and depending on implementation, windowing system and // hardware in use, it might be necessary to draw a larger region. Drawing // implementation must use [method@Gdk.DrawContext.get_frame_region] to // query the region that must be drawn. // // When using GTK, the widget system automatically places calls to // gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the // use of [GskRenderer](../gsk4/class.Renderer.html)s, so application code // does not need to call these functions explicitly. func (x *DrawContext) BeginFrame(RegionVar *cairo.Region) { xDrawContextBeginFrame(x.GoPointer(), RegionVar) } var xDrawContextEndFrame func(uintptr) // Ends a drawing operation started with gdk_draw_context_begin_frame(). // // This makes the drawing available on screen. // See [method@Gdk.DrawContext.begin_frame] for more details about drawing. // // When using a [class@Gdk.GLContext], this function may call `glFlush()` // implicitly before returning; it is not recommended to call `glFlush()` // explicitly before calling this function. func (x *DrawContext) EndFrame() { xDrawContextEndFrame(x.GoPointer()) } var xDrawContextGetDisplay func(uintptr) uintptr // Retrieves the `GdkDisplay` the @context is created for func (x *DrawContext) GetDisplay() *Display { var cls *Display cret := xDrawContextGetDisplay(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Display{} cls.Ptr = cret return cls } var xDrawContextGetFrameRegion func(uintptr) *cairo.Region // Retrieves the region that is currently being repainted. // // After a call to [method@Gdk.DrawContext.begin_frame] this function will // return a union of the region passed to that function and the area of the // surface that the @context determined needs to be repainted. // // If @context is not in between calls to [method@Gdk.DrawContext.begin_frame] // and [method@Gdk.DrawContext.end_frame], %NULL will be returned. func (x *DrawContext) GetFrameRegion() *cairo.Region { cret := xDrawContextGetFrameRegion(x.GoPointer()) return cret } var xDrawContextGetSurface func(uintptr) uintptr // Retrieves the surface that @context is bound to. func (x *DrawContext) GetSurface() *Surface { var cls *Surface cret := xDrawContextGetSurface(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Surface{} cls.Ptr = cret return cls } var xDrawContextIsInFrame func(uintptr) bool // Returns %TRUE if @context is in the process of drawing to its surface. // // This is the case between calls to [method@Gdk.DrawContext.begin_frame] // and [method@Gdk.DrawContext.end_frame]. In this situation, drawing commands // may be effecting the contents of the @context's surface. func (x *DrawContext) IsInFrame() bool { cret := xDrawContextIsInFrame(x.GoPointer()) return cret } func (c *DrawContext) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *DrawContext) SetGoPointer(ptr uintptr) { c.Ptr = ptr } func init() { core.SetPackageName("GDK", "gtk4") core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GDK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xDrawContextGLibType, libs, "gdk_draw_context_get_type") core.PuregoSafeRegister(&xDrawContextBeginFrame, libs, "gdk_draw_context_begin_frame") core.PuregoSafeRegister(&xDrawContextEndFrame, libs, "gdk_draw_context_end_frame") core.PuregoSafeRegister(&xDrawContextGetDisplay, libs, "gdk_draw_context_get_display") core.PuregoSafeRegister(&xDrawContextGetFrameRegion, libs, "gdk_draw_context_get_frame_region") core.PuregoSafeRegister(&xDrawContextGetSurface, libs, "gdk_draw_context_get_surface") core.PuregoSafeRegister(&xDrawContextIsInFrame, libs, "gdk_draw_context_is_in_frame") }