PrintSettings

A GtkPrintSettings object represents the settings of a print dialog in a system-independent way. The main use for this object is that once you’ve printed you can get a settings object that represents the settings the user chose, and the next time you print you can pass that object in so that the user doesn’t have to re-set all his settings.

Its also possible to enumerate the settings so that you can easily save the settings for the next time your app runs, or even store them in a document. The predefined keys try to use shared values as much as possible so that moving such a document between systems still works.

Printing support was added in GTK+ 2.10.

class PrintSettings : ObjectWrap {}

Constructors

this
this(void* ptr, Flag!"Take" take)
this
this()

Creates a new #GtkPrintSettings object.

Members

Functions

copy
gtk.print_settings.PrintSettings copy()

Copies a #GtkPrintSettings object.

foreach_
void foreach_(gtk.types.PrintSettingsFunc func)

Calls func for each key-value pair of settings.

get
string get(string key)

Looks up the string value associated with key.

getBool
bool getBool(string key)

Returns the boolean represented by the value that is associated with key.

getCollate
bool getCollate()

Gets the value of gtk.types.PRINT_SETTINGS_COLLATE.

getDefaultSource
string getDefaultSource()

Gets the value of gtk.types.PRINT_SETTINGS_DEFAULT_SOURCE.

getDither
string getDither()

Gets the value of gtk.types.PRINT_SETTINGS_DITHER.

getDouble
double getDouble(string key)

Returns the double value associated with key, or 0.

getDoubleWithDefault
double getDoubleWithDefault(string key, double def)

Returns the floating point number represented by the value that is associated with key, or default_val if the value does not represent a floating point number.

getDuplex
gtk.types.PrintDuplex getDuplex()

Gets the value of gtk.types.PRINT_SETTINGS_DUPLEX.

getFinishings
string getFinishings()

Gets the value of gtk.types.PRINT_SETTINGS_FINISHINGS.

getInt
int getInt(string key)

Returns the integer value of key, or 0.

getIntWithDefault
int getIntWithDefault(string key, int def)

Returns the value of key, interpreted as an integer, or the default value.

getLength
double getLength(string key, gtk.types.Unit unit)

Returns the value associated with key, interpreted as a length. The returned value is converted to units.

getMediaType
string getMediaType()

Gets the value of gtk.types.PRINT_SETTINGS_MEDIA_TYPE.

getNCopies
int getNCopies()

Gets the value of gtk.types.PRINT_SETTINGS_N_COPIES.

getNumberUp
int getNumberUp()

Gets the value of gtk.types.PRINT_SETTINGS_NUMBER_UP.

getNumberUpLayout
gtk.types.NumberUpLayout getNumberUpLayout()

Gets the value of gtk.types.PRINT_SETTINGS_NUMBER_UP_LAYOUT.

getOrientation
gtk.types.PageOrientation getOrientation()

Get the value of gtk.types.PRINT_SETTINGS_ORIENTATION, converted to a #GtkPageOrientation.

getOutputBin
string getOutputBin()

Gets the value of gtk.types.PRINT_SETTINGS_OUTPUT_BIN.

getPageRanges
gtk.types.PageRange[] getPageRanges()

Gets the value of gtk.types.PRINT_SETTINGS_PAGE_RANGES.

getPageSet
gtk.types.PageSet getPageSet()

Gets the value of gtk.types.PRINT_SETTINGS_PAGE_SET.

getPaperHeight
double getPaperHeight(gtk.types.Unit unit)

Gets the value of gtk.types.PRINT_SETTINGS_PAPER_HEIGHT, converted to unit.

getPaperSize
gtk.paper_size.PaperSize getPaperSize()

Gets the value of gtk.types.PRINT_SETTINGS_PAPER_FORMAT, converted to a #GtkPaperSize.

getPaperWidth
double getPaperWidth(gtk.types.Unit unit)

Gets the value of gtk.types.PRINT_SETTINGS_PAPER_WIDTH, converted to unit.

getPrintPages
gtk.types.PrintPages getPrintPages()

Gets the value of gtk.types.PRINT_SETTINGS_PRINT_PAGES.

getPrinter
string getPrinter()

Convenience function to obtain the value of gtk.types.PRINT_SETTINGS_PRINTER.

getPrinterLpi
double getPrinterLpi()

Gets the value of gtk.types.PRINT_SETTINGS_PRINTER_LPI.

getQuality
gtk.types.PrintQuality getQuality()

Gets the value of gtk.types.PRINT_SETTINGS_QUALITY.

getResolution
int getResolution()

Gets the value of gtk.types.PRINT_SETTINGS_RESOLUTION.

getResolutionX
int getResolutionX()

Gets the value of gtk.types.PRINT_SETTINGS_RESOLUTION_X.

getResolutionY
int getResolutionY()

Gets the value of gtk.types.PRINT_SETTINGS_RESOLUTION_Y.

getReverse
bool getReverse()

Gets the value of gtk.types.PRINT_SETTINGS_REVERSE.

getScale
double getScale()

Gets the value of gtk.types.PRINT_SETTINGS_SCALE.

getUseColor
bool getUseColor()

Gets the value of gtk.types.PRINT_SETTINGS_USE_COLOR.

hasKey
bool hasKey(string key)

Returns true, if a value is associated with key.

loadFile
bool loadFile(string fileName)

Reads the print settings from file_name. If the file could not be loaded then error is set to either a #GFileError or #GKeyFileError. See gtk.print_settings.PrintSettings.toFile.

loadKeyFile
bool loadKeyFile(glib.key_file.KeyFile keyFile, string groupName)

Reads the print settings from the group group_name in key_file. If the file could not be loaded then error is set to either a #GFileError or #GKeyFileError.

self
PrintSettings self()

Returns this, for use in with statements.

set
void set(string key, string value)

Associates value with key.

setBool
void setBool(string key, bool value)

Sets key to a boolean value.

setCollate
void setCollate(bool collate)

Sets the value of gtk.types.PRINT_SETTINGS_COLLATE.

setDefaultSource
void setDefaultSource(string defaultSource)

Sets the value of gtk.types.PRINT_SETTINGS_DEFAULT_SOURCE.

setDither
void setDither(string dither)

Sets the value of gtk.types.PRINT_SETTINGS_DITHER.

setDouble
void setDouble(string key, double value)

Sets key to a double value.

setDuplex
void setDuplex(gtk.types.PrintDuplex duplex)

Sets the value of gtk.types.PRINT_SETTINGS_DUPLEX.

setFinishings
void setFinishings(string finishings)

Sets the value of gtk.types.PRINT_SETTINGS_FINISHINGS.

setInt
void setInt(string key, int value)

Sets key to an integer value.

setLength
void setLength(string key, double value, gtk.types.Unit unit)

Associates a length in units of unit with key.

setMediaType
void setMediaType(string mediaType)

Sets the value of gtk.types.PRINT_SETTINGS_MEDIA_TYPE.

setNCopies
void setNCopies(int numCopies)

Sets the value of gtk.types.PRINT_SETTINGS_N_COPIES.

setNumberUp
void setNumberUp(int numberUp)

Sets the value of gtk.types.PRINT_SETTINGS_NUMBER_UP.

setNumberUpLayout
void setNumberUpLayout(gtk.types.NumberUpLayout numberUpLayout)

Sets the value of gtk.types.PRINT_SETTINGS_NUMBER_UP_LAYOUT.

setOrientation
void setOrientation(gtk.types.PageOrientation orientation)

Sets the value of gtk.types.PRINT_SETTINGS_ORIENTATION.

setOutputBin
void setOutputBin(string outputBin)

Sets the value of gtk.types.PRINT_SETTINGS_OUTPUT_BIN.

setPageRanges
void setPageRanges(gtk.types.PageRange[] pageRanges)

Sets the value of gtk.types.PRINT_SETTINGS_PAGE_RANGES.

setPageSet
void setPageSet(gtk.types.PageSet pageSet)

Sets the value of gtk.types.PRINT_SETTINGS_PAGE_SET.

setPaperHeight
void setPaperHeight(double height, gtk.types.Unit unit)

Sets the value of gtk.types.PRINT_SETTINGS_PAPER_HEIGHT.

setPaperSize
void setPaperSize(gtk.paper_size.PaperSize paperSize)

Sets the value of gtk.types.PRINT_SETTINGS_PAPER_FORMAT, gtk.types.PRINT_SETTINGS_PAPER_WIDTH and gtk.types.PRINT_SETTINGS_PAPER_HEIGHT.

setPaperWidth
void setPaperWidth(double width, gtk.types.Unit unit)

Sets the value of gtk.types.PRINT_SETTINGS_PAPER_WIDTH.

setPrintPages
void setPrintPages(gtk.types.PrintPages pages)

Sets the value of gtk.types.PRINT_SETTINGS_PRINT_PAGES.

setPrinter
void setPrinter(string printer)

Convenience function to set gtk.types.PRINT_SETTINGS_PRINTER to printer.

setPrinterLpi
void setPrinterLpi(double lpi)

Sets the value of gtk.types.PRINT_SETTINGS_PRINTER_LPI.

setQuality
void setQuality(gtk.types.PrintQuality quality)

Sets the value of gtk.types.PRINT_SETTINGS_QUALITY.

setResolution
void setResolution(int resolution)

Sets the values of gtk.types.PRINT_SETTINGS_RESOLUTION, gtk.types.PRINT_SETTINGS_RESOLUTION_X and gtk.types.PRINT_SETTINGS_RESOLUTION_Y.

setResolutionXy
void setResolutionXy(int resolutionX, int resolutionY)

Sets the values of gtk.types.PRINT_SETTINGS_RESOLUTION, gtk.types.PRINT_SETTINGS_RESOLUTION_X and gtk.types.PRINT_SETTINGS_RESOLUTION_Y.

setReverse
void setReverse(bool reverse)

Sets the value of gtk.types.PRINT_SETTINGS_REVERSE.

setScale
void setScale(double scale)

Sets the value of gtk.types.PRINT_SETTINGS_SCALE.

setUseColor
void setUseColor(bool useColor)

Sets the value of gtk.types.PRINT_SETTINGS_USE_COLOR.

toFile
bool toFile(string fileName)

This function saves the print settings from settings to file_name. If the file could not be loaded then error is set to either a #GFileError or #GKeyFileError.

toGvariant
glib.variant.Variant toGvariant()

Serialize print settings to an a{sv} variant.

toKeyFile
void toKeyFile(glib.key_file.KeyFile keyFile, string groupName)

This function adds the print settings from settings to key_file.

unset
void unset(string key)

Removes any value associated with key. This has the same effect as setting the value to null.

Properties

_gType
GType _gType [@property getter]

Static functions

_getGType
GType _getGType()
builder
PrintSettingsGidBuilder builder()

Get builder for gtk.print_settings.PrintSettings

newFromFile
gtk.print_settings.PrintSettings newFromFile(string fileName)

Reads the print settings from file_name. Returns a new #GtkPrintSettings object with the restored settings, or null if an error occurred. If the file could not be loaded then error is set to either a #GFileError or #GKeyFileError. See gtk.print_settings.PrintSettings.toFile.

newFromGvariant
gtk.print_settings.PrintSettings newFromGvariant(glib.variant.Variant variant)

Deserialize print settings from an a{sv} variant in the format produced by gtk.print_settings.PrintSettings.toGvariant.

newFromKeyFile
gtk.print_settings.PrintSettings newFromKeyFile(glib.key_file.KeyFile keyFile, string groupName)

Reads the print settings from the group group_name in key_file. Returns a new #GtkPrintSettings object with the restored settings, or null if an error occurred. If the file could not be loaded then error is set to either a #GFileError or #GKeyFileError.

Inherited Members

From ObjectWrap

_setGObject
void _setGObject(void* cObj, Flag!"Take" take)

Set the GObject of a D ObjectWrap wrapper.

_cPtr
void* _cPtr(Flag!"Dup" dup)

Get a pointer to the underlying C object.

_ref
void* _ref(void* gObj)

Calls g_object_ref() on a GObject.

_unref
_unref(void* gObj)

Calls g_object_unref() on a GObject.

_getGType
GType _getGType()

Get the GType of an object.

_gType
GType _gType [@property getter]

GObject GType property.

self
ObjectWrap self()

Convenience method to return this cast to a type. For use in D with statements.

_getDObject
T _getDObject(void* cptr, Flag!"Take" take)

Template to get the D object from a C GObject and cast it to the given D object type.

connectSignalClosure
gulong connectSignalClosure(string signalDetail, DClosure closure, Flag!"After" after)

Connect a D closure to an object signal.

setProperty
void setProperty(string propertyName, T val)

Template for setting a GObject property.

getProperty
T getProperty(string propertyName)

Template for getting a GObject property.

compatControl
size_t compatControl(size_t what, void* data)
bindProperty
gobject.binding.Binding bindProperty(string sourceProperty, gobject.object.ObjectWrap target, string targetProperty, gobject.types.BindingFlags flags)

Creates a binding between source_property on source and target_property on target.

bindPropertyFull
gobject.binding.Binding bindPropertyFull(string sourceProperty, gobject.object.ObjectWrap target, string targetProperty, gobject.types.BindingFlags flags, gobject.closure.Closure transformTo, gobject.closure.Closure transformFrom)

Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

forceFloating
void forceFloating()

This function is intended for #GObject implementations to re-enforce a floating[floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling gobject.object.ObjectWrap.refSink.

freezeNotify
void freezeNotify()

Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

getData
void* getData(string key)

Gets a named field from the objects table of associations (see gobject.object.ObjectWrap.setData).

getProperty
void getProperty(string propertyName, gobject.value.Value value)

Gets a property of an object.

getQdata
void* getQdata(glib.types.Quark quark)

This function gets back user data pointers stored via gobject.object.ObjectWrap.setQdata.

getv
void getv(string[] names, gobject.value.Value[] values)

Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

isFloating
bool isFloating()

Checks whether object has a floating[floating-ref] reference.

notify
void notify(string propertyName)

Emits a "notify" signal for the property property_name on object.

notifyByPspec
void notifyByPspec(gobject.param_spec.ParamSpec pspec)

Emits a "notify" signal for the property specified by pspec on object.

refSink
gobject.object.ObjectWrap refSink()

Increase the reference count of object, and possibly remove the floating[floating-ref] reference, if object has a floating reference.

runDispose
void runDispose()

Releases all references to other objects. This can be used to break reference cycles.

setData
void setData(string key, void* data)

Each object carries around a table of associations from strings to pointers. This function lets you set an association.

setProperty
void setProperty(string propertyName, gobject.value.Value value)

Sets a property on an object.

stealData
void* stealData(string key)

Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

stealQdata
void* stealQdata(glib.types.Quark quark)

This function gets back user data pointers stored via gobject.object.ObjectWrap.setQdata and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

thawNotify
void thawNotify()

Reverts the effect of a previous call to gobject.object.ObjectWrap.freezeNotify. The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

watchClosure
void watchClosure(gobject.closure.Closure closure)

This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling gobject.closure.Closure.invalidate on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, gobject.object.ObjectWrap.ref_ and gobject.object.ObjectWrap.unref are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

connectNotify
gulong connectNotify(string detail, T callback, Flag!"After" after)

Connect to Notify signal.