Top Description Fields Constructors Methods
org.eclipse.swt.printing

public Class PrintDialog

extends Dialog
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.internal.*, org.eclipse.swt.internal.gtk.*, org.eclipse.swt.internal.gtk3.*, org.eclipse.swt.internal.gtk4.*, org.eclipse.swt.widgets.*

Instances of this class allow the user to select a printer and various print-related parameters prior to starting a print job.

Important Note

This class is not intended to be subclassed.

See Also
Printing snippets, SWT Example: ControlExample, Dialog tab, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv static final String
pack-priv static final String
pack-priv static final String
pack-priv long
pack-priv int
pack-priv PrinterData
pack-priv static final String
pack-priv static final String
pack-priv byte[]

Constructor Summary

AccessConstructor and Description
public
PrintDialog(Shell
a composite control which will be the parent of the new instance (cannot be null)
parent
)

Constructs a new instance of this class given only its parent.

public
PrintDialog(Shell
a composite control which will be the parent of the new instance (cannot be null)
parent
,
int
the style of control to construct
style
)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Method Summary

Modifier and TypeMethod and Description
pack-priv static int
checkBits(int style, int int0, int int1, int int2, int int3, int int4, int int5)

pack-priv static int
checkStyleBit(Shell parent, int style)

protected void
checkSubclass()

Overrides org.eclipse.swt.widgets.Dialog.checkSubclass.

Checks that this class can be subclassed.
public int

Returns:

the end page setting that the user selected
getEndPage
()

Returns the end page setting that the user selected before pressing OK in the dialog.

public PrinterData

Returns:

the data that will be used when the dialog is opened
getPrinterData
()

Returns the printer data that will be used when the dialog is opened.

public boolean

Returns:

the 'Print to file' setting that the user selected
getPrintToFile
()

Returns the 'Print to file' setting that the user selected before pressing OK in the dialog.

public int

Returns:

the scope setting that the user selected
getScope
()

Returns the print job scope that the user selected before pressing OK in the dialog.

public int

Returns:

the start page setting that the user selected
getStartPage
()

Returns the start page setting that the user selected before pressing OK in the dialog.

pack-priv long
GtkPrintSettingsFunc(long key, long value, long data)

public PrinterData

Returns:

a printer data object describing the desired print job parameters, or null if the dialog was canceled, no printers were found, or an error occurred
open
()

Makes the receiver visible and brings it to the front of the display.

public void
setEndPage(int
the end page setting when the dialog is opened
endPage
)

Sets the end page that the user will see when the dialog is opened.

public void
setPrinterData(PrinterData
the data that will be used when the dialog is opened or null to use default data
data
)

Sets the printer data that will be used when the dialog is opened.

public void
setPrintToFile(boolean
the 'Print to file' setting when the dialog is opened
printToFile
)

Sets the 'Print to file' setting that the user will see when the dialog is opened.

public void
setScope(int
the scope setting when the dialog is opened
scope
)

Sets the scope of the print job.

public void
setStartPage(int
the startPage setting when the dialog is opened
startPage
)

Sets the start page that the user will see when the dialog is opened.

pack-priv void
store(String key, int value)

pack-priv void
store(String key, double value)

pack-priv void
store(String key, boolean value)

pack-priv void
store(String key, String value)

pack-priv void
store(byte[] key, byte[] value)

pack-priv void
storeBytes(String key, long value)

Inherited from org.eclipse.swt.widgets.Dialog:
getParentgetStylegetTextsetText

Field Detail

ADD_IDLE_PROC_KEYback to summary
pack-priv static final String ADD_IDLE_PROC_KEY
GET_EMISSION_PROC_KEYback to summary
pack-priv static final String GET_EMISSION_PROC_KEY
GET_MODAL_DIALOGback to summary
pack-priv static final String GET_MODAL_DIALOG
handleback to summary
pack-priv long handle
indexback to summary
pack-priv int index
printerDataback to summary
pack-priv PrinterData printerData
REMOVE_IDLE_PROC_KEYback to summary
pack-priv static final String REMOVE_IDLE_PROC_KEY
SET_MODAL_DIALOGback to summary
pack-priv static final String SET_MODAL_DIALOG
settingsDataback to summary
pack-priv byte[] settingsData

Constructor Detail

PrintDialogback to summary
public PrintDialog(Shell parent)

Constructs a new instance of this class given only its parent.

Parameters
parent:Shell

a composite control which will be the parent of the new instance (cannot be null)

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the parent is null
SWTException:
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
See Also
SWT, Widget#checkSubclass, Widget#getStyle
PrintDialogback to summary
public PrintDialog(Shell parent, int style)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

Parameters
parent:Shell

a composite control which will be the parent of the new instance (cannot be null)

style:int

the style of control to construct

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the parent is null
SWTException:
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
See Also
SWT, Widget#checkSubclass, Widget#getStyle

Method Detail

checkBitsback to summary
pack-priv static int checkBits(int style, int int0, int int1, int int2, int int3, int int4, int int5)
checkStyleBitback to summary
pack-priv static int checkStyleBit(Shell parent, int style)
checkSubclassback to summary
protected void checkSubclass()

Overrides org.eclipse.swt.widgets.Dialog.checkSubclass.

Doc from org.eclipse.swt.widgets.Dialog.checkSubclass.

Checks that this class can be subclassed.

Important Note

See the comment in Widget.checkSubclass().

Annotations
@Override
getEndPageback to summary
public int getEndPage()

Returns the end page setting that the user selected before pressing OK in the dialog.

This value can be from 1 to the maximum number of pages for the platform. Note that it is only valid if the scope is PrinterData.PAGE_RANGE.

Returns:int

the end page setting that the user selected

getPrinterDataback to summary
public PrinterData getPrinterData()

Returns the printer data that will be used when the dialog is opened.

Returns:PrinterData

the data that will be used when the dialog is opened

Since
3.4
getPrintToFileback to summary
public boolean getPrintToFile()

Returns the 'Print to file' setting that the user selected before pressing OK in the dialog.

Returns:boolean

the 'Print to file' setting that the user selected

getScopeback to summary
public int getScope()

Returns the print job scope that the user selected before pressing OK in the dialog. This will be one of the following values:

PrinterData.ALL_PAGES
Print all pages in the current document
PrinterData.PAGE_RANGE
Print the range of pages specified by startPage and endPage
PrinterData.SELECTION
Print the current selection
Returns:int

the scope setting that the user selected

getStartPageback to summary
public int getStartPage()

Returns the start page setting that the user selected before pressing OK in the dialog.

This value can be from 1 to the maximum number of pages for the platform. Note that it is only valid if the scope is PrinterData.PAGE_RANGE.

Returns:int

the start page setting that the user selected

GtkPrintSettingsFuncback to summary
pack-priv long GtkPrintSettingsFunc(long key, long value, long data)
openback to summary
public PrinterData open()

Makes the receiver visible and brings it to the front of the display.

Returns:PrinterData

a printer data object describing the desired print job parameters, or null if the dialog was canceled, no printers were found, or an error occurred

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setEndPageback to summary
public void setEndPage(int endPage)

Sets the end page that the user will see when the dialog is opened.

This value can be from 1 to the maximum number of pages for the platform. Note that it is only valid if the scope is PrinterData.PAGE_RANGE.

Parameters
endPage:int

the end page setting when the dialog is opened

setPrinterDataback to summary
public void setPrinterData(PrinterData data)

Sets the printer data that will be used when the dialog is opened.

Setting the printer data to null is equivalent to resetting all data fields to their default values.

Parameters
data:PrinterData

the data that will be used when the dialog is opened or null to use default data

Since
3.4
setPrintToFileback to summary
public void setPrintToFile(boolean printToFile)

Sets the 'Print to file' setting that the user will see when the dialog is opened.

Parameters
printToFile:boolean

the 'Print to file' setting when the dialog is opened

setScopeback to summary
public void setScope(int scope)

Sets the scope of the print job. The user will see this setting when the dialog is opened. This can have one of the following values:

PrinterData.ALL_PAGES
Print all pages in the current document
PrinterData.PAGE_RANGE
Print the range of pages specified by startPage and endPage
PrinterData.SELECTION
Print the current selection
Parameters
scope:int

the scope setting when the dialog is opened

setStartPageback to summary
public void setStartPage(int startPage)

Sets the start page that the user will see when the dialog is opened.

This value can be from 1 to the maximum number of pages for the platform. Note that it is only valid if the scope is PrinterData.PAGE_RANGE.

Parameters
startPage:int

the startPage setting when the dialog is opened

storeback to summary
pack-priv void store(String key, int value)
storeback to summary
pack-priv void store(String key, double value)
storeback to summary
pack-priv void store(String key, boolean value)
storeback to summary
pack-priv void store(String key, String value)
storeback to summary
pack-priv void store(byte[] key, byte[] value)
storeBytesback to summary
pack-priv void storeBytes(String key, long value)