]>
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 | |
788233da | 12 | #if defined(__GNUG__) && !defined(__APPLE__) |
c801d85f KB |
13 | #pragma interface |
14 | #endif | |
15 | ||
16 | // Define a new application | |
17 | class MyApp: public wxApp | |
18 | { | |
19 | public: | |
925e9792 | 20 | MyApp(){}; |
e3065973 JS |
21 | bool OnInit(); |
22 | int OnExit(); | |
34da0970 | 23 | |
9134af5b | 24 | wxFont m_testFont; |
c801d85f KB |
25 | }; |
26 | ||
34da0970 JS |
27 | DECLARE_APP(MyApp) |
28 | ||
c801d85f KB |
29 | class MyCanvas; |
30 | ||
31 | // Define a new canvas and frame | |
32 | class MyFrame: public wxFrame | |
33 | { | |
34 | public: | |
35 | MyCanvas *canvas; | |
cac7ac30 RR |
36 | wxBitmap m_bitmap; |
37 | int m_angle; | |
c801d85f KB |
38 | MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size); |
39 | ||
c801d85f | 40 | void Draw(wxDC& dc); |
cac7ac30 RR |
41 | void OnAngleUp(wxCommandEvent& event); |
42 | void OnAngleDown(wxCommandEvent& event); | |
c801d85f KB |
43 | |
44 | void OnSize(wxSizeEvent& event); | |
45 | void OnPrint(wxCommandEvent& event); | |
46 | void OnPrintPreview(wxCommandEvent& event); | |
c801d85f | 47 | void OnPageSetup(wxCommandEvent& event); |
dfad0599 | 48 | #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW |
c801d85f KB |
49 | void OnPrintPS(wxCommandEvent& event); |
50 | void OnPrintPreviewPS(wxCommandEvent& event); | |
c801d85f | 51 | void OnPageSetupPS(wxCommandEvent& event); |
dfad0599 JS |
52 | #endif |
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: | |
600683ca | 75 | MyPrintout(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 | ||
81 | void DrawPageOne(wxDC *dc); | |
82 | void DrawPageTwo(wxDC *dc); | |
83 | }; | |
84 | ||
85 | #define WXPRINT_QUIT 100 | |
86 | #define WXPRINT_PRINT 101 | |
c801d85f KB |
87 | #define WXPRINT_PAGE_SETUP 103 |
88 | #define WXPRINT_PREVIEW 104 | |
89 | ||
90 | #define WXPRINT_PRINT_PS 105 | |
c801d85f KB |
91 | #define WXPRINT_PAGE_SETUP_PS 107 |
92 | #define WXPRINT_PREVIEW_PS 108 | |
93 | ||
94 | #define WXPRINT_ABOUT 109 | |
95 | ||
cac7ac30 RR |
96 | #define WXPRINT_ANGLEUP 110 |
97 | #define WXPRINT_ANGLEDOWN 111 |