gtkfixedlayout.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 "github.com/bnema/puregotk/v4/gsk"
14)
15
16type FixedLayoutChildClass struct {
17 _ structs.HostLayout
18
19 ParentClass LayoutChildClass
20}
21
22func (x *FixedLayoutChildClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26type FixedLayoutClass struct {
27 _ structs.HostLayout
28
29 ParentClass LayoutManagerClass
30}
31
32func (x *FixedLayoutClass) GoPointer() uintptr {
33 return uintptr(unsafe.Pointer(x))
34}
35
36// Places child widgets at fixed positions.
37//
38// Most applications should never use this layout manager; fixed positioning
39// and sizing requires constant recalculations on where children need to be
40// positioned and sized. Other layout managers perform this kind of work
41// internally so that application developers don't need to do it. Specifically,
42// widgets positioned in a fixed layout manager will need to take into account:
43//
44// - Themes, which may change widget sizes.
45//
46// - Fonts other than the one you used to write the app will of course
47// change the size of widgets containing text; keep in mind that
48// users may use a larger font because of difficulty reading the
49// default, or they may be using a different OS that provides different
50// fonts.
51//
52// - Translation of text into other languages changes its size. Also,
53// display of non-English text will use a different font in many
54// cases.
55//
56// In addition, `GtkFixedLayout` does not pay attention to text direction and
57// thus may produce unwanted results if your app is run under right-to-left
58// languages such as Hebrew or Arabic. That is: normally GTK will order
59// containers appropriately depending on the text direction, e.g. to put labels
60// to the right of the thing they label when using an RTL language;
61// `GtkFixedLayout` won't be able to do that for you.
62//
63// Finally, fixed positioning makes it kind of annoying to add/remove UI
64// elements, since you have to reposition all the other elements. This is a
65// long-term maintenance problem for your application.
66type FixedLayout struct {
67 LayoutManager
68}
69
70var xFixedLayoutGLibType func() types.GType
71
72func FixedLayoutGLibType() types.GType {
73 return xFixedLayoutGLibType()
74}
75
76func FixedLayoutNewFromInternalPtr(ptr uintptr) *FixedLayout {
77 cls := &FixedLayout{}
78 cls.Ptr = ptr
79 return cls
80}
81
82var xNewFixedLayout func() uintptr
83
84// Creates a new `GtkFixedLayout`.
85func NewFixedLayout() *FixedLayout {
86 var cls *FixedLayout
87
88 cret := xNewFixedLayout()
89
90 if cret == 0 {
91 return nil
92 }
93 cls = &FixedLayout{}
94 cls.Ptr = cret
95 return cls
96}
97
98func (c *FixedLayout) GoPointer() uintptr {
99 if c == nil {
100 return 0
101 }
102 return c.Ptr
103}
104
105func (c *FixedLayout) SetGoPointer(ptr uintptr) {
106 c.Ptr = ptr
107}
108
109// `GtkLayoutChild` subclass for children in a `GtkFixedLayout`.
110type FixedLayoutChild struct {
111 LayoutChild
112}
113
114var xFixedLayoutChildGLibType func() types.GType
115
116func FixedLayoutChildGLibType() types.GType {
117 return xFixedLayoutChildGLibType()
118}
119
120func FixedLayoutChildNewFromInternalPtr(ptr uintptr) *FixedLayoutChild {
121 cls := &FixedLayoutChild{}
122 cls.Ptr = ptr
123 return cls
124}
125
126var xFixedLayoutChildGetTransform func(uintptr) *gsk.Transform
127
128// Retrieves the transformation of the child.
129func (x *FixedLayoutChild) GetTransform() *gsk.Transform {
130
131 cret := xFixedLayoutChildGetTransform(x.GoPointer())
132 return cret
133}
134
135var xFixedLayoutChildSetTransform func(uintptr, *gsk.Transform)
136
137// Sets the transformation of the child of a `GtkFixedLayout`.
138func (x *FixedLayoutChild) SetTransform(TransformVar *gsk.Transform) {
139
140 xFixedLayoutChildSetTransform(x.GoPointer(), TransformVar)
141
142}
143
144func (c *FixedLayoutChild) GoPointer() uintptr {
145 if c == nil {
146 return 0
147 }
148 return c.Ptr
149}
150
151func (c *FixedLayoutChild) SetGoPointer(ptr uintptr) {
152 c.Ptr = ptr
153}
154
155// SetPropertyTransform sets the "transform" property.
156// The transform of the child.
157func (x *FixedLayoutChild) SetPropertyTransform(value uintptr) {
158 var v gobject.Value
159 v.Init(gobject.TypePointerVal)
160 v.SetPointer(value)
161 x.SetProperty("transform", &v)
162}
163
164// GetPropertyTransform gets the "transform" property.
165// The transform of the child.
166func (x *FixedLayoutChild) GetPropertyTransform() uintptr {
167 var v gobject.Value
168 x.GetProperty("transform", &v)
169 return v.GetPointer()
170}
171
172func init() {
173 core.SetPackageName("GTK", "gtk4")
174 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
175 var libs []uintptr
176 for _, libPath := range core.GetPaths("GTK") {
177 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
178 if err != nil {
179 panic(err)
180 }
181 libs = append(libs, lib)
182 }
183
184 core.PuregoSafeRegister(&xFixedLayoutGLibType, libs, "gtk_fixed_layout_get_type")
185
186 core.PuregoSafeRegister(&xNewFixedLayout, libs, "gtk_fixed_layout_new")
187
188 core.PuregoSafeRegister(&xFixedLayoutChildGLibType, libs, "gtk_fixed_layout_child_get_type")
189
190 core.PuregoSafeRegister(&xFixedLayoutChildGetTransform, libs, "gtk_fixed_layout_child_get_transform")
191 core.PuregoSafeRegister(&xFixedLayoutChildSetTransform, libs, "gtk_fixed_layout_child_set_transform")
192
193}