wxMaxima
Loading...
Searching...
No Matches
printing.h
1
2// Name: samples/printing.h
3
4// Purpose: Printing demo for wxWidgets
5// Author: Julian Smart
6// Modified by:
7// Created: 1995
8// RCS-ID: $Id: printing.h 42522 2006-10-27 13:07:40Z JS $
9// Copyright: (c) Julian Smart
10// Licence: wxWindows licence
12
13// Define a new application
14class MyApp: public wxApp
15{
16 public:
17 MyApp(){};
18 bool OnInit();
19 int OnExit();
20
21 wxString m_workDirectory;
22 wxString m_fontDirectory;
23 int m_rc;
24
25 wxFont m_testFont;
26};
27
28DECLARE_APP(MyApp)
29
30class MyCanvas;
31
32// Define a new canvas and frame
33class MyFrame: public wxFrame
34{
35 public:
36 MyCanvas *canvas;
37 wxBitmap m_bitmap;
38 wxImage m_imgUp;
39 int m_angle;
40 MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
41 ~MyFrame();
42
43// Need a richtext ctrl to create a richtext buffer.
44// Use wxRichTextPrinting as a convenient manager
45// for richtext buffers
46#if wxUSE_RICHTEXT
47 wxRichTextCtrl *m_richtext;
48 wxRichTextPrinting *m_richtextPrinting;
49#endif
50 void Draw(wxDC& dc);
51 void OnAngleUp(wxCommandEvent& event);
52 void OnAngleDown(wxCommandEvent& event);
53
54 void OnSize(wxSizeEvent& event);
55 void OnPrint(wxCommandEvent& event);
56 void OnPDF(wxCommandEvent& event);
57 void OnPDFTemplate(wxCommandEvent& event);
58 void OnPrintPreview(wxCommandEvent& event);
59 void OnPageSetup(wxCommandEvent& event);
60#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
61 void OnPrintPS(wxCommandEvent& event);
62 void OnPrintPreviewPS(wxCommandEvent& event);
63 void OnPageSetupPS(wxCommandEvent& event);
64#endif
65#ifdef __WXMAC__
66 void OnPageMargins(wxCommandEvent& event);
67#endif
68
69 void OnExit(wxCommandEvent& event);
70 void OnPrintAbout(wxCommandEvent& event);
71
72// printing framework
73 void OnPdfPageSetupAll(wxCommandEvent& event);
74 void OnPdfPageSetupMinimal(wxCommandEvent& event);
75 void OnPdfPrintDialogAll(wxCommandEvent& event);
76 void OnPdfPrintDialogMinimal(wxCommandEvent& event);
77#if wxUSE_RICHTEXT
78 void OnPdfRichTextPrint(wxCommandEvent& event);
79 void OnPdfRichTextPreview(wxCommandEvent& event);
80#endif
81#if wxUSE_HTML
82 void OnPdfHtmlPrint(wxCommandEvent& event);
83 void OnPdfHtmlPreview(wxCommandEvent& event);
84#endif
85
86DECLARE_EVENT_TABLE()
87
88#if wxUSE_RICHTEXT
89private:
90 void WriteRichTextBuffer();
91#endif
92};
93
94// Define a new canvas which can receive some events
95class MyCanvas: public wxScrolledWindow
96{
97 public:
98 MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
99 ~MyCanvas(void){};
100
101 virtual void OnDraw(wxDC& dc);
102 void OnEvent(wxMouseEvent& event);
103
104DECLARE_EVENT_TABLE()
105};
106
107class MyPrintout: public wxPrintout
108{
109 public:
110 MyPrintout(const wxChar *title = _T("My printout")):wxPrintout(title) {}
111 bool OnPrintPage(int page);
112 bool HasPage(int page);
113 bool OnBeginDocument(int startPage, int endPage);
114 void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
115
116 void DrawPageOne();
117
118 void DrawPageTwo();
119
120};
121
122enum
123{
124 WXPRINT_QUIT = 100,
125 WXPRINT_PRINT,
126 WXPRINT_PDF,
127 WXPRINT_PDF_TPL,
128 WXPRINT_PAGE_SETUP,
129 WXPRINT_PREVIEW,
130 WXPRINT_PRINT_PS,
131 WXPRINT_PAGE_SETUP_PS,
132 WXPRINT_PREVIEW_PS,
133 WXPRINT_ABOUT,
134 WXPRINT_ANGLEUP,
135 WXPRINT_ANGLEDOWN,
136 WXPRINT_PAGE_MARGINS,
137 WXPDFPRINT_PAGE_SETUP_ALL,
138 WXPDFPRINT_PAGE_SETUP_MINIMAL,
139 WXPDFPRINT_PRINT_DIALOG_ALL,
140 WXPDFPRINT_PRINT_DIALOG_MINIMAL,
141 WXPDFPRINT_RICHTEXT_PRINT,
142 WXPDFPRINT_RICHTEXT_PREVIEW,
143 WXPDFPRINT_HTML_PRINT,
144 WXPDFPRINT_HTML_PREVIEW
145};
Definition: test_ImgCell.cpp:354
bool OnInit() override
Definition: test_ImgCell.cpp:367
Definition: printing.h:96
Definition: gridctrlsample.h:17
Definition: printing.h:108