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