]>
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); | |
22 | }; | |
23 | ||
24 | class MyCanvas; | |
25 | ||
26 | // Define a new canvas and frame | |
27 | class MyFrame: public wxFrame | |
28 | { | |
29 | public: | |
30 | MyCanvas *canvas; | |
31 | MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size); | |
32 | ||
33 | bool OnClose(void); | |
34 | ||
35 | void Draw(wxDC& dc); | |
36 | ||
37 | void OnSize(wxSizeEvent& event); | |
38 | void OnPrint(wxCommandEvent& event); | |
39 | void OnPrintPreview(wxCommandEvent& event); | |
40 | void OnPrintSetup(wxCommandEvent& event); | |
41 | void OnPageSetup(wxCommandEvent& event); | |
42 | void OnPrintPS(wxCommandEvent& event); | |
43 | void OnPrintPreviewPS(wxCommandEvent& event); | |
44 | void OnPrintSetupPS(wxCommandEvent& event); | |
45 | void OnPageSetupPS(wxCommandEvent& event); | |
46 | void OnExit(wxCommandEvent& event); | |
47 | void OnPrintAbout(wxCommandEvent& event); | |
48 | DECLARE_EVENT_TABLE() | |
49 | }; | |
50 | ||
51 | // Define a new canvas which can receive some events | |
52 | class MyCanvas: public wxScrolledWindow | |
53 | { | |
54 | public: | |
55 | MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED); | |
56 | ~MyCanvas(void) ; | |
57 | ||
58 | virtual void OnDraw(wxDC& dc); | |
59 | void OnEvent(wxMouseEvent& event); | |
60 | ||
61 | DECLARE_EVENT_TABLE() | |
62 | }; | |
63 | ||
64 | class MyPrintout: public wxPrintout | |
65 | { | |
66 | public: | |
67 | MyPrintout(char *title = "My printout"):wxPrintout(title) {} | |
68 | bool OnPrintPage(int page); | |
69 | bool HasPage(int page); | |
70 | bool OnBeginDocument(int startPage, int endPage); | |
71 | void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); | |
72 | ||
73 | void DrawPageOne(wxDC *dc); | |
74 | void DrawPageTwo(wxDC *dc); | |
75 | }; | |
76 | ||
77 | #define WXPRINT_QUIT 100 | |
78 | #define WXPRINT_PRINT 101 | |
79 | #define WXPRINT_PRINT_SETUP 102 | |
80 | #define WXPRINT_PAGE_SETUP 103 | |
81 | #define WXPRINT_PREVIEW 104 | |
82 | ||
83 | #define WXPRINT_PRINT_PS 105 | |
84 | #define WXPRINT_PRINT_SETUP_PS 106 | |
85 | #define WXPRINT_PAGE_SETUP_PS 107 | |
86 | #define WXPRINT_PREVIEW_PS 108 | |
87 | ||
88 | #define WXPRINT_ABOUT 109 | |
89 |