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/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type CellAreaContextClass struct {
16 _ structs.HostLayout
17
18 ParentClass gobject.ObjectClass
19
20 xAllocate uintptr
21
22 xReset uintptr
23
24 xGetPreferredHeightForWidth uintptr
25
26 xGetPreferredWidthForHeight uintptr
27
28 Padding [8]uintptr
29}
30
31func (x *CellAreaContextClass) GoPointer() uintptr {
32 return uintptr(unsafe.Pointer(x))
33}
34
35// OverrideAllocate sets the "allocate" callback function.
36// This tells the context that an allocation width or height
37//
38// (or both) have been decided for a group of rows. The context should
39// store any allocations for internally aligned cells at this point so
40// that they dont need to be recalculated at gtk_cell_area_render() time.
41func (x *CellAreaContextClass) OverrideAllocate(cb func(*CellAreaContext, int, int)) {
42 if cb == nil {
43 x.xAllocate = 0
44 } else {
45 x.xAllocate = purego.NewCallback(func(ContextVarp uintptr, WidthVarp int, HeightVarp int) {
46 cb(CellAreaContextNewFromInternalPtr(ContextVarp), WidthVarp, HeightVarp)
47 })
48 }
49}
50
51// GetAllocate gets the "allocate" callback function.
52// This tells the context that an allocation width or height
53//
54// (or both) have been decided for a group of rows. The context should
55// store any allocations for internally aligned cells at this point so
56// that they dont need to be recalculated at gtk_cell_area_render() time.
57func (x *CellAreaContextClass) GetAllocate() func(*CellAreaContext, int, int) {
58 if x.xAllocate == 0 {
59 return nil
60 }
61 var rawCallback func(ContextVarp uintptr, WidthVarp int, HeightVarp int)
62 purego.RegisterFunc(&rawCallback, x.xAllocate)
63 return func(ContextVar *CellAreaContext, WidthVar int, HeightVar int) {
64 rawCallback(ContextVar.GoPointer(), WidthVar, HeightVar)
65 }
66}
67
68// OverrideReset sets the "reset" callback function.
69// Clear any previously stored information about requested and
70//
71// allocated sizes for the context.
72func (x *CellAreaContextClass) OverrideReset(cb func(*CellAreaContext)) {
73 if cb == nil {
74 x.xReset = 0
75 } else {
76 x.xReset = purego.NewCallback(func(ContextVarp uintptr) {
77 cb(CellAreaContextNewFromInternalPtr(ContextVarp))
78 })
79 }
80}
81
82// GetReset gets the "reset" callback function.
83// Clear any previously stored information about requested and
84//
85// allocated sizes for the context.
86func (x *CellAreaContextClass) GetReset() func(*CellAreaContext) {
87 if x.xReset == 0 {
88 return nil
89 }
90 var rawCallback func(ContextVarp uintptr)
91 purego.RegisterFunc(&rawCallback, x.xReset)
92 return func(ContextVar *CellAreaContext) {
93 rawCallback(ContextVar.GoPointer())
94 }
95}
96
97// OverrideGetPreferredHeightForWidth sets the "get_preferred_height_for_width" callback function.
98// Returns the aligned height for the given
99//
100// width that context must store while collecting sizes for it’s rows.
101func (x *CellAreaContextClass) OverrideGetPreferredHeightForWidth(cb func(*CellAreaContext, int, *int, *int)) {
102 if cb == nil {
103 x.xGetPreferredHeightForWidth = 0
104 } else {
105 x.xGetPreferredHeightForWidth = purego.NewCallback(func(ContextVarp uintptr, WidthVarp int, MinimumHeightVarp *int, NaturalHeightVarp *int) {
106 cb(CellAreaContextNewFromInternalPtr(ContextVarp), WidthVarp, MinimumHeightVarp, NaturalHeightVarp)
107 })
108 }
109}
110
111// GetGetPreferredHeightForWidth gets the "get_preferred_height_for_width" callback function.
112// Returns the aligned height for the given
113//
114// width that context must store while collecting sizes for it’s rows.
115func (x *CellAreaContextClass) GetGetPreferredHeightForWidth() func(*CellAreaContext, int, *int, *int) {
116 if x.xGetPreferredHeightForWidth == 0 {
117 return nil
118 }
119 var rawCallback func(ContextVarp uintptr, WidthVarp int, MinimumHeightVarp *int, NaturalHeightVarp *int)
120 purego.RegisterFunc(&rawCallback, x.xGetPreferredHeightForWidth)
121 return func(ContextVar *CellAreaContext, WidthVar int, MinimumHeightVar *int, NaturalHeightVar *int) {
122 rawCallback(ContextVar.GoPointer(), WidthVar, MinimumHeightVar, NaturalHeightVar)
123 }
124}
125
126// OverrideGetPreferredWidthForHeight sets the "get_preferred_width_for_height" callback function.
127// Returns the aligned width for the given
128//
129// height that context must store while collecting sizes for it’s rows.
130func (x *CellAreaContextClass) OverrideGetPreferredWidthForHeight(cb func(*CellAreaContext, int, *int, *int)) {
131 if cb == nil {
132 x.xGetPreferredWidthForHeight = 0
133 } else {
134 x.xGetPreferredWidthForHeight = purego.NewCallback(func(ContextVarp uintptr, HeightVarp int, MinimumWidthVarp *int, NaturalWidthVarp *int) {
135 cb(CellAreaContextNewFromInternalPtr(ContextVarp), HeightVarp, MinimumWidthVarp, NaturalWidthVarp)
136 })
137 }
138}
139
140// GetGetPreferredWidthForHeight gets the "get_preferred_width_for_height" callback function.
141// Returns the aligned width for the given
142//
143// height that context must store while collecting sizes for it’s rows.
144func (x *CellAreaContextClass) GetGetPreferredWidthForHeight() func(*CellAreaContext, int, *int, *int) {
145 if x.xGetPreferredWidthForHeight == 0 {
146 return nil
147 }
148 var rawCallback func(ContextVarp uintptr, HeightVarp int, MinimumWidthVarp *int, NaturalWidthVarp *int)
149 purego.RegisterFunc(&rawCallback, x.xGetPreferredWidthForHeight)
150 return func(ContextVar *CellAreaContext, HeightVar int, MinimumWidthVar *int, NaturalWidthVar *int) {
151 rawCallback(ContextVar.GoPointer(), HeightVar, MinimumWidthVar, NaturalWidthVar)
152 }
153}
154
155type CellAreaContextPrivate struct {
156 _ structs.HostLayout
157}
158
159func (x *CellAreaContextPrivate) GoPointer() uintptr {
160 return uintptr(unsafe.Pointer(x))
161}
162
163// Stores geometrical information for a series of rows in a GtkCellArea
164//
165// The `GtkCellAreaContext` object is created by a given `GtkCellArea`
166// implementation via its `GtkCellAreaClass.create_context()` virtual
167// method and is used to store cell sizes and alignments for a series of
168// `GtkTreeModel` rows that are requested and rendered in the same context.
169//
170// `GtkCellLayout` widgets can create any number of contexts in which to
171// request and render groups of data rows. However, it’s important that the
172// same context which was used to request sizes for a given `GtkTreeModel`
173// row also be used for the same row when calling other `GtkCellArea` APIs
174// such as gtk_cell_area_render() and gtk_cell_area_event().
175type CellAreaContext struct {
176 gobject.Object
177}
178
179var xCellAreaContextGLibType func() types.GType
180
181func CellAreaContextGLibType() types.GType {
182 return xCellAreaContextGLibType()
183}
184
185func CellAreaContextNewFromInternalPtr(ptr uintptr) *CellAreaContext {
186 cls := &CellAreaContext{}
187 cls.Ptr = ptr
188 return cls
189}
190
191var xCellAreaContextAllocate func(uintptr, int, int)
192
193// Allocates a width and/or a height for all rows which are to be
194// rendered with @context.
195//
196// Usually allocation is performed only horizontally or sometimes
197// vertically since a group of rows are usually rendered side by
198// side vertically or horizontally and share either the same width
199// or the same height. Sometimes they are allocated in both horizontal
200// and vertical orientations producing a homogeneous effect of the
201// rows. This is generally the case for `GtkTreeView` when
202// `GtkTreeView:fixed-height-mode` is enabled.
203func (x *CellAreaContext) Allocate(WidthVar int, HeightVar int) {
204
205 xCellAreaContextAllocate(x.GoPointer(), WidthVar, HeightVar)
206
207}
208
209var xCellAreaContextGetAllocation func(uintptr, *int, *int)
210
211// Fetches the current allocation size for @context.
212//
213// If the context was not allocated in width or height, or if the
214// context was recently reset with gtk_cell_area_context_reset(),
215// the returned value will be -1.
216func (x *CellAreaContext) GetAllocation(WidthVar *int, HeightVar *int) {
217
218 xCellAreaContextGetAllocation(x.GoPointer(), WidthVar, HeightVar)
219
220}
221
222var xCellAreaContextGetArea func(uintptr) uintptr
223
224// Fetches the `GtkCellArea` this @context was created by.
225//
226// This is generally unneeded by layouting widgets; however,
227// it is important for the context implementation itself to
228// fetch information about the area it is being used for.
229//
230// For instance at `GtkCellAreaContextClass.allocate()` time
231// it’s important to know details about any cell spacing
232// that the `GtkCellArea` is configured with in order to
233// compute a proper allocation.
234func (x *CellAreaContext) GetArea() *CellArea {
235 var cls *CellArea
236
237 cret := xCellAreaContextGetArea(x.GoPointer())
238
239 if cret == 0 {
240 return nil
241 }
242 gobject.IncreaseRef(cret)
243 cls = &CellArea{}
244 cls.Ptr = cret
245 return cls
246}
247
248var xCellAreaContextGetPreferredHeight func(uintptr, *int, *int)
249
250// Gets the accumulative preferred height for all rows which have been
251// requested with this context.
252//
253// After gtk_cell_area_context_reset() is called and/or before ever
254// requesting the size of a `GtkCellArea`, the returned values are 0.
255func (x *CellAreaContext) GetPreferredHeight(MinimumHeightVar *int, NaturalHeightVar *int) {
256
257 xCellAreaContextGetPreferredHeight(x.GoPointer(), MinimumHeightVar, NaturalHeightVar)
258
259}
260
261var xCellAreaContextGetPreferredHeightForWidth func(uintptr, int, *int, *int)
262
263// Gets the accumulative preferred height for @width for all rows
264// which have been requested for the same said @width with this context.
265//
266// After gtk_cell_area_context_reset() is called and/or before ever
267// requesting the size of a `GtkCellArea`, the returned values are -1.
268func (x *CellAreaContext) GetPreferredHeightForWidth(WidthVar int, MinimumHeightVar *int, NaturalHeightVar *int) {
269
270 xCellAreaContextGetPreferredHeightForWidth(x.GoPointer(), WidthVar, MinimumHeightVar, NaturalHeightVar)
271
272}
273
274var xCellAreaContextGetPreferredWidth func(uintptr, *int, *int)
275
276// Gets the accumulative preferred width for all rows which have been
277// requested with this context.
278//
279// After gtk_cell_area_context_reset() is called and/or before ever
280// requesting the size of a `GtkCellArea`, the returned values are 0.
281func (x *CellAreaContext) GetPreferredWidth(MinimumWidthVar *int, NaturalWidthVar *int) {
282
283 xCellAreaContextGetPreferredWidth(x.GoPointer(), MinimumWidthVar, NaturalWidthVar)
284
285}
286
287var xCellAreaContextGetPreferredWidthForHeight func(uintptr, int, *int, *int)
288
289// Gets the accumulative preferred width for @height for all rows which
290// have been requested for the same said @height with this context.
291//
292// After gtk_cell_area_context_reset() is called and/or before ever
293// requesting the size of a `GtkCellArea`, the returned values are -1.
294func (x *CellAreaContext) GetPreferredWidthForHeight(HeightVar int, MinimumWidthVar *int, NaturalWidthVar *int) {
295
296 xCellAreaContextGetPreferredWidthForHeight(x.GoPointer(), HeightVar, MinimumWidthVar, NaturalWidthVar)
297
298}
299
300var xCellAreaContextPushPreferredHeight func(uintptr, int, int)
301
302// Causes the minimum and/or natural height to grow if the new
303// proposed sizes exceed the current minimum and natural height.
304//
305// This is used by `GtkCellAreaContext` implementations during
306// the request process over a series of `GtkTreeModel` rows to
307// progressively push the requested height over a series of
308// gtk_cell_area_get_preferred_height() requests.
309func (x *CellAreaContext) PushPreferredHeight(MinimumHeightVar int, NaturalHeightVar int) {
310
311 xCellAreaContextPushPreferredHeight(x.GoPointer(), MinimumHeightVar, NaturalHeightVar)
312
313}
314
315var xCellAreaContextPushPreferredWidth func(uintptr, int, int)
316
317// Causes the minimum and/or natural width to grow if the new
318// proposed sizes exceed the current minimum and natural width.
319//
320// This is used by `GtkCellAreaContext` implementations during
321// the request process over a series of `GtkTreeModel` rows to
322// progressively push the requested width over a series of
323// gtk_cell_area_get_preferred_width() requests.
324func (x *CellAreaContext) PushPreferredWidth(MinimumWidthVar int, NaturalWidthVar int) {
325
326 xCellAreaContextPushPreferredWidth(x.GoPointer(), MinimumWidthVar, NaturalWidthVar)
327
328}
329
330var xCellAreaContextReset func(uintptr)
331
332// Resets any previously cached request and allocation
333// data.
334//
335// When underlying `GtkTreeModel` data changes its
336// important to reset the context if the content
337// size is allowed to shrink. If the content size
338// is only allowed to grow (this is usually an option
339// for views rendering large data stores as a measure
340// of optimization), then only the row that changed
341// or was inserted needs to be (re)requested with
342// gtk_cell_area_get_preferred_width().
343//
344// When the new overall size of the context requires
345// that the allocated size changes (or whenever this
346// allocation changes at all), the variable row
347// sizes need to be re-requested for every row.
348//
349// For instance, if the rows are displayed all with
350// the same width from top to bottom then a change
351// in the allocated width necessitates a recalculation
352// of all the displayed row heights using
353// gtk_cell_area_get_preferred_height_for_width().
354func (x *CellAreaContext) Reset() {
355
356 xCellAreaContextReset(x.GoPointer())
357
358}
359
360func (c *CellAreaContext) GoPointer() uintptr {
361 if c == nil {
362 return 0
363 }
364 return c.Ptr
365}
366
367func (c *CellAreaContext) SetGoPointer(ptr uintptr) {
368 c.Ptr = ptr
369}
370
371// GetPropertyMinimumHeight gets the "minimum-height" property.
372// The minimum height for the `GtkCellArea` in this context
373// for all `GtkTreeModel` rows that this context was requested
374// for using gtk_cell_area_get_preferred_height().
375func (x *CellAreaContext) GetPropertyMinimumHeight() int {
376 var v gobject.Value
377 x.GetProperty("minimum-height", &v)
378 return v.GetInt()
379}
380
381// GetPropertyMinimumWidth gets the "minimum-width" property.
382// The minimum width for the `GtkCellArea` in this context
383// for all `GtkTreeModel` rows that this context was requested
384// for using gtk_cell_area_get_preferred_width().
385func (x *CellAreaContext) GetPropertyMinimumWidth() int {
386 var v gobject.Value
387 x.GetProperty("minimum-width", &v)
388 return v.GetInt()
389}
390
391// GetPropertyNaturalHeight gets the "natural-height" property.
392// The natural height for the `GtkCellArea` in this context
393// for all `GtkTreeModel` rows that this context was requested
394// for using gtk_cell_area_get_preferred_height().
395func (x *CellAreaContext) GetPropertyNaturalHeight() int {
396 var v gobject.Value
397 x.GetProperty("natural-height", &v)
398 return v.GetInt()
399}
400
401// GetPropertyNaturalWidth gets the "natural-width" property.
402// The natural width for the `GtkCellArea` in this context
403// for all `GtkTreeModel` rows that this context was requested
404// for using gtk_cell_area_get_preferred_width().
405func (x *CellAreaContext) GetPropertyNaturalWidth() int {
406 var v gobject.Value
407 x.GetProperty("natural-width", &v)
408 return v.GetInt()
409}
410
411func init() {
412 core.SetPackageName("GTK", "gtk4")
413 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
414 var libs []uintptr
415 for _, libPath := range core.GetPaths("GTK") {
416 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
417 if err != nil {
418 panic(err)
419 }
420 libs = append(libs, lib)
421 }
422
423 core.PuregoSafeRegister(&xCellAreaContextGLibType, libs, "gtk_cell_area_context_get_type")
424
425 core.PuregoSafeRegister(&xCellAreaContextAllocate, libs, "gtk_cell_area_context_allocate")
426 core.PuregoSafeRegister(&xCellAreaContextGetAllocation, libs, "gtk_cell_area_context_get_allocation")
427 core.PuregoSafeRegister(&xCellAreaContextGetArea, libs, "gtk_cell_area_context_get_area")
428 core.PuregoSafeRegister(&xCellAreaContextGetPreferredHeight, libs, "gtk_cell_area_context_get_preferred_height")
429 core.PuregoSafeRegister(&xCellAreaContextGetPreferredHeightForWidth, libs, "gtk_cell_area_context_get_preferred_height_for_width")
430 core.PuregoSafeRegister(&xCellAreaContextGetPreferredWidth, libs, "gtk_cell_area_context_get_preferred_width")
431 core.PuregoSafeRegister(&xCellAreaContextGetPreferredWidthForHeight, libs, "gtk_cell_area_context_get_preferred_width_for_height")
432 core.PuregoSafeRegister(&xCellAreaContextPushPreferredHeight, libs, "gtk_cell_area_context_push_preferred_height")
433 core.PuregoSafeRegister(&xCellAreaContextPushPreferredWidth, libs, "gtk_cell_area_context_push_preferred_width")
434 core.PuregoSafeRegister(&xCellAreaContextReset, libs, "gtk_cell_area_context_reset")
435
436}