Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: PageSetup

[30:7] extends: object

Stores page size, orientation and margins for printing. 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 [ctor@Gtk.PageSetup.new] to get the defaults, or use [func@Gtk.print_run_page_setup_dialog] to show the page setup dialog and receive the resulting page setup. ## A page setup dialog c 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; }

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • PageSetup ()

    Creates a new GtkPageSetup.

  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asObject ()

    Wraps this handle as Object.

    • @r A Object object.
  • copy ()

    Copies a GtkPageSetup.

  • get_bottom_margin (string unit)

    Gets the bottom margin in units of @unit.

    • @p unit is the unit for the return value.
  • get_left_margin (string unit)

    Gets the left margin in units of @unit.

    • @p unit is the unit for the return value.
  • get_orientation ()

    Gets the page orientation of the GtkPageSetup.

  • get_page_height (string unit)

    Returns the page height in units of @unit. Note that this function takes orientation and margins into consideration. See [method@Gtk.PageSetup.get_paper_height].

    • @p unit is the unit for the return value.
  • get_page_width (string unit)

    Returns the page width in units of @unit. Note that this function takes orientation and margins into consideration. See [method@Gtk.PageSetup.get_paper_width].

    • @p unit is the unit for the return value.
  • get_paper_height (string unit)

    Returns the paper height in units of @unit. Note that this function takes orientation, but not margins into consideration. See [method@Gtk.PageSetup.get_page_height].

    • @p unit is the unit for the return value.
  • get_paper_size ()

    Gets the paper size of the GtkPageSetup.

  • get_paper_width (string unit)

    Returns the paper width in units of @unit. Note that this function takes orientation, but not margins into consideration. See [method@Gtk.PageSetup.get_page_width].

    • @p unit is the unit for the return value.
  • get_right_margin (string unit)

    Gets the right margin in units of @unit.

    • @p unit is the unit for the return value.
  • get_top_margin (string unit)

    Gets the top margin in units of @unit.

    • @p unit is the unit for the return value.
  • load_file (string file_name)

    Reads the page setup from the file @file_name. See [method@Gtk.PageSetup.to_file].

    • @p file_name is the filename to read the page setup from.
  • load_key_file (object key_file, string group_name)

    Reads the page setup from the group @group_name in the key file

    • @key_file. ``
    • @p key_file is the GKeyFile to retrieve the page_setup from.
    • @p group_name is the name of the group in the key_file to read to use the default name “Page Setup”.
  • set_bottom_margin (double margin, string unit)

    Sets the bottom margin of the GtkPageSetup.

    • @p margin is the new bottom margin in units of @unit.
    • @p unit is the units for @margin.
    • @r None.
  • set_left_margin (double margin, string unit)

    Sets the left margin of the GtkPageSetup.

    • @p margin is the new left margin in units of @unit.
    • @p unit is the units for @margin.
    • @r None.
  • set_orientation (string orientation)

    Sets the page orientation of the GtkPageSetup.

    • @p orientation is a GtkPageOrientation value.
    • @r None.
  • set_paper_size (object size)

    Sets the paper size of the GtkPageSetup without changing the margins. See [method@Gtk.PageSetup.set_paper_size_and_default_margins].

    • @p size is a GtkPaperSize.
    • @r None.
  • set_paper_size_and_default_margins (object size)

    Sets the paper size of the GtkPageSetup and modifies the margins according to the new paper size.

    • @p size is a GtkPaperSize.
    • @r None.
  • set_right_margin (double margin, string unit)

    Sets the right margin of the GtkPageSetup.

    • @p margin is the new right margin in units of @unit.
    • @p unit is the units for @margin.
    • @r None.
  • set_top_margin (double margin, string unit)

    Sets the top margin of the GtkPageSetup.

    • @p margin is the new top margin in units of @unit.
    • @p unit is the units for @margin.
    • @r None.
  • to_file (string file_name)

    This function saves the information from @setup to @file_name.

    • @p file_name is the file to save to.
  • to_gvariant ()

    Serialize page setup to an a{sv} variant.

  • to_key_file (object key_file, string group_name)

    This function adds the page setup from @setup to @key_file.

    • @p key_file is the GKeyFile to save the page setup to.
    • @p group_name is the group to add the settings to in @key_file, or %NULL to use the default name “Page Setup”.
    • @r None.

class: PageSetupCtors

[377:14] static extends: object

Alternate constructors for PageSetup. Usage: PageSetupCtors.<name>(...). The primary constructor lives directly on PageSetup.

Methods

  • newFromFile (string file_name)

    Reads the page setup from the file @file_name. Returns a new GtkPageSetup object with the restored page setup, or %NULL if an error occurred. See [method@Gtk.PageSetup.to_file].

    • @p file_name is the filename to read the page setup from.
    • @r A new PageSetup.
  • newFromGvariant (object variant)

    Desrialize a page setup from an a{sv} variant. The variant must be in the format produced by [method@Gtk.PageSetup.to_gvariant].

    • @p variant is an a{sv} GVariant.
    • @r A new PageSetup.
  • newFromKeyFile (object key_file, string group_name)

    Reads the page setup from the group @group_name in the key file

    • @key_file. Returns a new GtkPageSetup object with the restored page setup, or %NULL if an error occurred.
    • @p key_file is the GKeyFile to retrieve the page_setup from.
    • @p group_name is the name of the group in the key_file to read to use the default name “Page Setup”.
    • @r A new PageSetup.