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