v0.2.1 c0399be

gtklayoutmanager.go RawHistoryFolder

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
15// The `GtkLayoutManagerClass` structure contains only private data, and
16// should only be accessed through the provided API, or when subclassing
17// `GtkLayoutManager`.
18type LayoutManagerClass struct {
19	_ structs.HostLayout
20
21	ParentClass gobject.ObjectClass
22
23	xGetRequestMode uintptr
24
25	xMeasure uintptr
26
27	xAllocate uintptr
28
29	LayoutChildType types.GType
30
31	xCreateLayoutChild uintptr
32
33	xRoot uintptr
34
35	xUnroot uintptr
36
37	Padding [16]uintptr
38}
39
40func (x *LayoutManagerClass) GoPointer() uintptr {
41	return uintptr(unsafe.Pointer(x))
42}
43
44// OverrideGetRequestMode sets the "get_request_mode" callback function.
45// a virtual function, used to return the preferred
46//
47//	request mode for the layout manager; for instance, "width for height"
48//	or "height for width"; see `GtkSizeRequestMode`
49func (x *LayoutManagerClass) OverrideGetRequestMode(cb func(*LayoutManager, *Widget) SizeRequestMode) {
50	if cb == nil {
51		x.xGetRequestMode = 0
52	} else {
53		x.xGetRequestMode = purego.NewCallback(func(ManagerVarp uintptr, WidgetVarp uintptr) SizeRequestMode {
54			return cb(LayoutManagerNewFromInternalPtr(ManagerVarp), WidgetNewFromInternalPtr(WidgetVarp))
55		})
56	}
57}
58
59// GetGetRequestMode gets the "get_request_mode" callback function.
60// a virtual function, used to return the preferred
61//
62//	request mode for the layout manager; for instance, "width for height"
63//	or "height for width"; see `GtkSizeRequestMode`
64func (x *LayoutManagerClass) GetGetRequestMode() func(*LayoutManager, *Widget) SizeRequestMode {
65	if x.xGetRequestMode == 0 {
66		return nil
67	}
68	var rawCallback func(ManagerVarp uintptr, WidgetVarp uintptr) SizeRequestMode
69	purego.RegisterFunc(&rawCallback, x.xGetRequestMode)
70	return func(ManagerVar *LayoutManager, WidgetVar *Widget) SizeRequestMode {
71		return rawCallback(ManagerVar.GoPointer(), WidgetVar.GoPointer())
72	}
73}
74
75// OverrideMeasure sets the "measure" callback function.
76// a virtual function, used to measure the minimum and preferred
77//
78//	sizes of the widget using the layout manager for a given orientation
79func (x *LayoutManagerClass) OverrideMeasure(cb func(*LayoutManager, *Widget, Orientation, int, *int, *int, *int, *int)) {
80	if cb == nil {
81		x.xMeasure = 0
82	} else {
83		x.xMeasure = purego.NewCallback(func(ManagerVarp uintptr, WidgetVarp uintptr, OrientationVarp Orientation, ForSizeVarp int, MinimumVarp *int, NaturalVarp *int, MinimumBaselineVarp *int, NaturalBaselineVarp *int) {
84			cb(LayoutManagerNewFromInternalPtr(ManagerVarp), WidgetNewFromInternalPtr(WidgetVarp), OrientationVarp, ForSizeVarp, MinimumVarp, NaturalVarp, MinimumBaselineVarp, NaturalBaselineVarp)
85		})
86	}
87}
88
89// GetMeasure gets the "measure" callback function.
90// a virtual function, used to measure the minimum and preferred
91//
92//	sizes of the widget using the layout manager for a given orientation
93func (x *LayoutManagerClass) GetMeasure() func(*LayoutManager, *Widget, Orientation, int, *int, *int, *int, *int) {
94	if x.xMeasure == 0 {
95		return nil
96	}
97	var rawCallback func(ManagerVarp uintptr, WidgetVarp uintptr, OrientationVarp Orientation, ForSizeVarp int, MinimumVarp *int, NaturalVarp *int, MinimumBaselineVarp *int, NaturalBaselineVarp *int)
98	purego.RegisterFunc(&rawCallback, x.xMeasure)
99	return func(ManagerVar *LayoutManager, WidgetVar *Widget, OrientationVar Orientation, ForSizeVar int, MinimumVar *int, NaturalVar *int, MinimumBaselineVar *int, NaturalBaselineVar *int) {
100		rawCallback(ManagerVar.GoPointer(), WidgetVar.GoPointer(), OrientationVar, ForSizeVar, MinimumVar, NaturalVar, MinimumBaselineVar, NaturalBaselineVar)
101	}
102}
103
104// OverrideAllocate sets the "allocate" callback function.
105// a virtual function, used to allocate the size of the widget
106//
107//	using the layout manager
108func (x *LayoutManagerClass) OverrideAllocate(cb func(*LayoutManager, *Widget, int, int, int)) {
109	if cb == nil {
110		x.xAllocate = 0
111	} else {
112		x.xAllocate = purego.NewCallback(func(ManagerVarp uintptr, WidgetVarp uintptr, WidthVarp int, HeightVarp int, BaselineVarp int) {
113			cb(LayoutManagerNewFromInternalPtr(ManagerVarp), WidgetNewFromInternalPtr(WidgetVarp), WidthVarp, HeightVarp, BaselineVarp)
114		})
115	}
116}
117
118// GetAllocate gets the "allocate" callback function.
119// a virtual function, used to allocate the size of the widget
120//
121//	using the layout manager
122func (x *LayoutManagerClass) GetAllocate() func(*LayoutManager, *Widget, int, int, int) {
123	if x.xAllocate == 0 {
124		return nil
125	}
126	var rawCallback func(ManagerVarp uintptr, WidgetVarp uintptr, WidthVarp int, HeightVarp int, BaselineVarp int)
127	purego.RegisterFunc(&rawCallback, x.xAllocate)
128	return func(ManagerVar *LayoutManager, WidgetVar *Widget, WidthVar int, HeightVar int, BaselineVar int) {
129		rawCallback(ManagerVar.GoPointer(), WidgetVar.GoPointer(), WidthVar, HeightVar, BaselineVar)
130	}
131}
132
133// OverrideCreateLayoutChild sets the "create_layout_child" callback function.
134// a virtual function, used to create a `GtkLayoutChild`
135//
136//	meta object for the layout properties
137func (x *LayoutManagerClass) OverrideCreateLayoutChild(cb func(*LayoutManager, *Widget, *Widget) *LayoutChild) {
138	if cb == nil {
139		x.xCreateLayoutChild = 0
140	} else {
141		x.xCreateLayoutChild = purego.NewCallback(func(ManagerVarp uintptr, WidgetVarp uintptr, ForChildVarp uintptr) uintptr {
142			ret := cb(LayoutManagerNewFromInternalPtr(ManagerVarp), WidgetNewFromInternalPtr(WidgetVarp), WidgetNewFromInternalPtr(ForChildVarp))
143			if ret == nil {
144				return 0
145			}
146			return ret.GoPointer()
147		})
148	}
149}
150
151// GetCreateLayoutChild gets the "create_layout_child" callback function.
152// a virtual function, used to create a `GtkLayoutChild`
153//
154//	meta object for the layout properties
155func (x *LayoutManagerClass) GetCreateLayoutChild() func(*LayoutManager, *Widget, *Widget) *LayoutChild {
156	if x.xCreateLayoutChild == 0 {
157		return nil
158	}
159	var rawCallback func(ManagerVarp uintptr, WidgetVarp uintptr, ForChildVarp uintptr) uintptr
160	purego.RegisterFunc(&rawCallback, x.xCreateLayoutChild)
161	return func(ManagerVar *LayoutManager, WidgetVar *Widget, ForChildVar *Widget) *LayoutChild {
162		rawRet := rawCallback(ManagerVar.GoPointer(), WidgetVar.GoPointer(), ForChildVar.GoPointer())
163		if rawRet == 0 {
164			return nil
165		}
166		ret := &LayoutChild{}
167		ret.Ptr = rawRet
168		return ret
169	}
170}
171
172// OverrideRoot sets the "root" callback function.
173// a virtual function, called when the widget using the layout
174//
175//	manager is attached to a `GtkRoot`
176func (x *LayoutManagerClass) OverrideRoot(cb func(*LayoutManager)) {
177	if cb == nil {
178		x.xRoot = 0
179	} else {
180		x.xRoot = purego.NewCallback(func(ManagerVarp uintptr) {
181			cb(LayoutManagerNewFromInternalPtr(ManagerVarp))
182		})
183	}
184}
185
186// GetRoot gets the "root" callback function.
187// a virtual function, called when the widget using the layout
188//
189//	manager is attached to a `GtkRoot`
190func (x *LayoutManagerClass) GetRoot() func(*LayoutManager) {
191	if x.xRoot == 0 {
192		return nil
193	}
194	var rawCallback func(ManagerVarp uintptr)
195	purego.RegisterFunc(&rawCallback, x.xRoot)
196	return func(ManagerVar *LayoutManager) {
197		rawCallback(ManagerVar.GoPointer())
198	}
199}
200
201// OverrideUnroot sets the "unroot" callback function.
202// a virtual function, called when the widget using the layout
203//
204//	manager is detached from a `GtkRoot`
205func (x *LayoutManagerClass) OverrideUnroot(cb func(*LayoutManager)) {
206	if cb == nil {
207		x.xUnroot = 0
208	} else {
209		x.xUnroot = purego.NewCallback(func(ManagerVarp uintptr) {
210			cb(LayoutManagerNewFromInternalPtr(ManagerVarp))
211		})
212	}
213}
214
215// GetUnroot gets the "unroot" callback function.
216// a virtual function, called when the widget using the layout
217//
218//	manager is detached from a `GtkRoot`
219func (x *LayoutManagerClass) GetUnroot() func(*LayoutManager) {
220	if x.xUnroot == 0 {
221		return nil
222	}
223	var rawCallback func(ManagerVarp uintptr)
224	purego.RegisterFunc(&rawCallback, x.xUnroot)
225	return func(ManagerVar *LayoutManager) {
226		rawCallback(ManagerVar.GoPointer())
227	}
228}
229
230// Handles the preferred size and allocation for children of a widget.
231//
232// You typically subclass `GtkLayoutManager` if you want to implement a
233// layout policy for the children of a widget, or if you want to determine
234// the size of a widget depending on its contents.
235//
236// Each `GtkWidget` can only have a `GtkLayoutManager` instance associated
237// to it at any given time; it is possible, though, to replace the layout
238// manager instance using [method@Gtk.Widget.set_layout_manager].
239//
240// ## Layout properties
241//
242// A layout manager can expose properties for controlling the layout of
243// each child, by creating an object type derived from [class@Gtk.LayoutChild]
244// and installing the properties on it as normal `GObject` properties.
245//
246// Each `GtkLayoutChild` instance storing the layout properties for a
247// specific child is created through the [method@Gtk.LayoutManager.get_layout_child]
248// method; a `GtkLayoutManager` controls the creation of its `GtkLayoutChild`
249// instances by overriding the GtkLayoutManagerClass.create_layout_child()
250// virtual function. The typical implementation should look like:
251//
252// ```c
253// static GtkLayoutChild *
254// create_layout_child (GtkLayoutManager *manager,
255//
256//	GtkWidget        *container,
257//	GtkWidget        *child)
258//
259//	{
260//	  return g_object_new (your_layout_child_get_type (),
261//	                       "layout-manager", manager,
262//	                       "child-widget", child,
263//	                       NULL);
264//	}
265//
266// ```
267//
268// The [property@Gtk.LayoutChild:layout-manager] and
269// [property@Gtk.LayoutChild:child-widget] properties
270// on the newly created `GtkLayoutChild` instance are mandatory. The
271// `GtkLayoutManager` will cache the newly created `GtkLayoutChild` instance
272// until the widget is removed from its parent, or the parent removes the
273// layout manager.
274//
275// Each `GtkLayoutManager` instance creating a `GtkLayoutChild` should use
276// [method@Gtk.LayoutManager.get_layout_child] every time it needs to query
277// the layout properties; each `GtkLayoutChild` instance should call
278// [method@Gtk.LayoutManager.layout_changed] every time a property is
279// updated, in order to queue a new size measuring and allocation.
280type LayoutManager struct {
281	gobject.Object
282}
283
284var xLayoutManagerGLibType func() types.GType
285
286func LayoutManagerGLibType() types.GType {
287	return xLayoutManagerGLibType()
288}
289
290func LayoutManagerNewFromInternalPtr(ptr uintptr) *LayoutManager {
291	cls := &LayoutManager{}
292	cls.Ptr = ptr
293	return cls
294}
295
296var xLayoutManagerAllocate func(uintptr, uintptr, int, int, int)
297
298// Assigns the given @width, @height, and @baseline to
299// a @widget, and computes the position and sizes of the children of
300// the @widget using the layout management policy of @manager.
301func (x *LayoutManager) Allocate(WidgetVar *Widget, WidthVar int, HeightVar int, BaselineVar int) {
302
303	xLayoutManagerAllocate(x.GoPointer(), WidgetVar.GoPointer(), WidthVar, HeightVar, BaselineVar)
304
305}
306
307var xLayoutManagerGetLayoutChild func(uintptr, uintptr) uintptr
308
309// Retrieves a `GtkLayoutChild` instance for the `GtkLayoutManager`,
310// creating one if necessary.
311//
312// The @child widget must be a child of the widget using @manager.
313//
314// The `GtkLayoutChild` instance is owned by the `GtkLayoutManager`,
315// and is guaranteed to exist as long as @child is a child of the
316// `GtkWidget` using the given `GtkLayoutManager`.
317func (x *LayoutManager) GetLayoutChild(ChildVar *Widget) *LayoutChild {
318	var cls *LayoutChild
319
320	cret := xLayoutManagerGetLayoutChild(x.GoPointer(), ChildVar.GoPointer())
321
322	if cret == 0 {
323		return nil
324	}
325	gobject.IncreaseRef(cret)
326	cls = &LayoutChild{}
327	cls.Ptr = cret
328	return cls
329}
330
331var xLayoutManagerGetRequestMode func(uintptr) SizeRequestMode
332
333// Retrieves the request mode of @manager.
334func (x *LayoutManager) GetRequestMode() SizeRequestMode {
335
336	cret := xLayoutManagerGetRequestMode(x.GoPointer())
337	return cret
338}
339
340var xLayoutManagerGetWidget func(uintptr) uintptr
341
342// Retrieves the `GtkWidget` using the given `GtkLayoutManager`.
343func (x *LayoutManager) GetWidget() *Widget {
344	var cls *Widget
345
346	cret := xLayoutManagerGetWidget(x.GoPointer())
347
348	if cret == 0 {
349		return nil
350	}
351	gobject.IncreaseRef(cret)
352	cls = &Widget{}
353	cls.Ptr = cret
354	return cls
355}
356
357var xLayoutManagerLayoutChanged func(uintptr)
358
359// Queues a resize on the `GtkWidget` using @manager, if any.
360//
361// This function should be called by subclasses of `GtkLayoutManager`
362// in response to changes to their layout management policies.
363func (x *LayoutManager) LayoutChanged() {
364
365	xLayoutManagerLayoutChanged(x.GoPointer())
366
367}
368
369var xLayoutManagerMeasure func(uintptr, uintptr, Orientation, int, *int, *int, *int, *int)
370
371// Measures the size of the @widget using @manager, for the
372// given @orientation and size.
373//
374// See the [class@Gtk.Widget] documentation on layout management for
375// more details.
376func (x *LayoutManager) Measure(WidgetVar *Widget, OrientationVar Orientation, ForSizeVar int, MinimumVar *int, NaturalVar *int, MinimumBaselineVar *int, NaturalBaselineVar *int) {
377
378	xLayoutManagerMeasure(x.GoPointer(), WidgetVar.GoPointer(), OrientationVar, ForSizeVar, MinimumVar, NaturalVar, MinimumBaselineVar, NaturalBaselineVar)
379
380}
381
382func (c *LayoutManager) GoPointer() uintptr {
383	if c == nil {
384		return 0
385	}
386	return c.Ptr
387}
388
389func (c *LayoutManager) SetGoPointer(ptr uintptr) {
390	c.Ptr = ptr
391}
392
393func init() {
394	core.SetPackageName("GTK", "gtk4")
395	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
396	var libs []uintptr
397	for _, libPath := range core.GetPaths("GTK") {
398		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
399		if err != nil {
400			panic(err)
401		}
402		libs = append(libs, lib)
403	}
404
405	core.PuregoSafeRegister(&xLayoutManagerGLibType, libs, "gtk_layout_manager_get_type")
406
407	core.PuregoSafeRegister(&xLayoutManagerAllocate, libs, "gtk_layout_manager_allocate")
408	core.PuregoSafeRegister(&xLayoutManagerGetLayoutChild, libs, "gtk_layout_manager_get_layout_child")
409	core.PuregoSafeRegister(&xLayoutManagerGetRequestMode, libs, "gtk_layout_manager_get_request_mode")
410	core.PuregoSafeRegister(&xLayoutManagerGetWidget, libs, "gtk_layout_manager_get_widget")
411	core.PuregoSafeRegister(&xLayoutManagerLayoutChanged, libs, "gtk_layout_manager_layout_changed")
412	core.PuregoSafeRegister(&xLayoutManagerMeasure, libs, "gtk_layout_manager_measure")
413
414}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close