]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cmndata.h
added more reserved functions
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "cmndata.h"
17 #endif
18
19 #include "wx/window.h"
20 #include "wx/font.h"
21 #include "wx/encinfo.h"
22 #include "wx/colour.h"
23 #include "wx/gdicmn.h"
24
25 #if wxUSE_STREAMS
26 #include "wx/stream.h"
27 #endif
28
29
30 class WXDLLEXPORT wxPrintNativeDataBase;
31
32
33 class WXDLLEXPORT wxColourData: public wxObject
34 {
35 public:
36 wxColourData();
37 wxColourData(const wxColourData& data);
38 ~wxColourData();
39
40 void SetChooseFull(bool flag) { m_chooseFull = flag; }
41 bool GetChooseFull() const { return m_chooseFull; }
42 void SetColour(const wxColour& colour) { m_dataColour = colour; }
43 const wxColour& GetColour() const { return m_dataColour; }
44 wxColour& GetColour() { return m_dataColour; }
45
46 // Array of 16 custom colours
47 void SetCustomColour(int i, const wxColour& colour);
48 wxColour GetCustomColour(int i);
49
50 void operator=(const wxColourData& data);
51
52 public:
53 wxColour m_dataColour;
54 wxColour m_custColours[16];
55 bool m_chooseFull;
56
57 private:
58 DECLARE_DYNAMIC_CLASS(wxColourData)
59 };
60
61 class WXDLLEXPORT wxFontData: public wxObject
62 {
63 public:
64 wxFontData();
65 ~wxFontData();
66
67 wxFontData(const wxFontData& data)
68 : wxObject()
69 , m_fontColour(data.m_fontColour)
70 , m_showHelp(data.m_showHelp)
71 , m_allowSymbols(data.m_allowSymbols)
72 , m_enableEffects(data.m_enableEffects)
73 , m_initialFont(data.m_initialFont)
74 , m_chosenFont(data.m_chosenFont)
75 , m_minSize(data.m_minSize)
76 , m_maxSize(data.m_maxSize)
77 , m_encoding(data.m_encoding)
78 , m_encodingInfo(data.m_encodingInfo)
79 {
80 }
81
82 wxFontData& operator=(const wxFontData& data)
83 {
84 wxObject::operator=(data);
85 m_fontColour = data.m_fontColour;
86 m_showHelp = data.m_showHelp;
87 m_allowSymbols = data.m_allowSymbols;
88 m_enableEffects = data.m_enableEffects;
89 m_initialFont = data.m_initialFont;
90 m_chosenFont = data.m_chosenFont;
91 m_minSize = data.m_minSize;
92 m_maxSize = data.m_maxSize;
93 m_encoding = data.m_encoding;
94 m_encodingInfo = data.m_encodingInfo;
95 return *this;
96 }
97
98 void SetAllowSymbols(bool flag) { m_allowSymbols = flag; }
99 bool GetAllowSymbols() const { return m_allowSymbols; }
100
101 void SetColour(const wxColour& colour) { m_fontColour = colour; }
102 wxColour &GetColour() { return m_fontColour; }
103
104 void SetShowHelp(bool flag) { m_showHelp = flag; }
105 bool GetShowHelp() const { return m_showHelp; }
106
107 void EnableEffects(bool flag) { m_enableEffects = flag; }
108 bool GetEnableEffects() const { return m_enableEffects; }
109
110 void SetInitialFont(const wxFont& font) { m_initialFont = font; }
111 wxFont GetInitialFont() const { return m_initialFont; }
112
113 void SetChosenFont(const wxFont& font) { m_chosenFont = font; }
114 wxFont GetChosenFont() const { return m_chosenFont; }
115
116 void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; }
117
118 // encoding info is split into 2 parts: the logical wxWin encoding
119 // (wxFontEncoding) and a structure containing the native parameters for
120 // it (wxNativeEncodingInfo)
121 wxFontEncoding GetEncoding() const { return m_encoding; }
122 void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; }
123
124 wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; }
125
126 public:
127 wxColour m_fontColour;
128 bool m_showHelp;
129 bool m_allowSymbols;
130 bool m_enableEffects;
131 wxFont m_initialFont;
132 wxFont m_chosenFont;
133 int m_minSize;
134 int m_maxSize;
135
136 private:
137 wxFontEncoding m_encoding;
138 wxNativeEncodingInfo m_encodingInfo;
139
140 private:
141 DECLARE_DYNAMIC_CLASS(wxFontData)
142 };
143
144 #if wxUSE_PRINTING_ARCHITECTURE
145 /*
146 * wxPrintData
147 * Encapsulates printer information (not printer dialog information)
148 */
149
150 enum wxPrintBin
151 {
152 wxPRINTBIN_DEFAULT,
153
154 wxPRINTBIN_ONLYONE,
155 wxPRINTBIN_LOWER,
156 wxPRINTBIN_MIDDLE,
157 wxPRINTBIN_MANUAL,
158 wxPRINTBIN_ENVELOPE,
159 wxPRINTBIN_ENVMANUAL,
160 wxPRINTBIN_AUTO,
161 wxPRINTBIN_TRACTOR,
162 wxPRINTBIN_SMALLFMT,
163 wxPRINTBIN_LARGEFMT,
164 wxPRINTBIN_LARGECAPACITY,
165 wxPRINTBIN_CASSETTE,
166 wxPRINTBIN_FORMSOURCE,
167
168 wxPRINTBIN_USER
169 };
170
171
172 class WXDLLEXPORT wxPrintData: public wxObject
173 {
174 public:
175 wxPrintData();
176 wxPrintData(const wxPrintData& printData);
177 ~wxPrintData();
178
179 int GetNoCopies() const { return m_printNoCopies; }
180 bool GetCollate() const { return m_printCollate; }
181 int GetOrientation() const { return m_printOrientation; }
182
183 // Is this data OK for showing the print dialog?
184 bool Ok() const ;
185
186 const wxString& GetPrinterName() const { return m_printerName; }
187 bool GetColour() const { return m_colour; }
188 wxDuplexMode GetDuplex() const { return m_duplexMode; }
189 wxPaperSize GetPaperId() const { return m_paperId; }
190 const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size
191 // in wxPageSetupDialogData
192 wxPrintQuality GetQuality() const { return m_printQuality; }
193 wxPrintBin GetBin() const { return m_bin; }
194 wxPrintMode GetPrintMode() const { return m_printMode; }
195
196 void SetNoCopies(int v) { m_printNoCopies = v; }
197 void SetCollate(bool flag) { m_printCollate = flag; }
198 void SetOrientation(int orient) { m_printOrientation = orient; }
199
200 void SetPrinterName(const wxString& name) { m_printerName = name; }
201 void SetColour(bool colour) { m_colour = colour; }
202 void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; }
203 void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; }
204 void SetPaperSize(const wxSize& sz) { m_paperSize = sz; }
205 void SetQuality(wxPrintQuality quality) { m_printQuality = quality; }
206 void SetBin(wxPrintBin bin) { m_bin = bin; }
207 void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
208
209 wxString GetFilename() const { return m_filename; }
210 void SetFilename( const wxString &filename ) { m_filename = filename; }
211
212 void operator=(const wxPrintData& data);
213
214 char* GetPrivData() const { return m_privData; }
215 int GetPrivDataLen() const { return m_privDataLen; }
216 void SetPrivData( char *privData, int len );
217
218
219 #if WXWIN_COMPATIBILITY_2_4
220 // PostScript-specific data
221 wxString GetPrinterCommand() const;
222 wxString GetPrinterOptions() const;
223 wxString GetPreviewCommand() const;
224 wxString GetFontMetricPath() const;
225 double GetPrinterScaleX() const;
226 double GetPrinterScaleY() const;
227 long GetPrinterTranslateX() const;
228 long GetPrinterTranslateY() const;
229
230 void SetPrinterCommand(const wxString& command);
231 void SetPrinterOptions(const wxString& options);
232 void SetPreviewCommand(const wxString& command);
233 void SetFontMetricPath(const wxString& path);
234 void SetPrinterScaleX(double x);
235 void SetPrinterScaleY(double y);
236 void SetPrinterScaling(double x, double y);
237 void SetPrinterTranslateX(long x);
238 void SetPrinterTranslateY(long y);
239 void SetPrinterTranslation(long x, long y);
240 #endif
241
242 // Convert between wxPrintData and native data
243 void ConvertToNative();
244 void ConvertFromNative();
245 // Holds the native print data
246 wxPrintNativeDataBase *GetNativeData() const { return m_nativeData; }
247
248 private:
249 wxPrintBin m_bin;
250 wxPrintMode m_printMode;
251
252 int m_printNoCopies;
253 int m_printOrientation;
254 bool m_printCollate;
255
256 wxString m_printerName;
257 bool m_colour;
258 wxDuplexMode m_duplexMode;
259 wxPrintQuality m_printQuality;
260 wxPaperSize m_paperId;
261 wxSize m_paperSize;
262
263 wxString m_filename;
264
265 char* m_privData;
266 int m_privDataLen;
267
268 wxPrintNativeDataBase *m_nativeData;
269
270 private:
271 DECLARE_DYNAMIC_CLASS(wxPrintData)
272 };
273
274 /*
275 * wxPrintDialogData
276 * Encapsulates information displayed and edited in the printer dialog box.
277 * Contains a wxPrintData object which is filled in according to the values retrieved
278 * from the dialog.
279 */
280
281 class WXDLLEXPORT wxPrintDialogData: public wxObject
282 {
283 public:
284 wxPrintDialogData();
285 wxPrintDialogData(const wxPrintDialogData& dialogData);
286 wxPrintDialogData(const wxPrintData& printData);
287 ~wxPrintDialogData();
288
289 int GetFromPage() const { return m_printFromPage; };
290 int GetToPage() const { return m_printToPage; };
291 int GetMinPage() const { return m_printMinPage; };
292 int GetMaxPage() const { return m_printMaxPage; };
293 int GetNoCopies() const { return m_printNoCopies; };
294 bool GetAllPages() const { return m_printAllPages; };
295 bool GetSelection() const { return m_printSelection; };
296 bool GetCollate() const { return m_printCollate; };
297 bool GetPrintToFile() const { return m_printToFile; };
298 #if WXWIN_COMPATIBILITY_2_4
299 bool GetSetupDialog() const { return m_printSetupDialog; };
300 #endif
301 void SetFromPage(int v) { m_printFromPage = v; };
302 void SetToPage(int v) { m_printToPage = v; };
303 void SetMinPage(int v) { m_printMinPage = v; };
304 void SetMaxPage(int v) { m_printMaxPage = v; };
305 void SetNoCopies(int v) { m_printNoCopies = v; };
306 void SetAllPages(bool flag) { m_printAllPages = flag; };
307 void SetSelection(bool flag) { m_printSelection = flag; };
308 void SetCollate(bool flag) { m_printCollate = flag; };
309 void SetPrintToFile(bool flag) { m_printToFile = flag; };
310 #if WXWIN_COMPATIBILITY_2_4
311 void SetSetupDialog(bool flag) { m_printSetupDialog = flag; };
312 #endif
313 void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; };
314 void EnableSelection(bool flag) { m_printEnableSelection = flag; };
315 void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; };
316 void EnableHelp(bool flag) { m_printEnableHelp = flag; };
317
318 bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; };
319 bool GetEnableSelection() const { return m_printEnableSelection; };
320 bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; };
321 bool GetEnableHelp() const { return m_printEnableHelp; };
322
323 // Is this data OK for showing the print dialog?
324 bool Ok() const { return m_printData.Ok() ; }
325
326 wxPrintData& GetPrintData() { return m_printData; }
327 void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
328
329 void operator=(const wxPrintDialogData& data);
330 void operator=(const wxPrintData& data); // Sets internal m_printData member
331
332 private:
333 int m_printFromPage;
334 int m_printToPage;
335 int m_printMinPage;
336 int m_printMaxPage;
337 int m_printNoCopies;
338 bool m_printAllPages;
339 bool m_printCollate;
340 bool m_printToFile;
341 bool m_printSelection;
342 bool m_printEnableSelection;
343 bool m_printEnablePageNumbers;
344 bool m_printEnableHelp;
345 bool m_printEnablePrintToFile;
346 #if WXWIN_COMPATIBILITY_2_4
347 bool m_printSetupDialog;
348 #endif
349 wxPrintData m_printData;
350
351 private:
352 DECLARE_DYNAMIC_CLASS(wxPrintDialogData)
353 };
354
355 /*
356 * This is the data used (and returned) by the wxPageSetupDialog.
357 */
358
359 // Compatibility with old name
360 #define wxPageSetupData wxPageSetupDialogData
361
362 class WXDLLEXPORT wxPageSetupDialogData: public wxObject
363 {
364 public:
365 wxPageSetupDialogData();
366 wxPageSetupDialogData(const wxPageSetupDialogData& dialogData);
367 wxPageSetupDialogData(const wxPrintData& printData);
368 ~wxPageSetupDialogData();
369
370 wxSize GetPaperSize() const { return m_paperSize; };
371 wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); };
372 wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; };
373 wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; };
374 wxPoint GetMarginTopLeft() const { return m_marginTopLeft; };
375 wxPoint GetMarginBottomRight() const { return m_marginBottomRight; };
376
377 bool GetDefaultMinMargins() const { return m_defaultMinMargins; };
378 bool GetEnableMargins() const { return m_enableMargins; };
379 bool GetEnableOrientation() const { return m_enableOrientation; };
380 bool GetEnablePaper() const { return m_enablePaper; };
381 bool GetEnablePrinter() const { return m_enablePrinter; };
382 bool GetDefaultInfo() const { return m_getDefaultInfo; };
383 bool GetEnableHelp() const { return m_enableHelp; };
384
385 // Is this data OK for showing the page setup dialog?
386 bool Ok() const { return m_printData.Ok() ; }
387
388 // If a corresponding paper type is found in the paper database, will set the m_printData
389 // paper size id member as well.
390 void SetPaperSize(const wxSize& sz);
391
392 void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); };
393
394 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
395 void SetPaperSize(wxPaperSize id);
396
397 void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; };
398 void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; };
399 void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; };
400 void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; };
401 void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; };
402 void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; };
403
404 void EnableMargins(bool flag) { m_enableMargins = flag; };
405 void EnableOrientation(bool flag) { m_enableOrientation = flag; };
406 void EnablePaper(bool flag) { m_enablePaper = flag; };
407 void EnablePrinter(bool flag) { m_enablePrinter = flag; };
408 void EnableHelp(bool flag) { m_enableHelp = flag; };
409
410 // Use paper size defined in this object to set the wxPrintData
411 // paper id
412 void CalculateIdFromPaperSize();
413
414 // Use paper id in wxPrintData to set this object's paper size
415 void CalculatePaperSizeFromId();
416
417 wxPageSetupDialogData& operator=(const wxPageSetupData& data);
418 wxPageSetupDialogData& operator=(const wxPrintData& data);
419
420 wxPrintData& GetPrintData() { return m_printData; }
421 void SetPrintData(const wxPrintData& printData);
422
423 private:
424 wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?)
425 wxPoint m_minMarginTopLeft;
426 wxPoint m_minMarginBottomRight;
427 wxPoint m_marginTopLeft;
428 wxPoint m_marginBottomRight;
429 bool m_defaultMinMargins;
430 bool m_enableMargins;
431 bool m_enableOrientation;
432 bool m_enablePaper;
433 bool m_enablePrinter;
434 bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT
435 bool m_enableHelp;
436 wxPrintData m_printData;
437
438 private:
439 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData)
440 };
441
442 #endif // wxUSE_PRINTING_ARCHITECTURE
443
444 #endif
445 // _WX_CMNDATA_H_BASE_