]>
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: | |
20 | MyApp(void) ; | |
21 | bool OnInit(void); | |
34da0970 JS |
22 | |
23 | wxFont* m_testFont; | |
c801d85f KB |
24 | }; |
25 | ||
34da0970 JS |
26 | DECLARE_APP(MyApp) |
27 | ||
c801d85f KB |
28 | class MyCanvas; |
29 | ||
30 | // Define a new canvas and frame | |
31 | class MyFrame: public wxFrame | |
32 | { | |
33 | public: | |
34 | MyCanvas *canvas; | |
35 | MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size); | |
36 | ||
37 | bool OnClose(void); | |
38 | ||
39 | void Draw(wxDC& dc); | |
40 | ||
41 | void OnSize(wxSizeEvent& event); | |
42 | void OnPrint(wxCommandEvent& event); | |
43 | void OnPrintPreview(wxCommandEvent& event); | |
44 | void OnPrintSetup(wxCommandEvent& event); | |
45 | void OnPageSetup(wxCommandEvent& event); | |
46 | void OnPrintPS(wxCommandEvent& event); | |
47 | void OnPrintPreviewPS(wxCommandEvent& event); | |
48 | void OnPrintSetupPS(wxCommandEvent& event); | |
49 | void OnPageSetupPS(wxCommandEvent& event); | |
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); | |
60 | ~MyCanvas(void) ; | |
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: | |
71 | MyPrintout(char *title = "My printout"):wxPrintout(title) {} | |
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 | |
83 | #define WXPRINT_PRINT_SETUP 102 | |
84 | #define WXPRINT_PAGE_SETUP 103 | |
85 | #define WXPRINT_PREVIEW 104 | |
86 | ||
87 | #define WXPRINT_PRINT_PS 105 | |
88 | #define WXPRINT_PRINT_SETUP_PS 106 | |
89 | #define WXPRINT_PAGE_SETUP_PS 107 | |
90 | #define WXPRINT_PREVIEW_PS 108 | |
91 | ||
92 | #define WXPRINT_ABOUT 109 | |
93 |