v0.2.1 c0399be

gdkdrawcontext.go RawHistoryFolder

1// Package gdk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gdk
3
4import (
5	"github.com/ebitengine/purego"
6
7	"github.com/bnema/puregotk/pkg/core"
8	"github.com/bnema/puregotk/v4/cairo"
9	"github.com/bnema/puregotk/v4/gobject"
10	"github.com/bnema/puregotk/v4/gobject/types"
11)
12
13// Base class for objects implementing different rendering methods.
14//
15// `GdkDrawContext` is the base object used by contexts implementing different
16// rendering methods, such as [class@Gdk.CairoContext] or [class@Gdk.GLContext].
17// It provides shared functionality between those contexts.
18//
19// You will always interact with one of those subclasses.
20//
21// A `GdkDrawContext` is always associated with a single toplevel surface.
22type DrawContext struct {
23	gobject.Object
24}
25
26var xDrawContextGLibType func() types.GType
27
28func DrawContextGLibType() types.GType {
29	return xDrawContextGLibType()
30}
31
32func DrawContextNewFromInternalPtr(ptr uintptr) *DrawContext {
33	cls := &DrawContext{}
34	cls.Ptr = ptr
35	return cls
36}
37
38var xDrawContextBeginFrame func(uintptr, *cairo.Region)
39
40// Indicates that you are beginning the process of redrawing @region
41// on the @context's surface.
42//
43// Calling this function begins a drawing operation using @context on the
44// surface that @context was created from. The actual requirements and
45// guarantees for the drawing operation vary for different implementations
46// of drawing, so a [class@Gdk.CairoContext] and a [class@Gdk.GLContext]
47// need to be treated differently.
48//
49// A call to this function is a requirement for drawing and must be
50// followed by a call to [method@Gdk.DrawContext.end_frame], which will
51// complete the drawing operation and ensure the contents become visible
52// on screen.
53//
54// Note that the @region passed to this function is the minimum region that
55// needs to be drawn and depending on implementation, windowing system and
56// hardware in use, it might be necessary to draw a larger region. Drawing
57// implementation must use [method@Gdk.DrawContext.get_frame_region] to
58// query the region that must be drawn.
59//
60// When using GTK, the widget system automatically places calls to
61// gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the
62// use of [GskRenderer](../gsk4/class.Renderer.html)s, so application code
63// does not need to call these functions explicitly.
64func (x *DrawContext) BeginFrame(RegionVar *cairo.Region) {
65
66	xDrawContextBeginFrame(x.GoPointer(), RegionVar)
67
68}
69
70var xDrawContextEndFrame func(uintptr)
71
72// Ends a drawing operation started with gdk_draw_context_begin_frame().
73//
74// This makes the drawing available on screen.
75// See [method@Gdk.DrawContext.begin_frame] for more details about drawing.
76//
77// When using a [class@Gdk.GLContext], this function may call `glFlush()`
78// implicitly before returning; it is not recommended to call `glFlush()`
79// explicitly before calling this function.
80func (x *DrawContext) EndFrame() {
81
82	xDrawContextEndFrame(x.GoPointer())
83
84}
85
86var xDrawContextGetDisplay func(uintptr) uintptr
87
88// Retrieves the `GdkDisplay` the @context is created for
89func (x *DrawContext) GetDisplay() *Display {
90	var cls *Display
91
92	cret := xDrawContextGetDisplay(x.GoPointer())
93
94	if cret == 0 {
95		return nil
96	}
97	gobject.IncreaseRef(cret)
98	cls = &Display{}
99	cls.Ptr = cret
100	return cls
101}
102
103var xDrawContextGetFrameRegion func(uintptr) *cairo.Region
104
105// Retrieves the region that is currently being repainted.
106//
107// After a call to [method@Gdk.DrawContext.begin_frame] this function will
108// return a union of the region passed to that function and the area of the
109// surface that the @context determined needs to be repainted.
110//
111// If @context is not in between calls to [method@Gdk.DrawContext.begin_frame]
112// and [method@Gdk.DrawContext.end_frame], %NULL will be returned.
113func (x *DrawContext) GetFrameRegion() *cairo.Region {
114
115	cret := xDrawContextGetFrameRegion(x.GoPointer())
116	return cret
117}
118
119var xDrawContextGetSurface func(uintptr) uintptr
120
121// Retrieves the surface that @context is bound to.
122func (x *DrawContext) GetSurface() *Surface {
123	var cls *Surface
124
125	cret := xDrawContextGetSurface(x.GoPointer())
126
127	if cret == 0 {
128		return nil
129	}
130	gobject.IncreaseRef(cret)
131	cls = &Surface{}
132	cls.Ptr = cret
133	return cls
134}
135
136var xDrawContextIsInFrame func(uintptr) bool
137
138// Returns %TRUE if @context is in the process of drawing to its surface.
139//
140// This is the case between calls to [method@Gdk.DrawContext.begin_frame]
141// and [method@Gdk.DrawContext.end_frame]. In this situation, drawing commands
142// may be effecting the contents of the @context's surface.
143func (x *DrawContext) IsInFrame() bool {
144
145	cret := xDrawContextIsInFrame(x.GoPointer())
146	return cret
147}
148
149func (c *DrawContext) GoPointer() uintptr {
150	if c == nil {
151		return 0
152	}
153	return c.Ptr
154}
155
156func (c *DrawContext) SetGoPointer(ptr uintptr) {
157	c.Ptr = ptr
158}
159
160func init() {
161	core.SetPackageName("GDK", "gtk4")
162	core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"})
163	var libs []uintptr
164	for _, libPath := range core.GetPaths("GDK") {
165		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
166		if err != nil {
167			panic(err)
168		}
169		libs = append(libs, lib)
170	}
171
172	core.PuregoSafeRegister(&xDrawContextGLibType, libs, "gdk_draw_context_get_type")
173
174	core.PuregoSafeRegister(&xDrawContextBeginFrame, libs, "gdk_draw_context_begin_frame")
175	core.PuregoSafeRegister(&xDrawContextEndFrame, libs, "gdk_draw_context_end_frame")
176	core.PuregoSafeRegister(&xDrawContextGetDisplay, libs, "gdk_draw_context_get_display")
177	core.PuregoSafeRegister(&xDrawContextGetFrameRegion, libs, "gdk_draw_context_get_frame_region")
178	core.PuregoSafeRegister(&xDrawContextGetSurface, libs, "gdk_draw_context_get_surface")
179	core.PuregoSafeRegister(&xDrawContextIsInFrame, libs, "gdk_draw_context_is_in_frame")
180
181}

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