Trait webkit2gtk::prelude::PrintOperationExt
source · [−]pub trait PrintOperationExt: 'static {
fn page_setup(&self) -> Option<PageSetup>;
fn print_settings(&self) -> Option<PrintSettings>;
fn print(&self);
fn run_dialog(
&self,
parent: Option<&impl IsA<Window>>
) -> PrintOperationResponse;
fn set_page_setup(&self, page_setup: &PageSetup);
fn set_print_settings(&self, print_settings: &PrintSettings);
fn web_view(&self) -> Option<WebView>;
fn connect_create_custom_widget<F: Fn(&Self) -> PrintCustomWidget + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_failed<F: Fn(&Self, &Error) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_finished<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_page_setup_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_print_settings_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
sourcefn page_setup(&self) -> Option<PageSetup>
fn page_setup(&self) -> Option<PageSetup>
Return the current page setup of self
.
It returns None
until
either set_page_setup()
or run_dialog()
have been called.
Returns
the current gtk::PageSetup
of self
.
sourcefn print_settings(&self) -> Option<PrintSettings>
fn print_settings(&self) -> Option<PrintSettings>
Return the current print settings of self
.
It returns None
until
either set_print_settings()
or run_dialog()
have been called.
Returns
the current gtk::PrintSettings
of self
.
sourcefn print(&self)
fn print(&self)
Start a print operation using current print settings and page setup.
Start a print operation using current print settings and page setup
without showing the print dialog. If either print settings or page setup
are not set with set_print_settings()
and
set_page_setup()
, the default options will be used
and the print job will be sent to the default printer.
The signal::PrintOperation::finished
signal is emitted when the printing
operation finishes. If an error occurs while printing the signal
signal::PrintOperation::failed
is emitted before signal::PrintOperation::finished
.
sourcefn run_dialog(&self, parent: Option<&impl IsA<Window>>) -> PrintOperationResponse
fn run_dialog(&self, parent: Option<&impl IsA<Window>>) -> PrintOperationResponse
Run the print dialog and start printing.
Run the print dialog and start printing using the options selected by
the user. This method returns when the print dialog is closed.
If the print dialog is cancelled PrintOperationResponse::Cancel
is returned. If the user clicks on the print button, PrintOperationResponse::Print
is returned and the print operation starts. In this case, the signal::PrintOperation::finished
signal is emitted when the operation finishes. If an error occurs while printing, the signal
signal::PrintOperation::failed
is emitted before signal::PrintOperation::finished
.
If the print dialog is not cancelled current print settings and page setup of self
are updated with options selected by the user when Print button is pressed in print dialog.
You can get the updated print settings and page setup by calling
print_settings()
and page_setup()
after this method.
parent
transient parent of the print dialog
Returns
the PrintOperationResponse
of the print dialog
sourcefn set_page_setup(&self, page_setup: &PageSetup)
fn set_page_setup(&self, page_setup: &PageSetup)
Set the current page setup of self
.
Current page setup is used for the
initial values of the print dialog when run_dialog()
is called.
page_setup
a gtk::PageSetup
to set
sourcefn set_print_settings(&self, print_settings: &PrintSettings)
fn set_print_settings(&self, print_settings: &PrintSettings)
Set the current print settings of self
.
Set the current print settings of self
. Current print settings are used for
the initial values of the print dialog when run_dialog()
is called.
print_settings
a gtk::PrintSettings
to set
sourcefn connect_create_custom_widget<F: Fn(&Self) -> PrintCustomWidget + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_create_custom_widget<F: Fn(&Self) -> PrintCustomWidget + 'static>(
&self,
f: F
) -> SignalHandlerId
v2_16
only.Emitted when displaying the print dialog with run_dialog()
.
The returned PrintCustomWidget
will be added to the print dialog and
it will be owned by the print_operation
. However, the object is guaranteed
to be alive until the signal::PrintCustomWidget::apply
is emitted.
Returns
A PrintCustomWidget
that will be embedded in the dialog.
sourcefn connect_failed<F: Fn(&Self, &Error) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_failed<F: Fn(&Self, &Error) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when an error occurs while printing. The given error
, of the domain
WEBKIT_PRINT_ERROR
, contains further details of the failure.
The signal::PrintOperation::finished
signal is emitted after this one.
error
the glib::Error
that was triggered
sourcefn connect_finished<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_finished<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the print operation has finished doing everything required for printing.