# wxPreviewFrame Class Reference
[Printing Framework]

`#include <wx/print.h>`

Inheritance diagram for wxPreviewFrame:
[legend]

## Detailed Description

This class provides the default method of managing the print preview interface.

Member functions may be overridden to replace functionality, or the class may be used without derivation.

##

Library: wxBase

Category: Printing Framework

See also:
  wxPreviewCanvas, wxPreviewControlBar, wxPrintPreview

## Public Member Functions
| wxPreviewFrame (wxPrintPreviewBase *preview, wxWindow *parent, const wxString &title="Print Preview", const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE, const wxString &name=wxFrameNameStr)
| Constructor.
virtual | ~wxPreviewFrame ()
| Destructor.
virtual void | CreateCanvas ()
| Creates a wxPreviewCanvas.
virtual void | CreateControlBar ()
| Creates a wxPreviewControlBar.
virtual void | Initialize ()
| Initializes the frame elements and prepares for showing it.
virtual void | InitializeWithModality (wxPreviewFrameModalityKind kind)
| Initializes the frame elements and prepares for showing it with the given modality kind.
void | OnCloseWindow (wxCloseEvent &event)
| Enables any disabled frames in the application, and deletes the print preview object, implicitly deleting any printout objects associated with the print preview object.

List of all members.

## Constructor & Destructor Documentation

wxPreviewFrame::wxPreviewFrame | ( | wxPrintPreviewBase * | preview,
|  | wxWindow * | parent,
|  | const wxString & | title = `"Print Preview"`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `wxDEFAULT_FRAME_STYLE`,
|  | const wxString & | name = `wxFrameNameStr` |
| ) |  |  |

Constructor.

Pass a print preview object plus other normal frame arguments. The print preview object will be destroyed by the frame when it closes.

virtual wxPreviewFrame::~wxPreviewFrame | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual void wxPreviewFrame::CreateCanvas | ( |  | ) | `[virtual]`

Creates a wxPreviewCanvas.

Override this function to allow a user-defined preview canvas object to be created.

virtual void wxPreviewFrame::CreateControlBar | ( |  | ) | `[virtual]`

Creates a wxPreviewControlBar.

Override this function to allow a user-defined preview control bar object to be created.

virtual void wxPreviewFrame::Initialize | ( |  | ) | `[virtual]`

Initializes the frame elements and prepares for showing it.

Calling this method is equivalent to calling InitializeWithModality() with wxPreviewFrame_AppModal argument, please see its documentation for more details.

Please notice that this function is virtual mostly for backwards compatibility only, there is no real need to override it as it's never called by wxWidgets itself.

virtual void wxPreviewFrame::InitializeWithModality | ( | wxPreviewFrameModalityKind | kind | ) | `[virtual]`

Initializes the frame elements and prepares for showing it with the given modality kind.

This method creates the frame elements by calling CreateCanvas() and CreateControlBar() methods (which may be overridden to customize them) and prepares to show the frame according to the value of kind parameter:

- If it is wxPreviewFrame_AppModal, all the other application windows will be disabled when this frame is shown. This is the same behaviour as that of simple Initialize().
- If it is wxPreviewFrame_WindowModal, only the parent window of the preview frame will be disabled when it is shown.
- And if it is wxPreviewFrame_NonModal, no windows at all will be disabled while the preview is shown.

Notice that this function (or Initialize()) must be called by the application prior to showing the frame but you still must call `Show(true)` to actually show it afterwards.

Parameters:

  | kind | The modality kind of preview frame.

Since:
  2.9.2

void wxPreviewFrame::OnCloseWindow | ( | wxCloseEvent & | event | ) |

Enables any disabled frames in the application, and deletes the print preview object, implicitly deleting any printout objects associated with the print preview object.

|  | [ top ]