]> git.saurik.com Git - wxWidgets.git/blame - samples/printing/printing.h
No changes, just replace #defines with enums in printing sample.
[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);
dfad0599 52#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
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
c801d85f
KB
61 void OnExit(wxCommandEvent& event);
62 void OnPrintAbout(wxCommandEvent& event);
48ed4a89
FM
63
64private:
65 MyCanvas* m_canvas;
66
67 DECLARE_EVENT_TABLE()
c801d85f
KB
68};
69
48ed4a89 70// Define a new white canvas
c801d85f
KB
71class MyCanvas: public wxScrolledWindow
72{
48ed4a89 73public:
c801d85f 74 MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
c801d85f 75
48ed4a89 76 //void OnPaint(wxPaintEvent& evt);
c801d85f 77 virtual void OnDraw(wxDC& dc);
c801d85f 78
48ed4a89
FM
79private:
80 DECLARE_EVENT_TABLE()
c801d85f
KB
81};
82
48ed4a89 83// Defines a new printout class to print our document
c801d85f
KB
84class MyPrintout: public wxPrintout
85{
48ed4a89 86public:
9a83f860 87 MyPrintout(MyFrame* frame, const wxString &title = wxT("My printout"))
48ed4a89
FM
88 : wxPrintout(title) { m_frame=frame; }
89
ca8b470a
VZ
90 virtual bool OnPrintPage(int page);
91 virtual bool HasPage(int page);
92 virtual bool OnBeginDocument(int startPage, int endPage);
93 virtual void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
c801d85f 94
48ed4a89
FM
95 void DrawPageOne();
96 void DrawPageTwo();
f415cab9 97
48ed4a89
FM
98 // Writes a header on a page. Margin units are in millimetres.
99 bool WritePageHeader(wxPrintout *printout, wxDC *dc, const wxString& text, float mmToLogical);
f415cab9 100
48ed4a89
FM
101private:
102 MyFrame *m_frame;
c801d85f
KB
103};
104
48ed4a89
FM
105
106// constants:
c25f8d00
VZ
107enum
108{
109 WXPRINT_PAGE_SETUP = 103,
48ed4a89 110
c25f8d00
VZ
111 WXPRINT_PRINT_PS,
112 WXPRINT_PAGE_SETUP_PS,
113 WXPRINT_PREVIEW_PS,
c801d85f 114
c25f8d00
VZ
115 WXPRINT_ANGLEUP,
116 WXPRINT_ANGLEDOWN
f415cab9
JS
117
118#ifdef __WXMAC__
c25f8d00 119 , WXPRINT_PAGE_MARGINS
f415cab9 120#endif
c25f8d00 121};