]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cmndata.h
Source cleaning: whitespaces, tabs, -1/wxID_ANY/wxDefaultCoord, TRUE/true, FALSE...
[wxWidgets.git] / include / wx / cmndata.h
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)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CMNDATA_H_BASE_
13 #define _WX_CMNDATA_H_BASE_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "cmndata.h"
17 #endif
18
19 #include "wx/window.h"
20 #include "wx/font.h"
21 #include "wx/encinfo.h"
22 #include "wx/colour.h"
23 #include "wx/gdicmn.h"
24
25 #if wxUSE_STREAMS
26 #include "wx/stream.h"
27 #endif
28
29 class WXDLLEXPORT wxColourData: public wxObject
30 {
31 public:
32 wxColourData();
33 wxColourData(const wxColourData& data);
34 ~wxColourData();
35
36 void SetChooseFull(bool flag) { m_chooseFull = flag; }
37 bool GetChooseFull() const { return m_chooseFull; }
38 void SetColour(const wxColour& colour) { m_dataColour = colour; }
39 const wxColour& GetColour() const { return m_dataColour; }
40 wxColour& GetColour() { return m_dataColour; }
41
42 // Array of 16 custom colours
43 void SetCustomColour(int i, const wxColour& colour);
44 wxColour GetCustomColour(int i);
45
46 void operator=(const wxColourData& data);
47
48 public:
49 wxColour m_dataColour;
50 wxColour m_custColours[16];
51 bool m_chooseFull;
52
53 private:
54 DECLARE_DYNAMIC_CLASS(wxColourData)
55 };
56
57 class WXDLLEXPORT wxFontData: public wxObject
58 {
59 public:
60 wxFontData();
61 ~wxFontData();
62
63 wxFontData(const wxFontData& data)
64 : wxObject()
65 , m_fontColour(data.m_fontColour)
66 , m_showHelp(data.m_showHelp)
67 , m_allowSymbols(data.m_allowSymbols)
68 , m_enableEffects(data.m_enableEffects)
69 , m_initialFont(data.m_initialFont)
70 , m_chosenFont(data.m_chosenFont)
71 , m_minSize(data.m_minSize)
72 , m_maxSize(data.m_maxSize)
73 , m_encoding(data.m_encoding)
74 , m_encodingInfo(data.m_encodingInfo)
75 {
76 }
77
78 wxFontData& operator=(const wxFontData& data)
79 {
80 wxObject::operator=(data);
81 m_fontColour = data.m_fontColour;
82 m_showHelp = data.m_showHelp;
83 m_allowSymbols = data.m_allowSymbols;
84 m_enableEffects = data.m_enableEffects;
85 m_initialFont = data.m_initialFont;
86 m_chosenFont = data.m_chosenFont;
87 m_minSize = data.m_minSize;
88 m_maxSize = data.m_maxSize;
89 m_encoding = data.m_encoding;
90 m_encodingInfo = data.m_encodingInfo;
91 return *this;
92 }
93
94 void SetAllowSymbols(bool flag) { m_allowSymbols = flag; }
95 bool GetAllowSymbols() const { return m_allowSymbols; }
96
97 void SetColour(const wxColour& colour) { m_fontColour = colour; }
98 wxColour &GetColour() { return m_fontColour; }
99
100 void SetShowHelp(bool flag) { m_showHelp = flag; }
101 bool GetShowHelp() const { return m_showHelp; }
102
103 void EnableEffects(bool flag) { m_enableEffects = flag; }
104 bool GetEnableEffects() const { return m_enableEffects; }
105
106 void SetInitialFont(const wxFont& font) { m_initialFont = font; }
107 wxFont GetInitialFont() const { return m_initialFont; }
108
109 void SetChosenFont(const wxFont& font) { m_chosenFont = font; }
110 wxFont GetChosenFont() const { return m_chosenFont; }
111
112 void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; }
113
114 // encoding info is split into 2 parts: the logical wxWin encoding
115 // (wxFontEncoding) and a structure containing the native parameters for
116 // it (wxNativeEncodingInfo)
117 wxFontEncoding GetEncoding() const { return m_encoding; }
118 void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; }
119
120 wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; }
121
122 public:
123 wxColour m_fontColour;
124 bool m_showHelp;
125 bool m_allowSymbols;
126 bool m_enableEffects;
127 wxFont m_initialFont;
128 wxFont m_chosenFont;
129 int m_minSize;
130 int m_maxSize;
131
132 private:
133 wxFontEncoding m_encoding;
134 wxNativeEncodingInfo m_encodingInfo;
135
136 private:
137 DECLARE_DYNAMIC_CLASS(wxFontData)
138 };
139
140 #if wxUSE_PRINTING_ARCHITECTURE
141 /*
142 * wxPrintData
143 * Encapsulates printer information (not printer dialog information)
144 */
145
146 #ifdef __WXMAC__
147
148 class wxNativePrintData ;
149
150 #endif
151
152 enum wxPrintBin
153 {
154 wxPRINTBIN_DEFAULT,
155
156 wxPRINTBIN_ONLYONE,
157 wxPRINTBIN_LOWER,
158 wxPRINTBIN_MIDDLE,
159 wxPRINTBIN_MANUAL,
160 wxPRINTBIN_ENVELOPE,
161 wxPRINTBIN_ENVMANUAL,
162 wxPRINTBIN_AUTO,
163 wxPRINTBIN_TRACTOR,
164 wxPRINTBIN_SMALLFMT,
165 wxPRINTBIN_LARGEFMT,
166 wxPRINTBIN_LARGECAPACITY,
167 wxPRINTBIN_CASSETTE,
168 wxPRINTBIN_FORMSOURCE,
169
170 wxPRINTBIN_USER,
171 };
172
173
174 class WXDLLEXPORT wxPrintData: public wxObject
175 {
176 public:
177 wxPrintData();
178 wxPrintData(const wxPrintData& printData);
179 ~wxPrintData();
180
181 int GetNoCopies() const { return m_printNoCopies; };
182 bool GetCollate() const { return m_printCollate; };
183 int GetOrientation() const { return m_printOrientation; };
184
185 // Is this data OK for showing the print dialog?
186 bool Ok() const ;
187
188 const wxString& GetPrinterName() const { return m_printerName; }
189 bool GetColour() const { return m_colour; }
190 wxDuplexMode GetDuplex() const { return m_duplexMode; }
191 wxPaperSize GetPaperId() const { return m_paperId; }
192 const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size
193 // in wxPageSetupDialogData
194 wxPrintQuality GetQuality() const { return m_printQuality; }
195 wxPrintBin GetBin() const { return m_bin; }
196
197 void SetNoCopies(int v) { m_printNoCopies = v; };
198 void SetCollate(bool flag) { m_printCollate = flag; };
199 void SetOrientation(int orient) { m_printOrientation = orient; };
200
201 void SetPrinterName(const wxString& name) { m_printerName = name; }
202 void SetColour(bool colour) { m_colour = colour; }
203 void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; }
204 void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; }
205 void SetPaperSize(const wxSize& sz) { m_paperSize = sz; }
206 void SetQuality(wxPrintQuality quality) { m_printQuality = quality; }
207 void SetBin(wxPrintBin bin) { m_bin = bin; }
208
209 // PostScript-specific data
210 const wxString& GetPrinterCommand() const { return m_printerCommand; }
211 const wxString& GetPrinterOptions() const { return m_printerOptions; }
212 const wxString& GetPreviewCommand() const { return m_previewCommand; }
213 const wxString& GetFilename() const { return m_filename; }
214 const wxString& GetFontMetricPath() const { return m_afmPath; }
215 double GetPrinterScaleX() const { return m_printerScaleX; }
216 double GetPrinterScaleY() const { return m_printerScaleY; }
217 long GetPrinterTranslateX() const { return m_printerTranslateX; }
218 long GetPrinterTranslateY() const { return m_printerTranslateY; }
219 wxPrintMode GetPrintMode() const { return m_printMode; }
220
221 void SetPrinterCommand(const wxString& command) { m_printerCommand = command; }
222 void SetPrinterOptions(const wxString& options) { m_printerOptions = options; }
223 void SetPreviewCommand(const wxString& command) { m_previewCommand = command; }
224 void SetFilename(const wxString& filename) { m_filename = filename; }
225 void SetFontMetricPath(const wxString& path) { m_afmPath = path; }
226 void SetPrinterScaleX(double x) { m_printerScaleX = x; }
227 void SetPrinterScaleY(double y) { m_printerScaleY = y; }
228 void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }
229 void SetPrinterTranslateX(long x) { m_printerTranslateX = x; }
230 void SetPrinterTranslateY(long y) { m_printerTranslateY = y; }
231 void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }
232 void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
233
234 #if wxUSE_STREAMS
235 wxOutputStream* GetOutputStream() { return m_outputstream; }
236 void SetOutputStream(wxOutputStream* outputstream) { m_outputstream = outputstream; }
237 #endif
238
239 void operator=(const wxPrintData& data);
240
241 #if defined(__WXMSW__)
242 // Convert to/from the DEVMODE structure
243 void ConvertToNative();
244 void ConvertFromNative();
245 void* GetNativeData() const { return m_devMode; }
246 void SetNativeData(void* data) { m_devMode = data; }
247 void* GetNativeDataDevNames() const { return m_devNames; }
248 void SetNativeDataDevNames(void* data) { m_devNames = data; }
249 #elif defined(__WXMAC__)
250 void ConvertToNative();
251 void ConvertFromNative();
252 #endif
253
254 public:
255 #if defined(__WXMSW__)
256 void* m_devMode;
257 void* m_devNames;
258 #elif defined(__WXMAC__)
259 wxNativePrintData* m_nativePrintData ;
260 #endif
261 #if wxUSE_STREAMS
262 wxOutputStream* m_outputstream;
263 #endif
264
265 private:
266 wxPrintBin m_bin;
267
268 int m_printNoCopies;
269 int m_printOrientation;
270 bool m_printCollate;
271
272 // New members, 24/3/99
273 wxString m_printerName;
274 bool m_colour;
275 wxDuplexMode m_duplexMode;
276 wxPrintQuality m_printQuality;
277 wxPaperSize m_paperId;
278 wxSize m_paperSize;
279
280 // PostScript-specific data
281 wxString m_printerCommand;
282 wxString m_previewCommand;
283 wxString m_printerOptions;
284 wxString m_filename;
285 wxString m_afmPath;
286 double m_printerScaleX;
287 double m_printerScaleY;
288 long m_printerTranslateX;
289 long m_printerTranslateY;
290 wxPrintMode m_printMode;
291
292 private:
293 DECLARE_DYNAMIC_CLASS(wxPrintData)
294 };
295
296 /*
297 * wxPrintDialogData
298 * Encapsulates information displayed and edited in the printer dialog box.
299 * Contains a wxPrintData object which is filled in according to the values retrieved
300 * from the dialog.
301 */
302
303 class WXDLLEXPORT wxPrintDialogData: public wxObject
304 {
305 public:
306 wxPrintDialogData();
307 wxPrintDialogData(const wxPrintDialogData& dialogData);
308 wxPrintDialogData(const wxPrintData& printData);
309 ~wxPrintDialogData();
310
311 int GetFromPage() const { return m_printFromPage; };
312 int GetToPage() const { return m_printToPage; };
313 int GetMinPage() const { return m_printMinPage; };
314 int GetMaxPage() const { return m_printMaxPage; };
315 int GetNoCopies() const { return m_printNoCopies; };
316 bool GetAllPages() const { return m_printAllPages; };
317 bool GetSelection() const { return m_printSelection; };
318 bool GetCollate() const { return m_printCollate; };
319 bool GetPrintToFile() const { return m_printToFile; };
320 bool GetSetupDialog() const { return m_printSetupDialog; };
321
322 void SetFromPage(int v) { m_printFromPage = v; };
323 void SetToPage(int v) { m_printToPage = v; };
324 void SetMinPage(int v) { m_printMinPage = v; };
325 void SetMaxPage(int v) { m_printMaxPage = v; };
326 void SetNoCopies(int v) { m_printNoCopies = v; };
327 void SetAllPages(bool flag) { m_printAllPages = flag; };
328 void SetSelection(bool flag) { m_printSelection = flag; };
329 void SetCollate(bool flag) { m_printCollate = flag; };
330 void SetPrintToFile(bool flag) { m_printToFile = flag; };
331 void SetSetupDialog(bool flag) { m_printSetupDialog = flag; };
332
333 void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; };
334 void EnableSelection(bool flag) { m_printEnableSelection = flag; };
335 void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; };
336 void EnableHelp(bool flag) { m_printEnableHelp = flag; };
337
338 bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; };
339 bool GetEnableSelection() const { return m_printEnableSelection; };
340 bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; };
341 bool GetEnableHelp() const { return m_printEnableHelp; };
342
343 // Is this data OK for showing the print dialog?
344 bool Ok() const { return m_printData.Ok() ; }
345
346 wxPrintData& GetPrintData() { return m_printData; }
347 void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
348
349 void operator=(const wxPrintDialogData& data);
350 void operator=(const wxPrintData& data); // Sets internal m_printData member
351
352 #ifdef __WXMSW__
353 // Convert to/from the PRINTDLG structure
354 void ConvertToNative();
355 void ConvertFromNative();
356 void SetOwnerWindow(wxWindow* win);
357 void* GetNativeData() const { return m_printDlgData; }
358 #elif defined(__WXMAC__)
359 void ConvertToNative();
360 void ConvertFromNative();
361 #endif
362
363 #ifdef __WXMSW__
364 void* m_printDlgData;
365 #endif
366
367 private:
368 int m_printFromPage;
369 int m_printToPage;
370 int m_printMinPage;
371 int m_printMaxPage;
372 int m_printNoCopies;
373 bool m_printAllPages;
374 bool m_printCollate;
375 bool m_printToFile;
376 bool m_printSelection;
377 bool m_printEnableSelection;
378 bool m_printEnablePageNumbers;
379 bool m_printEnableHelp;
380 bool m_printEnablePrintToFile;
381 bool m_printSetupDialog;
382 wxPrintData m_printData;
383
384 private:
385 DECLARE_DYNAMIC_CLASS(wxPrintDialogData)
386 };
387
388 /*
389 * This is the data used (and returned) by the wxPageSetupDialog.
390 */
391
392 // Compatibility with old name
393 #define wxPageSetupData wxPageSetupDialogData
394
395 class WXDLLEXPORT wxPageSetupDialogData: public wxObject
396 {
397 public:
398 wxPageSetupDialogData();
399 wxPageSetupDialogData(const wxPageSetupDialogData& dialogData);
400 wxPageSetupDialogData(const wxPrintData& printData);
401 ~wxPageSetupDialogData();
402
403 wxSize GetPaperSize() const { return m_paperSize; };
404 wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); };
405 wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; };
406 wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; };
407 wxPoint GetMarginTopLeft() const { return m_marginTopLeft; };
408 wxPoint GetMarginBottomRight() const { return m_marginBottomRight; };
409
410 bool GetDefaultMinMargins() const { return m_defaultMinMargins; };
411 bool GetEnableMargins() const { return m_enableMargins; };
412 bool GetEnableOrientation() const { return m_enableOrientation; };
413 bool GetEnablePaper() const { return m_enablePaper; };
414 bool GetEnablePrinter() const { return m_enablePrinter; };
415 bool GetDefaultInfo() const { return m_getDefaultInfo; };
416 bool GetEnableHelp() const { return m_enableHelp; };
417
418 // Is this data OK for showing the page setup dialog?
419 bool Ok() const { return m_printData.Ok() ; }
420
421 // If a corresponding paper type is found in the paper database, will set the m_printData
422 // paper size id member as well.
423 void SetPaperSize(const wxSize& sz);
424
425 void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); };
426
427 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
428 void SetPaperSize(wxPaperSize id);
429
430 void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; };
431 void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; };
432 void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; };
433 void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; };
434 void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; };
435 void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; };
436
437 void EnableMargins(bool flag) { m_enableMargins = flag; };
438 void EnableOrientation(bool flag) { m_enableOrientation = flag; };
439 void EnablePaper(bool flag) { m_enablePaper = flag; };
440 void EnablePrinter(bool flag) { m_enablePrinter = flag; };
441 void EnableHelp(bool flag) { m_enableHelp = flag; };
442
443 #if defined(__WIN95__)
444 // Convert to/from the PAGESETUPDLG structure
445 void ConvertToNative();
446 void ConvertFromNative();
447 void SetOwnerWindow(wxWindow* win);
448 void* GetNativeData() const { return m_pageSetupData; }
449 #elif defined(__WXMAC__)
450 void ConvertToNative();
451 void ConvertFromNative();
452 #endif
453
454 // Use paper size defined in this object to set the wxPrintData
455 // paper id
456 void CalculateIdFromPaperSize();
457
458 // Use paper id in wxPrintData to set this object's paper size
459 void CalculatePaperSizeFromId();
460
461 wxPageSetupDialogData& operator=(const wxPageSetupData& data);
462 wxPageSetupDialogData& operator=(const wxPrintData& data);
463
464 wxPrintData& GetPrintData() { return m_printData; }
465 void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
466
467 #if defined(__WIN95__)
468 void* m_pageSetupData;
469 #endif
470
471 private:
472 wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?)
473 wxPoint m_minMarginTopLeft;
474 wxPoint m_minMarginBottomRight;
475 wxPoint m_marginTopLeft;
476 wxPoint m_marginBottomRight;
477 bool m_defaultMinMargins;
478 bool m_enableMargins;
479 bool m_enableOrientation;
480 bool m_enablePaper;
481 bool m_enablePrinter;
482 bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT
483 bool m_enableHelp;
484 wxPrintData m_printData;
485
486 private:
487 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData)
488 };
489
490 #endif // wxUSE_PRINTING_ARCHITECTURE
491
492 #endif
493 // _WX_CMNDATA_H_BASE_