]>
git.saurik.com Git - wxWidgets.git/blob - samples/printing/printing.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Printing demo for wxWidgets
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(__APPLE__)
16 // Define a new application
17 class MyApp
: public wxApp
31 // Define a new canvas and frame
32 class MyFrame
: public wxFrame
36 MyFrame(wxFrame
*frame
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
);
40 void OnSize(wxSizeEvent
& event
);
41 void OnPrint(wxCommandEvent
& event
);
42 void OnPrintPreview(wxCommandEvent
& event
);
43 void OnPrintSetup(wxCommandEvent
& event
);
44 void OnPageSetup(wxCommandEvent
& event
);
45 #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
46 void OnPrintPS(wxCommandEvent
& event
);
47 void OnPrintPreviewPS(wxCommandEvent
& event
);
48 void OnPrintSetupPS(wxCommandEvent
& event
);
49 void OnPageSetupPS(wxCommandEvent
& event
);
52 void OnExit(wxCommandEvent
& event
);
53 void OnPrintAbout(wxCommandEvent
& event
);
57 // Define a new canvas which can receive some events
58 class MyCanvas
: public wxScrolledWindow
61 MyCanvas(wxFrame
*frame
, const wxPoint
& pos
, const wxSize
& size
, long style
= wxRETAINED
);
64 virtual void OnDraw(wxDC
& dc
);
65 void OnEvent(wxMouseEvent
& event
);
70 class MyPrintout
: public wxPrintout
73 MyPrintout(wxChar
*title
= _T("My printout")):wxPrintout(title
) {}
74 bool OnPrintPage(int page
);
75 bool HasPage(int page
);
76 bool OnBeginDocument(int startPage
, int endPage
);
77 void GetPageInfo(int *minPage
, int *maxPage
, int *selPageFrom
, int *selPageTo
);
79 void DrawPageOne(wxDC
*dc
);
80 void DrawPageTwo(wxDC
*dc
);
83 #define WXPRINT_QUIT 100
84 #define WXPRINT_PRINT 101
85 #define WXPRINT_PRINT_SETUP 102
86 #define WXPRINT_PAGE_SETUP 103
87 #define WXPRINT_PREVIEW 104
89 #define WXPRINT_PRINT_PS 105
90 #define WXPRINT_PRINT_SETUP_PS 106
91 #define WXPRINT_PAGE_SETUP_PS 107
92 #define WXPRINT_PREVIEW_PS 108
94 #define WXPRINT_ABOUT 109