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