]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | /* |
2 | * File: printing.h | |
3 | * Purpose: Printing demo for wxWindows class library | |
4 | * Author: Julian Smart | |
5 | * Created: 1995 | |
6 | * Updated: | |
7 | * Copyright: (c) 1995, AIAI, University of Edinburgh | |
8 | */ | |
9 | ||
10 | /* sccsid[] = "%W% %G%" */ | |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma interface | |
14 | #endif | |
15 | ||
16 | // Define a new application | |
17 | class MyApp: public wxApp | |
18 | { | |
19 | public: | |
e3065973 JS |
20 | MyApp() ; |
21 | bool OnInit(); | |
22 | int OnExit(); | |
34da0970 JS |
23 | |
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; | |
36 | MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size); | |
37 | ||
c801d85f KB |
38 | void Draw(wxDC& dc); |
39 | ||
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); | |
dfad0599 | 45 | #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW |
c801d85f KB |
46 | void OnPrintPS(wxCommandEvent& event); |
47 | void OnPrintPreviewPS(wxCommandEvent& event); | |
48 | void OnPrintSetupPS(wxCommandEvent& event); | |
49 | void OnPageSetupPS(wxCommandEvent& event); | |
dfad0599 JS |
50 | #endif |
51 | ||
c801d85f KB |
52 | void OnExit(wxCommandEvent& event); |
53 | void OnPrintAbout(wxCommandEvent& event); | |
54 | DECLARE_EVENT_TABLE() | |
55 | }; | |
56 | ||
57 | // Define a new canvas which can receive some events | |
58 | class MyCanvas: public wxScrolledWindow | |
59 | { | |
60 | public: | |
61 | MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED); | |
62 | ~MyCanvas(void) ; | |
63 | ||
64 | virtual void OnDraw(wxDC& dc); | |
65 | void OnEvent(wxMouseEvent& event); | |
66 | ||
67 | DECLARE_EVENT_TABLE() | |
68 | }; | |
69 | ||
70 | class MyPrintout: public wxPrintout | |
71 | { | |
72 | public: | |
73 | MyPrintout(char *title = "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); | |
78 | ||
79 | void DrawPageOne(wxDC *dc); | |
80 | void DrawPageTwo(wxDC *dc); | |
81 | }; | |
82 | ||
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 | |
88 | ||
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 | |
93 | ||
94 | #define WXPRINT_ABOUT 109 | |
95 |