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