File: print_since_3_16.go

package info (click to toggle)
golang-github-gotk3-gotk3 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,332 kB
  • sloc: ansic: 904; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 820 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14

// See: https://developer.gnome.org/gtk3/3.16/api-index-3-16.html

package gtk

// #include <gtk/gtk.h>
// #include "gtk.go.h"
import "C"
import (
	"runtime"
	"unsafe"
)

// PaperSizeNewFromIpp is a wrapper around gtk_paper_size_new_from_ipp().
func PaperSizeNewFromIPP(name string, width, height float64) (*PaperSize, error) {
	cstr := C.CString(name)
	defer C.free(unsafe.Pointer(cstr))

	c := C.gtk_paper_size_new_from_ipp((*C.gchar)(cstr), C.gdouble(width), C.gdouble(height))
	if c == nil {
		return nil, nilPtrErr
	}

	t := &PaperSize{c}
	runtime.SetFinalizer(t, (*PaperSize).free)
	return t, nil
}

// IsIPP() is a wrapper around gtk_paper_size_is_ipp().
func (ps *PaperSize) IsIPP() bool {
	c := C.gtk_paper_size_is_ipp(ps.native())
	return gobool(c)
}