1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common GDI data classes
4 // Author: Julian Smart and others
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CMNDATA_H_BASE_
13 #define _WX_CMNDATA_H_BASE_
16 #pragma interface "cmndata.h"
19 #include "wx/window.h"
21 #include "wx/colour.h"
22 #include "wx/gdicmn.h"
24 #if defined(__WXMAC__) && defined(TARGET_CARBON)
25 #if !defined(__UNIX__)
26 #include <PMApplication.h>
30 #if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT
31 class WXDLLEXPORT wxPrintSetupData
;
34 class WXDLLEXPORT wxColourData
: public wxObject
36 DECLARE_DYNAMIC_CLASS(wxColourData
)
39 wxColourData(const wxColourData
& data
);
42 void SetChooseFull(bool flag
) { chooseFull
= flag
; }
43 bool GetChooseFull() const { return chooseFull
; }
44 void SetColour(wxColour
& colour
) { dataColour
= colour
; }
45 wxColour
&GetColour() { return dataColour
; }
47 // Array of 16 custom colours
48 void SetCustomColour(int i
, wxColour
& colour
);
49 wxColour
GetCustomColour(int i
);
51 void operator=(const wxColourData
& data
);
55 wxColour custColours
[16];
59 class WXDLLEXPORT wxFontData
: public wxObject
61 DECLARE_DYNAMIC_CLASS(wxFontData
)
66 void SetAllowSymbols(bool flag
) { allowSymbols
= flag
; }
67 bool GetAllowSymbols() const { return allowSymbols
; }
69 void SetColour(const wxColour
& colour
) { fontColour
= colour
; }
70 wxColour
&GetColour() { return fontColour
; }
72 void SetShowHelp(bool flag
) { showHelp
= flag
; }
73 bool GetShowHelp() const { return showHelp
; }
75 void EnableEffects(bool flag
) { enableEffects
= flag
; }
76 bool GetEnableEffects() const { return enableEffects
; }
78 void SetInitialFont(const wxFont
& font
) { initialFont
= font
; }
79 wxFont
GetInitialFont() const { return initialFont
; }
81 void SetChosenFont(const wxFont
& font
) { chosenFont
= font
; }
82 wxFont
GetChosenFont() const { return chosenFont
; }
84 void SetRange(int minRange
, int maxRange
) { minSize
= minRange
; maxSize
= maxRange
; }
86 // encoding info is split into 2 parts: the logical wxWin encoding
87 // (wxFontEncoding) and a structure containing the native parameters for
88 // it (wxNativeEncodingInfo)
89 wxFontEncoding
GetEncoding() const { return m_encoding
; }
90 void SetEncoding(wxFontEncoding encoding
) { m_encoding
= encoding
; }
92 wxNativeEncodingInfo
& EncodingInfo() { return m_encodingInfo
; }
105 wxFontEncoding m_encoding
;
106 wxNativeEncodingInfo m_encodingInfo
;
109 #if wxUSE_PRINTING_ARCHITECTURE
112 * Encapsulates printer information (not printer dialog information)
115 class WXDLLEXPORT wxPrintData
: public wxObject
117 DECLARE_DYNAMIC_CLASS(wxPrintData
)
120 wxPrintData(const wxPrintData
& printData
);
123 int GetNoCopies() const { return m_printNoCopies
; };
124 bool GetCollate() const { return m_printCollate
; };
125 int GetOrientation() const { return m_printOrientation
; };
127 const wxString
& GetPrinterName() const { return m_printerName
; }
128 bool GetColour() const { return m_colour
; }
129 wxDuplexMode
GetDuplex() const { return m_duplexMode
; }
130 wxPaperSize
GetPaperId() const { return m_paperId
; }
131 const wxSize
& GetPaperSize() const { return m_paperSize
; } // Not used yet: confusable with paper size
132 // in wxPageSetupDialogData
133 wxPrintQuality
GetQuality() const { return m_printQuality
; }
135 void SetNoCopies(int v
) { m_printNoCopies
= v
; };
136 void SetCollate(bool flag
) { m_printCollate
= flag
; };
137 void SetOrientation(int orient
) { m_printOrientation
= orient
; };
139 void SetPrinterName(const wxString
& name
) { m_printerName
= name
; }
140 void SetColour(bool colour
) { m_colour
= colour
; }
141 void SetDuplex(wxDuplexMode duplex
) { m_duplexMode
= duplex
; }
142 void SetPaperId(wxPaperSize sizeId
) { m_paperId
= sizeId
; }
143 void SetPaperSize(const wxSize
& sz
) { m_paperSize
= sz
; }
144 void SetQuality(wxPrintQuality quality
) { m_printQuality
= quality
; }
146 // PostScript-specific data
147 const wxString
& GetPrinterCommand() const { return m_printerCommand
; }
148 const wxString
& GetPrinterOptions() const { return m_printerOptions
; }
149 const wxString
& GetPreviewCommand() const { return m_previewCommand
; }
150 const wxString
& GetFilename() const { return m_filename
; }
151 const wxString
& GetFontMetricPath() const { return m_afmPath
; }
152 double GetPrinterScaleX() const { return m_printerScaleX
; }
153 double GetPrinterScaleY() const { return m_printerScaleY
; }
154 long GetPrinterTranslateX() const { return m_printerTranslateX
; }
155 long GetPrinterTranslateY() const { return m_printerTranslateY
; }
156 wxPrintMode
GetPrintMode() const { return m_printMode
; }
158 void SetPrinterCommand(const wxString
& command
) { m_printerCommand
= command
; }
159 void SetPrinterOptions(const wxString
& options
) { m_printerOptions
= options
; }
160 void SetPreviewCommand(const wxString
& command
) { m_previewCommand
= command
; }
161 void SetFilename(const wxString
& filename
) { m_filename
= filename
; }
162 void SetFontMetricPath(const wxString
& path
) { m_afmPath
= path
; }
163 void SetPrinterScaleX(double x
) { m_printerScaleX
= x
; }
164 void SetPrinterScaleY(double y
) { m_printerScaleY
= y
; }
165 void SetPrinterScaling(double x
, double y
) { m_printerScaleX
= x
; m_printerScaleY
= y
; }
166 void SetPrinterTranslateX(long x
) { m_printerTranslateX
= x
; }
167 void SetPrinterTranslateY(long y
) { m_printerTranslateY
= y
; }
168 void SetPrinterTranslation(long x
, long y
) { m_printerTranslateX
= x
; m_printerTranslateY
= y
; }
169 void SetPrintMode(wxPrintMode printMode
) { m_printMode
= printMode
; }
171 void operator=(const wxPrintData
& data
);
174 #if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT
175 void operator=(const wxPrintSetupData
& setupData
);
178 #if defined(__WXMSW__)
179 // Convert to/from the DEVMODE structure
180 void ConvertToNative();
181 void ConvertFromNative();
182 void* GetNativeData() const { return m_devMode
; }
183 void SetNativeData(void* data
) { m_devMode
= data
; }
184 void* GetNativeDataDevNames() const { return m_devNames
; }
185 void SetNativeDataDevNames(void* data
) { m_devNames
= data
; }
186 #elif defined(__WXMAC__)
187 void ConvertToNative();
188 void ConvertFromNative();
195 #elif defined( __WXMAC__ )
197 PMPageFormat m_macPageFormat
;
198 PMPrintSettings m_macPrintSettings
;
200 THPrint m_macPrintInfo
;
207 int m_printOrientation
;
210 // New members, 24/3/99
211 wxString m_printerName
;
213 wxDuplexMode m_duplexMode
;
214 wxPrintQuality m_printQuality
;
215 wxPaperSize m_paperId
;
218 // PostScript-specific data
219 wxString m_printerCommand
;
220 wxString m_previewCommand
;
221 wxString m_printerOptions
;
224 double m_printerScaleX
;
225 double m_printerScaleY
;
226 long m_printerTranslateX
;
227 long m_printerTranslateY
;
228 wxPrintMode m_printMode
;
233 * Encapsulates information displayed and edited in the printer dialog box.
234 * Contains a wxPrintData object which is filled in according to the values retrieved
238 class WXDLLEXPORT wxPrintDialogData
: public wxObject
240 DECLARE_DYNAMIC_CLASS(wxPrintDialogData
)
243 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
244 wxPrintDialogData(const wxPrintData
& printData
);
245 ~wxPrintDialogData();
247 int GetFromPage() const { return m_printFromPage
; };
248 int GetToPage() const { return m_printToPage
; };
249 int GetMinPage() const { return m_printMinPage
; };
250 int GetMaxPage() const { return m_printMaxPage
; };
251 int GetNoCopies() const { return m_printNoCopies
; };
252 bool GetAllPages() const { return m_printAllPages
; };
253 bool GetSelection() const { return m_printSelection
; };
254 bool GetCollate() const { return m_printCollate
; };
255 bool GetPrintToFile() const { return m_printToFile
; };
256 bool GetSetupDialog() const { return m_printSetupDialog
; };
258 void SetFromPage(int v
) { m_printFromPage
= v
; };
259 void SetToPage(int v
) { m_printToPage
= v
; };
260 void SetMinPage(int v
) { m_printMinPage
= v
; };
261 void SetMaxPage(int v
) { m_printMaxPage
= v
; };
262 void SetNoCopies(int v
) { m_printNoCopies
= v
; };
263 void SetAllPages(bool flag
) { m_printAllPages
= flag
; };
264 void SetSelection(bool flag
) { m_printSelection
= flag
; };
265 void SetCollate(bool flag
) { m_printCollate
= flag
; };
266 void SetPrintToFile(bool flag
) { m_printToFile
= flag
; };
267 void SetSetupDialog(bool flag
) { m_printSetupDialog
= flag
; };
269 void EnablePrintToFile(bool flag
) { m_printEnablePrintToFile
= flag
; };
270 void EnableSelection(bool flag
) { m_printEnableSelection
= flag
; };
271 void EnablePageNumbers(bool flag
) { m_printEnablePageNumbers
= flag
; };
272 void EnableHelp(bool flag
) { m_printEnableHelp
= flag
; };
274 bool GetEnablePrintToFile() const { return m_printEnablePrintToFile
; };
275 bool GetEnableSelection() const { return m_printEnableSelection
; };
276 bool GetEnablePageNumbers() const { return m_printEnablePageNumbers
; };
277 bool GetEnableHelp() const { return m_printEnableHelp
; };
279 wxPrintData
& GetPrintData() { return m_printData
; }
280 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
282 void operator=(const wxPrintDialogData
& data
);
283 void operator=(const wxPrintData
& data
); // Sets internal m_printData member
286 // Convert to/from the PRINTDLG structure
287 void ConvertToNative();
288 void ConvertFromNative();
289 void SetOwnerWindow(wxWindow
* win
);
290 void* GetNativeData() const { return m_printDlgData
; }
291 #elif defined(__WXMAC__)
292 void ConvertToNative();
293 void ConvertFromNative();
297 void* m_printDlgData
;
307 bool m_printAllPages
;
310 bool m_printSelection
;
311 bool m_printEnableSelection
;
312 bool m_printEnablePageNumbers
;
313 bool m_printEnableHelp
;
314 bool m_printEnablePrintToFile
;
315 bool m_printSetupDialog
;
317 wxPrintData m_printData
;
321 * This is the data used (and returned) by the wxPageSetupDialog.
324 // Compatibility with old name
325 #define wxPageSetupData wxPageSetupDialogData
327 class WXDLLEXPORT wxPageSetupDialogData
: public wxObject
329 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData
)
332 wxPageSetupDialogData();
333 wxPageSetupDialogData(const wxPageSetupDialogData
& dialogData
);
334 wxPageSetupDialogData(const wxPrintData
& printData
);
335 ~wxPageSetupDialogData();
337 wxSize
GetPaperSize() const { return m_paperSize
; };
338 wxPaperSize
GetPaperId() const { return m_printData
.GetPaperId(); };
339 wxPoint
GetMinMarginTopLeft() const { return m_minMarginTopLeft
; };
340 wxPoint
GetMinMarginBottomRight() const { return m_minMarginBottomRight
; };
341 wxPoint
GetMarginTopLeft() const { return m_marginTopLeft
; };
342 wxPoint
GetMarginBottomRight() const { return m_marginBottomRight
; };
344 bool GetDefaultMinMargins() const { return m_defaultMinMargins
; };
345 bool GetEnableMargins() const { return m_enableMargins
; };
346 bool GetEnableOrientation() const { return m_enableOrientation
; };
347 bool GetEnablePaper() const { return m_enablePaper
; };
348 bool GetEnablePrinter() const { return m_enablePrinter
; };
349 bool GetDefaultInfo() const { return m_getDefaultInfo
; };
350 bool GetEnableHelp() const { return m_enableHelp
; };
352 // If a corresponding paper type is found in the paper database, will set the m_printData
353 // paper size id member as well.
354 void SetPaperSize(const wxSize
& sz
);
356 void SetPaperId(wxPaperSize
& id
) { m_printData
.SetPaperId(id
); };
358 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
359 void SetPaperSize(wxPaperSize id
);
361 void SetMinMarginTopLeft(const wxPoint
& pt
) { m_minMarginTopLeft
= pt
; };
362 void SetMinMarginBottomRight(const wxPoint
& pt
) { m_minMarginBottomRight
= pt
; };
363 void SetMarginTopLeft(const wxPoint
& pt
) { m_marginTopLeft
= pt
; };
364 void SetMarginBottomRight(const wxPoint
& pt
) { m_marginBottomRight
= pt
; };
365 void SetDefaultMinMargins(bool flag
) { m_defaultMinMargins
= flag
; };
366 void SetDefaultInfo(bool flag
) { m_getDefaultInfo
= flag
; };
368 void EnableMargins(bool flag
) { m_enableMargins
= flag
; };
369 void EnableOrientation(bool flag
) { m_enableOrientation
= flag
; };
370 void EnablePaper(bool flag
) { m_enablePaper
= flag
; };
371 void EnablePrinter(bool flag
) { m_enablePrinter
= flag
; };
372 void EnableHelp(bool flag
) { m_enableHelp
= flag
; };
374 #if defined(__WIN95__)
375 // Convert to/from the PAGESETUPDLG structure
376 void ConvertToNative();
377 void ConvertFromNative();
378 void SetOwnerWindow(wxWindow
* win
);
379 void* GetNativeData() const { return m_pageSetupData
; }
380 #elif defined(__WXMAC__)
381 void ConvertToNative();
382 void ConvertFromNative();
385 // Use paper size defined in this object to set the wxPrintData
387 void CalculateIdFromPaperSize();
389 // Use paper id in wxPrintData to set this object's paper size
390 void CalculatePaperSizeFromId();
392 void operator=(const wxPageSetupData
& data
);
393 void operator=(const wxPrintData
& data
);
395 wxPrintData
& GetPrintData() { return m_printData
; }
396 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
398 #if defined(__WIN95__)
399 void* m_pageSetupData
;
404 wxSize m_paperSize
; // The dimensions selected by the user (on return, same as in wxPrintData?)
405 wxPoint m_minMarginTopLeft
;
406 wxPoint m_minMarginBottomRight
;
407 wxPoint m_marginTopLeft
;
408 wxPoint m_marginBottomRight
;
411 bool m_defaultMinMargins
;
412 bool m_enableMargins
;
413 bool m_enableOrientation
;
415 bool m_enablePrinter
;
416 bool m_getDefaultInfo
; // Equiv. to PSD_RETURNDEFAULT
419 wxPrintData m_printData
;
422 #endif // wxUSE_PRINTING_ARCHITECTURE
425 // _WX_CMNDATA_H_BASE_