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