]> git.saurik.com Git - wxWidgets.git/blame_incremental - samples/printing/printing.h
Fix wrong configure test for abi::__forced_unwind in previous commit.
[wxWidgets.git] / samples / printing / printing.h
... / ...
CommitLineData
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
13class MyApp: public wxApp
14{
15public:
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
31private:
32 int m_angle;
33 wxBitmap m_bitmap;
34 wxFont m_testFont;
35};
36
37DECLARE_APP(MyApp)
38class MyCanvas;
39
40// Define a new canvas and frame
41class MyFrame: public wxFrame
42{
43public:
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 OnPreviewFrameModalityKind(wxCommandEvent& event);
62
63 void OnExit(wxCommandEvent& event);
64 void OnPrintAbout(wxCommandEvent& event);
65
66private:
67 MyCanvas* m_canvas;
68 wxPreviewFrameModalityKind m_previewModality;
69
70 DECLARE_EVENT_TABLE()
71};
72
73// Define a new white canvas
74class MyCanvas: public wxScrolledWindow
75{
76public:
77 MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
78
79 //void OnPaint(wxPaintEvent& evt);
80 virtual void OnDraw(wxDC& dc);
81
82private:
83 DECLARE_EVENT_TABLE()
84};
85
86// Defines a new printout class to print our document
87class MyPrintout: public wxPrintout
88{
89public:
90 MyPrintout(MyFrame* frame, const wxString &title = wxT("My printout"))
91 : wxPrintout(title) { m_frame=frame; }
92
93 virtual bool OnPrintPage(int page);
94 virtual bool HasPage(int page);
95 virtual bool OnBeginDocument(int startPage, int endPage);
96 virtual void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
97
98 void DrawPageOne();
99 void DrawPageTwo();
100
101 // Writes a header on a page. Margin units are in millimetres.
102 bool WritePageHeader(wxPrintout *printout, wxDC *dc, const wxString& text, float mmToLogical);
103
104private:
105 MyFrame *m_frame;
106};
107
108
109// constants:
110enum
111{
112 WXPRINT_PAGE_SETUP = 103,
113
114 WXPRINT_PRINT_PS,
115 WXPRINT_PAGE_SETUP_PS,
116 WXPRINT_PREVIEW_PS,
117
118 WXPRINT_ANGLEUP,
119 WXPRINT_ANGLEDOWN,
120
121#ifdef __WXMAC__
122 WXPRINT_PAGE_MARGINS,
123#endif
124
125 WXPRINT_FRAME_MODAL_APP,
126 WXPRINT_FRAME_MODAL_WIN,
127 WXPRINT_FRAME_MODAL_NON
128};