]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cmndata.h
fixed operator=(), ==() and !=() for wxPen
[wxWidgets.git] / include / wx / cmndata.h
CommitLineData
c801d85f
KB
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)
d6b9496a 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_CMNDATA_H_BASE_
13#define _WX_CMNDATA_H_BASE_
c801d85f 14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
c801d85f
KB
16#pragma interface "cmndata.h"
17#endif
18
77b497a0 19#include "wx/window.h"
34138703 20#include "wx/font.h"
0bc93470 21#include "wx/encinfo.h"
34138703 22#include "wx/colour.h"
8bedcdce 23#include "wx/gdicmn.h"
34138703 24
c801d85f
KB
25class WXDLLEXPORT wxColourData: public wxObject
26{
7bcb11d3
JS
27public:
28 wxColourData();
29 wxColourData(const wxColourData& data);
30 ~wxColourData();
d6b9496a 31
ae500232
JS
32 void SetChooseFull(bool flag) { m_chooseFull = flag; }
33 bool GetChooseFull() const { return m_chooseFull; }
34 void SetColour(const wxColour& colour) { m_dataColour = colour; }
35 const wxColour& GetColour() const { return m_dataColour; }
36 wxColour& GetColour() { return m_dataColour; }
7bcb11d3
JS
37
38 // Array of 16 custom colours
cebf2fec 39 void SetCustomColour(int i, const wxColour& colour);
7bcb11d3 40 wxColour GetCustomColour(int i);
d6b9496a 41
7bcb11d3
JS
42 void operator=(const wxColourData& data);
43
44public:
ae500232
JS
45 wxColour m_dataColour;
46 wxColour m_custColours[16];
47 bool m_chooseFull;
eba33006
RR
48
49private:
50 DECLARE_DYNAMIC_CLASS(wxColourData)
c801d85f
KB
51};
52
53class WXDLLEXPORT wxFontData: public wxObject
54{
7bcb11d3
JS
55public:
56 wxFontData();
7bcb11d3
JS
57 ~wxFontData();
58
5e472c1f
GD
59 wxFontData(const wxFontData& data)
60 : wxObject()
ae500232
JS
61 , m_fontColour(data.m_fontColour)
62 , m_showHelp(data.m_showHelp)
63 , m_allowSymbols(data.m_allowSymbols)
64 , m_enableEffects(data.m_enableEffects)
65 , m_initialFont(data.m_initialFont)
66 , m_chosenFont(data.m_chosenFont)
67 , m_minSize(data.m_minSize)
68 , m_maxSize(data.m_maxSize)
5e472c1f
GD
69 , m_encoding(data.m_encoding)
70 , m_encodingInfo(data.m_encodingInfo)
71 {
72 }
73
74 wxFontData& operator=(const wxFontData& data)
75 {
50947acc 76 wxObject::operator=(data);
ae500232
JS
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;
50947acc
GD
85 m_encoding = data.m_encoding;
86 m_encodingInfo = data.m_encodingInfo;
5e472c1f
GD
87 return *this;
88 }
89
ae500232
JS
90 void SetAllowSymbols(bool flag) { m_allowSymbols = flag; }
91 bool GetAllowSymbols() const { return m_allowSymbols; }
d6b9496a 92
ae500232
JS
93 void SetColour(const wxColour& colour) { m_fontColour = colour; }
94 wxColour &GetColour() { return m_fontColour; }
7bcb11d3 95
ae500232
JS
96 void SetShowHelp(bool flag) { m_showHelp = flag; }
97 bool GetShowHelp() const { return m_showHelp; }
7bcb11d3 98
ae500232
JS
99 void EnableEffects(bool flag) { m_enableEffects = flag; }
100 bool GetEnableEffects() const { return m_enableEffects; }
7bcb11d3 101
ae500232
JS
102 void SetInitialFont(const wxFont& font) { m_initialFont = font; }
103 wxFont GetInitialFont() const { return m_initialFont; }
7bcb11d3 104
ae500232
JS
105 void SetChosenFont(const wxFont& font) { m_chosenFont = font; }
106 wxFont GetChosenFont() const { return m_chosenFont; }
7bcb11d3 107
ae500232 108 void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; }
7bcb11d3 109
7beba2fc
VZ
110 // encoding info is split into 2 parts: the logical wxWin encoding
111 // (wxFontEncoding) and a structure containing the native parameters for
112 // it (wxNativeEncodingInfo)
113 wxFontEncoding GetEncoding() const { return m_encoding; }
114 void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; }
115
116 wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; }
7bcb11d3
JS
117
118public:
ae500232
JS
119 wxColour m_fontColour;
120 bool m_showHelp;
121 bool m_allowSymbols;
122 bool m_enableEffects;
123 wxFont m_initialFont;
124 wxFont m_chosenFont;
125 int m_minSize;
126 int m_maxSize;
7beba2fc
VZ
127
128private:
129 wxFontEncoding m_encoding;
130 wxNativeEncodingInfo m_encodingInfo;
eba33006
RR
131
132private:
133 DECLARE_DYNAMIC_CLASS(wxFontData)
c801d85f
KB
134};
135
88ac883a 136#if wxUSE_PRINTING_ARCHITECTURE
c801d85f
KB
137/*
138 * wxPrintData
7bcb11d3 139 * Encapsulates printer information (not printer dialog information)
c801d85f 140 */
7bcb11d3 141
8a5b9f08
SC
142#ifdef __WXMAC__
143
144class wxNativePrintData ;
145
146#endif
147
c801d85f
KB
148class WXDLLEXPORT wxPrintData: public wxObject
149{
eba33006 150public:
7bcb11d3
JS
151 wxPrintData();
152 wxPrintData(const wxPrintData& printData);
153 ~wxPrintData();
d6b9496a
VZ
154
155 int GetNoCopies() const { return m_printNoCopies; };
156 bool GetCollate() const { return m_printCollate; };
157 int GetOrientation() const { return m_printOrientation; };
158
58cf0491
JS
159 // Is this data OK for showing the print dialog?
160 bool Ok() const ;
161
d6b9496a
VZ
162 const wxString& GetPrinterName() const { return m_printerName; }
163 bool GetColour() const { return m_colour; }
164 wxDuplexMode GetDuplex() const { return m_duplexMode; }
165 wxPaperSize GetPaperId() const { return m_paperId; }
166 const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size
7bcb11d3 167 // in wxPageSetupDialogData
d6b9496a 168 wxPrintQuality GetQuality() const { return m_printQuality; }
7bcb11d3 169
d6b9496a
VZ
170 void SetNoCopies(int v) { m_printNoCopies = v; };
171 void SetCollate(bool flag) { m_printCollate = flag; };
172 void SetOrientation(int orient) { m_printOrientation = orient; };
7bcb11d3 173
d6b9496a
VZ
174 void SetPrinterName(const wxString& name) { m_printerName = name; }
175 void SetColour(bool colour) { m_colour = colour; }
176 void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; }
177 void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; }
178 void SetPaperSize(const wxSize& sz) { m_paperSize = sz; }
179 void SetQuality(wxPrintQuality quality) { m_printQuality = quality; }
7bcb11d3
JS
180
181 // PostScript-specific data
d6b9496a
VZ
182 const wxString& GetPrinterCommand() const { return m_printerCommand; }
183 const wxString& GetPrinterOptions() const { return m_printerOptions; }
184 const wxString& GetPreviewCommand() const { return m_previewCommand; }
185 const wxString& GetFilename() const { return m_filename; }
186 const wxString& GetFontMetricPath() const { return m_afmPath; }
187 double GetPrinterScaleX() const { return m_printerScaleX; }
188 double GetPrinterScaleY() const { return m_printerScaleY; }
189 long GetPrinterTranslateX() const { return m_printerTranslateX; }
190 long GetPrinterTranslateY() const { return m_printerTranslateY; }
191 wxPrintMode GetPrintMode() const { return m_printMode; }
192
193 void SetPrinterCommand(const wxString& command) { m_printerCommand = command; }
194 void SetPrinterOptions(const wxString& options) { m_printerOptions = options; }
195 void SetPreviewCommand(const wxString& command) { m_previewCommand = command; }
196 void SetFilename(const wxString& filename) { m_filename = filename; }
197 void SetFontMetricPath(const wxString& path) { m_afmPath = path; }
198 void SetPrinterScaleX(double x) { m_printerScaleX = x; }
199 void SetPrinterScaleY(double y) { m_printerScaleY = y; }
200 void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }
201 void SetPrinterTranslateX(long x) { m_printerTranslateX = x; }
202 void SetPrinterTranslateY(long y) { m_printerTranslateY = y; }
203 void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }
204 void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
7bcb11d3
JS
205
206 void operator=(const wxPrintData& data);
207
25889d3c 208#if defined(__WXMSW__)
7bcb11d3
JS
209 // Convert to/from the DEVMODE structure
210 void ConvertToNative();
211 void ConvertFromNative();
d6b9496a
VZ
212 void* GetNativeData() const { return m_devMode; }
213 void SetNativeData(void* data) { m_devMode = data; }
eaeb6a3c
JS
214 void* GetNativeDataDevNames() const { return m_devNames; }
215 void SetNativeDataDevNames(void* data) { m_devNames = data; }
03e11df5 216#elif defined(__WXMAC__)
e7549107
SC
217 void ConvertToNative();
218 void ConvertFromNative();
c801d85f 219#endif
d6b9496a 220
7bcb11d3 221public:
dea106e5 222#if defined(__WXMSW__)
7bcb11d3 223 void* m_devMode;
eaeb6a3c 224 void* m_devNames;
dea106e5 225#elif defined(__WXMAC__)
8a5b9f08 226 wxNativePrintData* m_nativePrintData ;
5b781a67 227#endif
7bcb11d3
JS
228
229private:
2b5f62a0 230
7bcb11d3
JS
231 int m_printNoCopies;
232 int m_printOrientation;
233 bool m_printCollate;
234
235 // New members, 24/3/99
236 wxString m_printerName;
237 bool m_colour;
238 wxDuplexMode m_duplexMode;
239 wxPrintQuality m_printQuality;
240 wxPaperSize m_paperId;
241 wxSize m_paperSize;
242
243 // PostScript-specific data
244 wxString m_printerCommand;
245 wxString m_previewCommand;
246 wxString m_printerOptions;
247 wxString m_filename;
248 wxString m_afmPath;
249 double m_printerScaleX;
250 double m_printerScaleY;
251 long m_printerTranslateX;
252 long m_printerTranslateY;
253 wxPrintMode m_printMode;
eba33006
RR
254
255private:
256 DECLARE_DYNAMIC_CLASS(wxPrintData)
c801d85f
KB
257};
258
259/*
7bcb11d3
JS
260 * wxPrintDialogData
261 * Encapsulates information displayed and edited in the printer dialog box.
262 * Contains a wxPrintData object which is filled in according to the values retrieved
263 * from the dialog.
c801d85f
KB
264 */
265
7bcb11d3 266class WXDLLEXPORT wxPrintDialogData: public wxObject
c801d85f 267{
eba33006 268public:
7bcb11d3
JS
269 wxPrintDialogData();
270 wxPrintDialogData(const wxPrintDialogData& dialogData);
271 wxPrintDialogData(const wxPrintData& printData);
272 ~wxPrintDialogData();
d6b9496a
VZ
273
274 int GetFromPage() const { return m_printFromPage; };
275 int GetToPage() const { return m_printToPage; };
276 int GetMinPage() const { return m_printMinPage; };
277 int GetMaxPage() const { return m_printMaxPage; };
278 int GetNoCopies() const { return m_printNoCopies; };
279 bool GetAllPages() const { return m_printAllPages; };
5360828d 280 bool GetSelection() const { return m_printSelection; };
d6b9496a
VZ
281 bool GetCollate() const { return m_printCollate; };
282 bool GetPrintToFile() const { return m_printToFile; };
283 bool GetSetupDialog() const { return m_printSetupDialog; };
284
285 void SetFromPage(int v) { m_printFromPage = v; };
286 void SetToPage(int v) { m_printToPage = v; };
287 void SetMinPage(int v) { m_printMinPage = v; };
288 void SetMaxPage(int v) { m_printMaxPage = v; };
289 void SetNoCopies(int v) { m_printNoCopies = v; };
290 void SetAllPages(bool flag) { m_printAllPages = flag; };
5360828d 291 void SetSelection(bool flag) { m_printSelection = flag; };
d6b9496a
VZ
292 void SetCollate(bool flag) { m_printCollate = flag; };
293 void SetPrintToFile(bool flag) { m_printToFile = flag; };
294 void SetSetupDialog(bool flag) { m_printSetupDialog = flag; };
295
296 void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; };
297 void EnableSelection(bool flag) { m_printEnableSelection = flag; };
298 void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; };
299 void EnableHelp(bool flag) { m_printEnableHelp = flag; };
300
301 bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; };
302 bool GetEnableSelection() const { return m_printEnableSelection; };
303 bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; };
304 bool GetEnableHelp() const { return m_printEnableHelp; };
305
58cf0491
JS
306 // Is this data OK for showing the print dialog?
307 bool Ok() const { return m_printData.Ok() ; }
308
d6b9496a
VZ
309 wxPrintData& GetPrintData() { return m_printData; }
310 void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
7bcb11d3
JS
311
312 void operator=(const wxPrintDialogData& data);
313 void operator=(const wxPrintData& data); // Sets internal m_printData member
d6b9496a 314
7bcb11d3
JS
315#ifdef __WXMSW__
316 // Convert to/from the PRINTDLG structure
317 void ConvertToNative();
318 void ConvertFromNative();
319 void SetOwnerWindow(wxWindow* win);
d6b9496a 320 void* GetNativeData() const { return m_printDlgData; }
03e11df5 321#elif defined(__WXMAC__)
eba33006
RR
322 void ConvertToNative();
323 void ConvertFromNative();
7bcb11d3 324#endif
d6b9496a 325
7bcb11d3
JS
326#ifdef __WXMSW__
327 void* m_printDlgData;
328#endif
329
330private:
7bcb11d3
JS
331 int m_printFromPage;
332 int m_printToPage;
333 int m_printMinPage;
334 int m_printMaxPage;
335 int m_printNoCopies;
336 bool m_printAllPages;
337 bool m_printCollate;
338 bool m_printToFile;
5360828d 339 bool m_printSelection;
7bcb11d3
JS
340 bool m_printEnableSelection;
341 bool m_printEnablePageNumbers;
342 bool m_printEnableHelp;
343 bool m_printEnablePrintToFile;
344 bool m_printSetupDialog;
7bcb11d3 345 wxPrintData m_printData;
eba33006
RR
346
347private:
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
7bcb11d3
JS
358class WXDLLEXPORT wxPageSetupDialogData: public wxObject
359{
7bcb11d3
JS
360public:
361 wxPageSetupDialogData();
362 wxPageSetupDialogData(const wxPageSetupDialogData& dialogData);
363 wxPageSetupDialogData(const wxPrintData& printData);
364 ~wxPageSetupDialogData();
365
d6b9496a
VZ
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
JS
381 // Is this data OK for showing the page setup dialog?
382 bool Ok() const { return m_printData.Ok() ; }
383
7bcb11d3
JS
384 // If a corresponding paper type is found in the paper database, will set the m_printData
385 // paper size id member as well.
386 void SetPaperSize(const wxSize& sz);
387
844e5ad3 388 void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); };
69157f8b 389
7bcb11d3
JS
390 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
391 void SetPaperSize(wxPaperSize id);
392
d6b9496a
VZ
393 void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; };
394 void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; };
395 void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; };
396 void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; };
397 void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; };
398 void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; };
399
400 void EnableMargins(bool flag) { m_enableMargins = flag; };
401 void EnableOrientation(bool flag) { m_enableOrientation = flag; };
402 void EnablePaper(bool flag) { m_enablePaper = flag; };
403 void EnablePrinter(bool flag) { m_enablePrinter = flag; };
404 void EnableHelp(bool flag) { m_enableHelp = flag; };
405
c801d85f 406#if defined(__WIN95__)
7bcb11d3
JS
407 // Convert to/from the PAGESETUPDLG structure
408 void ConvertToNative();
409 void ConvertFromNative();
410 void SetOwnerWindow(wxWindow* win);
d6b9496a 411 void* GetNativeData() const { return m_pageSetupData; }
03e11df5 412#elif defined(__WXMAC__)
eba33006
RR
413 void ConvertToNative();
414 void ConvertFromNative();
c801d85f 415#endif
7bcb11d3
JS
416
417 // Use paper size defined in this object to set the wxPrintData
418 // paper id
419 void CalculateIdFromPaperSize();
d6b9496a 420
7bcb11d3
JS
421 // Use paper id in wxPrintData to set this object's paper size
422 void CalculatePaperSizeFromId();
d6b9496a 423
5e472c1f
GD
424 wxPageSetupDialogData& operator=(const wxPageSetupData& data);
425 wxPageSetupDialogData& operator=(const wxPrintData& data);
7bcb11d3 426
d6b9496a
VZ
427 wxPrintData& GetPrintData() { return m_printData; }
428 void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
c801d85f
KB
429
430#if defined(__WIN95__)
7bcb11d3 431 void* m_pageSetupData;
c801d85f
KB
432#endif
433
7bcb11d3 434private:
7bcb11d3
JS
435 wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?)
436 wxPoint m_minMarginTopLeft;
437 wxPoint m_minMarginBottomRight;
438 wxPoint m_marginTopLeft;
439 wxPoint m_marginBottomRight;
7bcb11d3
JS
440 bool m_defaultMinMargins;
441 bool m_enableMargins;
442 bool m_enableOrientation;
443 bool m_enablePaper;
444 bool m_enablePrinter;
445 bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT
446 bool m_enableHelp;
7bcb11d3 447 wxPrintData m_printData;
eba33006
RR
448
449private:
450 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData)
7bcb11d3 451};
c801d85f 452
88ac883a
VZ
453#endif // wxUSE_PRINTING_ARCHITECTURE
454
c801d85f 455#endif
7bcb11d3 456// _WX_CMNDATA_H_BASE_