v0.2.1 c0399be

gtkpagesetup.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"github.com/ebitengine/purego"
6
7	"github.com/bnema/puregotk/pkg/core"
8	"github.com/bnema/puregotk/v4/glib"
9	"github.com/bnema/puregotk/v4/gobject"
10	"github.com/bnema/puregotk/v4/gobject/types"
11)
12
13// Stores page size, orientation and margins for printing.
14//
15// The idea is that you can get one of these from the page setup dialog
16// and then pass it to the `GtkPrintOperation` when printing.
17// The benefit of splitting this out of the `GtkPrintSettings` is that
18// these affect the actual layout of the page, and thus need to be set
19// long before user prints.
20//
21// ## Margins
22//
23// The margins specified in this object are the “print margins”, i.e. the
24// parts of the page that the printer cannot print on. These are different
25// from the layout margins that a word processor uses; they are typically
26// used to determine the minimal size for the layout margins.
27//
28// To obtain a `GtkPageSetup` use [ctor@Gtk.PageSetup.new] to get the defaults,
29// or use [func@Gtk.print_run_page_setup_dialog] to show the page setup dialog
30// and receive the resulting page setup.
31//
32// ## A page setup dialog
33//
34// ```c
35// static GtkPrintSettings *settings = NULL;
36// static GtkPageSetup *page_setup = NULL;
37//
38// static void
39// do_page_setup (void)
40//
41//	{
42//	  GtkPageSetup *new_page_setup;
43//
44//	  if (settings == NULL)
45//	    settings = gtk_print_settings_new ();
46//
47//	  new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window),
48//	                                                    page_setup, settings);
49//
50//	  if (page_setup)
51//	    g_object_unref (page_setup);
52//
53//	  page_setup = new_page_setup;
54//	}
55//
56// ```
57type PageSetup struct {
58	gobject.Object
59}
60
61var xPageSetupGLibType func() types.GType
62
63func PageSetupGLibType() types.GType {
64	return xPageSetupGLibType()
65}
66
67func PageSetupNewFromInternalPtr(ptr uintptr) *PageSetup {
68	cls := &PageSetup{}
69	cls.Ptr = ptr
70	return cls
71}
72
73var xNewPageSetup func() uintptr
74
75// Creates a new `GtkPageSetup`.
76func NewPageSetup() *PageSetup {
77	var cls *PageSetup
78
79	cret := xNewPageSetup()
80
81	if cret == 0 {
82		return nil
83	}
84	cls = &PageSetup{}
85	cls.Ptr = cret
86	return cls
87}
88
89var xNewPageSetupFromFile func(string, **glib.Error) uintptr
90
91// Reads the page setup from the file @file_name.
92//
93// Returns a new `GtkPageSetup` object with the restored
94// page setup, or %NULL if an error occurred.
95// See [method@Gtk.PageSetup.to_file].
96func NewPageSetupFromFile(FileNameVar string) (*PageSetup, error) {
97	var cls *PageSetup
98	var cerr *glib.Error
99
100	cret := xNewPageSetupFromFile(FileNameVar, &cerr)
101
102	if cret == 0 {
103		return nil, cerr
104	}
105	cls = &PageSetup{}
106	cls.Ptr = cret
107	if cerr == nil {
108		return cls, nil
109	}
110	return cls, cerr
111
112}
113
114var xNewPageSetupFromGvariant func(*glib.Variant) uintptr
115
116// Desrialize a page setup from an a{sv} variant.
117//
118// The variant must be in the format produced by
119// [method@Gtk.PageSetup.to_gvariant].
120func NewPageSetupFromGvariant(VariantVar *glib.Variant) *PageSetup {
121	var cls *PageSetup
122
123	cret := xNewPageSetupFromGvariant(VariantVar)
124
125	if cret == 0 {
126		return nil
127	}
128	cls = &PageSetup{}
129	cls.Ptr = cret
130	return cls
131}
132
133var xNewPageSetupFromKeyFile func(*glib.KeyFile, uintptr, **glib.Error) uintptr
134
135// Reads the page setup from the group @group_name in the key file
136// @key_file.
137//
138// Returns a new `GtkPageSetup` object with the restored
139// page setup, or %NULL if an error occurred.
140func NewPageSetupFromKeyFile(KeyFileVar *glib.KeyFile, GroupNameVar *string) (*PageSetup, error) {
141	var cls *PageSetup
142	var cerr *glib.Error
143
144	GroupNameVarPtr := core.GStrdupNullable(GroupNameVar)
145	defer core.GFreeNullable(GroupNameVarPtr)
146
147	cret := xNewPageSetupFromKeyFile(KeyFileVar, GroupNameVarPtr, &cerr)
148
149	if cret == 0 {
150		return nil, cerr
151	}
152	cls = &PageSetup{}
153	cls.Ptr = cret
154	if cerr == nil {
155		return cls, nil
156	}
157	return cls, cerr
158
159}
160
161var xPageSetupCopy func(uintptr) uintptr
162
163// Copies a `GtkPageSetup`.
164func (x *PageSetup) Copy() *PageSetup {
165	var cls *PageSetup
166
167	cret := xPageSetupCopy(x.GoPointer())
168
169	if cret == 0 {
170		return nil
171	}
172	cls = &PageSetup{}
173	cls.Ptr = cret
174	return cls
175}
176
177var xPageSetupGetBottomMargin func(uintptr, Unit) float64
178
179// Gets the bottom margin in units of @unit.
180func (x *PageSetup) GetBottomMargin(UnitVar Unit) float64 {
181
182	cret := xPageSetupGetBottomMargin(x.GoPointer(), UnitVar)
183	return cret
184}
185
186var xPageSetupGetLeftMargin func(uintptr, Unit) float64
187
188// Gets the left margin in units of @unit.
189func (x *PageSetup) GetLeftMargin(UnitVar Unit) float64 {
190
191	cret := xPageSetupGetLeftMargin(x.GoPointer(), UnitVar)
192	return cret
193}
194
195var xPageSetupGetOrientation func(uintptr) PageOrientation
196
197// Gets the page orientation of the `GtkPageSetup`.
198func (x *PageSetup) GetOrientation() PageOrientation {
199
200	cret := xPageSetupGetOrientation(x.GoPointer())
201	return cret
202}
203
204var xPageSetupGetPageHeight func(uintptr, Unit) float64
205
206// Returns the page height in units of @unit.
207//
208// Note that this function takes orientation
209// and margins into consideration.
210// See [method@Gtk.PageSetup.get_paper_height].
211func (x *PageSetup) GetPageHeight(UnitVar Unit) float64 {
212
213	cret := xPageSetupGetPageHeight(x.GoPointer(), UnitVar)
214	return cret
215}
216
217var xPageSetupGetPageWidth func(uintptr, Unit) float64
218
219// Returns the page width in units of @unit.
220//
221// Note that this function takes orientation
222// and margins into consideration.
223// See [method@Gtk.PageSetup.get_paper_width].
224func (x *PageSetup) GetPageWidth(UnitVar Unit) float64 {
225
226	cret := xPageSetupGetPageWidth(x.GoPointer(), UnitVar)
227	return cret
228}
229
230var xPageSetupGetPaperHeight func(uintptr, Unit) float64
231
232// Returns the paper height in units of @unit.
233//
234// Note that this function takes orientation,
235// but not margins into consideration.
236// See [method@Gtk.PageSetup.get_page_height].
237func (x *PageSetup) GetPaperHeight(UnitVar Unit) float64 {
238
239	cret := xPageSetupGetPaperHeight(x.GoPointer(), UnitVar)
240	return cret
241}
242
243var xPageSetupGetPaperSize func(uintptr) *PaperSize
244
245// Gets the paper size of the `GtkPageSetup`.
246func (x *PageSetup) GetPaperSize() *PaperSize {
247
248	cret := xPageSetupGetPaperSize(x.GoPointer())
249	return cret
250}
251
252var xPageSetupGetPaperWidth func(uintptr, Unit) float64
253
254// Returns the paper width in units of @unit.
255//
256// Note that this function takes orientation,
257// but not margins into consideration.
258// See [method@Gtk.PageSetup.get_page_width].
259func (x *PageSetup) GetPaperWidth(UnitVar Unit) float64 {
260
261	cret := xPageSetupGetPaperWidth(x.GoPointer(), UnitVar)
262	return cret
263}
264
265var xPageSetupGetRightMargin func(uintptr, Unit) float64
266
267// Gets the right margin in units of @unit.
268func (x *PageSetup) GetRightMargin(UnitVar Unit) float64 {
269
270	cret := xPageSetupGetRightMargin(x.GoPointer(), UnitVar)
271	return cret
272}
273
274var xPageSetupGetTopMargin func(uintptr, Unit) float64
275
276// Gets the top margin in units of @unit.
277func (x *PageSetup) GetTopMargin(UnitVar Unit) float64 {
278
279	cret := xPageSetupGetTopMargin(x.GoPointer(), UnitVar)
280	return cret
281}
282
283var xPageSetupLoadFile func(uintptr, string, **glib.Error) bool
284
285// Reads the page setup from the file @file_name.
286//
287// See [method@Gtk.PageSetup.to_file].
288func (x *PageSetup) LoadFile(FileNameVar string) (bool, error) {
289	var cerr *glib.Error
290
291	cret := xPageSetupLoadFile(x.GoPointer(), FileNameVar, &cerr)
292	if cerr == nil {
293		return cret, nil
294	}
295	return cret, cerr
296
297}
298
299var xPageSetupLoadKeyFile func(uintptr, *glib.KeyFile, uintptr, **glib.Error) bool
300
301// Reads the page setup from the group @group_name in the key file
302// @key_file.
303func (x *PageSetup) LoadKeyFile(KeyFileVar *glib.KeyFile, GroupNameVar *string) (bool, error) {
304	var cerr *glib.Error
305
306	GroupNameVarPtr := core.GStrdupNullable(GroupNameVar)
307	defer core.GFreeNullable(GroupNameVarPtr)
308
309	cret := xPageSetupLoadKeyFile(x.GoPointer(), KeyFileVar, GroupNameVarPtr, &cerr)
310	if cerr == nil {
311		return cret, nil
312	}
313	return cret, cerr
314
315}
316
317var xPageSetupSetBottomMargin func(uintptr, float64, Unit)
318
319// Sets the bottom margin of the `GtkPageSetup`.
320func (x *PageSetup) SetBottomMargin(MarginVar float64, UnitVar Unit) {
321
322	xPageSetupSetBottomMargin(x.GoPointer(), MarginVar, UnitVar)
323
324}
325
326var xPageSetupSetLeftMargin func(uintptr, float64, Unit)
327
328// Sets the left margin of the `GtkPageSetup`.
329func (x *PageSetup) SetLeftMargin(MarginVar float64, UnitVar Unit) {
330
331	xPageSetupSetLeftMargin(x.GoPointer(), MarginVar, UnitVar)
332
333}
334
335var xPageSetupSetOrientation func(uintptr, PageOrientation)
336
337// Sets the page orientation of the `GtkPageSetup`.
338func (x *PageSetup) SetOrientation(OrientationVar PageOrientation) {
339
340	xPageSetupSetOrientation(x.GoPointer(), OrientationVar)
341
342}
343
344var xPageSetupSetPaperSize func(uintptr, *PaperSize)
345
346// Sets the paper size of the `GtkPageSetup` without
347// changing the margins.
348//
349// See [method@Gtk.PageSetup.set_paper_size_and_default_margins].
350func (x *PageSetup) SetPaperSize(SizeVar *PaperSize) {
351
352	xPageSetupSetPaperSize(x.GoPointer(), SizeVar)
353
354}
355
356var xPageSetupSetPaperSizeAndDefaultMargins func(uintptr, *PaperSize)
357
358// Sets the paper size of the `GtkPageSetup` and modifies
359// the margins according to the new paper size.
360func (x *PageSetup) SetPaperSizeAndDefaultMargins(SizeVar *PaperSize) {
361
362	xPageSetupSetPaperSizeAndDefaultMargins(x.GoPointer(), SizeVar)
363
364}
365
366var xPageSetupSetRightMargin func(uintptr, float64, Unit)
367
368// Sets the right margin of the `GtkPageSetup`.
369func (x *PageSetup) SetRightMargin(MarginVar float64, UnitVar Unit) {
370
371	xPageSetupSetRightMargin(x.GoPointer(), MarginVar, UnitVar)
372
373}
374
375var xPageSetupSetTopMargin func(uintptr, float64, Unit)
376
377// Sets the top margin of the `GtkPageSetup`.
378func (x *PageSetup) SetTopMargin(MarginVar float64, UnitVar Unit) {
379
380	xPageSetupSetTopMargin(x.GoPointer(), MarginVar, UnitVar)
381
382}
383
384var xPageSetupToFile func(uintptr, string, **glib.Error) bool
385
386// This function saves the information from @setup to @file_name.
387func (x *PageSetup) ToFile(FileNameVar string) (bool, error) {
388	var cerr *glib.Error
389
390	cret := xPageSetupToFile(x.GoPointer(), FileNameVar, &cerr)
391	if cerr == nil {
392		return cret, nil
393	}
394	return cret, cerr
395
396}
397
398var xPageSetupToGvariant func(uintptr) *glib.Variant
399
400// Serialize page setup to an a{sv} variant.
401func (x *PageSetup) ToGvariant() *glib.Variant {
402
403	cret := xPageSetupToGvariant(x.GoPointer())
404	return cret
405}
406
407var xPageSetupToKeyFile func(uintptr, *glib.KeyFile, uintptr)
408
409// This function adds the page setup from @setup to @key_file.
410func (x *PageSetup) ToKeyFile(KeyFileVar *glib.KeyFile, GroupNameVar *string) {
411
412	GroupNameVarPtr := core.GStrdupNullable(GroupNameVar)
413	defer core.GFreeNullable(GroupNameVarPtr)
414
415	xPageSetupToKeyFile(x.GoPointer(), KeyFileVar, GroupNameVarPtr)
416
417}
418
419func (c *PageSetup) GoPointer() uintptr {
420	if c == nil {
421		return 0
422	}
423	return c.Ptr
424}
425
426func (c *PageSetup) SetGoPointer(ptr uintptr) {
427	c.Ptr = ptr
428}
429
430func init() {
431	core.SetPackageName("GTK", "gtk4")
432	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
433	var libs []uintptr
434	for _, libPath := range core.GetPaths("GTK") {
435		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
436		if err != nil {
437			panic(err)
438		}
439		libs = append(libs, lib)
440	}
441
442	core.PuregoSafeRegister(&xPageSetupGLibType, libs, "gtk_page_setup_get_type")
443
444	core.PuregoSafeRegister(&xNewPageSetup, libs, "gtk_page_setup_new")
445	core.PuregoSafeRegister(&xNewPageSetupFromFile, libs, "gtk_page_setup_new_from_file")
446	core.PuregoSafeRegister(&xNewPageSetupFromGvariant, libs, "gtk_page_setup_new_from_gvariant")
447	core.PuregoSafeRegister(&xNewPageSetupFromKeyFile, libs, "gtk_page_setup_new_from_key_file")
448
449	core.PuregoSafeRegister(&xPageSetupCopy, libs, "gtk_page_setup_copy")
450	core.PuregoSafeRegister(&xPageSetupGetBottomMargin, libs, "gtk_page_setup_get_bottom_margin")
451	core.PuregoSafeRegister(&xPageSetupGetLeftMargin, libs, "gtk_page_setup_get_left_margin")
452	core.PuregoSafeRegister(&xPageSetupGetOrientation, libs, "gtk_page_setup_get_orientation")
453	core.PuregoSafeRegister(&xPageSetupGetPageHeight, libs, "gtk_page_setup_get_page_height")
454	core.PuregoSafeRegister(&xPageSetupGetPageWidth, libs, "gtk_page_setup_get_page_width")
455	core.PuregoSafeRegister(&xPageSetupGetPaperHeight, libs, "gtk_page_setup_get_paper_height")
456	core.PuregoSafeRegister(&xPageSetupGetPaperSize, libs, "gtk_page_setup_get_paper_size")
457	core.PuregoSafeRegister(&xPageSetupGetPaperWidth, libs, "gtk_page_setup_get_paper_width")
458	core.PuregoSafeRegister(&xPageSetupGetRightMargin, libs, "gtk_page_setup_get_right_margin")
459	core.PuregoSafeRegister(&xPageSetupGetTopMargin, libs, "gtk_page_setup_get_top_margin")
460	core.PuregoSafeRegister(&xPageSetupLoadFile, libs, "gtk_page_setup_load_file")
461	core.PuregoSafeRegister(&xPageSetupLoadKeyFile, libs, "gtk_page_setup_load_key_file")
462	core.PuregoSafeRegister(&xPageSetupSetBottomMargin, libs, "gtk_page_setup_set_bottom_margin")
463	core.PuregoSafeRegister(&xPageSetupSetLeftMargin, libs, "gtk_page_setup_set_left_margin")
464	core.PuregoSafeRegister(&xPageSetupSetOrientation, libs, "gtk_page_setup_set_orientation")
465	core.PuregoSafeRegister(&xPageSetupSetPaperSize, libs, "gtk_page_setup_set_paper_size")
466	core.PuregoSafeRegister(&xPageSetupSetPaperSizeAndDefaultMargins, libs, "gtk_page_setup_set_paper_size_and_default_margins")
467	core.PuregoSafeRegister(&xPageSetupSetRightMargin, libs, "gtk_page_setup_set_right_margin")
468	core.PuregoSafeRegister(&xPageSetupSetTopMargin, libs, "gtk_page_setup_set_top_margin")
469	core.PuregoSafeRegister(&xPageSetupToFile, libs, "gtk_page_setup_to_file")
470	core.PuregoSafeRegister(&xPageSetupToGvariant, libs, "gtk_page_setup_to_gvariant")
471	core.PuregoSafeRegister(&xPageSetupToKeyFile, libs, "gtk_page_setup_to_key_file")
472
473}

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