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/glib"
13 "github.com/bnema/puregotk/v4/gobject"
14 "github.com/bnema/puregotk/v4/gobject/types"
15)
16
17// The type of the callback functions used for iterating over the
18// cell renderers and their allocated areas inside a `GtkCellArea`,
19// see gtk_cell_area_foreach_alloc().
20type CellAllocCallback func(uintptr, *gdk.Rectangle, *gdk.Rectangle, uintptr) bool
21
22// The type of the callback functions used for iterating over
23// the cell renderers of a `GtkCellArea`, see gtk_cell_area_foreach().
24type CellCallback func(uintptr, uintptr) bool
25
26type CellAreaClass struct {
27 _ structs.HostLayout
28
29 ParentClass gobject.InitiallyUnownedClass
30
31 xAdd uintptr
32
33 xRemove uintptr
34
35 xForeach uintptr
36
37 xForeachAlloc uintptr
38
39 xEvent uintptr
40
41 xSnapshot uintptr
42
43 xApplyAttributes uintptr
44
45 xCreateContext uintptr
46
47 xCopyContext uintptr
48
49 xGetRequestMode uintptr
50
51 xGetPreferredWidth uintptr
52
53 xGetPreferredHeightForWidth uintptr
54
55 xGetPreferredHeight uintptr
56
57 xGetPreferredWidthForHeight uintptr
58
59 xSetCellProperty uintptr
60
61 xGetCellProperty uintptr
62
63 xFocus uintptr
64
65 xIsActivatable uintptr
66
67 xActivate uintptr
68
69 Padding [8]uintptr
70}
71
72func (x *CellAreaClass) GoPointer() uintptr {
73 return uintptr(unsafe.Pointer(x))
74}
75
76var xCellAreaClassFindCellProperty func(uintptr, string) uintptr
77
78// Finds a cell property of a cell area class by name.
79func (x *CellAreaClass) FindCellProperty(PropertyNameVar string) *gobject.ParamSpec {
80 var cls *gobject.ParamSpec
81
82 cret := xCellAreaClassFindCellProperty(x.GoPointer(), PropertyNameVar)
83
84 if cret == 0 {
85 return nil
86 }
87 gobject.IncreaseRef(cret)
88 cls = &gobject.ParamSpec{}
89 cls.Ptr = cret
90 return cls
91}
92
93var xCellAreaClassInstallCellProperty func(uintptr, uint, uintptr)
94
95// Installs a cell property on a cell area class.
96func (x *CellAreaClass) InstallCellProperty(PropertyIdVar uint, PspecVar *gobject.ParamSpec) {
97
98 xCellAreaClassInstallCellProperty(x.GoPointer(), PropertyIdVar, PspecVar.GoPointer())
99
100}
101
102var xCellAreaClassListCellProperties func(uintptr, *uint) uintptr
103
104// Returns all cell properties of a cell area class.
105func (x *CellAreaClass) ListCellProperties(NPropertiesVar *uint) uintptr {
106
107 cret := xCellAreaClassListCellProperties(x.GoPointer(), NPropertiesVar)
108 return cret
109}
110
111// OverrideAdd sets the "add" callback function.
112// adds a `GtkCellRenderer` to the area.
113func (x *CellAreaClass) OverrideAdd(cb func(*CellArea, *CellRenderer)) {
114 if cb == nil {
115 x.xAdd = 0
116 } else {
117 x.xAdd = purego.NewCallback(func(AreaVarp uintptr, RendererVarp uintptr) {
118 cb(CellAreaNewFromInternalPtr(AreaVarp), CellRendererNewFromInternalPtr(RendererVarp))
119 })
120 }
121}
122
123// GetAdd gets the "add" callback function.
124// adds a `GtkCellRenderer` to the area.
125func (x *CellAreaClass) GetAdd() func(*CellArea, *CellRenderer) {
126 if x.xAdd == 0 {
127 return nil
128 }
129 var rawCallback func(AreaVarp uintptr, RendererVarp uintptr)
130 purego.RegisterFunc(&rawCallback, x.xAdd)
131 return func(AreaVar *CellArea, RendererVar *CellRenderer) {
132 rawCallback(AreaVar.GoPointer(), RendererVar.GoPointer())
133 }
134}
135
136// OverrideRemove sets the "remove" callback function.
137// removes a `GtkCellRenderer` from the area.
138func (x *CellAreaClass) OverrideRemove(cb func(*CellArea, *CellRenderer)) {
139 if cb == nil {
140 x.xRemove = 0
141 } else {
142 x.xRemove = purego.NewCallback(func(AreaVarp uintptr, RendererVarp uintptr) {
143 cb(CellAreaNewFromInternalPtr(AreaVarp), CellRendererNewFromInternalPtr(RendererVarp))
144 })
145 }
146}
147
148// GetRemove gets the "remove" callback function.
149// removes a `GtkCellRenderer` from the area.
150func (x *CellAreaClass) GetRemove() func(*CellArea, *CellRenderer) {
151 if x.xRemove == 0 {
152 return nil
153 }
154 var rawCallback func(AreaVarp uintptr, RendererVarp uintptr)
155 purego.RegisterFunc(&rawCallback, x.xRemove)
156 return func(AreaVar *CellArea, RendererVar *CellRenderer) {
157 rawCallback(AreaVar.GoPointer(), RendererVar.GoPointer())
158 }
159}
160
161// OverrideForeach sets the "foreach" callback function.
162// calls the `GtkCellCallback` function on every `GtkCellRenderer` in
163//
164// the area with the provided user data until the callback returns %TRUE.
165func (x *CellAreaClass) OverrideForeach(cb func(*CellArea, *CellCallback, uintptr)) {
166 if cb == nil {
167 x.xForeach = 0
168 } else {
169 x.xForeach = purego.NewCallback(func(AreaVarp uintptr, CallbackVarp uintptr, CallbackDataVarp uintptr) {
170 cb(CellAreaNewFromInternalPtr(AreaVarp), (*CellCallback)(unsafe.Pointer(CallbackVarp)), CallbackDataVarp)
171 })
172 }
173}
174
175// GetForeach gets the "foreach" callback function.
176// calls the `GtkCellCallback` function on every `GtkCellRenderer` in
177//
178// the area with the provided user data until the callback returns %TRUE.
179func (x *CellAreaClass) GetForeach() func(*CellArea, *CellCallback, uintptr) {
180 if x.xForeach == 0 {
181 return nil
182 }
183 var rawCallback func(AreaVarp uintptr, CallbackVarp uintptr, CallbackDataVarp uintptr)
184 purego.RegisterFunc(&rawCallback, x.xForeach)
185 return func(AreaVar *CellArea, CallbackVar *CellCallback, CallbackDataVar uintptr) {
186 rawCallback(AreaVar.GoPointer(), glib.NewCallback(CallbackVar), CallbackDataVar)
187 }
188}
189
190// OverrideForeachAlloc sets the "foreach_alloc" callback function.
191// Calls the `GtkCellAllocCallback` function on every
192//
193// `GtkCellRenderer` in the area with the allocated area for the cell
194// and the provided user data until the callback returns %TRUE.
195func (x *CellAreaClass) OverrideForeachAlloc(cb func(*CellArea, *CellAreaContext, *Widget, *gdk.Rectangle, *gdk.Rectangle, *CellAllocCallback, uintptr)) {
196 if cb == nil {
197 x.xForeachAlloc = 0
198 } else {
199 x.xForeachAlloc = purego.NewCallback(func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, CellAreaVarp *gdk.Rectangle, BackgroundAreaVarp *gdk.Rectangle, CallbackVarp uintptr, CallbackDataVarp uintptr) {
200 cb(CellAreaNewFromInternalPtr(AreaVarp), CellAreaContextNewFromInternalPtr(ContextVarp), WidgetNewFromInternalPtr(WidgetVarp), CellAreaVarp, BackgroundAreaVarp, (*CellAllocCallback)(unsafe.Pointer(CallbackVarp)), CallbackDataVarp)
201 })
202 }
203}
204
205// GetForeachAlloc gets the "foreach_alloc" callback function.
206// Calls the `GtkCellAllocCallback` function on every
207//
208// `GtkCellRenderer` in the area with the allocated area for the cell
209// and the provided user data until the callback returns %TRUE.
210func (x *CellAreaClass) GetForeachAlloc() func(*CellArea, *CellAreaContext, *Widget, *gdk.Rectangle, *gdk.Rectangle, *CellAllocCallback, uintptr) {
211 if x.xForeachAlloc == 0 {
212 return nil
213 }
214 var rawCallback func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, CellAreaVarp *gdk.Rectangle, BackgroundAreaVarp *gdk.Rectangle, CallbackVarp uintptr, CallbackDataVarp uintptr)
215 purego.RegisterFunc(&rawCallback, x.xForeachAlloc)
216 return func(AreaVar *CellArea, ContextVar *CellAreaContext, WidgetVar *Widget, CellAreaVar *gdk.Rectangle, BackgroundAreaVar *gdk.Rectangle, CallbackVar *CellAllocCallback, CallbackDataVar uintptr) {
217 rawCallback(AreaVar.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), CellAreaVar, BackgroundAreaVar, glib.NewCallback(CallbackVar), CallbackDataVar)
218 }
219}
220
221// OverrideEvent sets the "event" callback function.
222// Handle an event in the area, this is generally used to activate
223//
224// a cell at the event location for button events but can also be used
225// to generically pass events to `GtkWidget`s drawn onto the area.
226func (x *CellAreaClass) OverrideEvent(cb func(*CellArea, *CellAreaContext, *Widget, *gdk.Event, *gdk.Rectangle, CellRendererState) int) {
227 if cb == nil {
228 x.xEvent = 0
229 } else {
230 x.xEvent = purego.NewCallback(func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, EventVarp uintptr, CellAreaVarp *gdk.Rectangle, FlagsVarp CellRendererState) int {
231 return cb(CellAreaNewFromInternalPtr(AreaVarp), CellAreaContextNewFromInternalPtr(ContextVarp), WidgetNewFromInternalPtr(WidgetVarp), gdk.EventNewFromInternalPtr(EventVarp), CellAreaVarp, FlagsVarp)
232 })
233 }
234}
235
236// GetEvent gets the "event" callback function.
237// Handle an event in the area, this is generally used to activate
238//
239// a cell at the event location for button events but can also be used
240// to generically pass events to `GtkWidget`s drawn onto the area.
241func (x *CellAreaClass) GetEvent() func(*CellArea, *CellAreaContext, *Widget, *gdk.Event, *gdk.Rectangle, CellRendererState) int {
242 if x.xEvent == 0 {
243 return nil
244 }
245 var rawCallback func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, EventVarp uintptr, CellAreaVarp *gdk.Rectangle, FlagsVarp CellRendererState) int
246 purego.RegisterFunc(&rawCallback, x.xEvent)
247 return func(AreaVar *CellArea, ContextVar *CellAreaContext, WidgetVar *Widget, EventVar *gdk.Event, CellAreaVar *gdk.Rectangle, FlagsVar CellRendererState) int {
248 return rawCallback(AreaVar.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), EventVar.GoPointer(), CellAreaVar, FlagsVar)
249 }
250}
251
252// OverrideSnapshot sets the "snapshot" callback function.
253// Actually snapshot the area’s cells to the specified rectangle,
254//
255// @background_area should be correctly distributed to the cells
256// corresponding background areas.
257func (x *CellAreaClass) OverrideSnapshot(cb func(*CellArea, *CellAreaContext, *Widget, *Snapshot, *gdk.Rectangle, *gdk.Rectangle, CellRendererState, bool)) {
258 if cb == nil {
259 x.xSnapshot = 0
260 } else {
261 x.xSnapshot = purego.NewCallback(func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, SnapshotVarp uintptr, BackgroundAreaVarp *gdk.Rectangle, CellAreaVarp *gdk.Rectangle, FlagsVarp CellRendererState, PaintFocusVarp bool) {
262 cb(CellAreaNewFromInternalPtr(AreaVarp), CellAreaContextNewFromInternalPtr(ContextVarp), WidgetNewFromInternalPtr(WidgetVarp), SnapshotNewFromInternalPtr(SnapshotVarp), BackgroundAreaVarp, CellAreaVarp, FlagsVarp, PaintFocusVarp)
263 })
264 }
265}
266
267// GetSnapshot gets the "snapshot" callback function.
268// Actually snapshot the area’s cells to the specified rectangle,
269//
270// @background_area should be correctly distributed to the cells
271// corresponding background areas.
272func (x *CellAreaClass) GetSnapshot() func(*CellArea, *CellAreaContext, *Widget, *Snapshot, *gdk.Rectangle, *gdk.Rectangle, CellRendererState, bool) {
273 if x.xSnapshot == 0 {
274 return nil
275 }
276 var rawCallback func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, SnapshotVarp uintptr, BackgroundAreaVarp *gdk.Rectangle, CellAreaVarp *gdk.Rectangle, FlagsVarp CellRendererState, PaintFocusVarp bool)
277 purego.RegisterFunc(&rawCallback, x.xSnapshot)
278 return func(AreaVar *CellArea, ContextVar *CellAreaContext, WidgetVar *Widget, SnapshotVar *Snapshot, BackgroundAreaVar *gdk.Rectangle, CellAreaVar *gdk.Rectangle, FlagsVar CellRendererState, PaintFocusVar bool) {
279 rawCallback(AreaVar.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), SnapshotVar.GoPointer(), BackgroundAreaVar, CellAreaVar, FlagsVar, PaintFocusVar)
280 }
281}
282
283// OverrideApplyAttributes sets the "apply_attributes" callback function.
284// Apply the cell attributes to the cells. This is
285//
286// implemented as a signal and generally `GtkCellArea` subclasses don't
287// need to implement it since it is handled by the base class.
288func (x *CellAreaClass) OverrideApplyAttributes(cb func(*CellArea, TreeModel, *TreeIter, bool, bool)) {
289 if cb == nil {
290 x.xApplyAttributes = 0
291 } else {
292 x.xApplyAttributes = purego.NewCallback(func(AreaVarp uintptr, TreeModelVarp uintptr, IterVarp *TreeIter, IsExpanderVarp bool, IsExpandedVarp bool) {
293 cb(CellAreaNewFromInternalPtr(AreaVarp), &TreeModelBase{Ptr: TreeModelVarp}, IterVarp, IsExpanderVarp, IsExpandedVarp)
294 })
295 }
296}
297
298// GetApplyAttributes gets the "apply_attributes" callback function.
299// Apply the cell attributes to the cells. This is
300//
301// implemented as a signal and generally `GtkCellArea` subclasses don't
302// need to implement it since it is handled by the base class.
303func (x *CellAreaClass) GetApplyAttributes() func(*CellArea, TreeModel, *TreeIter, bool, bool) {
304 if x.xApplyAttributes == 0 {
305 return nil
306 }
307 var rawCallback func(AreaVarp uintptr, TreeModelVarp uintptr, IterVarp *TreeIter, IsExpanderVarp bool, IsExpandedVarp bool)
308 purego.RegisterFunc(&rawCallback, x.xApplyAttributes)
309 return func(AreaVar *CellArea, TreeModelVar TreeModel, IterVar *TreeIter, IsExpanderVar bool, IsExpandedVar bool) {
310 rawCallback(AreaVar.GoPointer(), TreeModelVar.GoPointer(), IterVar, IsExpanderVar, IsExpandedVar)
311 }
312}
313
314// OverrideCreateContext sets the "create_context" callback function.
315// Creates and returns a class specific `GtkCellAreaContext`
316//
317// to store cell alignment and allocation details for a said `GtkCellArea`
318// class.
319func (x *CellAreaClass) OverrideCreateContext(cb func(*CellArea) *CellAreaContext) {
320 if cb == nil {
321 x.xCreateContext = 0
322 } else {
323 x.xCreateContext = purego.NewCallback(func(AreaVarp uintptr) uintptr {
324 ret := cb(CellAreaNewFromInternalPtr(AreaVarp))
325 if ret == nil {
326 return 0
327 }
328 return ret.GoPointer()
329 })
330 }
331}
332
333// GetCreateContext gets the "create_context" callback function.
334// Creates and returns a class specific `GtkCellAreaContext`
335//
336// to store cell alignment and allocation details for a said `GtkCellArea`
337// class.
338func (x *CellAreaClass) GetCreateContext() func(*CellArea) *CellAreaContext {
339 if x.xCreateContext == 0 {
340 return nil
341 }
342 var rawCallback func(AreaVarp uintptr) uintptr
343 purego.RegisterFunc(&rawCallback, x.xCreateContext)
344 return func(AreaVar *CellArea) *CellAreaContext {
345 rawRet := rawCallback(AreaVar.GoPointer())
346 if rawRet == 0 {
347 return nil
348 }
349 ret := &CellAreaContext{}
350 ret.Ptr = rawRet
351 return ret
352 }
353}
354
355// OverrideCopyContext sets the "copy_context" callback function.
356// Creates a new `GtkCellAreaContext` in the same state as
357//
358// the passed @context with any cell alignment data and allocations intact.
359func (x *CellAreaClass) OverrideCopyContext(cb func(*CellArea, *CellAreaContext) *CellAreaContext) {
360 if cb == nil {
361 x.xCopyContext = 0
362 } else {
363 x.xCopyContext = purego.NewCallback(func(AreaVarp uintptr, ContextVarp uintptr) uintptr {
364 ret := cb(CellAreaNewFromInternalPtr(AreaVarp), CellAreaContextNewFromInternalPtr(ContextVarp))
365 if ret == nil {
366 return 0
367 }
368 return ret.GoPointer()
369 })
370 }
371}
372
373// GetCopyContext gets the "copy_context" callback function.
374// Creates a new `GtkCellAreaContext` in the same state as
375//
376// the passed @context with any cell alignment data and allocations intact.
377func (x *CellAreaClass) GetCopyContext() func(*CellArea, *CellAreaContext) *CellAreaContext {
378 if x.xCopyContext == 0 {
379 return nil
380 }
381 var rawCallback func(AreaVarp uintptr, ContextVarp uintptr) uintptr
382 purego.RegisterFunc(&rawCallback, x.xCopyContext)
383 return func(AreaVar *CellArea, ContextVar *CellAreaContext) *CellAreaContext {
384 rawRet := rawCallback(AreaVar.GoPointer(), ContextVar.GoPointer())
385 if rawRet == 0 {
386 return nil
387 }
388 ret := &CellAreaContext{}
389 ret.Ptr = rawRet
390 return ret
391 }
392}
393
394// OverrideGetRequestMode sets the "get_request_mode" callback function.
395// This allows an area to tell its layouting widget whether
396//
397// it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
398// %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
399func (x *CellAreaClass) OverrideGetRequestMode(cb func(*CellArea) SizeRequestMode) {
400 if cb == nil {
401 x.xGetRequestMode = 0
402 } else {
403 x.xGetRequestMode = purego.NewCallback(func(AreaVarp uintptr) SizeRequestMode {
404 return cb(CellAreaNewFromInternalPtr(AreaVarp))
405 })
406 }
407}
408
409// GetGetRequestMode gets the "get_request_mode" callback function.
410// This allows an area to tell its layouting widget whether
411//
412// it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
413// %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
414func (x *CellAreaClass) GetGetRequestMode() func(*CellArea) SizeRequestMode {
415 if x.xGetRequestMode == 0 {
416 return nil
417 }
418 var rawCallback func(AreaVarp uintptr) SizeRequestMode
419 purego.RegisterFunc(&rawCallback, x.xGetRequestMode)
420 return func(AreaVar *CellArea) SizeRequestMode {
421 return rawCallback(AreaVar.GoPointer())
422 }
423}
424
425// OverrideGetPreferredWidth sets the "get_preferred_width" callback function.
426// Calculates the minimum and natural width of the
427//
428// areas cells with the current attributes applied while considering
429// the particular layouting details of the said `GtkCellArea`. While
430// requests are performed over a series of rows, alignments and overall
431// minimum and natural sizes should be stored in the corresponding
432// `GtkCellAreaContext`.
433func (x *CellAreaClass) OverrideGetPreferredWidth(cb func(*CellArea, *CellAreaContext, *Widget, *int, *int)) {
434 if cb == nil {
435 x.xGetPreferredWidth = 0
436 } else {
437 x.xGetPreferredWidth = purego.NewCallback(func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, MinimumWidthVarp *int, NaturalWidthVarp *int) {
438 cb(CellAreaNewFromInternalPtr(AreaVarp), CellAreaContextNewFromInternalPtr(ContextVarp), WidgetNewFromInternalPtr(WidgetVarp), MinimumWidthVarp, NaturalWidthVarp)
439 })
440 }
441}
442
443// GetGetPreferredWidth gets the "get_preferred_width" callback function.
444// Calculates the minimum and natural width of the
445//
446// areas cells with the current attributes applied while considering
447// the particular layouting details of the said `GtkCellArea`. While
448// requests are performed over a series of rows, alignments and overall
449// minimum and natural sizes should be stored in the corresponding
450// `GtkCellAreaContext`.
451func (x *CellAreaClass) GetGetPreferredWidth() func(*CellArea, *CellAreaContext, *Widget, *int, *int) {
452 if x.xGetPreferredWidth == 0 {
453 return nil
454 }
455 var rawCallback func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, MinimumWidthVarp *int, NaturalWidthVarp *int)
456 purego.RegisterFunc(&rawCallback, x.xGetPreferredWidth)
457 return func(AreaVar *CellArea, ContextVar *CellAreaContext, WidgetVar *Widget, MinimumWidthVar *int, NaturalWidthVar *int) {
458 rawCallback(AreaVar.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), MinimumWidthVar, NaturalWidthVar)
459 }
460}
461
462// OverrideGetPreferredHeightForWidth sets the "get_preferred_height_for_width" callback function.
463// Calculates the minimum and natural height
464//
465// for the area if the passed @context would be allocated the given width.
466// When implementing this virtual method it is safe to assume that @context
467// has already stored the aligned cell widths for every `GtkTreeModel` row
468// that @context will be allocated for since this information was stored
469// at `GtkCellAreaClass.get_preferred_width()` time. This virtual method
470// should also store any necessary alignments of cell heights for the
471// case that the context is allocated a height.
472func (x *CellAreaClass) OverrideGetPreferredHeightForWidth(cb func(*CellArea, *CellAreaContext, *Widget, int, *int, *int)) {
473 if cb == nil {
474 x.xGetPreferredHeightForWidth = 0
475 } else {
476 x.xGetPreferredHeightForWidth = purego.NewCallback(func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, WidthVarp int, MinimumHeightVarp *int, NaturalHeightVarp *int) {
477 cb(CellAreaNewFromInternalPtr(AreaVarp), CellAreaContextNewFromInternalPtr(ContextVarp), WidgetNewFromInternalPtr(WidgetVarp), WidthVarp, MinimumHeightVarp, NaturalHeightVarp)
478 })
479 }
480}
481
482// GetGetPreferredHeightForWidth gets the "get_preferred_height_for_width" callback function.
483// Calculates the minimum and natural height
484//
485// for the area if the passed @context would be allocated the given width.
486// When implementing this virtual method it is safe to assume that @context
487// has already stored the aligned cell widths for every `GtkTreeModel` row
488// that @context will be allocated for since this information was stored
489// at `GtkCellAreaClass.get_preferred_width()` time. This virtual method
490// should also store any necessary alignments of cell heights for the
491// case that the context is allocated a height.
492func (x *CellAreaClass) GetGetPreferredHeightForWidth() func(*CellArea, *CellAreaContext, *Widget, int, *int, *int) {
493 if x.xGetPreferredHeightForWidth == 0 {
494 return nil
495 }
496 var rawCallback func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, WidthVarp int, MinimumHeightVarp *int, NaturalHeightVarp *int)
497 purego.RegisterFunc(&rawCallback, x.xGetPreferredHeightForWidth)
498 return func(AreaVar *CellArea, ContextVar *CellAreaContext, WidgetVar *Widget, WidthVar int, MinimumHeightVar *int, NaturalHeightVar *int) {
499 rawCallback(AreaVar.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), WidthVar, MinimumHeightVar, NaturalHeightVar)
500 }
501}
502
503// OverrideGetPreferredHeight sets the "get_preferred_height" callback function.
504// Calculates the minimum and natural height of the
505//
506// areas cells with the current attributes applied. Essentially this is
507// the same as `GtkCellAreaClass.get_preferred_width()` only for areas
508// that are being requested as %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT.
509func (x *CellAreaClass) OverrideGetPreferredHeight(cb func(*CellArea, *CellAreaContext, *Widget, *int, *int)) {
510 if cb == nil {
511 x.xGetPreferredHeight = 0
512 } else {
513 x.xGetPreferredHeight = purego.NewCallback(func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, MinimumHeightVarp *int, NaturalHeightVarp *int) {
514 cb(CellAreaNewFromInternalPtr(AreaVarp), CellAreaContextNewFromInternalPtr(ContextVarp), WidgetNewFromInternalPtr(WidgetVarp), MinimumHeightVarp, NaturalHeightVarp)
515 })
516 }
517}
518
519// GetGetPreferredHeight gets the "get_preferred_height" callback function.
520// Calculates the minimum and natural height of the
521//
522// areas cells with the current attributes applied. Essentially this is
523// the same as `GtkCellAreaClass.get_preferred_width()` only for areas
524// that are being requested as %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT.
525func (x *CellAreaClass) GetGetPreferredHeight() func(*CellArea, *CellAreaContext, *Widget, *int, *int) {
526 if x.xGetPreferredHeight == 0 {
527 return nil
528 }
529 var rawCallback func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, MinimumHeightVarp *int, NaturalHeightVarp *int)
530 purego.RegisterFunc(&rawCallback, x.xGetPreferredHeight)
531 return func(AreaVar *CellArea, ContextVar *CellAreaContext, WidgetVar *Widget, MinimumHeightVar *int, NaturalHeightVar *int) {
532 rawCallback(AreaVar.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), MinimumHeightVar, NaturalHeightVar)
533 }
534}
535
536// OverrideGetPreferredWidthForHeight sets the "get_preferred_width_for_height" callback function.
537// Calculates the minimum and natural width
538//
539// for the area if the passed @context would be allocated the given
540// height. The same as `GtkCellAreaClass.get_preferred_height_for_width()`
541// only for handling requests in the %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT
542// mode.
543func (x *CellAreaClass) OverrideGetPreferredWidthForHeight(cb func(*CellArea, *CellAreaContext, *Widget, int, *int, *int)) {
544 if cb == nil {
545 x.xGetPreferredWidthForHeight = 0
546 } else {
547 x.xGetPreferredWidthForHeight = purego.NewCallback(func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, HeightVarp int, MinimumWidthVarp *int, NaturalWidthVarp *int) {
548 cb(CellAreaNewFromInternalPtr(AreaVarp), CellAreaContextNewFromInternalPtr(ContextVarp), WidgetNewFromInternalPtr(WidgetVarp), HeightVarp, MinimumWidthVarp, NaturalWidthVarp)
549 })
550 }
551}
552
553// GetGetPreferredWidthForHeight gets the "get_preferred_width_for_height" callback function.
554// Calculates the minimum and natural width
555//
556// for the area if the passed @context would be allocated the given
557// height. The same as `GtkCellAreaClass.get_preferred_height_for_width()`
558// only for handling requests in the %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT
559// mode.
560func (x *CellAreaClass) GetGetPreferredWidthForHeight() func(*CellArea, *CellAreaContext, *Widget, int, *int, *int) {
561 if x.xGetPreferredWidthForHeight == 0 {
562 return nil
563 }
564 var rawCallback func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, HeightVarp int, MinimumWidthVarp *int, NaturalWidthVarp *int)
565 purego.RegisterFunc(&rawCallback, x.xGetPreferredWidthForHeight)
566 return func(AreaVar *CellArea, ContextVar *CellAreaContext, WidgetVar *Widget, HeightVar int, MinimumWidthVar *int, NaturalWidthVar *int) {
567 rawCallback(AreaVar.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), HeightVar, MinimumWidthVar, NaturalWidthVar)
568 }
569}
570
571// OverrideSetCellProperty sets the "set_cell_property" callback function.
572// This should be implemented to handle changes in child
573//
574// cell properties for a given `GtkCellRenderer` that were previously
575// installed on the `GtkCellAreaClass` with gtk_cell_area_class_install_cell_property().
576func (x *CellAreaClass) OverrideSetCellProperty(cb func(*CellArea, *CellRenderer, uint, *gobject.Value, *gobject.ParamSpec)) {
577 if cb == nil {
578 x.xSetCellProperty = 0
579 } else {
580 x.xSetCellProperty = purego.NewCallback(func(AreaVarp uintptr, RendererVarp uintptr, PropertyIdVarp uint, ValueVarp *gobject.Value, PspecVarp uintptr) {
581 cb(CellAreaNewFromInternalPtr(AreaVarp), CellRendererNewFromInternalPtr(RendererVarp), PropertyIdVarp, ValueVarp, gobject.ParamSpecNewFromInternalPtr(PspecVarp))
582 })
583 }
584}
585
586// GetSetCellProperty gets the "set_cell_property" callback function.
587// This should be implemented to handle changes in child
588//
589// cell properties for a given `GtkCellRenderer` that were previously
590// installed on the `GtkCellAreaClass` with gtk_cell_area_class_install_cell_property().
591func (x *CellAreaClass) GetSetCellProperty() func(*CellArea, *CellRenderer, uint, *gobject.Value, *gobject.ParamSpec) {
592 if x.xSetCellProperty == 0 {
593 return nil
594 }
595 var rawCallback func(AreaVarp uintptr, RendererVarp uintptr, PropertyIdVarp uint, ValueVarp *gobject.Value, PspecVarp uintptr)
596 purego.RegisterFunc(&rawCallback, x.xSetCellProperty)
597 return func(AreaVar *CellArea, RendererVar *CellRenderer, PropertyIdVar uint, ValueVar *gobject.Value, PspecVar *gobject.ParamSpec) {
598 rawCallback(AreaVar.GoPointer(), RendererVar.GoPointer(), PropertyIdVar, ValueVar, PspecVar.GoPointer())
599 }
600}
601
602// OverrideGetCellProperty sets the "get_cell_property" callback function.
603// This should be implemented to report the values of
604//
605// child cell properties for a given child `GtkCellRenderer`.
606func (x *CellAreaClass) OverrideGetCellProperty(cb func(*CellArea, *CellRenderer, uint, *gobject.Value, *gobject.ParamSpec)) {
607 if cb == nil {
608 x.xGetCellProperty = 0
609 } else {
610 x.xGetCellProperty = purego.NewCallback(func(AreaVarp uintptr, RendererVarp uintptr, PropertyIdVarp uint, ValueVarp *gobject.Value, PspecVarp uintptr) {
611 cb(CellAreaNewFromInternalPtr(AreaVarp), CellRendererNewFromInternalPtr(RendererVarp), PropertyIdVarp, ValueVarp, gobject.ParamSpecNewFromInternalPtr(PspecVarp))
612 })
613 }
614}
615
616// GetGetCellProperty gets the "get_cell_property" callback function.
617// This should be implemented to report the values of
618//
619// child cell properties for a given child `GtkCellRenderer`.
620func (x *CellAreaClass) GetGetCellProperty() func(*CellArea, *CellRenderer, uint, *gobject.Value, *gobject.ParamSpec) {
621 if x.xGetCellProperty == 0 {
622 return nil
623 }
624 var rawCallback func(AreaVarp uintptr, RendererVarp uintptr, PropertyIdVarp uint, ValueVarp *gobject.Value, PspecVarp uintptr)
625 purego.RegisterFunc(&rawCallback, x.xGetCellProperty)
626 return func(AreaVar *CellArea, RendererVar *CellRenderer, PropertyIdVar uint, ValueVar *gobject.Value, PspecVar *gobject.ParamSpec) {
627 rawCallback(AreaVar.GoPointer(), RendererVar.GoPointer(), PropertyIdVar, ValueVar, PspecVar.GoPointer())
628 }
629}
630
631// OverrideFocus sets the "focus" callback function.
632// This virtual method should be implemented to navigate focus from
633//
634// cell to cell inside the `GtkCellArea`. The `GtkCellArea` should move
635// focus from cell to cell inside the area and return %FALSE if focus
636// logically leaves the area with the following exceptions: When the
637// area contains no activatable cells, the entire area receives focus.
638// Focus should not be given to cells that are actually “focus siblings”
639// of other sibling cells (see gtk_cell_area_get_focus_from_sibling()).
640// Focus is set by calling gtk_cell_area_set_focus_cell().
641func (x *CellAreaClass) OverrideFocus(cb func(*CellArea, DirectionType) bool) {
642 if cb == nil {
643 x.xFocus = 0
644 } else {
645 x.xFocus = purego.NewCallback(func(AreaVarp uintptr, DirectionVarp DirectionType) bool {
646 return cb(CellAreaNewFromInternalPtr(AreaVarp), DirectionVarp)
647 })
648 }
649}
650
651// GetFocus gets the "focus" callback function.
652// This virtual method should be implemented to navigate focus from
653//
654// cell to cell inside the `GtkCellArea`. The `GtkCellArea` should move
655// focus from cell to cell inside the area and return %FALSE if focus
656// logically leaves the area with the following exceptions: When the
657// area contains no activatable cells, the entire area receives focus.
658// Focus should not be given to cells that are actually “focus siblings”
659// of other sibling cells (see gtk_cell_area_get_focus_from_sibling()).
660// Focus is set by calling gtk_cell_area_set_focus_cell().
661func (x *CellAreaClass) GetFocus() func(*CellArea, DirectionType) bool {
662 if x.xFocus == 0 {
663 return nil
664 }
665 var rawCallback func(AreaVarp uintptr, DirectionVarp DirectionType) bool
666 purego.RegisterFunc(&rawCallback, x.xFocus)
667 return func(AreaVar *CellArea, DirectionVar DirectionType) bool {
668 return rawCallback(AreaVar.GoPointer(), DirectionVar)
669 }
670}
671
672// OverrideIsActivatable sets the "is_activatable" callback function.
673// Returns whether the `GtkCellArea` can respond to
674//
675// `GtkCellAreaClass.activate()`, usually this does not need to be
676// implemented since the base class takes care of this however it can
677// be enhanced if the `GtkCellArea` subclass can handle activation in
678// other ways than activating its `GtkCellRenderers`.
679func (x *CellAreaClass) OverrideIsActivatable(cb func(*CellArea) bool) {
680 if cb == nil {
681 x.xIsActivatable = 0
682 } else {
683 x.xIsActivatable = purego.NewCallback(func(AreaVarp uintptr) bool {
684 return cb(CellAreaNewFromInternalPtr(AreaVarp))
685 })
686 }
687}
688
689// GetIsActivatable gets the "is_activatable" callback function.
690// Returns whether the `GtkCellArea` can respond to
691//
692// `GtkCellAreaClass.activate()`, usually this does not need to be
693// implemented since the base class takes care of this however it can
694// be enhanced if the `GtkCellArea` subclass can handle activation in
695// other ways than activating its `GtkCellRenderers`.
696func (x *CellAreaClass) GetIsActivatable() func(*CellArea) bool {
697 if x.xIsActivatable == 0 {
698 return nil
699 }
700 var rawCallback func(AreaVarp uintptr) bool
701 purego.RegisterFunc(&rawCallback, x.xIsActivatable)
702 return func(AreaVar *CellArea) bool {
703 return rawCallback(AreaVar.GoPointer())
704 }
705}
706
707// OverrideActivate sets the "activate" callback function.
708// This is called when the layouting widget rendering the
709//
710// `GtkCellArea` activates the focus cell (see gtk_cell_area_get_focus_cell()).
711func (x *CellAreaClass) OverrideActivate(cb func(*CellArea, *CellAreaContext, *Widget, *gdk.Rectangle, CellRendererState, bool) bool) {
712 if cb == nil {
713 x.xActivate = 0
714 } else {
715 x.xActivate = purego.NewCallback(func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, CellAreaVarp *gdk.Rectangle, FlagsVarp CellRendererState, EditOnlyVarp bool) bool {
716 return cb(CellAreaNewFromInternalPtr(AreaVarp), CellAreaContextNewFromInternalPtr(ContextVarp), WidgetNewFromInternalPtr(WidgetVarp), CellAreaVarp, FlagsVarp, EditOnlyVarp)
717 })
718 }
719}
720
721// GetActivate gets the "activate" callback function.
722// This is called when the layouting widget rendering the
723//
724// `GtkCellArea` activates the focus cell (see gtk_cell_area_get_focus_cell()).
725func (x *CellAreaClass) GetActivate() func(*CellArea, *CellAreaContext, *Widget, *gdk.Rectangle, CellRendererState, bool) bool {
726 if x.xActivate == 0 {
727 return nil
728 }
729 var rawCallback func(AreaVarp uintptr, ContextVarp uintptr, WidgetVarp uintptr, CellAreaVarp *gdk.Rectangle, FlagsVarp CellRendererState, EditOnlyVarp bool) bool
730 purego.RegisterFunc(&rawCallback, x.xActivate)
731 return func(AreaVar *CellArea, ContextVar *CellAreaContext, WidgetVar *Widget, CellAreaVar *gdk.Rectangle, FlagsVar CellRendererState, EditOnlyVar bool) bool {
732 return rawCallback(AreaVar.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), CellAreaVar, FlagsVar, EditOnlyVar)
733 }
734}
735
736// An abstract class for laying out `GtkCellRenderer`s
737//
738// The `GtkCellArea` is an abstract class for [iface@Gtk.CellLayout]
739// widgets (also referred to as "layouting widgets") to interface with
740// an arbitrary number of [class@Gtk.CellRenderer]s and interact with the user
741// for a given [iface@Gtk.TreeModel] row.
742//
743// The cell area handles events, focus navigation, drawing and
744// size requests and allocations for a given row of data.
745//
746// Usually users dont have to interact with the `GtkCellArea` directly
747// unless they are implementing a cell-layouting widget themselves.
748//
749// ## Requesting area sizes
750//
751// As outlined in
752// [GtkWidget’s geometry management section](class.Widget.html#height-for-width-geometry-management),
753// GTK uses a height-for-width
754// geometry management system to compute the sizes of widgets and user
755// interfaces. `GtkCellArea` uses the same semantics to calculate the
756// size of an area for an arbitrary number of `GtkTreeModel` rows.
757//
758// When requesting the size of a cell area one needs to calculate
759// the size for a handful of rows, and this will be done differently by
760// different layouting widgets. For instance a [class@Gtk.TreeViewColumn]
761// always lines up the areas from top to bottom while a [class@Gtk.IconView]
762// on the other hand might enforce that all areas received the same
763// width and wrap the areas around, requesting height for more cell
764// areas when allocated less width.
765//
766// It’s also important for areas to maintain some cell
767// alignments with areas rendered for adjacent rows (cells can
768// appear “columnized” inside an area even when the size of
769// cells are different in each row). For this reason the `GtkCellArea`
770// uses a [class@Gtk.CellAreaContext] object to store the alignments
771// and sizes along the way (as well as the overall largest minimum
772// and natural size for all the rows which have been calculated
773// with the said context).
774//
775// The [class@Gtk.CellAreaContext] is an opaque object specific to the
776// `GtkCellArea` which created it (see [method@Gtk.CellArea.create_context]).
777//
778// The owning cell-layouting widget can create as many contexts as
779// it wishes to calculate sizes of rows which should receive the
780// same size in at least one orientation (horizontally or vertically),
781// However, it’s important that the same [class@Gtk.CellAreaContext] which
782// was used to request the sizes for a given `GtkTreeModel` row be
783// used when rendering or processing events for that row.
784//
785// In order to request the width of all the rows at the root level
786// of a `GtkTreeModel` one would do the following:
787//
788// ```c
789// GtkTreeIter iter;
790// int minimum_width;
791// int natural_width;
792//
793// valid = gtk_tree_model_get_iter_first (model, &iter);
794// while (valid)
795//
796// {
797// gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
798// gtk_cell_area_get_preferred_width (area, context, widget, NULL, NULL);
799//
800// valid = gtk_tree_model_iter_next (model, &iter);
801// }
802//
803// gtk_cell_area_context_get_preferred_width (context, &minimum_width, &natural_width);
804// ```
805//
806// Note that in this example it’s not important to observe the
807// returned minimum and natural width of the area for each row
808// unless the cell-layouting object is actually interested in the
809// widths of individual rows. The overall width is however stored
810// in the accompanying `GtkCellAreaContext` object and can be consulted
811// at any time.
812//
813// This can be useful since `GtkCellLayout` widgets usually have to
814// support requesting and rendering rows in treemodels with an
815// exceedingly large amount of rows. The `GtkCellLayout` widget in
816// that case would calculate the required width of the rows in an
817// idle or timeout source (see [func@GLib.timeout_add]) and when the widget
818// is requested its actual width in [vfunc@Gtk.Widget.measure]
819// it can simply consult the width accumulated so far in the
820// `GtkCellAreaContext` object.
821//
822// A simple example where rows are rendered from top to bottom and
823// take up the full width of the layouting widget would look like:
824//
825// ```c
826// static void
827// foo_get_preferred_width (GtkWidget *widget,
828//
829// int *minimum_size,
830// int *natural_size)
831//
832// {
833// Foo *self = FOO (widget);
834// FooPrivate *priv = foo_get_instance_private (self);
835//
836// foo_ensure_at_least_one_handfull_of_rows_have_been_requested (self);
837//
838// gtk_cell_area_context_get_preferred_width (priv->context, minimum_size, natural_size);
839// }
840//
841// ```
842//
843// In the above example the `Foo` widget has to make sure that some
844// row sizes have been calculated (the amount of rows that `Foo` judged
845// was appropriate to request space for in a single timeout iteration)
846// before simply returning the amount of space required by the area via
847// the `GtkCellAreaContext`.
848//
849// Requesting the height for width (or width for height) of an area is
850// a similar task except in this case the `GtkCellAreaContext` does not
851// store the data (actually, it does not know how much space the layouting
852// widget plans to allocate it for every row. It’s up to the layouting
853// widget to render each row of data with the appropriate height and
854// width which was requested by the `GtkCellArea`).
855//
856// In order to request the height for width of all the rows at the
857// root level of a `GtkTreeModel` one would do the following:
858//
859// ```c
860// GtkTreeIter iter;
861// int minimum_height;
862// int natural_height;
863// int full_minimum_height = 0;
864// int full_natural_height = 0;
865//
866// valid = gtk_tree_model_get_iter_first (model, &iter);
867// while (valid)
868//
869// {
870// gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
871// gtk_cell_area_get_preferred_height_for_width (area, context, widget,
872// width, &minimum_height, &natural_height);
873//
874// if (width_is_for_allocation)
875// cache_row_height (&iter, minimum_height, natural_height);
876//
877// full_minimum_height += minimum_height;
878// full_natural_height += natural_height;
879//
880// valid = gtk_tree_model_iter_next (model, &iter);
881// }
882//
883// ```
884//
885// Note that in the above example we would need to cache the heights
886// returned for each row so that we would know what sizes to render the
887// areas for each row. However we would only want to really cache the
888// heights if the request is intended for the layouting widgets real
889// allocation.
890//
891// In some cases the layouting widget is requested the height for an
892// arbitrary for_width, this is a special case for layouting widgets
893// who need to request size for tens of thousands of rows. For this
894// case it’s only important that the layouting widget calculate
895// one reasonably sized chunk of rows and return that height
896// synchronously. The reasoning here is that any layouting widget is
897// at least capable of synchronously calculating enough height to fill
898// the screen height (or scrolled window height) in response to a single
899// call to [vfunc@Gtk.Widget.measure]. Returning
900// a perfect height for width that is larger than the screen area is
901// inconsequential since after the layouting receives an allocation
902// from a scrolled window it simply continues to drive the scrollbar
903// values while more and more height is required for the row heights
904// that are calculated in the background.
905//
906// ## Rendering Areas
907//
908// Once area sizes have been acquired at least for the rows in the
909// visible area of the layouting widget they can be rendered at
910// [vfunc@Gtk.Widget.snapshot] time.
911//
912// A crude example of how to render all the rows at the root level
913// runs as follows:
914//
915// ```c
916// GtkAllocation allocation;
917// GdkRectangle cell_area = { 0, };
918// GtkTreeIter iter;
919// int minimum_width;
920// int natural_width;
921//
922// gtk_widget_get_allocation (widget, &allocation);
923// cell_area.width = allocation.width;
924//
925// valid = gtk_tree_model_get_iter_first (model, &iter);
926// while (valid)
927//
928// {
929// cell_area.height = get_cached_height_for_row (&iter);
930//
931// gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
932// gtk_cell_area_render (area, context, widget, cr,
933// &cell_area, &cell_area, state_flags, FALSE);
934//
935// cell_area.y += cell_area.height;
936//
937// valid = gtk_tree_model_iter_next (model, &iter);
938// }
939//
940// ```
941//
942// Note that the cached height in this example really depends on how
943// the layouting widget works. The layouting widget might decide to
944// give every row its minimum or natural height or, if the model content
945// is expected to fit inside the layouting widget without scrolling, it
946// would make sense to calculate the allocation for each row at
947// the time the widget is allocated using [func@Gtk.distribute_natural_allocation].
948//
949// ## Handling Events and Driving Keyboard Focus
950//
951// Passing events to the area is as simple as handling events on any
952// normal widget and then passing them to the [method@Gtk.CellArea.event]
953// API as they come in. Usually `GtkCellArea` is only interested in
954// button events, however some customized derived areas can be implemented
955// who are interested in handling other events. Handling an event can
956// trigger the [signal@Gtk.CellArea::focus-changed] signal to fire; as well
957// as [signal@Gtk.CellArea::add-editable] in the case that an editable cell
958// was clicked and needs to start editing. You can call
959// [method@Gtk.CellArea.stop_editing] at any time to cancel any cell editing
960// that is currently in progress.
961//
962// The `GtkCellArea` drives keyboard focus from cell to cell in a way
963// similar to `GtkWidget`. For layouting widgets that support giving
964// focus to cells it’s important to remember to pass `GTK_CELL_RENDERER_FOCUSED`
965// to the area functions for the row that has focus and to tell the
966// area to paint the focus at render time.
967//
968// Layouting widgets that accept focus on cells should implement the
969// [vfunc@Gtk.Widget.focus] virtual method. The layouting widget is always
970// responsible for knowing where `GtkTreeModel` rows are rendered inside
971// the widget, so at [vfunc@Gtk.Widget.focus] time the layouting widget
972// should use the `GtkCellArea` methods to navigate focus inside the area
973// and then observe the [enum@Gtk.DirectionType] to pass the focus to adjacent
974// rows and areas.
975//
976// A basic example of how the [vfunc@Gtk.Widget.focus] virtual method
977// should be implemented:
978//
979// ```
980// static gboolean
981// foo_focus (GtkWidget *widget,
982//
983// GtkDirectionType direction)
984//
985// {
986// Foo *self = FOO (widget);
987// FooPrivate *priv = foo_get_instance_private (self);
988// int focus_row = priv->focus_row;
989// gboolean have_focus = FALSE;
990//
991// if (!gtk_widget_has_focus (widget))
992// gtk_widget_grab_focus (widget);
993//
994// valid = gtk_tree_model_iter_nth_child (priv->model, &iter, NULL, priv->focus_row);
995// while (valid)
996// {
997// gtk_cell_area_apply_attributes (priv->area, priv->model, &iter, FALSE, FALSE);
998//
999// if (gtk_cell_area_focus (priv->area, direction))
1000// {
1001// priv->focus_row = focus_row;
1002// have_focus = TRUE;
1003// break;
1004// }
1005// else
1006// {
1007// if (direction == GTK_DIR_RIGHT ||
1008// direction == GTK_DIR_LEFT)
1009// break;
1010// else if (direction == GTK_DIR_UP ||
1011// direction == GTK_DIR_TAB_BACKWARD)
1012// {
1013// if (focus_row == 0)
1014// break;
1015// else
1016// {
1017// focus_row--;
1018// valid = gtk_tree_model_iter_nth_child (priv->model, &iter, NULL, focus_row);
1019// }
1020// }
1021// else
1022// {
1023// if (focus_row == last_row)
1024// break;
1025// else
1026// {
1027// focus_row++;
1028// valid = gtk_tree_model_iter_next (priv->model, &iter);
1029// }
1030// }
1031// }
1032// }
1033// return have_focus;
1034// }
1035//
1036// ```
1037//
1038// Note that the layouting widget is responsible for matching the
1039// `GtkDirectionType` values to the way it lays out its cells.
1040//
1041// ## Cell Properties
1042//
1043// The `GtkCellArea` introduces cell properties for `GtkCellRenderer`s.
1044// This provides some general interfaces for defining the relationship
1045// cell areas have with their cells. For instance in a [class@Gtk.CellAreaBox]
1046// a cell might “expand” and receive extra space when the area is allocated
1047// more than its full natural request, or a cell might be configured to “align”
1048// with adjacent rows which were requested and rendered with the same
1049// `GtkCellAreaContext`.
1050//
1051// Use [method@Gtk.CellAreaClass.install_cell_property] to install cell
1052// properties for a cell area class and [method@Gtk.CellAreaClass.find_cell_property]
1053// or [method@Gtk.CellAreaClass.list_cell_properties] to get information about
1054// existing cell properties.
1055//
1056// To set the value of a cell property, use [method@Gtk.CellArea.cell_set_property],
1057// [method@Gtk.CellArea.cell_set] or [method@Gtk.CellArea.cell_set_valist]. To obtain
1058// the value of a cell property, use [method@Gtk.CellArea.cell_get_property]
1059// [method@Gtk.CellArea.cell_get] or [method@Gtk.CellArea.cell_get_valist].
1060type CellArea struct {
1061 gobject.InitiallyUnowned
1062}
1063
1064var xCellAreaGLibType func() types.GType
1065
1066func CellAreaGLibType() types.GType {
1067 return xCellAreaGLibType()
1068}
1069
1070func CellAreaNewFromInternalPtr(ptr uintptr) *CellArea {
1071 cls := &CellArea{}
1072 cls.Ptr = ptr
1073 return cls
1074}
1075
1076var xCellAreaActivate func(uintptr, uintptr, uintptr, *gdk.Rectangle, CellRendererState, bool) bool
1077
1078// Activates @area, usually by activating the currently focused
1079// cell, however some subclasses which embed widgets in the area
1080// can also activate a widget if it currently has the focus.
1081func (x *CellArea) Activate(ContextVar *CellAreaContext, WidgetVar *Widget, CellAreaVar *gdk.Rectangle, FlagsVar CellRendererState, EditOnlyVar bool) bool {
1082
1083 cret := xCellAreaActivate(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), CellAreaVar, FlagsVar, EditOnlyVar)
1084 return cret
1085}
1086
1087var xCellAreaActivateCell func(uintptr, uintptr, uintptr, uintptr, *gdk.Rectangle, CellRendererState) bool
1088
1089// This is used by `GtkCellArea` subclasses when handling events
1090// to activate cells, the base `GtkCellArea` class activates cells
1091// for keyboard events for free in its own GtkCellArea->activate()
1092// implementation.
1093func (x *CellArea) ActivateCell(WidgetVar *Widget, RendererVar *CellRenderer, EventVar *gdk.Event, CellAreaVar *gdk.Rectangle, FlagsVar CellRendererState) bool {
1094
1095 cret := xCellAreaActivateCell(x.GoPointer(), WidgetVar.GoPointer(), RendererVar.GoPointer(), EventVar.GoPointer(), CellAreaVar, FlagsVar)
1096 return cret
1097}
1098
1099var xCellAreaAdd func(uintptr, uintptr)
1100
1101// Adds @renderer to @area with the default child cell properties.
1102func (x *CellArea) Add(RendererVar *CellRenderer) {
1103
1104 xCellAreaAdd(x.GoPointer(), RendererVar.GoPointer())
1105
1106}
1107
1108var xCellAreaAddFocusSibling func(uintptr, uintptr, uintptr)
1109
1110// Adds @sibling to @renderer’s focusable area, focus will be drawn
1111// around @renderer and all of its siblings if @renderer can
1112// focus for a given row.
1113//
1114// Events handled by focus siblings can also activate the given
1115// focusable @renderer.
1116func (x *CellArea) AddFocusSibling(RendererVar *CellRenderer, SiblingVar *CellRenderer) {
1117
1118 xCellAreaAddFocusSibling(x.GoPointer(), RendererVar.GoPointer(), SiblingVar.GoPointer())
1119
1120}
1121
1122var xCellAreaAddWithProperties func(uintptr, uintptr, string, ...interface{})
1123
1124// Adds @renderer to @area, setting cell properties at the same time.
1125// See gtk_cell_area_add() and gtk_cell_area_cell_set() for more details.
1126func (x *CellArea) AddWithProperties(RendererVar *CellRenderer, FirstPropNameVar string, varArgs ...interface{}) {
1127
1128 xCellAreaAddWithProperties(x.GoPointer(), RendererVar.GoPointer(), FirstPropNameVar, varArgs...)
1129
1130}
1131
1132var xCellAreaApplyAttributes func(uintptr, uintptr, *TreeIter, bool, bool)
1133
1134// Applies any connected attributes to the renderers in
1135// @area by pulling the values from @tree_model.
1136func (x *CellArea) ApplyAttributes(TreeModelVar TreeModel, IterVar *TreeIter, IsExpanderVar bool, IsExpandedVar bool) {
1137
1138 xCellAreaApplyAttributes(x.GoPointer(), TreeModelVar.GoPointer(), IterVar, IsExpanderVar, IsExpandedVar)
1139
1140}
1141
1142var xCellAreaAttributeConnect func(uintptr, uintptr, string, int)
1143
1144// Connects an @attribute to apply values from @column for the
1145// `GtkTreeModel` in use.
1146func (x *CellArea) AttributeConnect(RendererVar *CellRenderer, AttributeVar string, ColumnVar int) {
1147
1148 xCellAreaAttributeConnect(x.GoPointer(), RendererVar.GoPointer(), AttributeVar, ColumnVar)
1149
1150}
1151
1152var xCellAreaAttributeDisconnect func(uintptr, uintptr, string)
1153
1154// Disconnects @attribute for the @renderer in @area so that
1155// attribute will no longer be updated with values from the
1156// model.
1157func (x *CellArea) AttributeDisconnect(RendererVar *CellRenderer, AttributeVar string) {
1158
1159 xCellAreaAttributeDisconnect(x.GoPointer(), RendererVar.GoPointer(), AttributeVar)
1160
1161}
1162
1163var xCellAreaAttributeGetColumn func(uintptr, uintptr, string) int
1164
1165// Returns the model column that an attribute has been mapped to,
1166// or -1 if the attribute is not mapped.
1167func (x *CellArea) AttributeGetColumn(RendererVar *CellRenderer, AttributeVar string) int {
1168
1169 cret := xCellAreaAttributeGetColumn(x.GoPointer(), RendererVar.GoPointer(), AttributeVar)
1170 return cret
1171}
1172
1173var xCellAreaCellGet func(uintptr, uintptr, string, ...interface{})
1174
1175// Gets the values of one or more cell properties for @renderer in @area.
1176func (x *CellArea) CellGet(RendererVar *CellRenderer, FirstPropNameVar string, varArgs ...interface{}) {
1177
1178 xCellAreaCellGet(x.GoPointer(), RendererVar.GoPointer(), FirstPropNameVar, varArgs...)
1179
1180}
1181
1182var xCellAreaCellGetProperty func(uintptr, uintptr, string, *gobject.Value)
1183
1184// Gets the value of a cell property for @renderer in @area.
1185func (x *CellArea) CellGetProperty(RendererVar *CellRenderer, PropertyNameVar string, ValueVar *gobject.Value) {
1186
1187 xCellAreaCellGetProperty(x.GoPointer(), RendererVar.GoPointer(), PropertyNameVar, ValueVar)
1188
1189}
1190
1191var xCellAreaCellGetValist func(uintptr, uintptr, string, []interface{})
1192
1193// Gets the values of one or more cell properties for @renderer in @area.
1194func (x *CellArea) CellGetValist(RendererVar *CellRenderer, FirstPropertyNameVar string, VarArgsVar []interface{}) {
1195
1196 xCellAreaCellGetValist(x.GoPointer(), RendererVar.GoPointer(), FirstPropertyNameVar, VarArgsVar)
1197
1198}
1199
1200var xCellAreaCellSet func(uintptr, uintptr, string, ...interface{})
1201
1202// Sets one or more cell properties for @cell in @area.
1203func (x *CellArea) CellSet(RendererVar *CellRenderer, FirstPropNameVar string, varArgs ...interface{}) {
1204
1205 xCellAreaCellSet(x.GoPointer(), RendererVar.GoPointer(), FirstPropNameVar, varArgs...)
1206
1207}
1208
1209var xCellAreaCellSetProperty func(uintptr, uintptr, string, *gobject.Value)
1210
1211// Sets a cell property for @renderer in @area.
1212func (x *CellArea) CellSetProperty(RendererVar *CellRenderer, PropertyNameVar string, ValueVar *gobject.Value) {
1213
1214 xCellAreaCellSetProperty(x.GoPointer(), RendererVar.GoPointer(), PropertyNameVar, ValueVar)
1215
1216}
1217
1218var xCellAreaCellSetValist func(uintptr, uintptr, string, []interface{})
1219
1220// Sets one or more cell properties for @renderer in @area.
1221func (x *CellArea) CellSetValist(RendererVar *CellRenderer, FirstPropertyNameVar string, VarArgsVar []interface{}) {
1222
1223 xCellAreaCellSetValist(x.GoPointer(), RendererVar.GoPointer(), FirstPropertyNameVar, VarArgsVar)
1224
1225}
1226
1227var xCellAreaCopyContext func(uintptr, uintptr) uintptr
1228
1229// This is sometimes needed for cases where rows need to share
1230// alignments in one orientation but may be separately grouped
1231// in the opposing orientation.
1232//
1233// For instance, `GtkIconView` creates all icons (rows) to have
1234// the same width and the cells theirin to have the same
1235// horizontal alignments. However each row of icons may have
1236// a separate collective height. `GtkIconView` uses this to
1237// request the heights of each row based on a context which
1238// was already used to request all the row widths that are
1239// to be displayed.
1240func (x *CellArea) CopyContext(ContextVar *CellAreaContext) *CellAreaContext {
1241 var cls *CellAreaContext
1242
1243 cret := xCellAreaCopyContext(x.GoPointer(), ContextVar.GoPointer())
1244
1245 if cret == 0 {
1246 return nil
1247 }
1248 cls = &CellAreaContext{}
1249 cls.Ptr = cret
1250 return cls
1251}
1252
1253var xCellAreaCreateContext func(uintptr) uintptr
1254
1255// Creates a `GtkCellArea`Context to be used with @area for
1256// all purposes. `GtkCellArea`Context stores geometry information
1257// for rows for which it was operated on, it is important to use
1258// the same context for the same row of data at all times (i.e.
1259// one should render and handle events with the same `GtkCellArea`Context
1260// which was used to request the size of those rows of data).
1261func (x *CellArea) CreateContext() *CellAreaContext {
1262 var cls *CellAreaContext
1263
1264 cret := xCellAreaCreateContext(x.GoPointer())
1265
1266 if cret == 0 {
1267 return nil
1268 }
1269 cls = &CellAreaContext{}
1270 cls.Ptr = cret
1271 return cls
1272}
1273
1274var xCellAreaEvent func(uintptr, uintptr, uintptr, uintptr, *gdk.Rectangle, CellRendererState) int
1275
1276// Delegates event handling to a `GtkCellArea`.
1277func (x *CellArea) Event(ContextVar *CellAreaContext, WidgetVar *Widget, EventVar *gdk.Event, CellAreaVar *gdk.Rectangle, FlagsVar CellRendererState) int {
1278
1279 cret := xCellAreaEvent(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), EventVar.GoPointer(), CellAreaVar, FlagsVar)
1280 return cret
1281}
1282
1283var xCellAreaFocus func(uintptr, DirectionType) bool
1284
1285// This should be called by the @area’s owning layout widget
1286// when focus is to be passed to @area, or moved within @area
1287// for a given @direction and row data.
1288//
1289// Implementing `GtkCellArea` classes should implement this
1290// method to receive and navigate focus in its own way particular
1291// to how it lays out cells.
1292func (x *CellArea) Focus(DirectionVar DirectionType) bool {
1293
1294 cret := xCellAreaFocus(x.GoPointer(), DirectionVar)
1295 return cret
1296}
1297
1298var xCellAreaForeach func(uintptr, uintptr, uintptr)
1299
1300// Calls @callback for every `GtkCellRenderer` in @area.
1301func (x *CellArea) Foreach(CallbackVar *CellCallback, CallbackDataVar uintptr) {
1302
1303 var CallbackVarRef uintptr
1304 if CallbackVar != nil {
1305 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1306 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1307 CallbackVarRef = cbRefPtr
1308 } else {
1309 fcb := func(arg0 uintptr, arg1 uintptr) bool {
1310 cbFn := *CallbackVar
1311 return cbFn(arg0, arg1)
1312 }
1313 CallbackVarRef = purego.NewCallback(fcb)
1314 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1315 }
1316 }
1317
1318 xCellAreaForeach(x.GoPointer(), CallbackVarRef, CallbackDataVar)
1319
1320}
1321
1322var xCellAreaForeachAlloc func(uintptr, uintptr, uintptr, *gdk.Rectangle, *gdk.Rectangle, uintptr, uintptr)
1323
1324// Calls @callback for every `GtkCellRenderer` in @area with the
1325// allocated rectangle inside @cell_area.
1326func (x *CellArea) ForeachAlloc(ContextVar *CellAreaContext, WidgetVar *Widget, CellAreaVar *gdk.Rectangle, BackgroundAreaVar *gdk.Rectangle, CallbackVar *CellAllocCallback, CallbackDataVar uintptr) {
1327
1328 var CallbackVarRef uintptr
1329 if CallbackVar != nil {
1330 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1331 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1332 CallbackVarRef = cbRefPtr
1333 } else {
1334 fcb := func(arg0 uintptr, arg1 *gdk.Rectangle, arg2 *gdk.Rectangle, arg3 uintptr) bool {
1335 cbFn := *CallbackVar
1336 return cbFn(arg0, arg1, arg2, arg3)
1337 }
1338 CallbackVarRef = purego.NewCallback(fcb)
1339 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1340 }
1341 }
1342
1343 xCellAreaForeachAlloc(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), CellAreaVar, BackgroundAreaVar, CallbackVarRef, CallbackDataVar)
1344
1345}
1346
1347var xCellAreaGetCellAllocation func(uintptr, uintptr, uintptr, uintptr, *gdk.Rectangle, *gdk.Rectangle)
1348
1349// Derives the allocation of @renderer inside @area if @area
1350// were to be rendered in @cell_area.
1351func (x *CellArea) GetCellAllocation(ContextVar *CellAreaContext, WidgetVar *Widget, RendererVar *CellRenderer, CellAreaVar *gdk.Rectangle, AllocationVar *gdk.Rectangle) {
1352
1353 xCellAreaGetCellAllocation(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), RendererVar.GoPointer(), CellAreaVar, AllocationVar)
1354
1355}
1356
1357var xCellAreaGetCellAtPosition func(uintptr, uintptr, uintptr, *gdk.Rectangle, int, int, *gdk.Rectangle) uintptr
1358
1359// Gets the `GtkCellRenderer` at @x and @y coordinates inside @area and optionally
1360// returns the full cell allocation for it inside @cell_area.
1361func (x *CellArea) GetCellAtPosition(ContextVar *CellAreaContext, WidgetVar *Widget, CellAreaVar *gdk.Rectangle, XVar int, YVar int, AllocAreaVar *gdk.Rectangle) *CellRenderer {
1362 var cls *CellRenderer
1363
1364 cret := xCellAreaGetCellAtPosition(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), CellAreaVar, XVar, YVar, AllocAreaVar)
1365
1366 if cret == 0 {
1367 return nil
1368 }
1369 gobject.IncreaseRef(cret)
1370 cls = &CellRenderer{}
1371 cls.Ptr = cret
1372 return cls
1373}
1374
1375var xCellAreaGetCurrentPathString func(uintptr) string
1376
1377// Gets the current `GtkTreePath` string for the currently
1378// applied `GtkTreeIter`, this is implicitly updated when
1379// gtk_cell_area_apply_attributes() is called and can be
1380// used to interact with renderers from `GtkCellArea`
1381// subclasses.
1382func (x *CellArea) GetCurrentPathString() string {
1383
1384 cret := xCellAreaGetCurrentPathString(x.GoPointer())
1385 return cret
1386}
1387
1388var xCellAreaGetEditWidget func(uintptr) uintptr
1389
1390// Gets the `GtkCellEditable` widget currently used
1391// to edit the currently edited cell.
1392func (x *CellArea) GetEditWidget() *CellEditableBase {
1393 var cls *CellEditableBase
1394
1395 cret := xCellAreaGetEditWidget(x.GoPointer())
1396
1397 if cret == 0 {
1398 return nil
1399 }
1400 gobject.IncreaseRef(cret)
1401 cls = &CellEditableBase{}
1402 cls.Ptr = cret
1403 return cls
1404}
1405
1406var xCellAreaGetEditedCell func(uintptr) uintptr
1407
1408// Gets the `GtkCellRenderer` in @area that is currently
1409// being edited.
1410func (x *CellArea) GetEditedCell() *CellRenderer {
1411 var cls *CellRenderer
1412
1413 cret := xCellAreaGetEditedCell(x.GoPointer())
1414
1415 if cret == 0 {
1416 return nil
1417 }
1418 gobject.IncreaseRef(cret)
1419 cls = &CellRenderer{}
1420 cls.Ptr = cret
1421 return cls
1422}
1423
1424var xCellAreaGetFocusCell func(uintptr) uintptr
1425
1426// Retrieves the currently focused cell for @area
1427func (x *CellArea) GetFocusCell() *CellRenderer {
1428 var cls *CellRenderer
1429
1430 cret := xCellAreaGetFocusCell(x.GoPointer())
1431
1432 if cret == 0 {
1433 return nil
1434 }
1435 gobject.IncreaseRef(cret)
1436 cls = &CellRenderer{}
1437 cls.Ptr = cret
1438 return cls
1439}
1440
1441var xCellAreaGetFocusFromSibling func(uintptr, uintptr) uintptr
1442
1443// Gets the `GtkCellRenderer` which is expected to be focusable
1444// for which @renderer is, or may be a sibling.
1445//
1446// This is handy for `GtkCellArea` subclasses when handling events,
1447// after determining the renderer at the event location it can
1448// then chose to activate the focus cell for which the event
1449// cell may have been a sibling.
1450func (x *CellArea) GetFocusFromSibling(RendererVar *CellRenderer) *CellRenderer {
1451 var cls *CellRenderer
1452
1453 cret := xCellAreaGetFocusFromSibling(x.GoPointer(), RendererVar.GoPointer())
1454
1455 if cret == 0 {
1456 return nil
1457 }
1458 gobject.IncreaseRef(cret)
1459 cls = &CellRenderer{}
1460 cls.Ptr = cret
1461 return cls
1462}
1463
1464var xCellAreaGetFocusSiblings func(uintptr, uintptr) *glib.List
1465
1466// Gets the focus sibling cell renderers for @renderer.
1467func (x *CellArea) GetFocusSiblings(RendererVar *CellRenderer) *glib.List {
1468
1469 cret := xCellAreaGetFocusSiblings(x.GoPointer(), RendererVar.GoPointer())
1470 return cret
1471}
1472
1473var xCellAreaGetPreferredHeight func(uintptr, uintptr, uintptr, *int, *int)
1474
1475// Retrieves a cell area’s initial minimum and natural height.
1476//
1477// @area will store some geometrical information in @context along the way;
1478// when requesting sizes over an arbitrary number of rows, it’s not important
1479// to check the @minimum_height and @natural_height of this call but rather to
1480// consult gtk_cell_area_context_get_preferred_height() after a series of
1481// requests.
1482func (x *CellArea) GetPreferredHeight(ContextVar *CellAreaContext, WidgetVar *Widget, MinimumHeightVar *int, NaturalHeightVar *int) {
1483
1484 xCellAreaGetPreferredHeight(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), MinimumHeightVar, NaturalHeightVar)
1485
1486}
1487
1488var xCellAreaGetPreferredHeightForWidth func(uintptr, uintptr, uintptr, int, *int, *int)
1489
1490// Retrieves a cell area’s minimum and natural height if it would be given
1491// the specified @width.
1492//
1493// @area stores some geometrical information in @context along the way
1494// while calling gtk_cell_area_get_preferred_width(). It’s important to
1495// perform a series of gtk_cell_area_get_preferred_width() requests with
1496// @context first and then call gtk_cell_area_get_preferred_height_for_width()
1497// on each cell area individually to get the height for width of each
1498// fully requested row.
1499//
1500// If at some point, the width of a single row changes, it should be
1501// requested with gtk_cell_area_get_preferred_width() again and then
1502// the full width of the requested rows checked again with
1503// gtk_cell_area_context_get_preferred_width().
1504func (x *CellArea) GetPreferredHeightForWidth(ContextVar *CellAreaContext, WidgetVar *Widget, WidthVar int, MinimumHeightVar *int, NaturalHeightVar *int) {
1505
1506 xCellAreaGetPreferredHeightForWidth(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), WidthVar, MinimumHeightVar, NaturalHeightVar)
1507
1508}
1509
1510var xCellAreaGetPreferredWidth func(uintptr, uintptr, uintptr, *int, *int)
1511
1512// Retrieves a cell area’s initial minimum and natural width.
1513//
1514// @area will store some geometrical information in @context along the way;
1515// when requesting sizes over an arbitrary number of rows, it’s not important
1516// to check the @minimum_width and @natural_width of this call but rather to
1517// consult gtk_cell_area_context_get_preferred_width() after a series of
1518// requests.
1519func (x *CellArea) GetPreferredWidth(ContextVar *CellAreaContext, WidgetVar *Widget, MinimumWidthVar *int, NaturalWidthVar *int) {
1520
1521 xCellAreaGetPreferredWidth(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), MinimumWidthVar, NaturalWidthVar)
1522
1523}
1524
1525var xCellAreaGetPreferredWidthForHeight func(uintptr, uintptr, uintptr, int, *int, *int)
1526
1527// Retrieves a cell area’s minimum and natural width if it would be given
1528// the specified @height.
1529//
1530// @area stores some geometrical information in @context along the way
1531// while calling gtk_cell_area_get_preferred_height(). It’s important to
1532// perform a series of gtk_cell_area_get_preferred_height() requests with
1533// @context first and then call gtk_cell_area_get_preferred_width_for_height()
1534// on each cell area individually to get the height for width of each
1535// fully requested row.
1536//
1537// If at some point, the height of a single row changes, it should be
1538// requested with gtk_cell_area_get_preferred_height() again and then
1539// the full height of the requested rows checked again with
1540// gtk_cell_area_context_get_preferred_height().
1541func (x *CellArea) GetPreferredWidthForHeight(ContextVar *CellAreaContext, WidgetVar *Widget, HeightVar int, MinimumWidthVar *int, NaturalWidthVar *int) {
1542
1543 xCellAreaGetPreferredWidthForHeight(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), HeightVar, MinimumWidthVar, NaturalWidthVar)
1544
1545}
1546
1547var xCellAreaGetRequestMode func(uintptr) SizeRequestMode
1548
1549// Gets whether the area prefers a height-for-width layout
1550// or a width-for-height layout.
1551func (x *CellArea) GetRequestMode() SizeRequestMode {
1552
1553 cret := xCellAreaGetRequestMode(x.GoPointer())
1554 return cret
1555}
1556
1557var xCellAreaHasRenderer func(uintptr, uintptr) bool
1558
1559// Checks if @area contains @renderer.
1560func (x *CellArea) HasRenderer(RendererVar *CellRenderer) bool {
1561
1562 cret := xCellAreaHasRenderer(x.GoPointer(), RendererVar.GoPointer())
1563 return cret
1564}
1565
1566var xCellAreaInnerCellArea func(uintptr, uintptr, *gdk.Rectangle, *gdk.Rectangle)
1567
1568// This is a convenience function for `GtkCellArea` implementations
1569// to get the inner area where a given `GtkCellRenderer` will be
1570// rendered. It removes any padding previously added by gtk_cell_area_request_renderer().
1571func (x *CellArea) InnerCellArea(WidgetVar *Widget, CellAreaVar *gdk.Rectangle, InnerAreaVar *gdk.Rectangle) {
1572
1573 xCellAreaInnerCellArea(x.GoPointer(), WidgetVar.GoPointer(), CellAreaVar, InnerAreaVar)
1574
1575}
1576
1577var xCellAreaIsActivatable func(uintptr) bool
1578
1579// Returns whether the area can do anything when activated,
1580// after applying new attributes to @area.
1581func (x *CellArea) IsActivatable() bool {
1582
1583 cret := xCellAreaIsActivatable(x.GoPointer())
1584 return cret
1585}
1586
1587var xCellAreaIsFocusSibling func(uintptr, uintptr, uintptr) bool
1588
1589// Returns whether @sibling is one of @renderer’s focus siblings
1590// (see gtk_cell_area_add_focus_sibling()).
1591func (x *CellArea) IsFocusSibling(RendererVar *CellRenderer, SiblingVar *CellRenderer) bool {
1592
1593 cret := xCellAreaIsFocusSibling(x.GoPointer(), RendererVar.GoPointer(), SiblingVar.GoPointer())
1594 return cret
1595}
1596
1597var xCellAreaRemove func(uintptr, uintptr)
1598
1599// Removes @renderer from @area.
1600func (x *CellArea) Remove(RendererVar *CellRenderer) {
1601
1602 xCellAreaRemove(x.GoPointer(), RendererVar.GoPointer())
1603
1604}
1605
1606var xCellAreaRemoveFocusSibling func(uintptr, uintptr, uintptr)
1607
1608// Removes @sibling from @renderer’s focus sibling list
1609// (see gtk_cell_area_add_focus_sibling()).
1610func (x *CellArea) RemoveFocusSibling(RendererVar *CellRenderer, SiblingVar *CellRenderer) {
1611
1612 xCellAreaRemoveFocusSibling(x.GoPointer(), RendererVar.GoPointer(), SiblingVar.GoPointer())
1613
1614}
1615
1616var xCellAreaRequestRenderer func(uintptr, uintptr, Orientation, uintptr, int, *int, *int)
1617
1618// This is a convenience function for `GtkCellArea` implementations
1619// to request size for cell renderers. It’s important to use this
1620// function to request size and then use gtk_cell_area_inner_cell_area()
1621// at render and event time since this function will add padding
1622// around the cell for focus painting.
1623func (x *CellArea) RequestRenderer(RendererVar *CellRenderer, OrientationVar Orientation, WidgetVar *Widget, ForSizeVar int, MinimumSizeVar *int, NaturalSizeVar *int) {
1624
1625 xCellAreaRequestRenderer(x.GoPointer(), RendererVar.GoPointer(), OrientationVar, WidgetVar.GoPointer(), ForSizeVar, MinimumSizeVar, NaturalSizeVar)
1626
1627}
1628
1629var xCellAreaSetFocusCell func(uintptr, uintptr)
1630
1631// Explicitly sets the currently focused cell to @renderer.
1632//
1633// This is generally called by implementations of
1634// `GtkCellAreaClass.focus()` or `GtkCellAreaClass.event()`,
1635// however it can also be used to implement functions such
1636// as gtk_tree_view_set_cursor_on_cell().
1637func (x *CellArea) SetFocusCell(RendererVar *CellRenderer) {
1638
1639 xCellAreaSetFocusCell(x.GoPointer(), RendererVar.GoPointer())
1640
1641}
1642
1643var xCellAreaSnapshot func(uintptr, uintptr, uintptr, uintptr, *gdk.Rectangle, *gdk.Rectangle, CellRendererState, bool)
1644
1645// Snapshots @area’s cells according to @area’s layout onto at
1646// the given coordinates.
1647func (x *CellArea) Snapshot(ContextVar *CellAreaContext, WidgetVar *Widget, SnapshotVar *Snapshot, BackgroundAreaVar *gdk.Rectangle, CellAreaVar *gdk.Rectangle, FlagsVar CellRendererState, PaintFocusVar bool) {
1648
1649 xCellAreaSnapshot(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), SnapshotVar.GoPointer(), BackgroundAreaVar, CellAreaVar, FlagsVar, PaintFocusVar)
1650
1651}
1652
1653var xCellAreaStopEditing func(uintptr, bool)
1654
1655// Explicitly stops the editing of the currently edited cell.
1656//
1657// If @canceled is %TRUE, the currently edited cell renderer
1658// will emit the ::editing-canceled signal, otherwise the
1659// the ::editing-done signal will be emitted on the current
1660// edit widget.
1661//
1662// See gtk_cell_area_get_edited_cell() and gtk_cell_area_get_edit_widget().
1663func (x *CellArea) StopEditing(CanceledVar bool) {
1664
1665 xCellAreaStopEditing(x.GoPointer(), CanceledVar)
1666
1667}
1668
1669func (c *CellArea) GoPointer() uintptr {
1670 if c == nil {
1671 return 0
1672 }
1673 return c.Ptr
1674}
1675
1676func (c *CellArea) SetGoPointer(ptr uintptr) {
1677 c.Ptr = ptr
1678}
1679
1680// Indicates that editing has started on @renderer and that @editable
1681// should be added to the owning cell-layouting widget at @cell_area.
1682func (x *CellArea) ConnectAddEditable(cb *func(CellArea, uintptr, uintptr, uintptr, string)) uint {
1683 cbPtr := uintptr(unsafe.Pointer(cb))
1684 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1685 handlerID := gobject.SignalConnect(x.GoPointer(), "add-editable", cbRefPtr)
1686 glib.SaveHandlerMapping(handlerID, cbPtr)
1687 return handlerID
1688 }
1689
1690 fcb := func(clsPtr uintptr, RendererVarp uintptr, EditableVarp uintptr, CellAreaVarp uintptr, PathVarp uintptr) {
1691 fa := CellArea{}
1692 fa.Ptr = clsPtr
1693 cbFn := *cb
1694
1695 cbFn(fa, RendererVarp, EditableVarp, CellAreaVarp, core.GoString(PathVarp))
1696
1697 }
1698 cbRefPtr := purego.NewCallback(fcb)
1699 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1700 handlerID := gobject.SignalConnect(x.GoPointer(), "add-editable", cbRefPtr)
1701 glib.SaveHandlerMapping(handlerID, cbPtr)
1702 return handlerID
1703}
1704
1705// This signal is emitted whenever applying attributes to @area from @model
1706func (x *CellArea) ConnectApplyAttributes(cb *func(CellArea, uintptr, uintptr, bool, bool)) uint {
1707 cbPtr := uintptr(unsafe.Pointer(cb))
1708 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1709 handlerID := gobject.SignalConnect(x.GoPointer(), "apply-attributes", cbRefPtr)
1710 glib.SaveHandlerMapping(handlerID, cbPtr)
1711 return handlerID
1712 }
1713
1714 fcb := func(clsPtr uintptr, ModelVarp uintptr, IterVarp uintptr, IsExpanderVarp bool, IsExpandedVarp bool) {
1715 fa := CellArea{}
1716 fa.Ptr = clsPtr
1717 cbFn := *cb
1718
1719 cbFn(fa, ModelVarp, IterVarp, IsExpanderVarp, IsExpandedVarp)
1720
1721 }
1722 cbRefPtr := purego.NewCallback(fcb)
1723 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1724 handlerID := gobject.SignalConnect(x.GoPointer(), "apply-attributes", cbRefPtr)
1725 glib.SaveHandlerMapping(handlerID, cbPtr)
1726 return handlerID
1727}
1728
1729// Indicates that focus changed on this @area. This signal
1730// is emitted either as a result of focus handling or event
1731// handling.
1732//
1733// It's possible that the signal is emitted even if the
1734// currently focused renderer did not change, this is
1735// because focus may change to the same renderer in the
1736// same cell area for a different row of data.
1737func (x *CellArea) ConnectFocusChanged(cb *func(CellArea, uintptr, string)) uint {
1738 cbPtr := uintptr(unsafe.Pointer(cb))
1739 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1740 handlerID := gobject.SignalConnect(x.GoPointer(), "focus-changed", cbRefPtr)
1741 glib.SaveHandlerMapping(handlerID, cbPtr)
1742 return handlerID
1743 }
1744
1745 fcb := func(clsPtr uintptr, RendererVarp uintptr, PathVarp uintptr) {
1746 fa := CellArea{}
1747 fa.Ptr = clsPtr
1748 cbFn := *cb
1749
1750 cbFn(fa, RendererVarp, core.GoString(PathVarp))
1751
1752 }
1753 cbRefPtr := purego.NewCallback(fcb)
1754 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1755 handlerID := gobject.SignalConnect(x.GoPointer(), "focus-changed", cbRefPtr)
1756 glib.SaveHandlerMapping(handlerID, cbPtr)
1757 return handlerID
1758}
1759
1760// Indicates that editing finished on @renderer and that @editable
1761// should be removed from the owning cell-layouting widget.
1762func (x *CellArea) ConnectRemoveEditable(cb *func(CellArea, uintptr, uintptr)) uint {
1763 cbPtr := uintptr(unsafe.Pointer(cb))
1764 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1765 handlerID := gobject.SignalConnect(x.GoPointer(), "remove-editable", cbRefPtr)
1766 glib.SaveHandlerMapping(handlerID, cbPtr)
1767 return handlerID
1768 }
1769
1770 fcb := func(clsPtr uintptr, RendererVarp uintptr, EditableVarp uintptr) {
1771 fa := CellArea{}
1772 fa.Ptr = clsPtr
1773 cbFn := *cb
1774
1775 cbFn(fa, RendererVarp, EditableVarp)
1776
1777 }
1778 cbRefPtr := purego.NewCallback(fcb)
1779 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1780 handlerID := gobject.SignalConnect(x.GoPointer(), "remove-editable", cbRefPtr)
1781 glib.SaveHandlerMapping(handlerID, cbPtr)
1782 return handlerID
1783}
1784
1785// Gets the ID of the @buildable object.
1786//
1787// `GtkBuilder` sets the name based on the ID attribute
1788// of the `<object>` tag used to construct the @buildable.
1789func (x *CellArea) GetBuildableId() string {
1790
1791 cret := XGtkBuildableGetBuildableId(x.GoPointer())
1792 return cret
1793}
1794
1795// Adds an attribute mapping to the list in @cell_layout.
1796//
1797// The @column is the column of the model to get a value from, and the
1798// @attribute is the property on @cell to be set from that value. So for
1799// example if column 2 of the model contains strings, you could have the
1800// “text” attribute of a `GtkCellRendererText` get its values from column 2.
1801// In this context "attribute" and "property" are used interchangeably.
1802func (x *CellArea) AddAttribute(CellVar *CellRenderer, AttributeVar string, ColumnVar int) {
1803
1804 XGtkCellLayoutAddAttribute(x.GoPointer(), CellVar.GoPointer(), AttributeVar, ColumnVar)
1805
1806}
1807
1808// Unsets all the mappings on all renderers on @cell_layout and
1809// removes all renderers from @cell_layout.
1810func (x *CellArea) Clear() {
1811
1812 XGtkCellLayoutClear(x.GoPointer())
1813
1814}
1815
1816// Clears all existing attributes previously set with
1817// gtk_cell_layout_set_attributes().
1818func (x *CellArea) ClearAttributes(CellVar *CellRenderer) {
1819
1820 XGtkCellLayoutClearAttributes(x.GoPointer(), CellVar.GoPointer())
1821
1822}
1823
1824// Returns the underlying `GtkCellArea` which might be @cell_layout
1825// if called on a `GtkCellArea` or might be %NULL if no `GtkCellArea`
1826// is used by @cell_layout.
1827func (x *CellArea) GetArea() *CellArea {
1828 var cls *CellArea
1829
1830 cret := XGtkCellLayoutGetArea(x.GoPointer())
1831
1832 if cret == 0 {
1833 return nil
1834 }
1835 gobject.IncreaseRef(cret)
1836 cls = &CellArea{}
1837 cls.Ptr = cret
1838 return cls
1839}
1840
1841// Returns the cell renderers which have been added to @cell_layout.
1842func (x *CellArea) GetCells() *glib.List {
1843
1844 cret := XGtkCellLayoutGetCells(x.GoPointer())
1845 return cret
1846}
1847
1848// Adds the @cell to the end of @cell_layout. If @expand is %FALSE, then the
1849// @cell is allocated no more space than it needs. Any unused space is
1850// divided evenly between cells for which @expand is %TRUE.
1851//
1852// Note that reusing the same cell renderer is not supported.
1853func (x *CellArea) PackEnd(CellVar *CellRenderer, ExpandVar bool) {
1854
1855 XGtkCellLayoutPackEnd(x.GoPointer(), CellVar.GoPointer(), ExpandVar)
1856
1857}
1858
1859// Packs the @cell into the beginning of @cell_layout. If @expand is %FALSE,
1860// then the @cell is allocated no more space than it needs. Any unused space
1861// is divided evenly between cells for which @expand is %TRUE.
1862//
1863// Note that reusing the same cell renderer is not supported.
1864func (x *CellArea) PackStart(CellVar *CellRenderer, ExpandVar bool) {
1865
1866 XGtkCellLayoutPackStart(x.GoPointer(), CellVar.GoPointer(), ExpandVar)
1867
1868}
1869
1870// Re-inserts @cell at @position.
1871//
1872// Note that @cell has already to be packed into @cell_layout
1873// for this to function properly.
1874func (x *CellArea) Reorder(CellVar *CellRenderer, PositionVar int) {
1875
1876 XGtkCellLayoutReorder(x.GoPointer(), CellVar.GoPointer(), PositionVar)
1877
1878}
1879
1880// Sets the attributes in the parameter list as the attributes
1881// of @cell_layout.
1882//
1883// See [method@Gtk.CellLayout.add_attribute] for more details.
1884//
1885// The attributes should be in attribute/column order, as in
1886// gtk_cell_layout_add_attribute(). All existing attributes are
1887// removed, and replaced with the new attributes.
1888func (x *CellArea) SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) {
1889
1890 XGtkCellLayoutSetAttributes(x.GoPointer(), CellVar.GoPointer(), varArgs...)
1891
1892}
1893
1894// Sets the `GtkCellLayout`DataFunc to use for @cell_layout.
1895//
1896// This function is used instead of the standard attributes mapping
1897// for setting the column value, and should set the value of @cell_layout’s
1898// cell renderer(s) as appropriate.
1899//
1900// @func may be %NULL to remove a previously set function.
1901func (x *CellArea) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) {
1902
1903 XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallbackNullable(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar))
1904
1905}
1906
1907func init() {
1908 core.SetPackageName("GTK", "gtk4")
1909 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
1910 var libs []uintptr
1911 for _, libPath := range core.GetPaths("GTK") {
1912 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1913 if err != nil {
1914 panic(err)
1915 }
1916 libs = append(libs, lib)
1917 }
1918
1919 core.PuregoSafeRegister(&xCellAreaClassFindCellProperty, libs, "gtk_cell_area_class_find_cell_property")
1920 core.PuregoSafeRegister(&xCellAreaClassInstallCellProperty, libs, "gtk_cell_area_class_install_cell_property")
1921 core.PuregoSafeRegister(&xCellAreaClassListCellProperties, libs, "gtk_cell_area_class_list_cell_properties")
1922
1923 core.PuregoSafeRegister(&xCellAreaGLibType, libs, "gtk_cell_area_get_type")
1924
1925 core.PuregoSafeRegister(&xCellAreaActivate, libs, "gtk_cell_area_activate")
1926 core.PuregoSafeRegister(&xCellAreaActivateCell, libs, "gtk_cell_area_activate_cell")
1927 core.PuregoSafeRegister(&xCellAreaAdd, libs, "gtk_cell_area_add")
1928 core.PuregoSafeRegister(&xCellAreaAddFocusSibling, libs, "gtk_cell_area_add_focus_sibling")
1929 core.PuregoSafeRegister(&xCellAreaAddWithProperties, libs, "gtk_cell_area_add_with_properties")
1930 core.PuregoSafeRegister(&xCellAreaApplyAttributes, libs, "gtk_cell_area_apply_attributes")
1931 core.PuregoSafeRegister(&xCellAreaAttributeConnect, libs, "gtk_cell_area_attribute_connect")
1932 core.PuregoSafeRegister(&xCellAreaAttributeDisconnect, libs, "gtk_cell_area_attribute_disconnect")
1933 core.PuregoSafeRegister(&xCellAreaAttributeGetColumn, libs, "gtk_cell_area_attribute_get_column")
1934 core.PuregoSafeRegister(&xCellAreaCellGet, libs, "gtk_cell_area_cell_get")
1935 core.PuregoSafeRegister(&xCellAreaCellGetProperty, libs, "gtk_cell_area_cell_get_property")
1936 core.PuregoSafeRegister(&xCellAreaCellGetValist, libs, "gtk_cell_area_cell_get_valist")
1937 core.PuregoSafeRegister(&xCellAreaCellSet, libs, "gtk_cell_area_cell_set")
1938 core.PuregoSafeRegister(&xCellAreaCellSetProperty, libs, "gtk_cell_area_cell_set_property")
1939 core.PuregoSafeRegister(&xCellAreaCellSetValist, libs, "gtk_cell_area_cell_set_valist")
1940 core.PuregoSafeRegister(&xCellAreaCopyContext, libs, "gtk_cell_area_copy_context")
1941 core.PuregoSafeRegister(&xCellAreaCreateContext, libs, "gtk_cell_area_create_context")
1942 core.PuregoSafeRegister(&xCellAreaEvent, libs, "gtk_cell_area_event")
1943 core.PuregoSafeRegister(&xCellAreaFocus, libs, "gtk_cell_area_focus")
1944 core.PuregoSafeRegister(&xCellAreaForeach, libs, "gtk_cell_area_foreach")
1945 core.PuregoSafeRegister(&xCellAreaForeachAlloc, libs, "gtk_cell_area_foreach_alloc")
1946 core.PuregoSafeRegister(&xCellAreaGetCellAllocation, libs, "gtk_cell_area_get_cell_allocation")
1947 core.PuregoSafeRegister(&xCellAreaGetCellAtPosition, libs, "gtk_cell_area_get_cell_at_position")
1948 core.PuregoSafeRegister(&xCellAreaGetCurrentPathString, libs, "gtk_cell_area_get_current_path_string")
1949 core.PuregoSafeRegister(&xCellAreaGetEditWidget, libs, "gtk_cell_area_get_edit_widget")
1950 core.PuregoSafeRegister(&xCellAreaGetEditedCell, libs, "gtk_cell_area_get_edited_cell")
1951 core.PuregoSafeRegister(&xCellAreaGetFocusCell, libs, "gtk_cell_area_get_focus_cell")
1952 core.PuregoSafeRegister(&xCellAreaGetFocusFromSibling, libs, "gtk_cell_area_get_focus_from_sibling")
1953 core.PuregoSafeRegister(&xCellAreaGetFocusSiblings, libs, "gtk_cell_area_get_focus_siblings")
1954 core.PuregoSafeRegister(&xCellAreaGetPreferredHeight, libs, "gtk_cell_area_get_preferred_height")
1955 core.PuregoSafeRegister(&xCellAreaGetPreferredHeightForWidth, libs, "gtk_cell_area_get_preferred_height_for_width")
1956 core.PuregoSafeRegister(&xCellAreaGetPreferredWidth, libs, "gtk_cell_area_get_preferred_width")
1957 core.PuregoSafeRegister(&xCellAreaGetPreferredWidthForHeight, libs, "gtk_cell_area_get_preferred_width_for_height")
1958 core.PuregoSafeRegister(&xCellAreaGetRequestMode, libs, "gtk_cell_area_get_request_mode")
1959 core.PuregoSafeRegister(&xCellAreaHasRenderer, libs, "gtk_cell_area_has_renderer")
1960 core.PuregoSafeRegister(&xCellAreaInnerCellArea, libs, "gtk_cell_area_inner_cell_area")
1961 core.PuregoSafeRegister(&xCellAreaIsActivatable, libs, "gtk_cell_area_is_activatable")
1962 core.PuregoSafeRegister(&xCellAreaIsFocusSibling, libs, "gtk_cell_area_is_focus_sibling")
1963 core.PuregoSafeRegister(&xCellAreaRemove, libs, "gtk_cell_area_remove")
1964 core.PuregoSafeRegister(&xCellAreaRemoveFocusSibling, libs, "gtk_cell_area_remove_focus_sibling")
1965 core.PuregoSafeRegister(&xCellAreaRequestRenderer, libs, "gtk_cell_area_request_renderer")
1966 core.PuregoSafeRegister(&xCellAreaSetFocusCell, libs, "gtk_cell_area_set_focus_cell")
1967 core.PuregoSafeRegister(&xCellAreaSnapshot, libs, "gtk_cell_area_snapshot")
1968 core.PuregoSafeRegister(&xCellAreaStopEditing, libs, "gtk_cell_area_stop_editing")
1969
1970}