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