Class PageSetup
- All Implemented Interfaces:
Proxy
The idea is that you can get one of these from the page setup dialog
and then pass it to the GtkPrintOperation when printing.
The benefit of splitting this out of the GtkPrintSettings is that
these affect the actual layout of the page, and thus need to be set
long before user prints.
Margins
The margins specified in this object are the “print margins”, i.e. the
parts of the page that the printer cannot print on. These are different
from the layout margins that a word processor uses; they are typically
used to determine the minimal size for the layout margins.
To obtain a GtkPageSetup use PageSetup() to get the defaults,
or use Gtk.printRunPageSetupDialog(org.gnome.gtk.Window, org.gnome.gtk.PageSetup, org.gnome.gtk.PrintSettings) to show the page setup dialog
and receive the resulting page setup.
A page setup dialog
static GtkPrintSettings *settings = NULL;
static GtkPageSetup *page_setup = NULL;
static void
do_page_setup (void)
{
GtkPageSetup *new_page_setup;
if (settings == NULL)
settings = gtk_print_settings_new ();
new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window),
page_setup, settings);
if (page_setup)
g_object_unref (page_setup);
page_setup = new_page_setup;
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPageSetup.Builder<B extends PageSetup.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new PageSetup.PageSetup(MemorySegment address) Create a PageSetup proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected PageSetupasParent()Returns this instance as if it were its parent type.static PageSetup.Builder<? extends PageSetup.Builder> builder()APageSetup.Builderobject constructs aPageSetupwith the specified properties.copy()Copies aGtkPageSetup.static PageSetupReads the page setup from the filefileName.static PageSetupfromGvariant(Variant variant) Desrialize a page setup from an a{sv} variant.static PageSetupfromKeyFile(KeyFile keyFile, @Nullable String groupName) Reads the page setup from the groupgroupNamein the key filekeyFile.doublegetBottomMargin(Unit unit) Gets the bottom margin in units ofunit.doublegetLeftMargin(Unit unit) Gets the left margin in units ofunit.Gets the page orientation of theGtkPageSetup.doublegetPageHeight(Unit unit) Returns the page height in units ofunit.doublegetPageWidth(Unit unit) Returns the page width in units ofunit.doublegetPaperHeight(Unit unit) Returns the paper height in units ofunit.Gets the paper size of theGtkPageSetup.doublegetPaperWidth(Unit unit) Returns the paper width in units ofunit.doublegetRightMargin(Unit unit) Gets the right margin in units ofunit.doublegetTopMargin(Unit unit) Gets the top margin in units ofunit.static @Nullable TypegetType()Get the GType of the PageSetup classbooleanReads the page setup from the filefileName.booleanloadKeyFile(KeyFile keyFile, @Nullable String groupName) Reads the page setup from the groupgroupNamein the key filekeyFile.voidsetBottomMargin(double margin, Unit unit) Sets the bottom margin of theGtkPageSetup.voidsetLeftMargin(double margin, Unit unit) Sets the left margin of theGtkPageSetup.voidsetOrientation(PageOrientation orientation) Sets the page orientation of theGtkPageSetup.voidsetPaperSize(PaperSize size) Sets the paper size of theGtkPageSetupwithout changing the margins.voidSets the paper size of theGtkPageSetupand modifies the margins according to the new paper size.voidsetRightMargin(double margin, Unit unit) Sets the right margin of theGtkPageSetup.voidsetTopMargin(double margin, Unit unit) Sets the top margin of theGtkPageSetup.booleanThis function saves the information from this PageSetup tofileName.Serialize page setup to an a{sv} variant.voidThis function adds the page setup from this PageSetup tokeyFile.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
PageSetup
Create a PageSetup proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
PageSetup
public PageSetup()Creates a new PageSetup.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
fromFile
Reads the page setup from the filefileName.Returns a new
GtkPageSetupobject with the restored page setup, ornullif an error occurred. SeetoFile(java.lang.String).- Parameters:
fileName- the filename to read the page setup from- Returns:
- the restored
GtkPageSetup - Throws:
GErrorException- seeGError
-
fromGvariant
Desrialize a page setup from an a{sv} variant.The variant must be in the format produced by
toGvariant().- Parameters:
variant- an a{sv}GVariant- Returns:
- a new
GtkPageSetupobject
-
fromKeyFile
public static PageSetup fromKeyFile(KeyFile keyFile, @Nullable String groupName) throws GErrorException Reads the page setup from the groupgroupNamein the key filekeyFile.Returns a new
GtkPageSetupobject with the restored page setup, ornullif an error occurred.- Parameters:
keyFile- theGKeyFileto retrieve the page_setup fromgroupName- the name of the group in the key_file to read to use the default name “Page Setup”- Returns:
- the restored
GtkPageSetup - Throws:
GErrorException- seeGError
-
copy
-
getBottomMargin
Gets the bottom margin in units ofunit.- Parameters:
unit- the unit for the return value- Returns:
- the bottom margin
-
getLeftMargin
Gets the left margin in units ofunit.- Parameters:
unit- the unit for the return value- Returns:
- the left margin
-
getOrientation
Gets the page orientation of theGtkPageSetup.- Returns:
- the page orientation
-
getPageHeight
Returns the page height in units ofunit.Note that this function takes orientation and margins into consideration. See
getPaperHeight(org.gnome.gtk.Unit).- Parameters:
unit- the unit for the return value- Returns:
- the page height.
-
getPageWidth
Returns the page width in units ofunit.Note that this function takes orientation and margins into consideration. See
getPaperWidth(org.gnome.gtk.Unit).- Parameters:
unit- the unit for the return value- Returns:
- the page width.
-
getPaperHeight
Returns the paper height in units ofunit.Note that this function takes orientation, but not margins into consideration. See
getPageHeight(org.gnome.gtk.Unit).- Parameters:
unit- the unit for the return value- Returns:
- the paper height.
-
getPaperSize
-
getPaperWidth
Returns the paper width in units ofunit.Note that this function takes orientation, but not margins into consideration. See
getPageWidth(org.gnome.gtk.Unit).- Parameters:
unit- the unit for the return value- Returns:
- the paper width.
-
getRightMargin
Gets the right margin in units ofunit.- Parameters:
unit- the unit for the return value- Returns:
- the right margin
-
getTopMargin
Gets the top margin in units ofunit.- Parameters:
unit- the unit for the return value- Returns:
- the top margin
-
loadFile
Reads the page setup from the filefileName.- Parameters:
fileName- the filename to read the page setup from- Returns:
trueon success- Throws:
GErrorException- seeGError
-
loadKeyFile
Reads the page setup from the groupgroupNamein the key filekeyFile.- Parameters:
keyFile- theGKeyFileto retrieve the page_setup fromgroupName- the name of the group in the key_file to read to use the default name “Page Setup”- Returns:
trueon success- Throws:
GErrorException- seeGError
-
setBottomMargin
Sets the bottom margin of theGtkPageSetup.- Parameters:
margin- the new bottom margin in units ofunitunit- the units formargin
-
setLeftMargin
Sets the left margin of theGtkPageSetup.- Parameters:
margin- the new left margin in units ofunitunit- the units formargin
-
setOrientation
Sets the page orientation of theGtkPageSetup.- Parameters:
orientation- aGtkPageOrientationvalue
-
setPaperSize
Sets the paper size of theGtkPageSetupwithout changing the margins.- Parameters:
size- aGtkPaperSize
-
setPaperSizeAndDefaultMargins
Sets the paper size of theGtkPageSetupand modifies the margins according to the new paper size.- Parameters:
size- aGtkPaperSize
-
setRightMargin
Sets the right margin of theGtkPageSetup.- Parameters:
margin- the new right margin in units ofunitunit- the units formargin
-
setTopMargin
Sets the top margin of theGtkPageSetup.- Parameters:
margin- the new top margin in units ofunitunit- the units formargin
-
toFile
This function saves the information from this PageSetup tofileName.- Parameters:
fileName- the file to save to- Returns:
trueon success- Throws:
GErrorException- seeGError
-
toGvariant
Serialize page setup to an a{sv} variant.- Returns:
- a new, floating,
GVariant
-
toKeyFile
-
builder
APageSetup.Builderobject constructs aPageSetupwith the specified properties. Use the variousset...()methods to set properties, and finish construction withPageSetup.Builder.build().- Returns:
- the builder object
-