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