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