]> git.saurik.com Git - wxWidgets.git/blame - samples/printing/printing.h
Always add libwxscintilla in monolithic mode.
[wxWidgets.git] / samples / printing / printing.h
CommitLineData
6adaedf0 1/////////////////////////////////////////////////////////////////////////////
f415cab9 2// Name: samples/printing.h
be5a51fb 3// Purpose: Printing demo for wxWidgets
6adaedf0
JS
4// Author: Julian Smart
5// Modified by:
6// Created: 1995
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
c801d85f 11
c801d85f
KB
12// Define a new application
13class MyApp: public wxApp
14{
48ed4a89
FM
15public:
16 MyApp() {}
17
18 virtual bool OnInit();
19 virtual int OnExit();
20
21 void Draw(wxDC& dc);
34da0970 22
48ed4a89
FM
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;
c801d85f
KB
35};
36
34da0970 37DECLARE_APP(MyApp)
c801d85f
KB
38class MyCanvas;
39
40// Define a new canvas and frame
41class MyFrame: public wxFrame
42{
48ed4a89 43public:
c801d85f
KB
44 MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
45
cac7ac30
RR
46 void OnAngleUp(wxCommandEvent& event);
47 void OnAngleDown(wxCommandEvent& event);
c801d85f 48
c801d85f
KB
49 void OnPrint(wxCommandEvent& event);
50 void OnPrintPreview(wxCommandEvent& event);
c801d85f 51 void OnPageSetup(wxCommandEvent& event);
ccb2be5b 52#if wxUSE_POSTSCRIPT
c801d85f
KB
53 void OnPrintPS(wxCommandEvent& event);
54 void OnPrintPreviewPS(wxCommandEvent& event);
c801d85f 55 void OnPageSetupPS(wxCommandEvent& event);
dfad0599 56#endif
f415cab9
JS
57#ifdef __WXMAC__
58 void OnPageMargins(wxCommandEvent& event);
59#endif
dfad0599 60
6aacfc73
VZ
61 void OnPreviewFrameModalityKind(wxCommandEvent& event);
62
c801d85f
KB
63 void OnExit(wxCommandEvent& event);
64 void OnPrintAbout(wxCommandEvent& event);
48ed4a89
FM
65
66private:
67 MyCanvas* m_canvas;
6aacfc73 68 wxPreviewFrameModalityKind m_previewModality;
48ed4a89
FM
69
70 DECLARE_EVENT_TABLE()
c801d85f
KB
71};
72
48ed4a89 73// Define a new white canvas
c801d85f
KB
74class MyCanvas: public wxScrolledWindow
75{
48ed4a89 76public:
c801d85f 77 MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
c801d85f 78
48ed4a89 79 //void OnPaint(wxPaintEvent& evt);
c801d85f 80 virtual void OnDraw(wxDC& dc);
c801d85f 81
48ed4a89
FM
82private:
83 DECLARE_EVENT_TABLE()
c801d85f
KB
84};
85
48ed4a89 86// Defines a new printout class to print our document
c801d85f
KB
87class MyPrintout: public wxPrintout
88{
48ed4a89 89public:
9a83f860 90 MyPrintout(MyFrame* frame, const wxString &title = wxT("My printout"))
48ed4a89
FM
91 : wxPrintout(title) { m_frame=frame; }
92
ca8b470a
VZ
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);
c801d85f 97
48ed4a89
FM
98 void DrawPageOne();
99 void DrawPageTwo();
f415cab9 100
48ed4a89
FM
101 // Writes a header on a page. Margin units are in millimetres.
102 bool WritePageHeader(wxPrintout *printout, wxDC *dc, const wxString& text, float mmToLogical);
f415cab9 103
48ed4a89
FM
104private:
105 MyFrame *m_frame;
c801d85f
KB
106};
107
48ed4a89
FM
108
109// constants:
c25f8d00
VZ
110enum
111{
112 WXPRINT_PAGE_SETUP = 103,
48ed4a89 113
c25f8d00
VZ
114 WXPRINT_PRINT_PS,
115 WXPRINT_PAGE_SETUP_PS,
116 WXPRINT_PREVIEW_PS,
c801d85f 117
c25f8d00 118 WXPRINT_ANGLEUP,
6aacfc73 119 WXPRINT_ANGLEDOWN,
f415cab9
JS
120
121#ifdef __WXMAC__
6aacfc73 122 WXPRINT_PAGE_MARGINS,
f415cab9 123#endif
6aacfc73
VZ
124
125 WXPRINT_FRAME_MODAL_APP,
126 WXPRINT_FRAME_MODAL_WIN,
127 WXPRINT_FRAME_MODAL_NON
c25f8d00 128};