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