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