]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cmndata.h | |
3 | // Purpose: Common GDI data classes | |
4 | // Author: Julian Smart and others | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) | |
d6b9496a | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_CMNDATA_H_BASE_ |
13 | #define _WX_CMNDATA_H_BASE_ | |
c801d85f KB |
14 | |
15 | #ifdef __GNUG__ | |
16 | #pragma interface "cmndata.h" | |
17 | #endif | |
18 | ||
34138703 JS |
19 | #include "wx/font.h" |
20 | #include "wx/colour.h" | |
21 | ||
7bcb11d3 JS |
22 | #if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT |
23 | class WXDLLEXPORT wxPrintSetupData; | |
24 | #endif | |
25 | ||
c801d85f KB |
26 | class WXDLLEXPORT wxColourData: public wxObject |
27 | { | |
7bcb11d3 JS |
28 | DECLARE_DYNAMIC_CLASS(wxColourData) |
29 | public: | |
30 | wxColourData(); | |
31 | wxColourData(const wxColourData& data); | |
32 | ~wxColourData(); | |
d6b9496a VZ |
33 | |
34 | void SetChooseFull(bool flag) { chooseFull = flag; } | |
35 | bool GetChooseFull() const { return chooseFull; } | |
36 | void SetColour(wxColour& colour) { dataColour = colour; } | |
37 | wxColour &GetColour() { return dataColour; } | |
7bcb11d3 JS |
38 | |
39 | // Array of 16 custom colours | |
40 | void SetCustomColour(int i, wxColour& colour); | |
41 | wxColour GetCustomColour(int i); | |
d6b9496a | 42 | |
7bcb11d3 JS |
43 | void operator=(const wxColourData& data); |
44 | ||
45 | public: | |
46 | wxColour dataColour; | |
47 | wxColour custColours[16]; | |
48 | bool chooseFull; | |
c801d85f KB |
49 | }; |
50 | ||
51 | class WXDLLEXPORT wxFontData: public wxObject | |
52 | { | |
7bcb11d3 JS |
53 | DECLARE_DYNAMIC_CLASS(wxFontData) |
54 | public: | |
55 | wxFontData(); | |
56 | wxFontData(const wxFontData& fontData); | |
57 | ~wxFontData(); | |
58 | ||
d6b9496a VZ |
59 | void SetAllowSymbols(bool flag) { allowSymbols = flag; } |
60 | bool GetAllowSymbols() const { return allowSymbols; } | |
61 | ||
62 | void SetColour(const wxColour& colour) { fontColour = colour; } | |
63 | wxColour &GetColour() { return fontColour; } | |
7bcb11d3 | 64 | |
d6b9496a VZ |
65 | void SetShowHelp(bool flag) { showHelp = flag; } |
66 | bool GetShowHelp() const { return showHelp; } | |
7bcb11d3 | 67 | |
d6b9496a VZ |
68 | void EnableEffects(bool flag) { enableEffects = flag; } |
69 | bool GetEnableEffects() const { return enableEffects; } | |
7bcb11d3 | 70 | |
d6b9496a VZ |
71 | void SetInitialFont(const wxFont& font) { initialFont = font; } |
72 | wxFont GetInitialFont() const { return initialFont; } | |
7bcb11d3 | 73 | |
d6b9496a VZ |
74 | void SetChosenFont(const wxFont& font) { chosenFont = font; } |
75 | wxFont GetChosenFont() const { return chosenFont; } | |
7bcb11d3 | 76 | |
d6b9496a | 77 | void SetRange(int minRange, int maxRange) { minSize = minRange; maxSize = maxRange; } |
7bcb11d3 | 78 | |
7bcb11d3 JS |
79 | void operator=(const wxFontData& data); |
80 | ||
81 | public: | |
82 | wxColour fontColour; | |
83 | bool showHelp; | |
84 | bool allowSymbols; | |
85 | bool enableEffects; | |
86 | wxFont initialFont; | |
87 | wxFont chosenFont; | |
88 | int minSize; | |
89 | int maxSize; | |
c801d85f KB |
90 | }; |
91 | ||
92 | /* | |
93 | * wxPrintData | |
7bcb11d3 | 94 | * Encapsulates printer information (not printer dialog information) |
c801d85f | 95 | */ |
7bcb11d3 | 96 | |
c801d85f KB |
97 | class WXDLLEXPORT wxPrintData: public wxObject |
98 | { | |
7bcb11d3 | 99 | DECLARE_DYNAMIC_CLASS(wxPrintData) |
d6b9496a | 100 | |
7bcb11d3 JS |
101 | wxPrintData(); |
102 | wxPrintData(const wxPrintData& printData); | |
103 | ~wxPrintData(); | |
d6b9496a VZ |
104 | |
105 | int GetNoCopies() const { return m_printNoCopies; }; | |
106 | bool GetCollate() const { return m_printCollate; }; | |
107 | int GetOrientation() const { return m_printOrientation; }; | |
108 | ||
109 | const wxString& GetPrinterName() const { return m_printerName; } | |
110 | bool GetColour() const { return m_colour; } | |
111 | wxDuplexMode GetDuplex() const { return m_duplexMode; } | |
112 | wxPaperSize GetPaperId() const { return m_paperId; } | |
113 | const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size | |
7bcb11d3 | 114 | // in wxPageSetupDialogData |
d6b9496a | 115 | wxPrintQuality GetQuality() const { return m_printQuality; } |
7bcb11d3 | 116 | |
d6b9496a VZ |
117 | void SetNoCopies(int v) { m_printNoCopies = v; }; |
118 | void SetCollate(bool flag) { m_printCollate = flag; }; | |
119 | void SetOrientation(int orient) { m_printOrientation = orient; }; | |
7bcb11d3 | 120 | |
d6b9496a VZ |
121 | void SetPrinterName(const wxString& name) { m_printerName = name; } |
122 | void SetColour(bool colour) { m_colour = colour; } | |
123 | void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; } | |
124 | void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; } | |
125 | void SetPaperSize(const wxSize& sz) { m_paperSize = sz; } | |
126 | void SetQuality(wxPrintQuality quality) { m_printQuality = quality; } | |
7bcb11d3 JS |
127 | |
128 | // PostScript-specific data | |
d6b9496a VZ |
129 | const wxString& GetPrinterCommand() const { return m_printerCommand; } |
130 | const wxString& GetPrinterOptions() const { return m_printerOptions; } | |
131 | const wxString& GetPreviewCommand() const { return m_previewCommand; } | |
132 | const wxString& GetFilename() const { return m_filename; } | |
133 | const wxString& GetFontMetricPath() const { return m_afmPath; } | |
134 | double GetPrinterScaleX() const { return m_printerScaleX; } | |
135 | double GetPrinterScaleY() const { return m_printerScaleY; } | |
136 | long GetPrinterTranslateX() const { return m_printerTranslateX; } | |
137 | long GetPrinterTranslateY() const { return m_printerTranslateY; } | |
138 | wxPrintMode GetPrintMode() const { return m_printMode; } | |
139 | ||
140 | void SetPrinterCommand(const wxString& command) { m_printerCommand = command; } | |
141 | void SetPrinterOptions(const wxString& options) { m_printerOptions = options; } | |
142 | void SetPreviewCommand(const wxString& command) { m_previewCommand = command; } | |
143 | void SetFilename(const wxString& filename) { m_filename = filename; } | |
144 | void SetFontMetricPath(const wxString& path) { m_afmPath = path; } | |
145 | void SetPrinterScaleX(double x) { m_printerScaleX = x; } | |
146 | void SetPrinterScaleY(double y) { m_printerScaleY = y; } | |
147 | void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; } | |
148 | void SetPrinterTranslateX(long x) { m_printerTranslateX = x; } | |
149 | void SetPrinterTranslateY(long y) { m_printerTranslateY = y; } | |
150 | void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; } | |
151 | void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; } | |
7bcb11d3 JS |
152 | |
153 | void operator=(const wxPrintData& data); | |
154 | ||
155 | // For compatibility | |
156 | #if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT | |
157 | void operator=(const wxPrintSetupData& setupData); | |
158 | #endif | |
d6b9496a | 159 | |
2049ba38 | 160 | #ifdef __WXMSW__ |
7bcb11d3 JS |
161 | // Convert to/from the DEVMODE structure |
162 | void ConvertToNative(); | |
163 | void ConvertFromNative(); | |
d6b9496a VZ |
164 | void* GetNativeData() const { return m_devMode; } |
165 | void SetNativeData(void* data) { m_devMode = data; } | |
c801d85f | 166 | #endif |
d6b9496a | 167 | |
7bcb11d3 | 168 | public: |
2049ba38 | 169 | #ifdef __WXMSW__ |
7bcb11d3 | 170 | void* m_devMode; |
c801d85f | 171 | #endif |
7bcb11d3 JS |
172 | |
173 | private: | |
174 | ||
175 | int m_printNoCopies; | |
176 | int m_printOrientation; | |
177 | bool m_printCollate; | |
178 | ||
179 | // New members, 24/3/99 | |
180 | wxString m_printerName; | |
181 | bool m_colour; | |
182 | wxDuplexMode m_duplexMode; | |
183 | wxPrintQuality m_printQuality; | |
184 | wxPaperSize m_paperId; | |
185 | wxSize m_paperSize; | |
186 | ||
187 | // PostScript-specific data | |
188 | wxString m_printerCommand; | |
189 | wxString m_previewCommand; | |
190 | wxString m_printerOptions; | |
191 | wxString m_filename; | |
192 | wxString m_afmPath; | |
193 | double m_printerScaleX; | |
194 | double m_printerScaleY; | |
195 | long m_printerTranslateX; | |
196 | long m_printerTranslateY; | |
197 | wxPrintMode m_printMode; | |
c801d85f KB |
198 | }; |
199 | ||
200 | /* | |
7bcb11d3 JS |
201 | * wxPrintDialogData |
202 | * Encapsulates information displayed and edited in the printer dialog box. | |
203 | * Contains a wxPrintData object which is filled in according to the values retrieved | |
204 | * from the dialog. | |
c801d85f KB |
205 | */ |
206 | ||
7bcb11d3 | 207 | class WXDLLEXPORT wxPrintDialogData: public wxObject |
c801d85f | 208 | { |
7bcb11d3 | 209 | DECLARE_DYNAMIC_CLASS(wxPrintDialogData) |
d6b9496a | 210 | |
7bcb11d3 JS |
211 | wxPrintDialogData(); |
212 | wxPrintDialogData(const wxPrintDialogData& dialogData); | |
213 | wxPrintDialogData(const wxPrintData& printData); | |
214 | ~wxPrintDialogData(); | |
d6b9496a VZ |
215 | |
216 | int GetFromPage() const { return m_printFromPage; }; | |
217 | int GetToPage() const { return m_printToPage; }; | |
218 | int GetMinPage() const { return m_printMinPage; }; | |
219 | int GetMaxPage() const { return m_printMaxPage; }; | |
220 | int GetNoCopies() const { return m_printNoCopies; }; | |
221 | bool GetAllPages() const { return m_printAllPages; }; | |
222 | bool GetCollate() const { return m_printCollate; }; | |
223 | bool GetPrintToFile() const { return m_printToFile; }; | |
224 | bool GetSetupDialog() const { return m_printSetupDialog; }; | |
225 | ||
226 | void SetFromPage(int v) { m_printFromPage = v; }; | |
227 | void SetToPage(int v) { m_printToPage = v; }; | |
228 | void SetMinPage(int v) { m_printMinPage = v; }; | |
229 | void SetMaxPage(int v) { m_printMaxPage = v; }; | |
230 | void SetNoCopies(int v) { m_printNoCopies = v; }; | |
231 | void SetAllPages(bool flag) { m_printAllPages = flag; }; | |
232 | void SetCollate(bool flag) { m_printCollate = flag; }; | |
233 | void SetPrintToFile(bool flag) { m_printToFile = flag; }; | |
234 | void SetSetupDialog(bool flag) { m_printSetupDialog = flag; }; | |
235 | ||
236 | void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; }; | |
237 | void EnableSelection(bool flag) { m_printEnableSelection = flag; }; | |
238 | void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; }; | |
239 | void EnableHelp(bool flag) { m_printEnableHelp = flag; }; | |
240 | ||
241 | bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; }; | |
242 | bool GetEnableSelection() const { return m_printEnableSelection; }; | |
243 | bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; }; | |
244 | bool GetEnableHelp() const { return m_printEnableHelp; }; | |
245 | ||
246 | wxPrintData& GetPrintData() { return m_printData; } | |
247 | void SetPrintData(const wxPrintData& printData) { m_printData = printData; } | |
7bcb11d3 JS |
248 | |
249 | void operator=(const wxPrintDialogData& data); | |
250 | void operator=(const wxPrintData& data); // Sets internal m_printData member | |
d6b9496a | 251 | |
7bcb11d3 JS |
252 | #ifdef __WXMSW__ |
253 | // Convert to/from the PRINTDLG structure | |
254 | void ConvertToNative(); | |
255 | void ConvertFromNative(); | |
256 | void SetOwnerWindow(wxWindow* win); | |
d6b9496a | 257 | void* GetNativeData() const { return m_printDlgData; } |
7bcb11d3 | 258 | #endif |
d6b9496a | 259 | |
7bcb11d3 JS |
260 | #ifdef __WXMSW__ |
261 | void* m_printDlgData; | |
262 | #endif | |
263 | ||
264 | private: | |
265 | ||
266 | int m_printFromPage; | |
267 | int m_printToPage; | |
268 | int m_printMinPage; | |
269 | int m_printMaxPage; | |
270 | int m_printNoCopies; | |
271 | bool m_printAllPages; | |
272 | bool m_printCollate; | |
273 | bool m_printToFile; | |
274 | bool m_printEnableSelection; | |
275 | bool m_printEnablePageNumbers; | |
276 | bool m_printEnableHelp; | |
277 | bool m_printEnablePrintToFile; | |
278 | bool m_printSetupDialog; | |
279 | ||
280 | wxPrintData m_printData; | |
281 | }; | |
282 | ||
283 | /* | |
284 | * This is the data used (and returned) by the wxPageSetupDialog. | |
285 | */ | |
286 | ||
287 | // Compatibility with old name | |
288 | #define wxPageSetupData wxPageSetupDialogData | |
c801d85f | 289 | |
7bcb11d3 JS |
290 | class WXDLLEXPORT wxPageSetupDialogData: public wxObject |
291 | { | |
292 | DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData) | |
d6b9496a | 293 | |
7bcb11d3 JS |
294 | public: |
295 | wxPageSetupDialogData(); | |
296 | wxPageSetupDialogData(const wxPageSetupDialogData& dialogData); | |
297 | wxPageSetupDialogData(const wxPrintData& printData); | |
298 | ~wxPageSetupDialogData(); | |
299 | ||
d6b9496a VZ |
300 | wxSize GetPaperSize() const { return m_paperSize; }; |
301 | wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); }; | |
302 | wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; }; | |
303 | wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; }; | |
304 | wxPoint GetMarginTopLeft() const { return m_marginTopLeft; }; | |
305 | wxPoint GetMarginBottomRight() const { return m_marginBottomRight; }; | |
306 | ||
307 | bool GetDefaultMinMargins() const { return m_defaultMinMargins; }; | |
308 | bool GetEnableMargins() const { return m_enableMargins; }; | |
309 | bool GetEnableOrientation() const { return m_enableOrientation; }; | |
310 | bool GetEnablePaper() const { return m_enablePaper; }; | |
311 | bool GetEnablePrinter() const { return m_enablePrinter; }; | |
312 | bool GetDefaultInfo() const { return m_getDefaultInfo; }; | |
313 | bool GetEnableHelp() const { return m_enableHelp; }; | |
7bcb11d3 JS |
314 | |
315 | // If a corresponding paper type is found in the paper database, will set the m_printData | |
316 | // paper size id member as well. | |
317 | void SetPaperSize(const wxSize& sz); | |
318 | ||
319 | // Sets the wxPrintData id, plus the paper width/height if found in the paper database. | |
320 | void SetPaperSize(wxPaperSize id); | |
321 | ||
d6b9496a VZ |
322 | void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; }; |
323 | void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; }; | |
324 | void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; }; | |
325 | void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; }; | |
326 | void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; }; | |
327 | void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; }; | |
328 | ||
329 | void EnableMargins(bool flag) { m_enableMargins = flag; }; | |
330 | void EnableOrientation(bool flag) { m_enableOrientation = flag; }; | |
331 | void EnablePaper(bool flag) { m_enablePaper = flag; }; | |
332 | void EnablePrinter(bool flag) { m_enablePrinter = flag; }; | |
333 | void EnableHelp(bool flag) { m_enableHelp = flag; }; | |
334 | ||
c801d85f | 335 | #if defined(__WIN95__) |
7bcb11d3 JS |
336 | // Convert to/from the PAGESETUPDLG structure |
337 | void ConvertToNative(); | |
338 | void ConvertFromNative(); | |
339 | void SetOwnerWindow(wxWindow* win); | |
d6b9496a | 340 | void* GetNativeData() const { return m_pageSetupData; } |
c801d85f | 341 | #endif |
7bcb11d3 JS |
342 | |
343 | // Use paper size defined in this object to set the wxPrintData | |
344 | // paper id | |
345 | void CalculateIdFromPaperSize(); | |
d6b9496a | 346 | |
7bcb11d3 JS |
347 | // Use paper id in wxPrintData to set this object's paper size |
348 | void CalculatePaperSizeFromId(); | |
d6b9496a | 349 | |
7bcb11d3 JS |
350 | void operator=(const wxPageSetupData& data); |
351 | void operator=(const wxPrintData& data); | |
352 | ||
d6b9496a VZ |
353 | wxPrintData& GetPrintData() { return m_printData; } |
354 | void SetPrintData(const wxPrintData& printData) { m_printData = printData; } | |
c801d85f KB |
355 | |
356 | #if defined(__WIN95__) | |
7bcb11d3 | 357 | void* m_pageSetupData; |
c801d85f KB |
358 | #endif |
359 | ||
7bcb11d3 | 360 | private: |
c801d85f | 361 | |
7bcb11d3 JS |
362 | wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?) |
363 | wxPoint m_minMarginTopLeft; | |
364 | wxPoint m_minMarginBottomRight; | |
365 | wxPoint m_marginTopLeft; | |
366 | wxPoint m_marginBottomRight; | |
367 | ||
368 | // Flags | |
369 | bool m_defaultMinMargins; | |
370 | bool m_enableMargins; | |
371 | bool m_enableOrientation; | |
372 | bool m_enablePaper; | |
373 | bool m_enablePrinter; | |
374 | bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT | |
375 | bool m_enableHelp; | |
376 | ||
377 | wxPrintData m_printData; | |
378 | }; | |
c801d85f KB |
379 | |
380 | #endif | |
7bcb11d3 | 381 | // _WX_CMNDATA_H_BASE_ |