Struct gtk4::builders::PrintOperationBuilder
source · pub struct PrintOperationBuilder { /* private fields */ }
Expand description
A builder-pattern type to construct PrintOperation
objects.
Implementations§
source§impl PrintOperationBuilder
impl PrintOperationBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new PrintOperationBuilder
.
sourcepub fn build(self) -> PrintOperation
pub fn build(self) -> PrintOperation
Build the PrintOperation
.
sourcepub fn allow_async(self, allow_async: bool) -> Self
pub fn allow_async(self, allow_async: bool) -> Self
Determines whether the print operation may run asynchronously or not.
Some systems don’t support asynchronous printing, but those that do
will return PrintOperationResult::InProgress
as the status, and
emit the signal::PrintOperation::done
signal when the operation
is actually done.
The Windows port does not support asynchronous operation at all (this
is unlikely to change). On other platforms, all actions except for
PrintOperationAction::Export
support asynchronous operation.
sourcepub fn current_page(self, current_page: i32) -> Self
pub fn current_page(self, current_page: i32) -> Self
The current page in the document.
If this is set before PrintOperationExt::run()
,
the user will be able to select to print only the current page.
Note that this only makes sense for pre-paginated documents.
sourcepub fn custom_tab_label(self, custom_tab_label: &str) -> Self
pub fn custom_tab_label(self, custom_tab_label: &str) -> Self
Used as the label of the tab containing custom widgets.
Note that this property may be ignored on some platforms.
If this is None
, GTK uses a default label.
sourcepub fn default_page_setup(self, default_page_setup: &PageSetup) -> Self
pub fn default_page_setup(self, default_page_setup: &PageSetup) -> Self
The PageSetup
used by default.
This page setup will be used by PrintOperationExt::run()
,
but it can be overridden on a per-page basis by connecting
to the signal::PrintOperation::request-page-setup
signal.
sourcepub fn embed_page_setup(self, embed_page_setup: bool) -> Self
pub fn embed_page_setup(self, embed_page_setup: bool) -> Self
If true
, page size combo box and orientation combo box
are embedded into page setup page.
sourcepub fn export_filename(self, export_filename: &str) -> Self
pub fn export_filename(self, export_filename: &str) -> Self
The name of a file to generate instead of showing the print dialog.
Currently, PDF is the only supported format.
The intended use of this property is for implementing “Export to PDF” actions.
“Print to PDF” support is independent of this and is done by letting the user pick the “Print to PDF” item from the list of printers in the print dialog.
sourcepub fn has_selection(self, has_selection: bool) -> Self
pub fn has_selection(self, has_selection: bool) -> Self
Determines whether there is a selection in your application.
This can allow your application to print the selection. This is typically used to make a “Selection” button sensitive.
sourcepub fn job_name(self, job_name: &str) -> Self
pub fn job_name(self, job_name: &str) -> Self
A string used to identify the job (e.g. in monitoring applications like eggcups).
If you don’t set a job name, GTK picks a default one by numbering successive print jobs.
sourcepub fn n_pages(self, n_pages: i32) -> Self
pub fn n_pages(self, n_pages: i32) -> Self
The number of pages in the document.
This must be set to a positive number before the rendering
starts. It may be set in a signal::PrintOperation::begin-print
signal handler.
Note that the page numbers passed to the
signal::PrintOperation::request-page-setup
and
signal::PrintOperation::draw-page
signals are 0-based, i.e.
if the user chooses to print all pages, the last ::draw-page signal
will be for page @n_pages - 1.
sourcepub fn print_settings(self, print_settings: &PrintSettings) -> Self
pub fn print_settings(self, print_settings: &PrintSettings) -> Self
The PrintSettings
used for initializing the dialog.
Setting this property is typically used to re-establish
print settings from a previous print operation, see
PrintOperationExt::run()
.
sourcepub fn show_progress(self, show_progress: bool) -> Self
pub fn show_progress(self, show_progress: bool) -> Self
Determines whether to show a progress dialog during the print operation.
sourcepub fn support_selection(self, support_selection: bool) -> Self
pub fn support_selection(self, support_selection: bool) -> Self
If true
, the print operation will support print of selection.
This allows the print dialog to show a “Selection” button.
sourcepub fn track_print_status(self, track_print_status: bool) -> Self
pub fn track_print_status(self, track_print_status: bool) -> Self
If true
, the print operation will try to continue report on
the status of the print job in the printer queues and printer.
This can allow your application to show things like “out of paper” issues, and when the print job actually reaches the printer. However, this is often implemented using polling, and should not be enabled unless needed.
sourcepub fn unit(self, unit: Unit) -> Self
pub fn unit(self, unit: Unit) -> Self
The transformation for the cairo context obtained from
PrintContext
is set up in such a way that distances
are measured in units of @unit.
sourcepub fn use_full_page(self, use_full_page: bool) -> Self
pub fn use_full_page(self, use_full_page: bool) -> Self
If true
, the transformation for the cairo context obtained
from PrintContext
puts the origin at the top left corner
of the page.
This may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet. Otherwise, the origin is at the top left corner of the imageable area (i.e. inside the margins).
Trait Implementations§
source§impl Clone for PrintOperationBuilder
impl Clone for PrintOperationBuilder
source§fn clone(&self) -> PrintOperationBuilder
fn clone(&self) -> PrintOperationBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more