]>
Commit | Line | Data |
---|---|---|
6adaedf0 | 1 | ///////////////////////////////////////////////////////////////////////////// |
f415cab9 JS |
2 | // Name: samples/printing.h |
3 | ||
be5a51fb | 4 | // Purpose: Printing demo for wxWidgets |
6adaedf0 JS |
5 | // Author: Julian Smart |
6 | // Modified by: | |
7 | // Created: 1995 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) Julian Smart | |
10 | // Licence: wxWindows licence | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
c801d85f | 12 | |
c801d85f KB |
13 | // Define a new application |
14 | class MyApp: public wxApp | |
15 | { | |
16 | public: | |
925e9792 | 17 | MyApp(){}; |
e3065973 JS |
18 | bool OnInit(); |
19 | int OnExit(); | |
34da0970 | 20 | |
9134af5b | 21 | wxFont m_testFont; |
c801d85f KB |
22 | }; |
23 | ||
34da0970 JS |
24 | DECLARE_APP(MyApp) |
25 | ||
c801d85f KB |
26 | class MyCanvas; |
27 | ||
28 | // Define a new canvas and frame | |
29 | class MyFrame: public wxFrame | |
30 | { | |
31 | public: | |
32 | MyCanvas *canvas; | |
cac7ac30 RR |
33 | wxBitmap m_bitmap; |
34 | int m_angle; | |
c801d85f KB |
35 | MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size); |
36 | ||
c801d85f | 37 | void Draw(wxDC& dc); |
cac7ac30 RR |
38 | void OnAngleUp(wxCommandEvent& event); |
39 | void OnAngleDown(wxCommandEvent& event); | |
c801d85f KB |
40 | |
41 | void OnSize(wxSizeEvent& event); | |
42 | void OnPrint(wxCommandEvent& event); | |
43 | void OnPrintPreview(wxCommandEvent& event); | |
c801d85f | 44 | void OnPageSetup(wxCommandEvent& event); |
dfad0599 | 45 | #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW |
c801d85f KB |
46 | void OnPrintPS(wxCommandEvent& event); |
47 | void OnPrintPreviewPS(wxCommandEvent& event); | |
c801d85f | 48 | void OnPageSetupPS(wxCommandEvent& event); |
dfad0599 | 49 | #endif |
f415cab9 JS |
50 | #ifdef __WXMAC__ |
51 | void OnPageMargins(wxCommandEvent& event); | |
52 | #endif | |
dfad0599 | 53 | |
c801d85f KB |
54 | void OnExit(wxCommandEvent& event); |
55 | void OnPrintAbout(wxCommandEvent& event); | |
56 | DECLARE_EVENT_TABLE() | |
57 | }; | |
58 | ||
59 | // Define a new canvas which can receive some events | |
60 | class MyCanvas: public wxScrolledWindow | |
61 | { | |
62 | public: | |
63 | MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED); | |
925e9792 | 64 | ~MyCanvas(void){}; |
c801d85f KB |
65 | |
66 | virtual void OnDraw(wxDC& dc); | |
67 | void OnEvent(wxMouseEvent& event); | |
68 | ||
69 | DECLARE_EVENT_TABLE() | |
70 | }; | |
71 | ||
72 | class MyPrintout: public wxPrintout | |
73 | { | |
74 | public: | |
fbfb8bcc | 75 | MyPrintout(const wxChar *title = _T("My printout")):wxPrintout(title) {} |
c801d85f KB |
76 | bool OnPrintPage(int page); |
77 | bool HasPage(int page); | |
78 | bool OnBeginDocument(int startPage, int endPage); | |
79 | void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); | |
80 | ||
f415cab9 JS |
81 | void DrawPageOne(); |
82 | ||
83 | void DrawPageTwo(); | |
84 | ||
c801d85f KB |
85 | }; |
86 | ||
87 | #define WXPRINT_QUIT 100 | |
88 | #define WXPRINT_PRINT 101 | |
c801d85f KB |
89 | #define WXPRINT_PAGE_SETUP 103 |
90 | #define WXPRINT_PREVIEW 104 | |
91 | ||
92 | #define WXPRINT_PRINT_PS 105 | |
c801d85f KB |
93 | #define WXPRINT_PAGE_SETUP_PS 107 |
94 | #define WXPRINT_PREVIEW_PS 108 | |
95 | ||
96 | #define WXPRINT_ABOUT 109 | |
97 | ||
cac7ac30 RR |
98 | #define WXPRINT_ANGLEUP 110 |
99 | #define WXPRINT_ANGLEDOWN 111 | |
f415cab9 JS |
100 | |
101 | #ifdef __WXMAC__ | |
102 | #define WXPRINT_PAGE_MARGINS 112 | |
103 | #endif |