# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx::PRT # This class represents the Windows or PostScript printer, and is the vehicle through which printing may be launched by an application. # Printing can also be achieved through using of lower functions and classes, but this and associated classes provide a more convenient and general method of printing. # === # # Category: Printing Framework # @see Printing Framework Overview # @see Wx::PRT::PrinterDC # @see Wx::PRT::PrintDialog # @see Wx::PRT::Printout # @see Wx::PRT::PrintPreview # # class Printer < Object # Constructor. # Pass an optional pointer to a block of print dialog data, which will be copied to the printer object's local data. # @see Wx::PRT::PrintDialogData # @see Wx::PRT::PrintData # @param data [Wx::PRT::PrintDialogData] # @return [Wx::PRT::Printer] def initialize(data=nil) end # Creates the default printing abort window, with a cancel button. # @param parent [Wx::Window] # @param printout [Wx::PRT::Printout] # @return [Wx::PRT::PrintAbortDialog] def create_abort_window(parent, printout) end # Returns true if the user has aborted the print job. # @return [Boolean] def get_abort; end alias_method :abort, :get_abort # Starts the printing process. # Provide a parent window, a user-defined {Wx::PRT::Printout} object which controls the printing of a document, and whether the print dialog should be invoked first. # {Wx::PRT::Printer#print} could return false if there was a problem initializing the printer device context (current printer not set, for example) or the user cancelled printing. Call {Wx::PRT::Printer.get_last_error} to get detailed information about the kind of the error. # @param parent [Wx::Window] # @param printout [Wx::PRT::Printout] # @param prompt [Boolean] # @return [Boolean] def print(parent, printout, prompt=true) end # Invokes the print dialog. # If successful (the user did not press Cancel and no error occurred), a suitable device context will be returned; otherwise NULL is returned; call {Wx::PRT::Printer.get_last_error} to get detailed information about the kind of the error. # The application must delete this device context to avoid a memory leak. # @param parent [Wx::Window] # @return [Wx::DC] def print_dialog(parent) end # Default error-reporting function. # @param parent [Wx::Window] # @param printout [Wx::PRT::Printout] # @param message [String] # @return [void] def report_error(parent, printout, message) end # Return last error. # Valid after calling {Wx::PRT::Printer#print}, {Wx::PRT::Printer#print_dialog} or {Wx::PRT::PrintPreview#print}. # These functions set last error to {Wx::PRT::PrinterError::PRINTER_NO_ERROR} if no error happened. # Returned value is one of the following: # # {Wx::PRT::PrinterError::PRINTER_NO_ERROR} # No error happened. # # {Wx::PRT::PrinterError::PRINTER_CANCELLED} # The user cancelled printing. # # {Wx::PRT::PrinterError::PRINTER_ERROR} # There was an error during printing. # @return [Wx::PrinterError] def self.get_last_error; end end # Printer # This class encapsulates the functionality of printing out an application document. # A new class must be derived and members overridden to respond to calls such as {Wx::PRT::Printout#on_print_page} and {Wx::PRT::Printout#has_page} and to render the print image onto an associated {Wx::DC}. Instances of this class are passed to {Wx::PRT::Printer#print} or to a {Wx::PRT::PrintPreview} object to initiate printing or previewing. # Your derived {Wx::PRT::Printout} is responsible for drawing both the preview image and the printed page. If your windows' drawing routines accept an arbitrary DC as an argument, you can re-use those routines within your {Wx::PRT::Printout} subclass to draw the printout image. You may also add additional drawing elements within your {Wx::PRT::Printout} subclass, like headers, footers, and/or page numbers. However, the image on the printed page will often differ from the image drawn on the screen, as will the print preview image not just in the presence of headers and footers, but typically in scale. A high-resolution printer presents a much larger drawing surface (i.e., a higher-resolution DC); a zoomed-out preview image presents a much smaller drawing surface (lower-resolution DC). By using the routines FitThisSizeToXXX() and/or MapScreenSizeToXXX() within your {Wx::PRT::Printout} subclass to set the user scale and origin of the associated DC, you can easily use a single drawing routine to draw on your application's windows, to create the print preview image, and to create the printed paper image, and achieve a common appearance to the preview image and the printed page. # === # # Category: Printing Framework # @see Printing Framework Overview # @see Wx::PRT::PrinterDC # @see Wx::PRT::PrintDialog # @see Wx::PRT::PageSetupDialog # @see Wx::PRT::Printer # @see Wx::PRT::PrintPreview # # class Printout < Object # Constructor. # Pass an optional title argument - the current filename would be a good idea. This will appear in the printing list (at least in MSW) # @param title [String] # @return [Wx::PRT::Printout] def initialize(title=("Wx::PRT::Printout")) end # Set the user scale and device origin of the {Wx::DC} associated with this {Wx::PRT::Printout} so that the given image size fits entirely within the page rectangle and the origin is at the top left corner of the page rectangle. # On MSW and Mac, the page rectangle is the printable area of the page. On other platforms and PostScript printing, the page rectangle is the entire paper. # Use this if you want your printed image as large as possible, but with the caveat that on some platforms, portions of the image might be cut off at the edges. # @param imageSize [Array(Integer, Integer), Wx::Size] # @return [void] def fit_this_size_to_page(imageSize) end # Set the user scale and device origin of the {Wx::DC} associated with this {Wx::PRT::Printout} so that the given image size fits entirely within the page margins set in the given {Wx::PRT::PageSetupDialogData} object. # This function provides the greatest consistency across all platforms because it does not depend on having access to the printable area of the paper. # On Mac, the native {Wx::PRT::PageSetupDialog} does not let you set the page margins; you'll have to provide your own mechanism, or you can use the Mac-only class wxMacPageMarginsDialog. # @param imageSize [Array(Integer, Integer), Wx::Size] # @param pageSetupData [Wx::PRT::PageSetupDialogData] # @return [void] def fit_this_size_to_page_margins(imageSize, pageSetupData) end # Set the user scale and device origin of the {Wx::DC} associated with this {Wx::PRT::Printout} so that the given image size fits entirely within the paper and the origin is at the top left corner of the paper. # Use this if you're managing your own page margins. # With most printers, the region around the edges of the paper are not printable so that the edges of the image could be cut off. # @param imageSize [Array(Integer, Integer), Wx::Size] # @return [void] def fit_this_size_to_paper(imageSize) end # Returns the device context associated with the printout (given to the printout at start of printing or previewing). # The application can use {Wx::PRT::Printout#get_dc} to obtain a device context to draw on. # This will be a {Wx::PRT::PrinterDC} if printing under Windows or Mac, a {Wx::PRT::PostScriptDC} if printing on other platforms, and a {Wx::MemoryDC} if previewing. # @return [Wx::DC] def get_dc; end alias_method :dc, :get_dc # Return the rectangle corresponding to the page margins specified by the given {Wx::PRT::PageSetupDialogData} object in the associated {Wx::DC}'s logical coordinates for the current user scale and device origin. # The page margins are specified with respect to the edges of the paper on all platforms. # @param pageSetupData [Wx::PRT::PageSetupDialogData] # @return [Wx::Rect] def get_logical_page_margins_rect(pageSetupData) end alias_method :logical_page_margins_rect, :get_logical_page_margins_rect # Return the rectangle corresponding to the page in the associated {Wx::DC} 's logical coordinates for the current user scale and device origin. # On MSW and Mac, this will be the printable area of the paper. On other platforms and PostScript printing, this will be the full paper rectangle. # @return [Wx::Rect] def get_logical_page_rect; end alias_method :logical_page_rect, :get_logical_page_rect # Return the rectangle corresponding to the paper in the associated {Wx::DC} 's logical coordinates for the current user scale and device origin. # @return [Wx::Rect] def get_logical_paper_rect; end alias_method :logical_paper_rect, :get_logical_paper_rect # Returns the number of pixels per logical inch of the printer device context. # Dividing the printer PPI by the screen PPI can give a suitable scaling factor for drawing text onto the printer. # Remember to multiply this by a scaling factor to take the preview DC size into account. Or you can just use the FitThisSizeToXXX() and MapScreenSizeToXXX routines below, which do most of the scaling calculations for you. # @return [Array(Integer,Integer)] def get_ppi_printer; end alias_method :ppi_printer, :get_ppi_printer # Returns the number of pixels per logical inch of the screen device context. # Dividing the printer PPI by the screen PPI can give a suitable scaling factor for drawing text onto the printer. # If you are doing your own scaling, remember to multiply this by a scaling factor to take the preview DC size into account. # @return [Array(Integer,Integer)] def get_ppi_screen; end alias_method :ppi_screen, :get_ppi_screen # Called by the framework to obtain information from the application about minimum and maximum page values that the user can select, and the required page range to be printed. # By default this returns (1, 32000) for the page minimum and maximum values, and (1, 1) for the required page range. # minPage must be greater than zero and maxPage must be greater than minPage. # @return [Array(Integer,Integer,Integer,Integer)] def get_page_info; end alias_method :page_info, :get_page_info # Returns the size of the printer page in millimetres. # @return [Array(Integer,Integer)] def get_page_size_mm; end alias_method :page_size_mm, :get_page_size_mm # Returns the size of the printer page in pixels, called the page rectangle. # The page rectangle has a top left corner at (0,0) and a bottom right corner at (w,h). These values may not be the same as the values returned from {Wx::DC#get_size}; if the printout is being used for previewing, a memory device context is used, which uses a bitmap size reflecting the current preview zoom. The application must take this discrepancy into account if previewing is to be supported. # @return [Array(Integer,Integer)] def get_page_size_pixels; end alias_method :page_size_pixels, :get_page_size_pixels # Returns the rectangle that corresponds to the entire paper in pixels, called the paper rectangle. # This distinction between paper rectangle and page rectangle reflects the fact that most printers cannot print all the way to the edge of the paper. The page rectangle is a rectangle whose top left corner is at (0,0) and whose width and height are given by {Wx::DC#get_page_size_pixels}. # On MSW and Mac, the page rectangle gives the printable area of the paper, while the paper rectangle represents the entire paper, including non-printable borders. Thus, the rectangle returned by {Wx::DC#get_paper_rect_pixels}. # On other platforms and for PostScript printing, the paper is treated as if its entire area were printable, so this function will return the same rectangle as the page rectangle. # @return [Wx::Rect] def get_paper_rect_pixels; end alias_method :paper_rect_pixels, :get_paper_rect_pixels # Returns the title of the printout. # Todothe python note here was wrong # @return [String] def get_title; end alias_method :title, :get_title # Should be overridden to return true if the document has this page, or false if not. # Returning false signifies the end of the document. By default, HasPage behaves as if the document has only one page. # @param pageNum [Integer] # @return [Boolean] def has_page(pageNum) end alias_method :has_page?, :has_page # Returns true if the printout is currently being used for previewing. # # @see Wx::PRT::Printout#get_preview # @return [Boolean] def is_preview; end alias_method :preview?, :is_preview # Returns the associated preview object if any. # If this printout object is used for previewing, returns the associated {Wx::PRT::PrintPreview}. Otherwise returns NULL. # The returned pointer is not owned by the printout and must not be deleted. # @see Wx::PRT::Printout#is_preview # @return [Wx::PRT::PrintPreview] def get_preview; end alias_method :preview, :get_preview # Set the user scale and device origin of the {Wx::DC} associated with this {Wx::PRT::Printout} so that one screen pixel maps to one device pixel on the DC. # That is, the user scale is set to (1,1) and the device origin is set to (0,0). # Use this if you want to do your own scaling prior to calling {Wx::DC} drawing calls, for example, if your underlying model is floating-point and you want to achieve maximum drawing precision on high-resolution printers. # You can use the GetLogicalXXXRect() routines below to obtain the paper rectangle, page rectangle, or page margins rectangle to perform your own scaling. # While the underlying drawing model of macOS is floating-point, wxWidgets's drawing model scales from integer coordinates. # @return [void] def map_screen_size_to_device; end # This sets the user scale of the {Wx::DC} associated with this {Wx::PRT::Printout} to the same scale as {Wx::PRT::Printout#map_screen_size_to_paper} but sets the logical origin to the top left corner of the page rectangle. # @return [void] def map_screen_size_to_page; end # This sets the user scale of the {Wx::DC} associated with this {Wx::PRT::Printout} to the same scale as {Wx::PRT::Printout#map_screen_size_to_page_margins} but sets the logical origin to the top left corner of the page margins specified by the given {Wx::PRT::PageSetupDialogData} object. # @param pageSetupData [Wx::PRT::PageSetupDialogData] # @return [void] def map_screen_size_to_page_margins(pageSetupData) end # Set the user scale and device origin of the {Wx::DC} associated with this {Wx::PRT::Printout} so that the printed page matches the screen size as closely as possible and the logical origin is in the top left corner of the paper rectangle. # That is, a 100-pixel object on screen should appear at the same size on the printed page. (It will, of course, be larger or smaller in the preview image, depending on the zoom factor.) # Use this if you want WYSIWYG behaviour, e.g., in a text editor. # @return [void] def map_screen_size_to_paper; end # Shift the device origin by an amount specified in logical coordinates. # @param xoff [Integer] # @param yoff [Integer] # @return [void] def offset_logical_origin(xoff, yoff) end # Called by the framework at the start of document printing. # Return false from this function cancels the print job. # {Wx::PRT::Printout#on_begin_document} is called once for every copy printed. # The base {Wx::PRT::Printout#on_begin_document} must be called (and the return value checked) from within the overridden function, since it calls {Wx::DC#start_doc}. # @param startPage [Integer] # @param endPage [Integer] # @return [Boolean] def on_begin_document(startPage, endPage) end # Called by the framework at the start of printing. # {Wx::PRT::Printout#on_begin_printing} is called once for every print job (regardless of how many copies are being printed). # @return [void] def on_begin_printing; end # Called by the framework at the end of document printing. # {Wx::PRT::Printout#on_end_document} is called once for every copy printed. # The base {Wx::PRT::Printout#on_end_document} must be called from within the overridden function, since it calls {Wx::DC#end_doc}. # @return [void] def on_end_document; end # Called by the framework at the end of printing. # OnEndPrinting is called once for every print job (regardless of how many copies are being printed). # @return [void] def on_end_printing; end # Called once by the framework before any other demands are made of the {Wx::PRT::Printout} object. # This gives the object an opportunity to calculate the number of pages in the document, for example. # @return [void] def on_prepare_printing; end # Called by the framework when a page should be printed. # Returning false cancels the print job. # @param pageNum [Integer] # @return [Boolean] def on_print_page(pageNum) end # Set the device origin of the associated {Wx::DC} so that the current logical point becomes the new logical origin. # @param x [Integer] # @param y [Integer] # @return [void] def set_logical_origin(x, y) end end # Printout # Objects of this class manage the print preview process. # The object is passed a {Wx::PRT::Printout} object, and the {Wx::PRT::PrintPreview} object itself is passed to a {Wx::PRT::PreviewFrame} object. Previewing is started by initializing and showing the preview frame. Unlike {Wx::PRT::Printer#print}, flow of control returns to the application immediately after the frame is shown. # The preview shown is only exact on Windows. On other platforms, the {Wx::DC} used for preview is different from what is used for printing and the results may be significantly different, depending on how is the output created. In particular, printing code relying on {Wx::DC#get_text_extent} heavily (for example, {Wx::HTML::HtmlEasyPrinting} and other {Wx::HTML} classes do) is affected. It is recommended to use native preview functionality on platforms that offer it (macOS, GTK+). # # === # # Category: Printing Framework # @see Printing Framework Overview # @see Wx::PRT::PrinterDC # @see Wx::PRT::PrintDialog # @see Wx::PRT::Printout # @see Wx::PRT::Printer # @see Wx::PreviewCanvas # @see Wx::PreviewControlBar # @see Wx::PRT::PreviewFrame # # class PrintPreview < Object # @overload initialize(printout, printoutForPrinting=nil, data=nil) # Constructor. # Pass a printout object, an optional printout object to be used for actual printing, and the address of an optional block of printer data, which will be copied to the print preview object's print data. # If printoutForPrinting is non-NULL, a "Print..." button will be placed on the preview frame so that the user can print directly from the preview interface. # Do not explicitly delete the printout objects once this constructor has been called, since they will be deleted in the {Wx::PRT::PrintPreview} destructor. The same does not apply to the data argument. # # Use {Wx::PRT::PrintPreview#is_ok} to check whether the {Wx::PRT::PrintPreview} object was created correctly. # @param printout [Wx::PRT::Printout] # @param printoutForPrinting [Wx::PRT::Printout] # @param data [Wx::PRT::PrintDialogData] # @return [Wx::PRT::PrintPreview] # @overload initialize(printout, printoutForPrinting, data) # @param printout [Wx::PRT::Printout] # @param printoutForPrinting [Wx::PRT::Printout] # @param data [Wx::PRT::PrintData] # @return [Wx::PRT::PrintPreview] def initialize(*args) end # Gets the preview window used for displaying the print preview image. # @return [wxScrolledWindow] def get_canvas; end alias_method :canvas, :get_canvas # Gets the page currently being previewed. # @return [Integer] def get_current_page; end alias_method :current_page, :get_current_page # Gets the frame used for displaying the print preview canvas and control bar. # @return [Wx::Frame] def get_frame; end alias_method :frame, :get_frame # Returns the maximum page number. # @return [Integer] def get_max_page; end alias_method :max_page, :get_max_page # Returns the minimum page number. # @return [Integer] def get_min_page; end alias_method :min_page, :get_min_page # Gets the preview printout object associated with the {Wx::PRT::PrintPreview} object. # @return [Wx::PRT::Printout] def get_printout; end alias_method :printout, :get_printout # Gets the printout object to be used for printing from within the preview interface, or NULL if none exists. # @return [Wx::PRT::Printout] def get_printout_for_printing; end alias_method :printout_for_printing, :get_printout_for_printing # Gets the current percentage zoom level of the preview canvas. # # @see Wx::PRT::PrintPreview#set_zoom # @return [Integer] def get_zoom; end alias_method :zoom, :get_zoom # Returns true if the {Wx::PRT::PrintPreview} is valid, false otherwise. # It could return false if there was a problem initializing the printer device context (current printer not set, for example). # @return [Boolean] def is_ok; end alias_method :ok?, :is_ok # Invokes the print process using the second {Wx::PRT::Printout} object supplied in the {Wx::PRT::PrintPreview} constructor. # Will normally be called by the Print... panel item on the preview frame's control bar. # Returns false in case of error call {Wx::PRT::Printer.get_last_error} to get detailed information about the kind of the error. # @param prompt [Boolean] # @return [Boolean] def print(prompt) end # Renders a page into a {Wx::MemoryDC}. # Used internally by {Wx::PRT::PrintPreview}. # @param pageNum [Integer] # @return [Boolean] def render_page(pageNum) end # Sets the current page to be previewed. # @param pageNum [Integer] # @return [Boolean] def set_current_page(pageNum) end alias_method :current_page=, :set_current_page # Sets the frame to be used for displaying the print preview canvas and control bar. # @param frame [Wx::Frame] # @return [void] def set_frame(frame) end alias_method :frame=, :set_frame # Associates a printout object with the {Wx::PRT::PrintPreview} object. # @param printout [Wx::PRT::Printout] # @return [void] def set_printout(printout) end alias_method :printout=, :set_printout # Sets the percentage preview zoom, and refreshes the preview canvas accordingly. # # @see Wx::PRT::PrintPreview#get_zoom # @param percent [Integer] # @return [void] def set_zoom(percent) end alias_method :zoom=, :set_zoom end # PrintPreview end