wxIScan
wxiviewprintout.h
Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////
00002 // Project:     wxIView
00003 // Purpose:     Complex wxWidgets sample
00004 // Name:        wxIViewPrintout.h
00005 // Author:      Daniel Nell
00006 // Created:     2005/10/18
00007 // Copyright:   (c) Daniel Nell
00008 // License:     wxWindows license
00009 // Modified by:
00010 /////////////////////////////////////////////////////////////////////////////
00011 
00012 #ifndef __WXIVIEWPRINTOUT_H
00013 #define __WXIVIEWPRINTOUT_H
00014 
00015 #define wxivIMAGEPPIX (180)
00016 #define wxivIMAGEPPIY (180)
00017 
00018 
00019 // Forward declartion.
00020 class wxIViewPaintBase;
00021 
00022 
00023 /////////////////////////////////////////////////////////////////////////////
00024 //  Class wxIViewPrintout
00025 //
00026 /// \brief Class to print out an image.
00027 ///
00028 /// Images can be multipage images, too.
00029 class wxIViewPrintout : public wxPrintout
00030 {
00031   public:
00032     /// \brief Standard constructor.
00033     ///
00034     /// \param poPaint              a pointer to an instance of wxIViewPaintBase
00035     /// \param strTitle             the window caption text, defaults to "wxIViewPrintout"
00036     /// \param bFitToPage           flag to indicate it the image is to be scaled to full page size,
00037     ///                             defaults to true
00038     /// \param nResolutionX         horizontal resolution of the image in dpi, defaults to wxivIMAGEPPIX
00039     /// \param nResolutionY         vertical resolution of the image in dpi, defaults to wxivIMAGEPPIY
00040     wxIViewPrintout( wxIViewPaintBase *poPaint,
00041                      const wxString& strTitle= wxT( "wxIViewPrintout" ),
00042                      bool bFitToPage= true,
00043                      int nResolutionX= wxivIMAGEPPIX,
00044                      int nResolutionY= wxivIMAGEPPIY );
00045 
00046     /// \brief From the wxWidgets documentation:
00047     ///        Called by the framework to obtain information from the application about minimum
00048     ///        and maximum page values that the user can select, and the required page range to
00049     ///        be printed. By default this returns 1, 32000 for the page minimum and maximum
00050     ///        values, and 1, 1 for the required page range. If minPage is zero, the page number
00051     ///        controls in the print dialog will be disabled.
00052     ///
00053     /// \param nMinPage             ...
00054     /// \param nMaxPage             ...
00055     /// \param nSelPageFrom         ...
00056     /// \param nSelPageTo           ...
00057     virtual void GetPageInfo( int *nMinPage, int *nMaxPage, int *nSelPageFrom, int *nSelPageTo );
00058 
00059     /// \brief From the wxWidgets documentation:
00060     ///        Should be overridden to return true if the document has this page, or false if not.
00061     ///        Returning false signifies the end of the document. By default, HasPage behaves as if
00062     ///        the document has only one page.
00063     ///
00064     /// \param nPage                page number to print
00065     virtual bool HasPage( int nPage );
00066 
00067     /// \brief From the wxWidgets documentation:
00068     ///        Called by the framework when a page should be printed. Returning false cancels the
00069     ///        print job. The application can use wxPrintout::GetDC to obtain a device context to
00070     ///        draw on.
00071     ///
00072     /// \param nPage                page number to print
00073     virtual bool OnPrintPage( int nPage );
00074 
00075   protected:
00076     wxIViewPaintBase *m_poPaint;    ///< Pointer to the parent object.
00077     bool m_bFitToPage;              ///< Flag: Should the output scaled to fix the printer page?
00078     int m_nResolutionX;             ///< Resolution in width direction in DPI.
00079     int m_nResolutionY;             ///< Resolution in height direction in DPI.
00080 };
00081 
00082 
00083 /////////////////////////////////////////////////////////////////////////////
00084 //  Class wxIViewPreviewFrame
00085 //
00086 /// \brief A slightly extended print preview window. The only differenct to the
00087 ///        base class wxPreviewFrame: It only shows options in its control bar
00088 ///        that are usable (e.g. options for turning pages if there are more
00089 ///        than one).
00090 ///
00091 /// ...
00092 class wxIViewPreviewFrame : public wxPreviewFrame
00093 {
00094   public:
00095     /// \brief Standard constructor
00096     ///
00097     /// \param poPrintPreview    a pointer to ...
00098     /// \param poParentWindow    a pointer to the parent window
00099     /// \param strTitle          a string containing the window title, defaults to "Print Preview"
00100     /// \param oPos              window position, defaults to wxDefaultPosition
00101     /// \param oSize             window size, defaults to wxDefaultSize
00102     /// \param nStyle            window style, defaults to wxDEFAULT_FRAME_STYLE
00103     /// \param strName           a string containing class information, defaults to "wxIViewPreviewFrame"
00104     wxIViewPreviewFrame( wxPrintPreview* poPrintPreview,
00105                          wxWindow* poParentWindow,
00106                          const wxString& strTitle= wxT( "Print Preview" ),
00107                          const wxPoint& oPos= wxDefaultPosition,
00108                          const wxSize& oSize= wxDefaultSize,
00109                          long  nStyle= wxDEFAULT_FRAME_STYLE,
00110                          const wxString& strName = wxT( "wxIViewPreviewFrame" ) )
00111       : wxPreviewFrame( poPrintPreview, poParentWindow, strTitle, oPos, oSize, nStyle,
00112                         strName )
00113     {
00114     }
00115 
00116     /// \brief Create the preview window's control bar.
00117     ///
00118     /// Creates a control bar that does not contain buttons for turning pages
00119     /// forward and backward if there is only one page that can be printed.
00120     /// The code is inspired on the default implementation of
00121     /// wxPreviewFrame::CreateControlBar() in ${WXWIN}/src/common.prntbase.cpp .
00122     virtual void CreateControlBar();
00123 };
00124 
00125 #endif // __WXIVIEWPRINTOUT_H
00126