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_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "cmndata.h"
19 #include "wx/window.h"
21 #include "wx/encinfo.h"
22 #include "wx/colour.h"
23 #include "wx/gdicmn.h"
26 #include "wx/stream.h"
30 class WXDLLEXPORT wxPrintNativeDataBase
;
33 class WXDLLEXPORT wxColourData
: public wxObject
37 wxColourData(const wxColourData
& data
);
40 void SetChooseFull(bool flag
) { m_chooseFull
= flag
; }
41 bool GetChooseFull() const { return m_chooseFull
; }
42 void SetColour(const wxColour
& colour
) { m_dataColour
= colour
; }
43 const wxColour
& GetColour() const { return m_dataColour
; }
44 wxColour
& GetColour() { return m_dataColour
; }
46 // Array of 16 custom colours
47 void SetCustomColour(int i
, const wxColour
& colour
);
48 wxColour
GetCustomColour(int i
);
50 void operator=(const wxColourData
& data
);
53 wxColour m_dataColour
;
54 wxColour m_custColours
[16];
58 DECLARE_DYNAMIC_CLASS(wxColourData
)
61 class WXDLLEXPORT wxFontData
: public wxObject
67 wxFontData(const wxFontData
& data
)
69 , m_fontColour(data
.m_fontColour
)
70 , m_showHelp(data
.m_showHelp
)
71 , m_allowSymbols(data
.m_allowSymbols
)
72 , m_enableEffects(data
.m_enableEffects
)
73 , m_initialFont(data
.m_initialFont
)
74 , m_chosenFont(data
.m_chosenFont
)
75 , m_minSize(data
.m_minSize
)
76 , m_maxSize(data
.m_maxSize
)
77 , m_encoding(data
.m_encoding
)
78 , m_encodingInfo(data
.m_encodingInfo
)
82 wxFontData
& operator=(const wxFontData
& data
)
84 wxObject::operator=(data
);
85 m_fontColour
= data
.m_fontColour
;
86 m_showHelp
= data
.m_showHelp
;
87 m_allowSymbols
= data
.m_allowSymbols
;
88 m_enableEffects
= data
.m_enableEffects
;
89 m_initialFont
= data
.m_initialFont
;
90 m_chosenFont
= data
.m_chosenFont
;
91 m_minSize
= data
.m_minSize
;
92 m_maxSize
= data
.m_maxSize
;
93 m_encoding
= data
.m_encoding
;
94 m_encodingInfo
= data
.m_encodingInfo
;
98 void SetAllowSymbols(bool flag
) { m_allowSymbols
= flag
; }
99 bool GetAllowSymbols() const { return m_allowSymbols
; }
101 void SetColour(const wxColour
& colour
) { m_fontColour
= colour
; }
102 wxColour
&GetColour() { return m_fontColour
; }
104 void SetShowHelp(bool flag
) { m_showHelp
= flag
; }
105 bool GetShowHelp() const { return m_showHelp
; }
107 void EnableEffects(bool flag
) { m_enableEffects
= flag
; }
108 bool GetEnableEffects() const { return m_enableEffects
; }
110 void SetInitialFont(const wxFont
& font
) { m_initialFont
= font
; }
111 wxFont
GetInitialFont() const { return m_initialFont
; }
113 void SetChosenFont(const wxFont
& font
) { m_chosenFont
= font
; }
114 wxFont
GetChosenFont() const { return m_chosenFont
; }
116 void SetRange(int minRange
, int maxRange
) { m_minSize
= minRange
; m_maxSize
= maxRange
; }
118 // encoding info is split into 2 parts: the logical wxWin encoding
119 // (wxFontEncoding) and a structure containing the native parameters for
120 // it (wxNativeEncodingInfo)
121 wxFontEncoding
GetEncoding() const { return m_encoding
; }
122 void SetEncoding(wxFontEncoding encoding
) { m_encoding
= encoding
; }
124 wxNativeEncodingInfo
& EncodingInfo() { return m_encodingInfo
; }
127 wxColour m_fontColour
;
130 bool m_enableEffects
;
131 wxFont m_initialFont
;
137 wxFontEncoding m_encoding
;
138 wxNativeEncodingInfo m_encodingInfo
;
141 DECLARE_DYNAMIC_CLASS(wxFontData
)
144 #if wxUSE_PRINTING_ARCHITECTURE
147 * Encapsulates printer information (not printer dialog information)
152 class wxNativePrintData
;
165 wxPRINTBIN_ENVMANUAL
,
170 wxPRINTBIN_LARGECAPACITY
,
172 wxPRINTBIN_FORMSOURCE
,
178 class WXDLLEXPORT wxPrintData
: public wxObject
182 wxPrintData(const wxPrintData
& printData
);
185 int GetNoCopies() const { return m_printNoCopies
; };
186 bool GetCollate() const { return m_printCollate
; };
187 int GetOrientation() const { return m_printOrientation
; };
189 // Is this data OK for showing the print dialog?
192 const wxString
& GetPrinterName() const { return m_printerName
; }
193 bool GetColour() const { return m_colour
; }
194 wxDuplexMode
GetDuplex() const { return m_duplexMode
; }
195 wxPaperSize
GetPaperId() const { return m_paperId
; }
196 const wxSize
& GetPaperSize() const { return m_paperSize
; } // Not used yet: confusable with paper size
197 // in wxPageSetupDialogData
198 wxPrintQuality
GetQuality() const { return m_printQuality
; }
199 wxPrintBin
GetBin() const { return m_bin
; }
200 wxPrintMode
GetPrintMode() const { return m_printMode
; }
202 void SetNoCopies(int v
) { m_printNoCopies
= v
; };
203 void SetCollate(bool flag
) { m_printCollate
= flag
; };
204 void SetOrientation(int orient
) { m_printOrientation
= orient
; };
206 void SetPrinterName(const wxString
& name
) { m_printerName
= name
; }
207 void SetColour(bool colour
) { m_colour
= colour
; }
208 void SetDuplex(wxDuplexMode duplex
) { m_duplexMode
= duplex
; }
209 void SetPaperId(wxPaperSize sizeId
) { m_paperId
= sizeId
; }
210 void SetPaperSize(const wxSize
& sz
) { m_paperSize
= sz
; }
211 void SetQuality(wxPrintQuality quality
) { m_printQuality
= quality
; }
212 void SetBin(wxPrintBin bin
) { m_bin
= bin
; }
213 void SetPrintMode(wxPrintMode printMode
) { m_printMode
= printMode
; }
215 wxString
GetFilename() const { return m_filename
; }
216 void SetFilename( const wxString
&filename
) { m_filename
= filename
; }
218 void operator=(const wxPrintData
& data
);
220 #if WXWIN_COMPATIBILITY_2_4
221 // PostScript-specific data
222 wxString
GetPrinterCommand() const;
223 wxString
GetPrinterOptions() const;
224 wxString
GetPreviewCommand() const;
225 wxString
GetFontMetricPath() const;
226 double GetPrinterScaleX() const;
227 double GetPrinterScaleY() const;
228 long GetPrinterTranslateX() const;
229 long GetPrinterTranslateY() const;
231 void SetPrinterCommand(const wxString
& command
);
232 void SetPrinterOptions(const wxString
& options
);
233 void SetPreviewCommand(const wxString
& command
);
234 void SetFontMetricPath(const wxString
& path
);
235 void SetPrinterScaleX(double x
);
236 void SetPrinterScaleY(double y
);
237 void SetPrinterScaling(double x
, double y
);
238 void SetPrinterTranslateX(long x
);
239 void SetPrinterTranslateY(long y
);
240 void SetPrinterTranslation(long x
, long y
);
243 // Convert between wxPrintData and native data
244 void ConvertToNative();
245 void ConvertFromNative();
246 // Holds the native print data
247 wxPrintNativeDataBase
*GetNativeData() const { return m_nativeData
; }
250 #if defined(__WXMAC__)
251 wxNativePrintData
* m_nativePrintData
;
256 wxPrintMode m_printMode
;
259 int m_printOrientation
;
262 wxString m_printerName
;
264 wxDuplexMode m_duplexMode
;
265 wxPrintQuality m_printQuality
;
266 wxPaperSize m_paperId
;
271 wxPrintNativeDataBase
*m_nativeData
;
274 DECLARE_DYNAMIC_CLASS(wxPrintData
)
279 * Encapsulates information displayed and edited in the printer dialog box.
280 * Contains a wxPrintData object which is filled in according to the values retrieved
284 class WXDLLEXPORT wxPrintDialogData
: public wxObject
288 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
289 wxPrintDialogData(const wxPrintData
& printData
);
290 ~wxPrintDialogData();
292 int GetFromPage() const { return m_printFromPage
; };
293 int GetToPage() const { return m_printToPage
; };
294 int GetMinPage() const { return m_printMinPage
; };
295 int GetMaxPage() const { return m_printMaxPage
; };
296 int GetNoCopies() const { return m_printNoCopies
; };
297 bool GetAllPages() const { return m_printAllPages
; };
298 bool GetSelection() const { return m_printSelection
; };
299 bool GetCollate() const { return m_printCollate
; };
300 bool GetPrintToFile() const { return m_printToFile
; };
301 #if WXWIN_COMPATIBILITY_2_4
302 bool GetSetupDialog() const { return m_printSetupDialog
; };
304 void SetFromPage(int v
) { m_printFromPage
= v
; };
305 void SetToPage(int v
) { m_printToPage
= v
; };
306 void SetMinPage(int v
) { m_printMinPage
= v
; };
307 void SetMaxPage(int v
) { m_printMaxPage
= v
; };
308 void SetNoCopies(int v
) { m_printNoCopies
= v
; };
309 void SetAllPages(bool flag
) { m_printAllPages
= flag
; };
310 void SetSelection(bool flag
) { m_printSelection
= flag
; };
311 void SetCollate(bool flag
) { m_printCollate
= flag
; };
312 void SetPrintToFile(bool flag
) { m_printToFile
= flag
; };
313 #if WXWIN_COMPATIBILITY_2_4
314 void SetSetupDialog(bool flag
) { m_printSetupDialog
= flag
; };
316 void EnablePrintToFile(bool flag
) { m_printEnablePrintToFile
= flag
; };
317 void EnableSelection(bool flag
) { m_printEnableSelection
= flag
; };
318 void EnablePageNumbers(bool flag
) { m_printEnablePageNumbers
= flag
; };
319 void EnableHelp(bool flag
) { m_printEnableHelp
= flag
; };
321 bool GetEnablePrintToFile() const { return m_printEnablePrintToFile
; };
322 bool GetEnableSelection() const { return m_printEnableSelection
; };
323 bool GetEnablePageNumbers() const { return m_printEnablePageNumbers
; };
324 bool GetEnableHelp() const { return m_printEnableHelp
; };
326 // Is this data OK for showing the print dialog?
327 bool Ok() const { return m_printData
.Ok() ; }
329 wxPrintData
& GetPrintData() { return m_printData
; }
330 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
332 void operator=(const wxPrintDialogData
& data
);
333 void operator=(const wxPrintData
& data
); // Sets internal m_printData member
335 #if defined(__WXMAC__)
336 void ConvertToNative();
337 void ConvertFromNative();
346 bool m_printAllPages
;
349 bool m_printSelection
;
350 bool m_printEnableSelection
;
351 bool m_printEnablePageNumbers
;
352 bool m_printEnableHelp
;
353 bool m_printEnablePrintToFile
;
354 #if WXWIN_COMPATIBILITY_2_4
355 bool m_printSetupDialog
;
357 wxPrintData m_printData
;
360 DECLARE_DYNAMIC_CLASS(wxPrintDialogData
)
364 * This is the data used (and returned) by the wxPageSetupDialog.
367 // Compatibility with old name
368 #define wxPageSetupData wxPageSetupDialogData
370 class WXDLLEXPORT wxPageSetupDialogData
: public wxObject
373 wxPageSetupDialogData();
374 wxPageSetupDialogData(const wxPageSetupDialogData
& dialogData
);
375 wxPageSetupDialogData(const wxPrintData
& printData
);
376 ~wxPageSetupDialogData();
378 wxSize
GetPaperSize() const { return m_paperSize
; };
379 wxPaperSize
GetPaperId() const { return m_printData
.GetPaperId(); };
380 wxPoint
GetMinMarginTopLeft() const { return m_minMarginTopLeft
; };
381 wxPoint
GetMinMarginBottomRight() const { return m_minMarginBottomRight
; };
382 wxPoint
GetMarginTopLeft() const { return m_marginTopLeft
; };
383 wxPoint
GetMarginBottomRight() const { return m_marginBottomRight
; };
385 bool GetDefaultMinMargins() const { return m_defaultMinMargins
; };
386 bool GetEnableMargins() const { return m_enableMargins
; };
387 bool GetEnableOrientation() const { return m_enableOrientation
; };
388 bool GetEnablePaper() const { return m_enablePaper
; };
389 bool GetEnablePrinter() const { return m_enablePrinter
; };
390 bool GetDefaultInfo() const { return m_getDefaultInfo
; };
391 bool GetEnableHelp() const { return m_enableHelp
; };
393 // Is this data OK for showing the page setup dialog?
394 bool Ok() const { return m_printData
.Ok() ; }
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
);
400 void SetPaperId(wxPaperSize id
) { m_printData
.SetPaperId(id
); };
402 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
403 void SetPaperSize(wxPaperSize id
);
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
; };
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
; };
418 #if defined(__WXMAC__)
419 void ConvertToNative();
420 void ConvertFromNative();
423 // Use paper size defined in this object to set the wxPrintData
425 void CalculateIdFromPaperSize();
427 // Use paper id in wxPrintData to set this object's paper size
428 void CalculatePaperSizeFromId();
430 wxPageSetupDialogData
& operator=(const wxPageSetupData
& data
);
431 wxPageSetupDialogData
& operator=(const wxPrintData
& data
);
433 wxPrintData
& GetPrintData() { return m_printData
; }
434 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
437 wxSize m_paperSize
; // The dimensions selected by the user (on return, same as in wxPrintData?)
438 wxPoint m_minMarginTopLeft
;
439 wxPoint m_minMarginBottomRight
;
440 wxPoint m_marginTopLeft
;
441 wxPoint m_marginBottomRight
;
442 bool m_defaultMinMargins
;
443 bool m_enableMargins
;
444 bool m_enableOrientation
;
446 bool m_enablePrinter
;
447 bool m_getDefaultInfo
; // Equiv. to PSD_RETURNDEFAULT
449 wxPrintData m_printData
;
452 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData
)
455 #endif // wxUSE_PRINTING_ARCHITECTURE
458 // _WX_CMNDATA_H_BASE_