]>
git.saurik.com Git - wxWidgets.git/blob - samples/printing/printing.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: samples/printing.h
3 // Purpose: Printing demo for wxWidgets
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // Define a new application
13 class MyApp
: public wxApp
18 virtual bool OnInit();
29 { return m_testFont
; }
40 // Define a new canvas and frame
41 class MyFrame
: public wxFrame
44 MyFrame(wxFrame
*frame
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
);
46 void OnAngleUp(wxCommandEvent
& event
);
47 void OnAngleDown(wxCommandEvent
& event
);
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
);
58 void OnPageMargins(wxCommandEvent
& event
);
61 void OnExit(wxCommandEvent
& event
);
62 void OnPrintAbout(wxCommandEvent
& event
);
70 // Define a new white canvas
71 class MyCanvas
: public wxScrolledWindow
74 MyCanvas(wxFrame
*frame
, const wxPoint
& pos
, const wxSize
& size
, long style
= wxRETAINED
);
76 //void OnPaint(wxPaintEvent& evt);
77 virtual void OnDraw(wxDC
& dc
);
83 // Defines a new printout class to print our document
84 class MyPrintout
: public wxPrintout
87 MyPrintout(MyFrame
* frame
, const wxString
&title
= wxT("My printout"))
88 : wxPrintout(title
) { m_frame
=frame
; }
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
);
98 // Writes a header on a page. Margin units are in millimetres.
99 bool WritePageHeader(wxPrintout
*printout
, wxDC
*dc
, const wxString
& text
, float mmToLogical
);
108 #define WXPRINT_PAGE_SETUP 103
110 #define WXPRINT_PRINT_PS 105
111 #define WXPRINT_PAGE_SETUP_PS 107
112 #define WXPRINT_PREVIEW_PS 108
114 #define WXPRINT_ANGLEUP 110
115 #define WXPRINT_ANGLEDOWN 111
118 #define WXPRINT_PAGE_MARGINS 112