wxPrintPreview(3)
π NAME π
wxPrintPreview β okay so basically objects of this class manage the print preview process. that's the whole vibe, bestie. β¨
πΈ DESCRIPTION πΈ
okay so picture this: you hand the object a wxPrintout object, and then you hand the wxPrintPreview object itself to a wxPreviewFrame object. that's the chain, that's the lore. π¦
previewing kicks off when you initialize and show the preview frame. and here's the slay part β unlike wxPrinter:print/4, the flow of control comes right back to the application immediately after the frame is shown. no waiting around, main character energy fr fr. π
β οΈ Note (read this one, i'm serious): the preview shown is only exact on Windows. on other platforms, thewxDCused for preview is different from what's used for printing, and the results may be significantly different, depending on how the output is created. in particular, printing code that leans heavily onwxDC:getTextExtent/3(for example,wxHtmlEasyPrintingand otherwxHTMLclasses do exactly that) is affected. it is recommended to use native preview functionality on platforms that offer it (macOS, GTK+). π
See (the little reading list, go off):
- Overview printing
wxPrintDialogwxPrintoutwxPrinterwxPreviewCanvaswxPreviewControlBarwxPreviewFrame
also, wxWidgets docs: wxPrintPreview
π DATA TYPES π
wxPrintPreview() :: wx:wx_object().
that's it, that's the type. she's a wx object and she knows it. π
β¨ FUNCTIONS β¨
π destroy(This :: wxPrintPreview()) -> ok.
Destroys the object. bye bestie, no notes. π
π getCanvas(This) -> wxPreviewCanvas:wxPreviewCanvas() when This :: wxPrintPreview().
Gets the preview window used for displaying the print preview image. that's the canvas you're staring at. πΌοΈ
π getCurrentPage(This) -> integer() when This :: wxPrintPreview().
Gets the page currently being previewed. where are we rn, bestie.
π getFrame(This) -> wxFrame:wxFrame() when This :: wxPrintPreview().
Gets the frame used for displaying the print preview canvas and control bar. the whole lil stage for the show. π
π getMaxPage(This) -> integer() when This :: wxPrintPreview().
Returns the maximum page number. the ceiling, periodt.
π getMinPage(This) -> integer() when This :: wxPrintPreview().
Returns the minimum page number. the floor, also periodt.
π getPrintout(This) -> wxPrintout:wxPrintout() when This :: wxPrintPreview().
Gets the preview printout object associated with the wxPrintPreview object. π«Ά
π getPrintoutForPrinting(This) -> wxPrintout:wxPrintout() when This :: wxPrintPreview().
Gets the printout object to be used for printing from within the preview interface, or NULL if none exists. ngl if it's NULL she simply did not show up. π
π isOk(This) -> boolean() when This :: wxPrintPreview().
Returns true if the wxPrintPreview is valid, false otherwise.
It could return false if there was a problem initializing the printer device context (current printer not set, for example). so like, always vibe check this one. π
π new(Printout, [Option]) -> wxPrintPreview()
when
Printout :: wxPrintout:wxPrintout(),
Option ::
{printoutForPrinting, wxPrintout:wxPrintout()} |
{data, wxPrintDialogData:wxPrintDialogData()}.
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. a whole extra button, we love to see it. π₯
Remark: Do not explicitly delete the printout objects once this constructor has been called, since they will be deleted in thewxPrintPreviewdestructor. The same does not apply to thedataargument. okay so the destructor handles cleanup for the printouts, but bestie, thedataargument is on you β do not mix those up, or it's giving memory issues. π
Use isOk/1 to check whether the wxPrintPreview object was created correctly.
π new(Printout, PrintoutForPrinting, Data) -> wxPrintPreview()
when
Printout :: wxPrintout:wxPrintout(),
PrintoutForPrinting :: wxPrintout:wxPrintout(),
Data :: wxPrintData:wxPrintData().
π paintPage(This, Canvas, Dc) -> boolean()
when
This :: wxPrintPreview(),
Canvas :: wxPreviewCanvas:wxPreviewCanvas(),
Dc :: wxDC:wxDC().
This refreshes the preview window with the preview image. π
It must be called from the preview window's OnPaint member. like, mandatory, no skipping. π
The implementation simply blits the preview bitmap onto the canvas, creating a new preview bitmap if none exists. lowkey efficient, highkey iconic.
π print(This, Prompt) -> boolean()
when This :: wxPrintPreview(), Prompt :: boolean().
Invokes the print process using the second wxPrintout object supplied in the wxPrintPreview constructor. π¨οΈ
Will normally be called by the Print... panel item on the preview frame's control bar.
Returns false in case of error β call wxPrinter:getLastError/0 to get detailed information about the kind of the error. so if it flops, go ask getLastError/0 what happened. π
π renderPage(This, PageNum) -> boolean()
when This :: wxPrintPreview(), PageNum :: integer().
Renders a page into a wxMemoryDC.
Used internally by wxPrintPreview. iykyk, you probably don't need to touch this one yourself. π
π setCanvas(This, Window) -> ok
when
This :: wxPrintPreview(),
Window :: wxPreviewCanvas:wxPreviewCanvas().
Sets the window to be used for displaying the print preview image. πΌοΈ
π setCurrentPage(This, PageNum) -> boolean()
when
This :: wxPrintPreview(),
PageNum :: integer().
Sets the current page to be previewed. flipping to the page you actually want, slay. π
π setFrame(This, Frame) -> ok
when
This :: wxPrintPreview(),
Frame :: wxFrame:wxFrame().
Sets the frame to be used for displaying the print preview canvas and control bar. π
π setPrintout(This, Printout) -> ok
when
This :: wxPrintPreview(),
Printout :: wxPrintout:wxPrintout().
Associates a printout object with the wxPrintPreview object. besties, officially linked. π«Ά
π setZoom(This, Percent) -> ok
when This :: wxPrintPreview(), Percent :: integer().
Sets the percentage preview zoom, and refreshes the preview canvas accordingly. zoom in, zoom out, she ate that. πβ¨
aww okay that's the whole page bestie, you got this π
β with love from Ericsson AB, running the wx 2.6 era of the wxPrintPreview(3) page. mwah, go write some preview code. π
ππ¦
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms