v0.2.2 9100209

gtkprintjob.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"unsafe"
6
7	"github.com/ebitengine/purego"
8
9	"github.com/bnema/puregotk/pkg/core"
10	"github.com/bnema/puregotk/v4/cairo"
11	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// The type of callback that is passed to gtk_print_job_send().
17//
18// It is called when the print job has been completely sent.
19type PrintJobCompleteFunc func(uintptr, uintptr, *glib.Error)
20
21// Represents a job that is sent to a printer.
22//
23// You only need to deal directly with print jobs if you use the
24// non-portable [class@Gtk.PrintUnixDialog] API.
25//
26// Use [method@Gtk.PrintJob.get_surface] to obtain the cairo surface
27// onto which the pages must be drawn. Use [method@Gtk.PrintJob.send]
28// to send the finished job to the printer. If you don’t use cairo
29// `GtkPrintJob` also supports printing of manually generated PostScript,
30// via [method@Gtk.PrintJob.set_source_file].
31type PrintJob struct {
32	gobject.Object
33}
34
35var xPrintJobGLibType func() types.GType
36
37func PrintJobGLibType() types.GType {
38	return xPrintJobGLibType()
39}
40
41func PrintJobNewFromInternalPtr(ptr uintptr) *PrintJob {
42	cls := &PrintJob{}
43	cls.Ptr = ptr
44	return cls
45}
46
47var xNewPrintJob func(string, uintptr, uintptr, uintptr) uintptr
48
49// Creates a new `GtkPrintJob`.
50func NewPrintJob(TitleVar string, PrinterVar *Printer, SettingsVar *PrintSettings, PageSetupVar *PageSetup) *PrintJob {
51	var cls *PrintJob
52
53	cret := xNewPrintJob(TitleVar, PrinterVar.GoPointer(), SettingsVar.GoPointer(), PageSetupVar.GoPointer())
54
55	if cret == 0 {
56		return nil
57	}
58	cls = &PrintJob{}
59	cls.Ptr = cret
60	return cls
61}
62
63var xPrintJobGetCollate func(uintptr) bool
64
65// Gets whether this job is printed collated.
66func (x *PrintJob) GetCollate() bool {
67
68	cret := xPrintJobGetCollate(x.GoPointer())
69	return cret
70}
71
72var xPrintJobGetNUp func(uintptr) uint
73
74// Gets the n-up setting for this job.
75func (x *PrintJob) GetNUp() uint {
76
77	cret := xPrintJobGetNUp(x.GoPointer())
78	return cret
79}
80
81var xPrintJobGetNUpLayout func(uintptr) NumberUpLayout
82
83// Gets the n-up layout setting for this job.
84func (x *PrintJob) GetNUpLayout() NumberUpLayout {
85
86	cret := xPrintJobGetNUpLayout(x.GoPointer())
87	return cret
88}
89
90var xPrintJobGetNumCopies func(uintptr) int
91
92// Gets the number of copies of this job.
93func (x *PrintJob) GetNumCopies() int {
94
95	cret := xPrintJobGetNumCopies(x.GoPointer())
96	return cret
97}
98
99var xPrintJobGetPageRanges func(uintptr, *int) uintptr
100
101// Gets the page ranges for this job.
102func (x *PrintJob) GetPageRanges(NRangesVar *int) uintptr {
103
104	cret := xPrintJobGetPageRanges(x.GoPointer(), NRangesVar)
105	return cret
106}
107
108var xPrintJobGetPageSet func(uintptr) PageSet
109
110// Gets the `GtkPageSet` setting for this job.
111func (x *PrintJob) GetPageSet() PageSet {
112
113	cret := xPrintJobGetPageSet(x.GoPointer())
114	return cret
115}
116
117var xPrintJobGetPages func(uintptr) PrintPages
118
119// Gets the `GtkPrintPages` setting for this job.
120func (x *PrintJob) GetPages() PrintPages {
121
122	cret := xPrintJobGetPages(x.GoPointer())
123	return cret
124}
125
126var xPrintJobGetPrinter func(uintptr) uintptr
127
128// Gets the `GtkPrinter` of the print job.
129func (x *PrintJob) GetPrinter() *Printer {
130	var cls *Printer
131
132	cret := xPrintJobGetPrinter(x.GoPointer())
133
134	if cret == 0 {
135		return nil
136	}
137	gobject.IncreaseRef(cret)
138	cls = &Printer{}
139	cls.Ptr = cret
140	return cls
141}
142
143var xPrintJobGetReverse func(uintptr) bool
144
145// Gets whether this job is printed reversed.
146func (x *PrintJob) GetReverse() bool {
147
148	cret := xPrintJobGetReverse(x.GoPointer())
149	return cret
150}
151
152var xPrintJobGetRotate func(uintptr) bool
153
154// Gets whether the job is printed rotated.
155func (x *PrintJob) GetRotate() bool {
156
157	cret := xPrintJobGetRotate(x.GoPointer())
158	return cret
159}
160
161var xPrintJobGetScale func(uintptr) float64
162
163// Gets the scale for this job.
164func (x *PrintJob) GetScale() float64 {
165
166	cret := xPrintJobGetScale(x.GoPointer())
167	return cret
168}
169
170var xPrintJobGetSettings func(uintptr) uintptr
171
172// Gets the `GtkPrintSettings` of the print job.
173func (x *PrintJob) GetSettings() *PrintSettings {
174	var cls *PrintSettings
175
176	cret := xPrintJobGetSettings(x.GoPointer())
177
178	if cret == 0 {
179		return nil
180	}
181	gobject.IncreaseRef(cret)
182	cls = &PrintSettings{}
183	cls.Ptr = cret
184	return cls
185}
186
187var xPrintJobGetStatus func(uintptr) PrintStatus
188
189// Gets the status of the print job.
190func (x *PrintJob) GetStatus() PrintStatus {
191
192	cret := xPrintJobGetStatus(x.GoPointer())
193	return cret
194}
195
196var xPrintJobGetSurface func(uintptr) *cairo.Surface
197
198// Gets a cairo surface onto which the pages of
199// the print job should be rendered.
200func (x *PrintJob) GetSurface() (*cairo.Surface, error) {
201	var cerr *glib.Error
202
203	cret := xPrintJobGetSurface(x.GoPointer())
204	if cerr == nil {
205		return cret, nil
206	}
207	return cret, cerr
208
209}
210
211var xPrintJobGetTitle func(uintptr) string
212
213// Gets the job title.
214func (x *PrintJob) GetTitle() string {
215
216	cret := xPrintJobGetTitle(x.GoPointer())
217	return cret
218}
219
220var xPrintJobGetTrackPrintStatus func(uintptr) bool
221
222// Returns whether jobs will be tracked after printing.
223//
224// For details, see [method@Gtk.PrintJob.set_track_print_status].
225func (x *PrintJob) GetTrackPrintStatus() bool {
226
227	cret := xPrintJobGetTrackPrintStatus(x.GoPointer())
228	return cret
229}
230
231var xPrintJobSend func(uintptr, uintptr, uintptr, uintptr)
232
233// Sends the print job off to the printer.
234func (x *PrintJob) Send(CallbackVar *PrintJobCompleteFunc, UserDataVar uintptr, DnotifyVar *glib.DestroyNotify) {
235
236	var CallbackVarRef uintptr
237	if CallbackVar != nil {
238		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
239		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
240			CallbackVarRef = cbRefPtr
241		} else {
242			fcb := func(arg0 uintptr, arg1 uintptr, arg2 *glib.Error) {
243				cbFn := *CallbackVar
244				cbFn(arg0, arg1, arg2)
245			}
246			CallbackVarRef = purego.NewCallback(fcb)
247			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
248		}
249	}
250
251	var DnotifyVarRef uintptr
252	if DnotifyVar != nil {
253		DnotifyVarPtr := uintptr(unsafe.Pointer(DnotifyVar))
254		if cbRefPtr, ok := glib.GetCallback(DnotifyVarPtr); ok {
255			DnotifyVarRef = cbRefPtr
256		} else {
257			fcb := func(arg0 uintptr) {
258				cbFn := *DnotifyVar
259				cbFn(arg0)
260			}
261			DnotifyVarRef = purego.NewCallback(fcb)
262			glib.SaveCallbackWithClosure(DnotifyVarPtr, DnotifyVarRef, DnotifyVar)
263		}
264	}
265
266	xPrintJobSend(x.GoPointer(), CallbackVarRef, UserDataVar, DnotifyVarRef)
267
268}
269
270var xPrintJobSetCollate func(uintptr, bool)
271
272// Sets whether this job is printed collated.
273func (x *PrintJob) SetCollate(CollateVar bool) {
274
275	xPrintJobSetCollate(x.GoPointer(), CollateVar)
276
277}
278
279var xPrintJobSetNUp func(uintptr, uint)
280
281// Sets the n-up setting for this job.
282func (x *PrintJob) SetNUp(NUpVar uint) {
283
284	xPrintJobSetNUp(x.GoPointer(), NUpVar)
285
286}
287
288var xPrintJobSetNUpLayout func(uintptr, NumberUpLayout)
289
290// Sets the n-up layout setting for this job.
291func (x *PrintJob) SetNUpLayout(LayoutVar NumberUpLayout) {
292
293	xPrintJobSetNUpLayout(x.GoPointer(), LayoutVar)
294
295}
296
297var xPrintJobSetNumCopies func(uintptr, int)
298
299// Sets the number of copies for this job.
300func (x *PrintJob) SetNumCopies(NumCopiesVar int) {
301
302	xPrintJobSetNumCopies(x.GoPointer(), NumCopiesVar)
303
304}
305
306var xPrintJobSetPageRanges func(uintptr, []PageRange, int)
307
308// Sets the page ranges for this job.
309func (x *PrintJob) SetPageRanges(RangesVar []PageRange, NRangesVar int) {
310
311	xPrintJobSetPageRanges(x.GoPointer(), RangesVar, NRangesVar)
312
313}
314
315var xPrintJobSetPageSet func(uintptr, PageSet)
316
317// Sets the `GtkPageSet` setting for this job.
318func (x *PrintJob) SetPageSet(PageSetVar PageSet) {
319
320	xPrintJobSetPageSet(x.GoPointer(), PageSetVar)
321
322}
323
324var xPrintJobSetPages func(uintptr, PrintPages)
325
326// Sets the `GtkPrintPages` setting for this job.
327func (x *PrintJob) SetPages(PagesVar PrintPages) {
328
329	xPrintJobSetPages(x.GoPointer(), PagesVar)
330
331}
332
333var xPrintJobSetReverse func(uintptr, bool)
334
335// Sets whether this job is printed reversed.
336func (x *PrintJob) SetReverse(ReverseVar bool) {
337
338	xPrintJobSetReverse(x.GoPointer(), ReverseVar)
339
340}
341
342var xPrintJobSetRotate func(uintptr, bool)
343
344// Sets whether this job is printed rotated.
345func (x *PrintJob) SetRotate(RotateVar bool) {
346
347	xPrintJobSetRotate(x.GoPointer(), RotateVar)
348
349}
350
351var xPrintJobSetScale func(uintptr, float64)
352
353// Sets the scale for this job.
354//
355// 1.0 means unscaled.
356func (x *PrintJob) SetScale(ScaleVar float64) {
357
358	xPrintJobSetScale(x.GoPointer(), ScaleVar)
359
360}
361
362var xPrintJobSetSourceFd func(uintptr, int, **glib.Error) bool
363
364// Make the `GtkPrintJob` send an existing document to the
365// printing system.
366//
367// The file can be in any format understood by the platforms
368// printing system (typically PostScript, but on many platforms
369// PDF may work too). See [method@Gtk.Printer.accepts_pdf] and
370// [method@Gtk.Printer.accepts_ps].
371//
372// This is similar to [method@Gtk.PrintJob.set_source_file],
373// but takes expects an open file descriptor for the file,
374// instead of a filename.
375func (x *PrintJob) SetSourceFd(FdVar int) (bool, error) {
376	var cerr *glib.Error
377
378	cret := xPrintJobSetSourceFd(x.GoPointer(), FdVar, &cerr)
379	if cerr == nil {
380		return cret, nil
381	}
382	return cret, cerr
383
384}
385
386var xPrintJobSetSourceFile func(uintptr, string, **glib.Error) bool
387
388// Make the `GtkPrintJob` send an existing document to the
389// printing system.
390//
391// The file can be in any format understood by the platforms
392// printing system (typically PostScript, but on many platforms
393// PDF may work too). See [method@Gtk.Printer.accepts_pdf] and
394// [method@Gtk.Printer.accepts_ps].
395func (x *PrintJob) SetSourceFile(FilenameVar string) (bool, error) {
396	var cerr *glib.Error
397
398	cret := xPrintJobSetSourceFile(x.GoPointer(), FilenameVar, &cerr)
399	if cerr == nil {
400		return cret, nil
401	}
402	return cret, cerr
403
404}
405
406var xPrintJobSetTrackPrintStatus func(uintptr, bool)
407
408// If track_status is %TRUE, the print job will try to continue report
409// on the status of the print job in the printer queues and printer.
410//
411// This can allow your application to show things like “out of paper”
412// issues, and when the print job actually reaches the printer.
413//
414// This function is often implemented using some form of polling,
415// so it should not be enabled unless needed.
416func (x *PrintJob) SetTrackPrintStatus(TrackStatusVar bool) {
417
418	xPrintJobSetTrackPrintStatus(x.GoPointer(), TrackStatusVar)
419
420}
421
422func (c *PrintJob) GoPointer() uintptr {
423	if c == nil {
424		return 0
425	}
426	return c.Ptr
427}
428
429func (c *PrintJob) SetGoPointer(ptr uintptr) {
430	c.Ptr = ptr
431}
432
433// SetPropertyTitle sets the "title" property.
434// The title of the print job.
435func (x *PrintJob) SetPropertyTitle(value string) {
436	var v gobject.Value
437	v.Init(gobject.TypeStringVal)
438	v.SetString(&value)
439	x.SetProperty("title", &v)
440}
441
442// GetPropertyTitle gets the "title" property.
443// The title of the print job.
444func (x *PrintJob) GetPropertyTitle() string {
445	var v gobject.Value
446	x.GetProperty("title", &v)
447	return v.GetString()
448}
449
450// SetPropertyTrackPrintStatus sets the "track-print-status" property.
451// %TRUE if the print job will continue to emit status-changed
452// signals after the print data has been setn to the printer.
453func (x *PrintJob) SetPropertyTrackPrintStatus(value bool) {
454	var v gobject.Value
455	v.Init(gobject.TypeBooleanVal)
456	v.SetBoolean(value)
457	x.SetProperty("track-print-status", &v)
458}
459
460// GetPropertyTrackPrintStatus gets the "track-print-status" property.
461// %TRUE if the print job will continue to emit status-changed
462// signals after the print data has been setn to the printer.
463func (x *PrintJob) GetPropertyTrackPrintStatus() bool {
464	var v gobject.Value
465	x.GetProperty("track-print-status", &v)
466	return v.GetBoolean()
467}
468
469// Emitted when the status of a job changes.
470//
471// The signal handler can use [method@Gtk.PrintJob.get_status]
472// to obtain the new status.
473func (x *PrintJob) ConnectStatusChanged(cb *func(PrintJob)) uint {
474	cbPtr := uintptr(unsafe.Pointer(cb))
475	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
476		handlerID := gobject.SignalConnect(x.GoPointer(), "status-changed", cbRefPtr)
477		glib.SaveHandlerMapping(handlerID, cbPtr)
478		return handlerID
479	}
480
481	fcb := func(clsPtr uintptr) {
482		fa := PrintJob{}
483		fa.Ptr = clsPtr
484		cbFn := *cb
485
486		cbFn(fa)
487
488	}
489	cbRefPtr := purego.NewCallback(fcb)
490	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
491	handlerID := gobject.SignalConnect(x.GoPointer(), "status-changed", cbRefPtr)
492	glib.SaveHandlerMapping(handlerID, cbPtr)
493	return handlerID
494}
495
496func init() {
497	core.SetPackageName("GTK", "gtk4")
498	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
499	var libs []uintptr
500	for _, libPath := range core.GetPaths("GTK") {
501		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
502		if err != nil {
503			panic(err)
504		}
505		libs = append(libs, lib)
506	}
507
508	core.PuregoSafeRegister(&xPrintJobGLibType, libs, "gtk_print_job_get_type")
509
510	core.PuregoSafeRegister(&xNewPrintJob, libs, "gtk_print_job_new")
511
512	core.PuregoSafeRegister(&xPrintJobGetCollate, libs, "gtk_print_job_get_collate")
513	core.PuregoSafeRegister(&xPrintJobGetNUp, libs, "gtk_print_job_get_n_up")
514	core.PuregoSafeRegister(&xPrintJobGetNUpLayout, libs, "gtk_print_job_get_n_up_layout")
515	core.PuregoSafeRegister(&xPrintJobGetNumCopies, libs, "gtk_print_job_get_num_copies")
516	core.PuregoSafeRegister(&xPrintJobGetPageRanges, libs, "gtk_print_job_get_page_ranges")
517	core.PuregoSafeRegister(&xPrintJobGetPageSet, libs, "gtk_print_job_get_page_set")
518	core.PuregoSafeRegister(&xPrintJobGetPages, libs, "gtk_print_job_get_pages")
519	core.PuregoSafeRegister(&xPrintJobGetPrinter, libs, "gtk_print_job_get_printer")
520	core.PuregoSafeRegister(&xPrintJobGetReverse, libs, "gtk_print_job_get_reverse")
521	core.PuregoSafeRegister(&xPrintJobGetRotate, libs, "gtk_print_job_get_rotate")
522	core.PuregoSafeRegister(&xPrintJobGetScale, libs, "gtk_print_job_get_scale")
523	core.PuregoSafeRegister(&xPrintJobGetSettings, libs, "gtk_print_job_get_settings")
524	core.PuregoSafeRegister(&xPrintJobGetStatus, libs, "gtk_print_job_get_status")
525	core.PuregoSafeRegister(&xPrintJobGetSurface, libs, "gtk_print_job_get_surface")
526	core.PuregoSafeRegister(&xPrintJobGetTitle, libs, "gtk_print_job_get_title")
527	core.PuregoSafeRegister(&xPrintJobGetTrackPrintStatus, libs, "gtk_print_job_get_track_print_status")
528	core.PuregoSafeRegister(&xPrintJobSend, libs, "gtk_print_job_send")
529	core.PuregoSafeRegister(&xPrintJobSetCollate, libs, "gtk_print_job_set_collate")
530	core.PuregoSafeRegister(&xPrintJobSetNUp, libs, "gtk_print_job_set_n_up")
531	core.PuregoSafeRegister(&xPrintJobSetNUpLayout, libs, "gtk_print_job_set_n_up_layout")
532	core.PuregoSafeRegister(&xPrintJobSetNumCopies, libs, "gtk_print_job_set_num_copies")
533	core.PuregoSafeRegister(&xPrintJobSetPageRanges, libs, "gtk_print_job_set_page_ranges")
534	core.PuregoSafeRegister(&xPrintJobSetPageSet, libs, "gtk_print_job_set_page_set")
535	core.PuregoSafeRegister(&xPrintJobSetPages, libs, "gtk_print_job_set_pages")
536	core.PuregoSafeRegister(&xPrintJobSetReverse, libs, "gtk_print_job_set_reverse")
537	core.PuregoSafeRegister(&xPrintJobSetRotate, libs, "gtk_print_job_set_rotate")
538	core.PuregoSafeRegister(&xPrintJobSetScale, libs, "gtk_print_job_set_scale")
539	core.PuregoSafeRegister(&xPrintJobSetSourceFd, libs, "gtk_print_job_set_source_fd")
540	core.PuregoSafeRegister(&xPrintJobSetSourceFile, libs, "gtk_print_job_set_source_file")
541	core.PuregoSafeRegister(&xPrintJobSetTrackPrintStatus, libs, "gtk_print_job_set_track_print_status")
542
543}

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