]>
git.saurik.com Git - wxWidgets.git/blob - samples/printing/printing.h
1 /////////////////////////////////////////////////////////////////////////////
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
27 // Define a new canvas and frame
28 class MyFrame
: public wxFrame
34 MyFrame(wxFrame
*frame
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
);
37 void OnAngleUp(wxCommandEvent
& event
);
38 void OnAngleDown(wxCommandEvent
& event
);
40 void OnSize(wxSizeEvent
& event
);
41 void OnPrint(wxCommandEvent
& event
);
42 void OnPrintPreview(wxCommandEvent
& event
);
43 void OnPageSetup(wxCommandEvent
& event
);
44 #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
45 void OnPrintPS(wxCommandEvent
& event
);
46 void OnPrintPreviewPS(wxCommandEvent
& event
);
47 void OnPageSetupPS(wxCommandEvent
& event
);
50 void OnExit(wxCommandEvent
& event
);
51 void OnPrintAbout(wxCommandEvent
& event
);
55 // Define a new canvas which can receive some events
56 class MyCanvas
: public wxScrolledWindow
59 MyCanvas(wxFrame
*frame
, const wxPoint
& pos
, const wxSize
& size
, long style
= wxRETAINED
);
62 virtual void OnDraw(wxDC
& dc
);
63 void OnEvent(wxMouseEvent
& event
);
68 class MyPrintout
: public wxPrintout
71 MyPrintout(const wxChar
*title
= _T("My printout")):wxPrintout(title
) {}
72 bool OnPrintPage(int page
);
73 bool HasPage(int page
);
74 bool OnBeginDocument(int startPage
, int endPage
);
75 void GetPageInfo(int *minPage
, int *maxPage
, int *selPageFrom
, int *selPageTo
);
77 void DrawPageOne(wxDC
*dc
);
78 void DrawPageTwo(wxDC
*dc
);
81 #define WXPRINT_QUIT 100
82 #define WXPRINT_PRINT 101
83 #define WXPRINT_PAGE_SETUP 103
84 #define WXPRINT_PREVIEW 104
86 #define WXPRINT_PRINT_PS 105
87 #define WXPRINT_PAGE_SETUP_PS 107
88 #define WXPRINT_PREVIEW_PS 108
90 #define WXPRINT_ABOUT 109
92 #define WXPRINT_ANGLEUP 110
93 #define WXPRINT_ANGLEDOWN 111