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