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