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/glib"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// `GtkPaperSize` handles paper sizes.
16//
17// It uses the standard called
18// [PWG 5101.1-2002 PWG: Standard for Media Standardized Names](http://www.pwg.org/standards.html)
19// to name the paper sizes (and to get the data for the page sizes).
20// In addition to standard paper sizes, `GtkPaperSize` allows to
21// construct custom paper sizes with arbitrary dimensions.
22//
23// The `GtkPaperSize` object stores not only the dimensions (width
24// and height) of a paper size and its name, it also provides
25// default print margins.
26type PaperSize struct {
27 _ structs.HostLayout
28}
29
30var xPaperSizeGLibType func() types.GType
31
32func PaperSizeGLibType() types.GType {
33 return xPaperSizeGLibType()
34}
35
36func (x *PaperSize) GoPointer() uintptr {
37 return uintptr(unsafe.Pointer(x))
38}
39
40var xNewPaperSize func(uintptr) *PaperSize
41
42// Creates a new `GtkPaperSize` object by parsing a
43// [PWG 5101.1-2002](ftp://ftp.pwg.org/pub/pwg/candidates/cs-pwgmsn10-20020226-5101.1.pdf)
44// paper name.
45//
46// If @name is %NULL, the default paper size is returned,
47// see [func@Gtk.PaperSize.get_default].
48func NewPaperSize(NameVar *string) *PaperSize {
49
50 NameVarPtr := core.GStrdupNullable(NameVar)
51 defer core.GFreeNullable(NameVarPtr)
52
53 cret := xNewPaperSize(NameVarPtr)
54 return cret
55}
56
57var xNewPaperSizeCustom func(string, string, float64, float64, Unit) *PaperSize
58
59// Creates a new `GtkPaperSize` object with the
60// given parameters.
61func NewPaperSizeCustom(NameVar string, DisplayNameVar string, WidthVar float64, HeightVar float64, UnitVar Unit) *PaperSize {
62
63 cret := xNewPaperSizeCustom(NameVar, DisplayNameVar, WidthVar, HeightVar, UnitVar)
64 return cret
65}
66
67var xNewPaperSizeFromGvariant func(*glib.Variant) *PaperSize
68
69// Deserialize a paper size from a `GVariant`.
70//
71// The `GVariant must be in the format produced by
72// [method@Gtk.PaperSize.to_gvariant].
73func NewPaperSizeFromGvariant(VariantVar *glib.Variant) *PaperSize {
74
75 cret := xNewPaperSizeFromGvariant(VariantVar)
76 return cret
77}
78
79var xNewPaperSizeFromIpp func(string, float64, float64) *PaperSize
80
81// Creates a new `GtkPaperSize` object by using
82// IPP information.
83//
84// If @ipp_name is not a recognized paper name,
85// @width and @height are used to
86// construct a custom `GtkPaperSize` object.
87func NewPaperSizeFromIpp(IppNameVar string, WidthVar float64, HeightVar float64) *PaperSize {
88
89 cret := xNewPaperSizeFromIpp(IppNameVar, WidthVar, HeightVar)
90 return cret
91}
92
93var xNewPaperSizeFromKeyFile func(*glib.KeyFile, uintptr, **glib.Error) *PaperSize
94
95// Reads a paper size from the group @group_name in the key file
96// @key_file.
97func NewPaperSizeFromKeyFile(KeyFileVar *glib.KeyFile, GroupNameVar *string) (*PaperSize, error) {
98 var cerr *glib.Error
99
100 GroupNameVarPtr := core.GStrdupNullable(GroupNameVar)
101 defer core.GFreeNullable(GroupNameVarPtr)
102
103 cret := xNewPaperSizeFromKeyFile(KeyFileVar, GroupNameVarPtr, &cerr)
104 if cerr == nil {
105 return cret, nil
106 }
107 return cret, cerr
108
109}
110
111var xNewPaperSizeFromPpd func(string, string, float64, float64) *PaperSize
112
113// Creates a new `GtkPaperSize` object by using
114// PPD information.
115//
116// If @ppd_name is not a recognized PPD paper name,
117// @ppd_display_name, @width and @height are used to
118// construct a custom `GtkPaperSize` object.
119func NewPaperSizeFromPpd(PpdNameVar string, PpdDisplayNameVar string, WidthVar float64, HeightVar float64) *PaperSize {
120
121 cret := xNewPaperSizeFromPpd(PpdNameVar, PpdDisplayNameVar, WidthVar, HeightVar)
122 return cret
123}
124
125var xPaperSizeCopy func(uintptr) *PaperSize
126
127// Copies an existing `GtkPaperSize`.
128func (x *PaperSize) Copy() *PaperSize {
129
130 cret := xPaperSizeCopy(x.GoPointer())
131 return cret
132}
133
134var xPaperSizeFree func(uintptr)
135
136// Free the given `GtkPaperSize` object.
137func (x *PaperSize) Free() {
138
139 xPaperSizeFree(x.GoPointer())
140
141}
142
143var xPaperSizeGetDefaultBottomMargin func(uintptr, Unit) float64
144
145// Gets the default bottom margin for the `GtkPaperSize`.
146func (x *PaperSize) GetDefaultBottomMargin(UnitVar Unit) float64 {
147
148 cret := xPaperSizeGetDefaultBottomMargin(x.GoPointer(), UnitVar)
149 return cret
150}
151
152var xPaperSizeGetDefaultLeftMargin func(uintptr, Unit) float64
153
154// Gets the default left margin for the `GtkPaperSize`.
155func (x *PaperSize) GetDefaultLeftMargin(UnitVar Unit) float64 {
156
157 cret := xPaperSizeGetDefaultLeftMargin(x.GoPointer(), UnitVar)
158 return cret
159}
160
161var xPaperSizeGetDefaultRightMargin func(uintptr, Unit) float64
162
163// Gets the default right margin for the `GtkPaperSize`.
164func (x *PaperSize) GetDefaultRightMargin(UnitVar Unit) float64 {
165
166 cret := xPaperSizeGetDefaultRightMargin(x.GoPointer(), UnitVar)
167 return cret
168}
169
170var xPaperSizeGetDefaultTopMargin func(uintptr, Unit) float64
171
172// Gets the default top margin for the `GtkPaperSize`.
173func (x *PaperSize) GetDefaultTopMargin(UnitVar Unit) float64 {
174
175 cret := xPaperSizeGetDefaultTopMargin(x.GoPointer(), UnitVar)
176 return cret
177}
178
179var xPaperSizeGetDisplayName func(uintptr) string
180
181// Gets the human-readable name of the `GtkPaperSize`.
182func (x *PaperSize) GetDisplayName() string {
183
184 cret := xPaperSizeGetDisplayName(x.GoPointer())
185 return cret
186}
187
188var xPaperSizeGetHeight func(uintptr, Unit) float64
189
190// Gets the paper height of the `GtkPaperSize`, in
191// units of @unit.
192func (x *PaperSize) GetHeight(UnitVar Unit) float64 {
193
194 cret := xPaperSizeGetHeight(x.GoPointer(), UnitVar)
195 return cret
196}
197
198var xPaperSizeGetName func(uintptr) string
199
200// Gets the name of the `GtkPaperSize`.
201func (x *PaperSize) GetName() string {
202
203 cret := xPaperSizeGetName(x.GoPointer())
204 return cret
205}
206
207var xPaperSizeGetPpdName func(uintptr) string
208
209// Gets the PPD name of the `GtkPaperSize`, which
210// may be %NULL.
211func (x *PaperSize) GetPpdName() string {
212
213 cret := xPaperSizeGetPpdName(x.GoPointer())
214 return cret
215}
216
217var xPaperSizeGetWidth func(uintptr, Unit) float64
218
219// Gets the paper width of the `GtkPaperSize`, in
220// units of @unit.
221func (x *PaperSize) GetWidth(UnitVar Unit) float64 {
222
223 cret := xPaperSizeGetWidth(x.GoPointer(), UnitVar)
224 return cret
225}
226
227var xPaperSizeIsCustom func(uintptr) bool
228
229// Returns %TRUE if @size is not a standard paper size.
230func (x *PaperSize) IsCustom() bool {
231
232 cret := xPaperSizeIsCustom(x.GoPointer())
233 return cret
234}
235
236var xPaperSizeIsEqual func(uintptr, *PaperSize) bool
237
238// Compares two `GtkPaperSize` objects.
239func (x *PaperSize) IsEqual(Size2Var *PaperSize) bool {
240
241 cret := xPaperSizeIsEqual(x.GoPointer(), Size2Var)
242 return cret
243}
244
245var xPaperSizeIsIpp func(uintptr) bool
246
247// Returns %TRUE if @size is an IPP standard paper size.
248func (x *PaperSize) IsIpp() bool {
249
250 cret := xPaperSizeIsIpp(x.GoPointer())
251 return cret
252}
253
254var xPaperSizeSetSize func(uintptr, float64, float64, Unit)
255
256// Changes the dimensions of a @size to @width x @height.
257func (x *PaperSize) SetSize(WidthVar float64, HeightVar float64, UnitVar Unit) {
258
259 xPaperSizeSetSize(x.GoPointer(), WidthVar, HeightVar, UnitVar)
260
261}
262
263var xPaperSizeToGvariant func(uintptr) *glib.Variant
264
265// Serialize a paper size to an `a{sv}` variant.
266func (x *PaperSize) ToGvariant() *glib.Variant {
267
268 cret := xPaperSizeToGvariant(x.GoPointer())
269 return cret
270}
271
272var xPaperSizeToKeyFile func(uintptr, *glib.KeyFile, string)
273
274// This function adds the paper size from @size to @key_file.
275func (x *PaperSize) ToKeyFile(KeyFileVar *glib.KeyFile, GroupNameVar string) {
276
277 xPaperSizeToKeyFile(x.GoPointer(), KeyFileVar, GroupNameVar)
278
279}
280
281const (
282 // Name for the A3 paper size.
283 PAPER_NAME_A3 string = "iso_a3"
284 // Name for the A4 paper size.
285 PAPER_NAME_A4 string = "iso_a4"
286 // Name for the A5 paper size.
287 PAPER_NAME_A5 string = "iso_a5"
288 // Name for the B5 paper size.
289 PAPER_NAME_B5 string = "iso_b5"
290 // Name for the Executive paper size.
291 PAPER_NAME_EXECUTIVE string = "na_executive"
292 // Name for the Legal paper size.
293 PAPER_NAME_LEGAL string = "na_legal"
294 // Name for the Letter paper size.
295 PAPER_NAME_LETTER string = "na_letter"
296)
297
298var xPaperSizeGetDefault func() string
299
300// Returns the name of the default paper size, which
301// depends on the current locale.
302func PaperSizeGetDefault() string {
303
304 cret := xPaperSizeGetDefault()
305 return cret
306}
307
308var xPaperSizeGetPaperSizes func(bool) *glib.List
309
310// Creates a list of known paper sizes.
311func PaperSizeGetPaperSizes(IncludeCustomVar bool) *glib.List {
312
313 cret := xPaperSizeGetPaperSizes(IncludeCustomVar)
314 return cret
315}
316
317func init() {
318 core.SetPackageName("GTK", "gtk4")
319 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
320 var libs []uintptr
321 for _, libPath := range core.GetPaths("GTK") {
322 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
323 if err != nil {
324 panic(err)
325 }
326 libs = append(libs, lib)
327 }
328
329 core.PuregoSafeRegister(&xPaperSizeGetDefault, libs, "gtk_paper_size_get_default")
330 core.PuregoSafeRegister(&xPaperSizeGetPaperSizes, libs, "gtk_paper_size_get_paper_sizes")
331
332 core.PuregoSafeRegister(&xPaperSizeGLibType, libs, "gtk_paper_size_get_type")
333
334 core.PuregoSafeRegister(&xNewPaperSize, libs, "gtk_paper_size_new")
335 core.PuregoSafeRegister(&xNewPaperSizeCustom, libs, "gtk_paper_size_new_custom")
336 core.PuregoSafeRegister(&xNewPaperSizeFromGvariant, libs, "gtk_paper_size_new_from_gvariant")
337 core.PuregoSafeRegister(&xNewPaperSizeFromIpp, libs, "gtk_paper_size_new_from_ipp")
338 core.PuregoSafeRegister(&xNewPaperSizeFromKeyFile, libs, "gtk_paper_size_new_from_key_file")
339 core.PuregoSafeRegister(&xNewPaperSizeFromPpd, libs, "gtk_paper_size_new_from_ppd")
340
341 core.PuregoSafeRegister(&xPaperSizeCopy, libs, "gtk_paper_size_copy")
342 core.PuregoSafeRegister(&xPaperSizeFree, libs, "gtk_paper_size_free")
343 core.PuregoSafeRegister(&xPaperSizeGetDefaultBottomMargin, libs, "gtk_paper_size_get_default_bottom_margin")
344 core.PuregoSafeRegister(&xPaperSizeGetDefaultLeftMargin, libs, "gtk_paper_size_get_default_left_margin")
345 core.PuregoSafeRegister(&xPaperSizeGetDefaultRightMargin, libs, "gtk_paper_size_get_default_right_margin")
346 core.PuregoSafeRegister(&xPaperSizeGetDefaultTopMargin, libs, "gtk_paper_size_get_default_top_margin")
347 core.PuregoSafeRegister(&xPaperSizeGetDisplayName, libs, "gtk_paper_size_get_display_name")
348 core.PuregoSafeRegister(&xPaperSizeGetHeight, libs, "gtk_paper_size_get_height")
349 core.PuregoSafeRegister(&xPaperSizeGetName, libs, "gtk_paper_size_get_name")
350 core.PuregoSafeRegister(&xPaperSizeGetPpdName, libs, "gtk_paper_size_get_ppd_name")
351 core.PuregoSafeRegister(&xPaperSizeGetWidth, libs, "gtk_paper_size_get_width")
352 core.PuregoSafeRegister(&xPaperSizeIsCustom, libs, "gtk_paper_size_is_custom")
353 core.PuregoSafeRegister(&xPaperSizeIsEqual, libs, "gtk_paper_size_is_equal")
354 core.PuregoSafeRegister(&xPaperSizeIsIpp, libs, "gtk_paper_size_is_ipp")
355 core.PuregoSafeRegister(&xPaperSizeSetSize, libs, "gtk_paper_size_set_size")
356 core.PuregoSafeRegister(&xPaperSizeToGvariant, libs, "gtk_paper_size_to_gvariant")
357 core.PuregoSafeRegister(&xPaperSizeToKeyFile, libs, "gtk_paper_size_to_key_file")
358
359}