]> git.saurik.com Git - wxWidgets.git/blob - samples/printing/printing.h
Added wxPGCell::SetFont() and GetFont(); Documented wxPGCell class.
[wxWidgets.git] / samples / printing / printing.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: samples/printing.h
3 // Purpose: Printing demo for wxWidgets
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 1995
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // Define a new application
13 class MyApp: public wxApp
14 {
15 public:
16 MyApp() {}
17
18 virtual bool OnInit();
19 virtual int OnExit();
20
21 void Draw(wxDC& dc);
22
23 void IncrementAngle()
24 { m_angle += 5; }
25 void DecrementAngle()
26 { m_angle -= 5; }
27
28 wxFont& GetTestFont()
29 { return m_testFont; }
30
31 private:
32 int m_angle;
33 wxBitmap m_bitmap;
34 wxFont m_testFont;
35 };
36
37 DECLARE_APP(MyApp)
38 class MyCanvas;
39
40 // Define a new canvas and frame
41 class MyFrame: public wxFrame
42 {
43 public:
44 MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
45
46 void OnAngleUp(wxCommandEvent& event);
47 void OnAngleDown(wxCommandEvent& event);
48
49 void OnPrint(wxCommandEvent& event);
50 void OnPrintPreview(wxCommandEvent& event);
51 void OnPageSetup(wxCommandEvent& event);
52 #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
53 void OnPrintPS(wxCommandEvent& event);
54 void OnPrintPreviewPS(wxCommandEvent& event);
55 void OnPageSetupPS(wxCommandEvent& event);
56 #endif
57 #ifdef __WXMAC__
58 void OnPageMargins(wxCommandEvent& event);
59 #endif
60
61 void OnExit(wxCommandEvent& event);
62 void OnPrintAbout(wxCommandEvent& event);
63
64 private:
65 MyCanvas* m_canvas;
66
67 DECLARE_EVENT_TABLE()
68 };
69
70 // Define a new white canvas
71 class MyCanvas: public wxScrolledWindow
72 {
73 public:
74 MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
75
76 //void OnPaint(wxPaintEvent& evt);
77 virtual void OnDraw(wxDC& dc);
78
79 private:
80 DECLARE_EVENT_TABLE()
81 };
82
83 // Defines a new printout class to print our document
84 class MyPrintout: public wxPrintout
85 {
86 public:
87 MyPrintout(MyFrame* frame, const wxString &title = wxT("My printout"))
88 : wxPrintout(title) { m_frame=frame; }
89
90 bool OnPrintPage(int page);
91 bool HasPage(int page);
92 bool OnBeginDocument(int startPage, int endPage);
93 void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
94
95 void DrawPageOne();
96 void DrawPageTwo();
97
98 // Writes a header on a page. Margin units are in millimetres.
99 bool WritePageHeader(wxPrintout *printout, wxDC *dc, const wxString& text, float mmToLogical);
100
101 private:
102 MyFrame *m_frame;
103 };
104
105
106 // constants:
107
108 #define WXPRINT_PAGE_SETUP 103
109
110 #define WXPRINT_PRINT_PS 105
111 #define WXPRINT_PAGE_SETUP_PS 107
112 #define WXPRINT_PREVIEW_PS 108
113
114 #define WXPRINT_ANGLEUP 110
115 #define WXPRINT_ANGLEDOWN 111
116
117 #ifdef __WXMAC__
118 #define WXPRINT_PAGE_MARGINS 112
119 #endif