]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cmndata.h
wxWindow::Show() works again
[wxWidgets.git] / include / wx / cmndata.h
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)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CMNDATA_H_BASE_
13 #define _WX_CMNDATA_H_BASE_
14
15 #ifdef __GNUG__
16 #pragma interface "cmndata.h"
17 #endif
18
19 #include "wx/font.h"
20 #include "wx/colour.h"
21
22 #if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
23 class WXDLLEXPORT wxPrintSetupData;
24 #endif
25
26 class WXDLLEXPORT wxColourData: public wxObject
27 {
28 DECLARE_DYNAMIC_CLASS(wxColourData)
29 public:
30 wxColourData();
31 wxColourData(const wxColourData& data);
32 ~wxColourData();
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; }
38
39 // Array of 16 custom colours
40 void SetCustomColour(int i, wxColour& colour);
41 wxColour GetCustomColour(int i);
42
43 void operator=(const wxColourData& data);
44
45 public:
46 wxColour dataColour;
47 wxColour custColours[16];
48 bool chooseFull;
49 };
50
51 class WXDLLEXPORT wxFontData: public wxObject
52 {
53 DECLARE_DYNAMIC_CLASS(wxFontData)
54 public:
55 wxFontData();
56 wxFontData(const wxFontData& fontData);
57 ~wxFontData();
58
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; }
64
65 void SetShowHelp(bool flag) { showHelp = flag; }
66 bool GetShowHelp() const { return showHelp; }
67
68 void EnableEffects(bool flag) { enableEffects = flag; }
69 bool GetEnableEffects() const { return enableEffects; }
70
71 void SetInitialFont(const wxFont& font) { initialFont = font; }
72 wxFont GetInitialFont() const { return initialFont; }
73
74 void SetChosenFont(const wxFont& font) { chosenFont = font; }
75 wxFont GetChosenFont() const { return chosenFont; }
76
77 void SetRange(int minRange, int maxRange) { minSize = minRange; maxSize = maxRange; }
78
79 void operator=(const wxFontData& data);
80
81 public:
82 wxColour fontColour;
83 bool showHelp;
84 bool allowSymbols;
85 bool enableEffects;
86 wxFont initialFont;
87 wxFont chosenFont;
88 int minSize;
89 int maxSize;
90 };
91
92 /*
93 * wxPrintData
94 * Encapsulates printer information (not printer dialog information)
95 */
96
97 class WXDLLEXPORT wxPrintData: public wxObject
98 {
99 DECLARE_DYNAMIC_CLASS(wxPrintData)
100
101 wxPrintData();
102 wxPrintData(const wxPrintData& printData);
103 ~wxPrintData();
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
114 // in wxPageSetupDialogData
115 wxPrintQuality GetQuality() const { return m_printQuality; }
116
117 void SetNoCopies(int v) { m_printNoCopies = v; };
118 void SetCollate(bool flag) { m_printCollate = flag; };
119 void SetOrientation(int orient) { m_printOrientation = orient; };
120
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; }
127
128 // PostScript-specific data
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; }
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
159
160 #ifdef __WXMSW__
161 // Convert to/from the DEVMODE structure
162 void ConvertToNative();
163 void ConvertFromNative();
164 void* GetNativeData() const { return m_devMode; }
165 void SetNativeData(void* data) { m_devMode = data; }
166 #endif
167
168 public:
169 #ifdef __WXMSW__
170 void* m_devMode;
171 #endif
172
173 private:
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;
198 };
199
200 /*
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.
205 */
206
207 class WXDLLEXPORT wxPrintDialogData: public wxObject
208 {
209 DECLARE_DYNAMIC_CLASS(wxPrintDialogData)
210
211 wxPrintDialogData();
212 wxPrintDialogData(const wxPrintDialogData& dialogData);
213 wxPrintDialogData(const wxPrintData& printData);
214 ~wxPrintDialogData();
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; }
248
249 void operator=(const wxPrintDialogData& data);
250 void operator=(const wxPrintData& data); // Sets internal m_printData member
251
252 #ifdef __WXMSW__
253 // Convert to/from the PRINTDLG structure
254 void ConvertToNative();
255 void ConvertFromNative();
256 void SetOwnerWindow(wxWindow* win);
257 void* GetNativeData() const { return m_printDlgData; }
258 #endif
259
260 #ifdef __WXMSW__
261 void* m_printDlgData;
262 #endif
263
264 private:
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
289
290 class WXDLLEXPORT wxPageSetupDialogData: public wxObject
291 {
292 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData)
293
294 public:
295 wxPageSetupDialogData();
296 wxPageSetupDialogData(const wxPageSetupDialogData& dialogData);
297 wxPageSetupDialogData(const wxPrintData& printData);
298 ~wxPageSetupDialogData();
299
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; };
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
319 void SetPaperId(wxPaperSize& id) { m_printData.SetPaperId(id); };
320
321 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
322 void SetPaperSize(wxPaperSize id);
323
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
337 #if defined(__WIN95__)
338 // Convert to/from the PAGESETUPDLG structure
339 void ConvertToNative();
340 void ConvertFromNative();
341 void SetOwnerWindow(wxWindow* win);
342 void* GetNativeData() const { return m_pageSetupData; }
343 #endif
344
345 // Use paper size defined in this object to set the wxPrintData
346 // paper id
347 void CalculateIdFromPaperSize();
348
349 // Use paper id in wxPrintData to set this object's paper size
350 void CalculatePaperSizeFromId();
351
352 void operator=(const wxPageSetupData& data);
353 void operator=(const wxPrintData& data);
354
355 wxPrintData& GetPrintData() { return m_printData; }
356 void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
357
358 #if defined(__WIN95__)
359 void* m_pageSetupData;
360 #endif
361
362 private:
363
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 };
381
382 #endif
383 // _WX_CMNDATA_H_BASE_