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