wxIScan
wxIViewPreviewFrame Class Reference

A slightly extended print preview window. The only differenct to the base class wxPreviewFrame: It only shows options in its control bar that are usable (e.g. options for turning pages if there are more than one). More...

#include <wxiviewprintout.h>

List of all members.

Public Member Functions

 wxIViewPreviewFrame (wxPrintPreview *poPrintPreview, wxWindow *poParentWindow, const wxString &strTitle=wxT("Print Preview"), const wxPoint &oPos=wxDefaultPosition, const wxSize &oSize=wxDefaultSize, long nStyle=wxDEFAULT_FRAME_STYLE, const wxString &strName=wxT("wxIViewPreviewFrame"))
 Standard constructor.
virtual void CreateControlBar ()
 Create the preview window's control bar.

Detailed Description

A slightly extended print preview window. The only differenct to the base class wxPreviewFrame: It only shows options in its control bar that are usable (e.g. options for turning pages if there are more than one).

...

Definition at line 92 of file wxiviewprintout.h.


Constructor & Destructor Documentation

wxIViewPreviewFrame::wxIViewPreviewFrame ( wxPrintPreview *  poPrintPreview,
wxWindow *  poParentWindow,
const wxString &  strTitle = wxT( "Print Preview" ),
const wxPoint &  oPos = wxDefaultPosition,
const wxSize &  oSize = wxDefaultSize,
long  nStyle = wxDEFAULT_FRAME_STYLE,
const wxString &  strName = wxT( "wxIViewPreviewFrame" ) 
) [inline]

Standard constructor.

Parameters:
poPrintPreviewa pointer to ...
poParentWindowa pointer to the parent window
strTitlea string containing the window title, defaults to "Print Preview"
oPoswindow position, defaults to wxDefaultPosition
oSizewindow size, defaults to wxDefaultSize
nStylewindow style, defaults to wxDEFAULT_FRAME_STYLE
strNamea string containing class information, defaults to "wxIViewPreviewFrame"

Definition at line 104 of file wxiviewprintout.h.

      : wxPreviewFrame( poPrintPreview, poParentWindow, strTitle, oPos, oSize, nStyle,
                        strName )
    {
    }

Member Function Documentation

void wxIViewPreviewFrame::CreateControlBar ( ) [virtual]

Create the preview window's control bar.

Creates a control bar that does not contain buttons for turning pages forward and backward if there is only one page that can be printed. The code is inspired on the default implementation of wxPreviewFrame::CreateControlBar() in ${WXWIN}/src/common.prntbase.cpp .

Definition at line 187 of file wxiviewprintout.cpp.

{
    // Note: This code is based on the default implementation of
    //       wxPreviewFrame::CreateControlBar() which you can find in file
    //       ${WXWIN}/src/common.prntbase.cpp .
    //
    // Default controls. In this implemention only the zoom control is shown
    // by default.
    long nButtons= wxPREVIEW_ZOOM;

    // Add the first/previous/next/last page buttons if there is a wxPrintOut object
    // associated and if wxPrintOut::GetPageInfo() returns more than one page.
    if( m_printPreview->GetPrintout() )
    {
        int nMinPage;
        int nMaxPage;
        int nDummy;

        m_printPreview->GetPrintout()->GetPageInfo( &nMinPage, &nMaxPage,
                                                    &nDummy, &nDummy );

        // Check if there is more than one page.
        if( nMaxPage - nMinPage > 0 )
        {
            // Add buttons for 1st/previous/next/last page.
            nButtons |=   wxPREVIEW_FIRST | wxPREVIEW_PREVIOUS
                        | wxPREVIEW_NEXT  | wxPREVIEW_LAST
                        | wxPREVIEW_GOTO;
        }
    }

    // Add the 'Print' button if there is a wxPrintOut object for printing associated.
    if( m_printPreview->GetPrintoutForPrinting() )
    {
        nButtons |= wxPREVIEW_PRINT;
    }

    // Create a new preview tool bar...
    m_controlBar = new wxPreviewControlBar( m_printPreview, nButtons, this,
                                            wxPoint( 0, 0 ), wxSize( 400, 40 ) );

    // ... and update buttons.
    m_controlBar->CreateButtons();
}

The documentation for this class was generated from the following files: