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