]> git.saurik.com Git - wxWidgets.git/blame - samples/printing/printing.h
Tamil translations update from Dinakar T.D.
[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
6adaedf0
JS
7// Copyright: (c) Julian Smart
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
c801d85f 10
c801d85f
KB
11// Define a new application
12class MyApp: public wxApp
13{
48ed4a89
FM
14public:
15 MyApp() {}
16
17 virtual bool OnInit();
18 virtual int OnExit();
19
20 void Draw(wxDC& dc);
34da0970 21
48ed4a89
FM
22 void IncrementAngle()
23 { m_angle += 5; }
24 void DecrementAngle()
25 { m_angle -= 5; }
26
27 wxFont& GetTestFont()
28 { return m_testFont; }
29
30private:
31 int m_angle;
32 wxBitmap m_bitmap;
33 wxFont m_testFont;
c801d85f
KB
34};
35
34da0970 36DECLARE_APP(MyApp)
c801d85f
KB
37class MyCanvas;
38
39// Define a new canvas and frame
40class MyFrame: public wxFrame
41{
48ed4a89 42public:
c801d85f
KB
43 MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
44
cac7ac30
RR
45 void OnAngleUp(wxCommandEvent& event);
46 void OnAngleDown(wxCommandEvent& event);
c801d85f 47
c801d85f
KB
48 void OnPrint(wxCommandEvent& event);
49 void OnPrintPreview(wxCommandEvent& event);
c801d85f 50 void OnPageSetup(wxCommandEvent& event);
ccb2be5b 51#if wxUSE_POSTSCRIPT
c801d85f
KB
52 void OnPrintPS(wxCommandEvent& event);
53 void OnPrintPreviewPS(wxCommandEvent& event);
c801d85f 54 void OnPageSetupPS(wxCommandEvent& event);
dfad0599 55#endif
f415cab9
JS
56#ifdef __WXMAC__
57 void OnPageMargins(wxCommandEvent& event);
58#endif
dfad0599 59
6aacfc73
VZ
60 void OnPreviewFrameModalityKind(wxCommandEvent& event);
61
c801d85f
KB
62 void OnExit(wxCommandEvent& event);
63 void OnPrintAbout(wxCommandEvent& event);
48ed4a89
FM
64
65private:
66 MyCanvas* m_canvas;
6aacfc73 67 wxPreviewFrameModalityKind m_previewModality;
48ed4a89
FM
68
69 DECLARE_EVENT_TABLE()
c801d85f
KB
70};
71
48ed4a89 72// Define a new white canvas
c801d85f
KB
73class MyCanvas: public wxScrolledWindow
74{
48ed4a89 75public:
c801d85f 76 MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
c801d85f 77
48ed4a89 78 //void OnPaint(wxPaintEvent& evt);
c801d85f 79 virtual void OnDraw(wxDC& dc);
c801d85f 80
48ed4a89
FM
81private:
82 DECLARE_EVENT_TABLE()
c801d85f
KB
83};
84
48ed4a89 85// Defines a new printout class to print our document
c801d85f
KB
86class MyPrintout: public wxPrintout
87{
48ed4a89 88public:
9a83f860 89 MyPrintout(MyFrame* frame, const wxString &title = wxT("My printout"))
48ed4a89
FM
90 : wxPrintout(title) { m_frame=frame; }
91
ca8b470a
VZ
92 virtual bool OnPrintPage(int page);
93 virtual bool HasPage(int page);
94 virtual bool OnBeginDocument(int startPage, int endPage);
95 virtual void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
c801d85f 96
48ed4a89
FM
97 void DrawPageOne();
98 void DrawPageTwo();
f415cab9 99
48ed4a89
FM
100 // Writes a header on a page. Margin units are in millimetres.
101 bool WritePageHeader(wxPrintout *printout, wxDC *dc, const wxString& text, float mmToLogical);
f415cab9 102
48ed4a89
FM
103private:
104 MyFrame *m_frame;
c801d85f
KB
105};
106
48ed4a89
FM
107
108// constants:
c25f8d00
VZ
109enum
110{
111 WXPRINT_PAGE_SETUP = 103,
48ed4a89 112
c25f8d00
VZ
113 WXPRINT_PRINT_PS,
114 WXPRINT_PAGE_SETUP_PS,
115 WXPRINT_PREVIEW_PS,
c801d85f 116
c25f8d00 117 WXPRINT_ANGLEUP,
6aacfc73 118 WXPRINT_ANGLEDOWN,
f415cab9
JS
119
120#ifdef __WXMAC__
6aacfc73 121 WXPRINT_PAGE_MARGINS,
f415cab9 122#endif
6aacfc73
VZ
123
124 WXPRINT_FRAME_MODAL_APP,
125 WXPRINT_FRAME_MODAL_WIN,
126 WXPRINT_FRAME_MODAL_NON
c25f8d00 127};