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