gtk4

Struct PrintOperation

Source
pub struct PrintOperation { /* private fields */ }
Expand description

PrintOperation is the high-level, portable printing API.

It looks a bit different than other GTK dialogs such as the FileChooser, since some platforms don’t expose enough infrastructure to implement a good print dialog. On such platforms, PrintOperation uses the native print dialog. On platforms which do not provide a native print dialog, GTK uses its own, see PrintUnixDialog.

The typical way to use the high-level printing API is to create a PrintOperation object with new() when the user selects to print. Then you set some properties on it, e.g. the page size, any PrintSettings from previous print operations, the number of pages, the current page, etc.

Then you start the print operation by calling PrintOperationExt::run(). It will then show a dialog, let the user select a printer and options. When the user finished the dialog, various signals will be emitted on the PrintOperation, the main one being draw-page, which you are supposed to handle and render the page on the provided PrintContext using Cairo.

§The high-level printing API

⚠️ The following code is in c ⚠️

static GtkPrintSettings *settings = NULL;

static void
do_print (void)
{
  GtkPrintOperation *print;
  GtkPrintOperationResult res;

  print = gtk_print_operation_new ();

  if (settings != NULL)
    gtk_print_operation_set_print_settings (print, settings);

  g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL);
  g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL);

  res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
                                 GTK_WINDOW (main_window), NULL);

  if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
    {
      if (settings != NULL)
        g_object_unref (settings);
      settings = g_object_ref (gtk_print_operation_get_print_settings (print));
    }

  g_object_unref (print);
}

By default PrintOperation uses an external application to do print preview. To implement a custom print preview, an application must connect to the preview signal. The functions PrintOperationPreviewExt::render_page(), PrintOperationPreviewExt::end_preview() and PrintOperationPreviewExt::is_selected() are useful when implementing a print preview.

§Properties

§allow-async

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 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.

Readable | Writeable

§current-page

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.

Readable | Writeable

§custom-tab-label

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.

Readable | Writeable

§default-page-setup

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 request-page-setup signal.

Readable | Writeable

§embed-page-setup

If true, page size combo box and orientation combo box are embedded into page setup page.

Readable | Writeable

§export-filename

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.

Readable | Writeable

§has-selection

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.

Readable | Writeable

§job-name

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.

Readable | Writeable

§n-pages

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 begin-print signal handler.

Note that the page numbers passed to the request-page-setup and 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.

Readable | Writeable

§n-pages-to-print

The number of pages that will be printed.

Note that this value is set during print preparation phase (PrintStatus::Preparing), so this value should never be get before the data generation phase (PrintStatus::GeneratingData). You can connect to the status-changed signal and call PrintOperationExt::n_pages_to_print() when print status is PrintStatus::GeneratingData.

This is typically used to track the progress of print operation.

Readable

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().

Readable | Writeable

§show-progress

Determines whether to show a progress dialog during the print operation.

Readable | Writeable

§status

The status of the print operation.

Readable

§status-string

A string representation of the status of the print operation.

The string is translated and suitable for displaying the print status e.g. in a Statusbar.

See the status property for a status value that is suitable for programmatic use.

Readable

§support-selection

If true, the print operation will support print of selection.

This allows the print dialog to show a “Selection” button.

Readable | Writeable

§track-print-status

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.

Readable | Writeable

§unit

The transformation for the cairo context obtained from PrintContext is set up in such a way that distances are measured in units of @unit.

Readable | Writeable

§use-full-page

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).

Readable | Writeable

§Signals

§begin-print

Emitted after the user has finished changing print settings in the dialog, before the actual rendering starts.

A typical use for ::begin-print is to use the parameters from the PrintContext and paginate the document accordingly, and then set the number of pages with PrintOperationExt::set_n_pages().

§create-custom-widget

Emitted when displaying the print dialog.

If you return a widget in a handler for this signal it will be added to a custom tab in the print dialog. You typically return a container widget with multiple widgets in it.

The print dialog owns the returned widget, and its lifetime is not controlled by the application. However, the widget is guaranteed to stay around until the custom-widget-apply signal is emitted on the operation. Then you can read out any information you need from the widgets.

§custom-widget-apply

Emitted right before ::begin-print if you added a custom widget in the ::create-custom-widget handler.

When you get this signal you should read the information from the custom widgets, as the widgets are not guaranteed to be around at a later time.

§done

Emitted when the print operation run has finished doing everything required for printing.

@result gives you information about what happened during the run. If @result is PrintOperationResult::Error then you can call Gtk::PrintOperation::get_error() for more information.

If you enabled print status tracking then PrintOperationExt::is_finished() may still return false after the ::done signal was emitted.

§draw-page

Emitted for every page that is printed.

The signal handler must render the @page_nr’s page onto the cairo context obtained from @context using PrintContext::cairo_context().

⚠️ The following code is in c ⚠️

static void
draw_page (GtkPrintOperation *operation,
           GtkPrintContext   *context,
           int                page_nr,
           gpointer           user_data)
{
  cairo_t *cr;
  PangoLayout *layout;
  double width, text_height;
  int layout_height;
  PangoFontDescription *desc;

  cr = gtk_print_context_get_cairo_context (context);
  width = gtk_print_context_get_width (context);

  cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);

  cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
  cairo_fill (cr);

  layout = gtk_print_context_create_pango_layout (context);

  desc = pango_font_description_from_string ("sans 14");
  pango_layout_set_font_description (layout, desc);
  pango_font_description_free (desc);

  pango_layout_set_text (layout, "some text", -1);
  pango_layout_set_width (layout, width * PANGO_SCALE);
  pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);

  pango_layout_get_size (layout, NULL, &layout_height);
  text_height = (double)layout_height / PANGO_SCALE;

  cairo_move_to (cr, width / 2,  (HEADER_HEIGHT - text_height) / 2);
  pango_cairo_show_layout (cr, layout);

  g_object_unref (layout);
}

Use PrintOperationExt::set_use_full_page() and PrintOperationExt::set_unit() before starting the print operation to set up the transformation of the cairo context according to your needs.

§end-print

Emitted after all pages have been rendered.

A handler for this signal can clean up any resources that have been allocated in the begin-print handler.

§paginate

Emitted after the ::begin-print signal, but before the actual rendering starts.

It keeps getting emitted until a connected signal handler returns true.

The ::paginate signal is intended to be used for paginating a document in small chunks, to avoid blocking the user interface for a long time. The signal handler should update the number of pages using PrintOperationExt::set_n_pages(), and return true if the document has been completely paginated.

If you don’t need to do pagination in chunks, you can simply do it all in the ::begin-print handler, and set the number of pages from there.

§preview

Gets emitted when a preview is requested from the native dialog.

The default handler for this signal uses an external viewer application to preview.

To implement a custom print preview, an application must return true from its handler for this signal. In order to use the provided @context for the preview implementation, it must be given a suitable cairo context with PrintContext::set_cairo_context().

The custom preview implementation can use PrintOperationPreviewExt::is_selected() and PrintOperationPreviewExt::render_page() to find pages which are selected for print and render them. The preview must be finished by calling PrintOperationPreviewExt::end_preview() (typically in response to the user clicking a close button).

§request-page-setup

Emitted once for every page that is printed.

This gives the application a chance to modify the page setup. Any changes done to @setup will be in force only for printing this page.

§status-changed

Emitted at between the various phases of the print operation.

See PrintStatus for the phases that are being discriminated. Use PrintOperationExt::status() to find out the current status.

§update-custom-widget

Emitted after change of selected printer.

The actual page setup and print settings are passed to the custom widget, which can actualize itself according to this change.

PrintOperationPreview

§got-page-size

Emitted once for each page that gets rendered to the preview.

A handler for this signal should update the @context according to @page_setup and set up a suitable cairo context, using PrintContext::set_cairo_context().

§ready

The ::ready signal gets emitted once per preview operation, before the first page is rendered.

A handler for this signal can be used for setup tasks.

§Implements

PrintOperationExt, [trait@glib::ObjectExt], PrintOperationPreviewExt

GLib type: GObject with reference counted clone semantics.

Implementations§

Source§

impl PrintOperation

Source

pub const NONE: Option<&'static PrintOperation> = None

Source

pub fn new() -> PrintOperation

Creates a new PrintOperation.

§Returns

a new PrintOperation

Source

pub fn builder() -> PrintOperationBuilder

Creates a new builder-pattern struct instance to construct PrintOperation objects.

This method returns an instance of PrintOperationBuilder which can be used to create PrintOperation objects.

Source§

impl PrintOperation

Source

pub fn error(&self) -> Option<Error>

Trait Implementations§

Source§

impl Clone for PrintOperation

Source§

fn clone(&self) -> Self

Makes a clone of this shared reference.

This increments the strong reference count of the object. Dropping the object will decrement it again.

1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PrintOperation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PrintOperation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl HasParamSpec for PrintOperation

Source§

type ParamSpec = ParamSpecObject

Source§

type SetValue = PrintOperation

Preferred value to be used as setter for the associated ParamSpec.
Source§

type BuilderFn = fn(_: &str) -> ParamSpecObjectBuilder<'_, PrintOperation>

Source§

fn param_spec_builder() -> Self::BuilderFn

Source§

impl Hash for PrintOperation

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Hashes the memory address of this object.

1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PrintOperationImpl> IsSubclassable<T> for PrintOperation

Source§

fn class_init(class: &mut Class<Self>)

Override the virtual methods of this class for the given subclass and do other class initialization. Read more
Source§

fn instance_init(instance: &mut InitializingObject<T>)

Instance specific initialization. Read more
Source§

impl Ord for PrintOperation

Source§

fn cmp(&self, other: &Self) -> Ordering

Comparison for two GObjects.

Compares the memory addresses of the provided objects.

1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl ParentClassIs for PrintOperation

Source§

impl<OT: ObjectType> PartialEq<OT> for PrintOperation

Source§

fn eq(&self, other: &OT) -> bool

Equality for two GObjects.

Two GObjects are equal if their memory addresses are equal.

1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<OT: ObjectType> PartialOrd<OT> for PrintOperation

Source§

fn partial_cmp(&self, other: &OT) -> Option<Ordering>

Partial comparison for two GObjects.

Compares the memory addresses of the provided objects.

1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for PrintOperation

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl Eq for PrintOperation

Source§

impl IsA<PrintOperationPreview> for PrintOperation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Cast for T
where T: ObjectType,

Source§

fn upcast<T>(self) -> T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a superclass or interface T. Read more
Source§

fn upcast_ref<T>(&self) -> &T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a reference of its superclass or interface T. Read more
Source§

fn downcast<T>(self) -> Result<T, Self>
where T: ObjectType, Self: MayDowncastTo<T>,

Tries to downcast to a subclass or interface implementor T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: ObjectType, Self: MayDowncastTo<T>,

Tries to downcast to a reference of its subclass or interface implementor T. Read more
Source§

fn dynamic_cast<T>(self) -> Result<T, Self>
where T: ObjectType,

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while upcast will do many checks at compile-time already. downcast will perform the same checks at runtime as dynamic_cast, but will also ensure some amount of compile-time safety. Read more
Source§

fn dynamic_cast_ref<T>(&self) -> Option<&T>
where T: ObjectType,

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more
Source§

unsafe fn unsafe_cast<T>(self) -> T
where T: ObjectType,

Casts to T unconditionally. Read more
Source§

unsafe fn unsafe_cast_ref<T>(&self) -> &T
where T: ObjectType,

Casts to &T unconditionally. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(_: *const GList, _: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(_: *const GList, _: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GPtrArray, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec( _: *const GPtrArray, _: usize, ) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(_: *const GPtrArray, _: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GSList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(_: *const GSList, _: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(_: *const GSList, _: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GPtrArray, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec( ptr: *mut GPtrArray, num: usize, ) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GPtrArray, num: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *const GList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(_: *const GList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(_: *const GList) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *const GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(_: *const GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(_: *const GPtrArray) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *const GSList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(_: *const GSList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(_: *const GSList) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *mut GList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(ptr: *mut GList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(ptr: *mut GList) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *mut GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(ptr: *mut GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(ptr: *mut GPtrArray) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *mut GSList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(ptr: *mut GSList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(ptr: *mut GSList) -> Vec<T>

Source§

impl<O> GObjectPropertyExpressionExt for O
where O: IsA<Object>,

Source§

fn property_expression(&self, property_name: &str) -> PropertyExpression

Create an expression looking up an object’s property.
Source§

fn property_expression_weak(&self, property_name: &str) -> PropertyExpression

Create an expression looking up an object’s property with a weak reference.
Source§

fn this_expression(property_name: &str) -> PropertyExpression

Create an expression looking up a property in the bound this object.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<U> IsSubclassableExt for U

Source§

impl<T> ObjectExt for T
where T: ObjectType,

Source§

fn is<U>(&self) -> bool
where U: StaticType,

Returns true if the object is an instance of (can be cast to) T.
Source§

fn type_(&self) -> Type

Returns the type of the object.
Source§

fn object_class(&self) -> &Class<Object>

Returns the ObjectClass of the object. Read more
Source§

fn class(&self) -> &Class<T>
where T: IsClass,

Returns the class of the object.
Source§

fn class_of<U>(&self) -> Option<&Class<U>>
where U: IsClass,

Returns the class of the object in the given type T. Read more
Source§

fn interface<U>(&self) -> Option<InterfaceRef<'_, U>>
where U: IsInterface,

Returns the interface T of the object. Read more
Source§

fn set_property(&self, property_name: &str, value: impl Into<Value>)

Sets the property property_name of the object to value value. Read more
Source§

fn set_property_from_value(&self, property_name: &str, value: &Value)

Sets the property property_name of the object to value value. Read more
Source§

fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])

Sets multiple properties of the object at once. Read more
Source§

fn set_properties_from_value(&self, property_values: &[(&str, Value)])

Sets multiple properties of the object at once. Read more
Source§

fn property<V>(&self, property_name: &str) -> V
where V: for<'b> FromValue<'b> + 'static,

Gets the property property_name of the object and cast it to the type V. Read more
Source§

fn property_value(&self, property_name: &str) -> Value

Gets the property property_name of the object. Read more
Source§

fn has_property(&self, property_name: &str) -> bool

Check if the object has a property property_name.
Source§

fn has_property_with_type(&self, property_name: &str, type_: Type) -> bool

Check if the object has a property property_name of the given type_.
Source§

fn property_type(&self, property_name: &str) -> Option<Type>

Get the type of the property property_name of this object. Read more
Source§

fn find_property(&self, property_name: &str) -> Option<ParamSpec>

Get the ParamSpec of the property property_name of this object.
Source§

fn list_properties(&self) -> PtrSlice<ParamSpec>

Return all ParamSpec of the properties of this object.
Source§

fn freeze_notify(&self) -> PropertyNotificationFreezeGuard

Freeze all property notifications until the return guard object is dropped. Read more
Source§

unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)
where QD: 'static,

Set arbitrary data on this object with the given key. Read more
Source§

unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>>
where QD: 'static,

Return previously set arbitrary data of this object with the given key. Read more
Source§

unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>
where QD: 'static,

Retrieve previously set arbitrary data of this object with the given key. Read more
Source§

unsafe fn set_data<QD>(&self, key: &str, value: QD)
where QD: 'static,

Set arbitrary data on this object with the given key. Read more
Source§

unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>>
where QD: 'static,

Return previously set arbitrary data of this object with the given key. Read more
Source§

unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>
where QD: 'static,

Retrieve previously set arbitrary data of this object with the given key. Read more
Source§

fn block_signal(&self, handler_id: &SignalHandlerId)

Block a given signal handler. Read more
Source§

fn unblock_signal(&self, handler_id: &SignalHandlerId)

Unblock a given signal handler.
Source§

fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)

Stop emission of the currently emitted signal.
Source§

fn stop_signal_emission_by_name(&self, signal_name: &str)

Stop emission of the currently emitted signal by the (possibly detailed) signal name.
Source§

fn connect<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,

Connect to the signal signal_name on this object. Read more
Source§

fn connect_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,

Connect to the signal signal_id on this object. Read more
Source§

fn connect_local<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + 'static,

Connect to the signal signal_name on this object. Read more
Source§

fn connect_local_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + 'static,

Connect to the signal signal_id on this object. Read more
Source§

unsafe fn connect_unsafe<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value>,

Connect to the signal signal_name on this object. Read more
Source§

unsafe fn connect_unsafe_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value>,

Connect to the signal signal_id on this object. Read more
Source§

fn connect_closure( &self, signal_name: &str, after: bool, closure: RustClosure, ) -> SignalHandlerId

Connect a closure to the signal signal_name on this object. Read more
Source§

fn connect_closure_id( &self, signal_id: SignalId, details: Option<Quark>, after: bool, closure: RustClosure, ) -> SignalHandlerId

Connect a closure to the signal signal_id on this object. Read more
Source§

fn watch_closure(&self, closure: &impl AsRef<Closure>)

Limits the lifetime of closure to the lifetime of the object. When the object’s reference count drops to zero, the closure will be invalidated. An invalidated closure will ignore any calls to invoke_with_values, or invoke when using Rust closures.
Source§

fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> R

Emit signal by signal id. Read more
Source§

fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>

Same as Self::emit but takes Value for the arguments.
Source§

fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> R

Emit signal by its name. Read more
Source§

fn emit_by_name_with_values( &self, signal_name: &str, args: &[Value], ) -> Option<Value>

Emit signal by its name. Read more
Source§

fn emit_by_name_with_details<R>( &self, signal_name: &str, details: Quark, args: &[&dyn ToValue], ) -> R

Emit signal by its name with details. Read more
Source§

fn emit_by_name_with_details_and_values( &self, signal_name: &str, details: Quark, args: &[Value], ) -> Option<Value>

Emit signal by its name with details. Read more
Source§

fn emit_with_details<R>( &self, signal_id: SignalId, details: Quark, args: &[&dyn ToValue], ) -> R

Emit signal by signal id with details. Read more
Source§

fn emit_with_details_and_values( &self, signal_id: SignalId, details: Quark, args: &[Value], ) -> Option<Value>

Emit signal by signal id with details. Read more
Source§

fn disconnect(&self, handler_id: SignalHandlerId)

Disconnect a previously connected signal handler.
Source§

fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
where F: Fn(&T, &ParamSpec) + Send + Sync + 'static,

Connect to the notify signal of the object. Read more
Source§

fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
where F: Fn(&T, &ParamSpec) + 'static,

Connect to the notify signal of the object. Read more
Source§

unsafe fn connect_notify_unsafe<F>( &self, name: Option<&str>, f: F, ) -> SignalHandlerId
where F: Fn(&T, &ParamSpec),

Connect to the notify signal of the object. Read more
Source§

fn notify(&self, property_name: &str)

Notify that the given property has changed its value. Read more
Source§

fn notify_by_pspec(&self, pspec: &ParamSpec)

Notify that the given property has changed its value. Read more
Source§

fn downgrade(&self) -> WeakRef<T>

Downgrade this object to a weak reference.
Source§

fn add_weak_ref_notify<F>(&self, f: F) -> WeakRefNotify<T>
where F: FnOnce() + Send + 'static,

Add a callback to be notified when the Object is disposed.
Source§

fn add_weak_ref_notify_local<F>(&self, f: F) -> WeakRefNotify<T>
where F: FnOnce() + 'static,

Add a callback to be notified when the Object is disposed. Read more
Source§

fn bind_property<'a, 'f, 't, O>( &'a self, source_property: &'a str, target: &'a O, target_property: &'a str, ) -> BindingBuilder<'a, 'f, 't>
where O: ObjectType,

Bind property source_property on this object to the target_property on the target object. Read more
Source§

fn ref_count(&self) -> u32

Returns the strong reference count of this object.
Source§

unsafe fn run_dispose(&self)

Runs the dispose mechanism of the object. Read more
Source§

impl<O> PrintOperationExt for O
where O: IsA<PrintOperation>,

Source§

fn cancel(&self)

Cancels a running print operation. Read more
Source§

fn draw_page_finish(&self)

Signal that drawing of particular page is complete. Read more
Source§

fn default_page_setup(&self) -> PageSetup

Returns the default page setup. Read more
Source§

fn embeds_page_setup(&self) -> bool

Gets whether page setup selection combos are embedded Read more
Source§

fn has_selection(&self) -> bool

Gets whether there is a selection. Read more
Source§

fn n_pages_to_print(&self) -> i32

Returns the number of pages that will be printed. Read more
Source§

fn print_settings(&self) -> Option<PrintSettings>

Returns the current print settings. Read more
Source§

fn status(&self) -> PrintStatus

Returns the status of the print operation. Read more
Source§

fn status_string(&self) -> GString

Returns a string representation of the status of the print operation. Read more
Source§

fn supports_selection(&self) -> bool

Gets whether the application supports print of selection Read more
Source§

fn is_finished(&self) -> bool

A convenience function to find out if the print operation is finished. Read more
Source§

fn run( &self, action: PrintOperationAction, parent: Option<&impl IsA<Window>>, ) -> Result<PrintOperationResult, Error>

Runs the print operation. Read more
Source§

fn set_allow_async(&self, allow_async: bool)

Sets whether gtk_print_operation_run() may return before the print operation is completed. Read more
Source§

fn set_current_page(&self, current_page: i32)

Sets the current page. Read more
Source§

fn set_custom_tab_label(&self, label: Option<&str>)

Sets the label for the tab holding custom widgets. Read more
Source§

fn set_default_page_setup(&self, default_page_setup: Option<&PageSetup>)

Makes @default_page_setup the default page setup for @self. Read more
Source§

fn set_defer_drawing(&self)

Sets up the PrintOperation to wait for calling of draw_page_finish() from application. Read more
Source§

fn set_embed_page_setup(&self, embed: bool)

Embed page size combo box and orientation combo box into page setup page. Read more
Source§

fn set_export_filename(&self, filename: impl AsRef<Path>)

Sets up the PrintOperation to generate a file instead of showing the print dialog. Read more
Source§

fn set_has_selection(&self, has_selection: bool)

Sets whether there is a selection to print. Read more
Source§

fn set_job_name(&self, job_name: &str)

Sets the name of the print job. Read more
Source§

fn set_n_pages(&self, n_pages: i32)

Sets the number of pages in the document. Read more
Source§

fn set_print_settings(&self, print_settings: Option<&PrintSettings>)

Sets the print settings for @self. Read more
Source§

fn set_show_progress(&self, show_progress: bool)

If @show_progress is true, the print operation will show a progress dialog during the print operation. Read more
Source§

fn set_support_selection(&self, support_selection: bool)

Sets whether selection is supported by PrintOperation. Read more
Source§

fn set_track_print_status(&self, track_status: bool)

If track_status is true, the print operation will try to continue report on the status of the print job in the printer queues and printer. Read more
Source§

fn set_unit(&self, unit: Unit)

Sets up the transformation for the cairo context obtained from PrintContext in such a way that distances are measured in units of @unit. Read more
Source§

fn set_use_full_page(&self, full_page: bool)

If @full_page is true, the transformation for the cairo context obtained from PrintContext puts the origin at the top left corner of the page. Read more
Source§

fn allows_async(&self) -> bool

Determines whether the print operation may run asynchronously or not. Read more
Source§

fn current_page(&self) -> i32

The current page in the document. Read more
Source§

fn custom_tab_label(&self) -> Option<GString>

Used as the label of the tab containing custom widgets. Read more
Source§

fn export_filename(&self) -> Option<GString>

The name of a file to generate instead of showing the print dialog. Read more
Source§

fn job_name(&self) -> Option<GString>

A string used to identify the job (e.g. in monitoring applications like eggcups). Read more
Source§

fn n_pages(&self) -> i32

The number of pages in the document. Read more
Source§

fn shows_progress(&self) -> bool

Determines whether to show a progress dialog during the print operation.
Source§

fn tracks_print_status(&self) -> bool

If true, the print operation will try to continue report on the status of the print job in the printer queues and printer. Read more
Source§

fn unit(&self) -> Unit

The transformation for the cairo context obtained from PrintContext is set up in such a way that distances are measured in units of @unit.
Source§

fn uses_full_page(&self) -> bool

If true, the transformation for the cairo context obtained from PrintContext puts the origin at the top left corner of the page. Read more
Source§

fn connect_begin_print<F: Fn(&Self, &PrintContext) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted after the user has finished changing print settings in the dialog, before the actual rendering starts. Read more
Source§

fn connect_create_custom_widget<F: Fn(&Self) -> Option<Object> + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted when displaying the print dialog. Read more
Source§

fn connect_custom_widget_apply<F: Fn(&Self, &Widget) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted right before ::begin-print if you added a custom widget in the ::create-custom-widget handler. Read more
Source§

fn connect_done<F: Fn(&Self, PrintOperationResult) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted when the print operation run has finished doing everything required for printing. Read more
Source§

fn connect_draw_page<F: Fn(&Self, &PrintContext, i32) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted for every page that is printed. Read more
Source§

fn connect_end_print<F: Fn(&Self, &PrintContext) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted after all pages have been rendered. Read more
Source§

fn connect_paginate<F: Fn(&Self, &PrintContext) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted after the ::begin-print signal, but before the actual rendering starts. Read more
Source§

fn connect_preview<F: Fn(&Self, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId

Gets emitted when a preview is requested from the native dialog. Read more
Source§

fn connect_request_page_setup<F: Fn(&Self, &PrintContext, i32, &PageSetup) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted once for every page that is printed. Read more
Source§

fn connect_status_changed<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted at between the various phases of the print operation. Read more
Source§

fn connect_update_custom_widget<F: Fn(&Self, &Widget, &PageSetup, &PrintSettings) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted after change of selected printer. Read more
Source§

fn connect_allow_async_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_current_page_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_custom_tab_label_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_default_page_setup_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_embed_page_setup_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_export_filename_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_has_selection_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_job_name_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_n_pages_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_n_pages_to_print_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_print_settings_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_show_progress_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source§

fn connect_status_string_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_support_selection_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_track_print_status_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_unit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source§

fn connect_use_full_page_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

impl<O> PrintOperationPreviewExt for O

Source§

fn end_preview(&self)

Ends a preview. Read more
Source§

fn is_selected(&self, page_nr: i32) -> bool

Returns whether the given page is included in the set of pages that have been selected for printing. Read more
Source§

fn render_page(&self, page_nr: i32)

Renders a page to the preview. Read more
Source§

fn connect_got_page_size<F: Fn(&Self, &PrintContext, &PageSetup) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted once for each page that gets rendered to the preview. Read more
Source§

fn connect_ready<F: Fn(&Self, &PrintContext) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::ready signal gets emitted once per preview operation, before the first page is rendered. Read more
Source§

impl<T> Property for T
where T: HasParamSpec,

Source§

type Value = T

Source§

impl<T> PropertyGet for T
where T: HasParamSpec,

Source§

type Value = T

Source§

fn get<R, F>(&self, f: F) -> R
where F: Fn(&<T as PropertyGet>::Value) -> R,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

Ensures that the type has been registered with the type system.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TransparentType for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'a, T, C, E> FromValueOptional<'a> for T
where T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,

Source§

impl<Super, Sub> MayDowncastTo<Sub> for Super
where Super: IsA<Super>, Sub: IsA<Super>,