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"
20 #include "wx/colour.h"
22 #if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
23 class WXDLLEXPORT wxPrintSetupData
;
26 class WXDLLEXPORT wxColourData
: public wxObject
28 DECLARE_DYNAMIC_CLASS(wxColourData
)
31 wxColourData(const wxColourData
& data
);
34 inline void SetChooseFull(bool flag
) { chooseFull
= flag
; }
35 inline bool GetChooseFull() const { return chooseFull
; }
36 inline void SetColour(wxColour
& colour
) { dataColour
= colour
; }
37 inline wxColour
&GetColour() { return dataColour
; }
39 // Array of 16 custom colours
40 void SetCustomColour(int i
, wxColour
& colour
);
41 wxColour
GetCustomColour(int i
);
43 void operator=(const wxColourData
& data
);
47 wxColour custColours
[16];
51 class WXDLLEXPORT wxFontData
: public wxObject
53 DECLARE_DYNAMIC_CLASS(wxFontData
)
56 wxFontData(const wxFontData
& fontData
);
59 inline void SetAllowSymbols(bool flag
) { allowSymbols
= flag
; }
60 inline bool GetAllowSymbols() const { return allowSymbols
; }
62 inline void SetColour(const wxColour
& colour
) { fontColour
= colour
; }
63 inline wxColour
&GetColour() { return fontColour
; }
65 inline void SetShowHelp(bool flag
) { showHelp
= flag
; }
66 inline bool GetShowHelp() const { return showHelp
; }
68 inline void EnableEffects(bool flag
) { enableEffects
= flag
; }
69 inline bool GetEnableEffects() const { return enableEffects
; }
71 inline void SetInitialFont(const wxFont
& font
) { initialFont
= font
; }
72 inline wxFont
GetInitialFont() const { return initialFont
; }
74 inline void SetChosenFont(const wxFont
& font
) { chosenFont
= font
; }
75 inline wxFont
GetChosenFont() const { return chosenFont
; }
77 inline void SetRange(int minRange
, int maxRange
) { minSize
= minRange
; maxSize
= maxRange
; }
79 void operator=(const wxFontData
& data
);
94 * Encapsulates printer information (not printer dialog information)
97 class WXDLLEXPORT wxPrintData
: public wxObject
99 DECLARE_DYNAMIC_CLASS(wxPrintData
)
102 wxPrintData(const wxPrintData
& printData
);
105 inline int GetNoCopies() const { return m_printNoCopies
; };
106 inline bool GetCollate() const { return m_printCollate
; };
107 inline int GetOrientation() const { return m_printOrientation
; };
109 inline const wxString
& GetPrinterName() const { return m_printerName
; }
110 inline bool GetColour() const { return m_colour
; }
111 inline wxDuplexMode
GetDuplex() const { return m_duplexMode
; }
112 inline wxPaperSize
GetPaperId() const { return m_paperId
; }
113 inline const wxSize
& GetPaperSize() const { return m_paperSize
; } // Not used yet: confusable with paper size
114 // in wxPageSetupDialogData
115 inline wxPrintQuality
GetQuality() const { return m_printQuality
; }
117 inline void SetNoCopies(int v
) { m_printNoCopies
= v
; };
118 inline void SetCollate(bool flag
) { m_printCollate
= flag
; };
119 inline void SetOrientation(int orient
) { m_printOrientation
= orient
; };
121 inline void SetPrinterName(const wxString
& name
) { m_printerName
= name
; }
122 inline void SetColour(bool colour
) { m_colour
= colour
; }
123 inline void SetDuplex(wxDuplexMode duplex
) { m_duplexMode
= duplex
; }
124 inline void SetPaperId(wxPaperSize sizeId
) { m_paperId
= sizeId
; }
125 inline void SetPaperSize(const wxSize
& sz
) { m_paperSize
= sz
; }
126 inline void SetQuality(wxPrintQuality quality
) { m_printQuality
= quality
; }
128 // PostScript-specific data
129 inline const wxString
& GetPrinterCommand() const { return m_printerCommand
; }
130 inline const wxString
& GetPrinterOptions() const { return m_printerOptions
; }
131 inline const wxString
& GetPreviewCommand() const { return m_previewCommand
; }
132 inline const wxString
& GetFilename() const { return m_filename
; }
133 inline const wxString
& GetFontMetricPath() const { return m_afmPath
; }
134 inline double GetPrinterScaleX() const { return m_printerScaleX
; }
135 inline double GetPrinterScaleY() const { return m_printerScaleY
; }
136 inline long GetPrinterTranslateX() const { return m_printerTranslateX
; }
137 inline long GetPrinterTranslateY() const { return m_printerTranslateY
; }
138 inline wxPrintMode
GetPrintMode() const { return m_printMode
; }
140 inline void SetPrinterCommand(const wxString
& command
) { m_printerCommand
= command
; }
141 inline void SetPrinterOptions(const wxString
& options
) { m_printerOptions
= options
; }
142 inline void SetPreviewCommand(const wxString
& command
) { m_previewCommand
= command
; }
143 inline void SetFilename(const wxString
& filename
) { m_filename
= filename
; }
144 inline void SetFontMetricPath(const wxString
& path
) { m_afmPath
= path
; }
145 inline void SetPrinterScaleX(double x
) { m_printerScaleX
= x
; }
146 inline void SetPrinterScaleY(double y
) { m_printerScaleY
= y
; }
147 inline void SetPrinterScaling(double x
, double y
) { m_printerScaleX
= x
; m_printerScaleY
= y
; }
148 inline void SetPrinterTranslateX(long x
) { m_printerTranslateX
= x
; }
149 inline void SetPrinterTranslateY(long y
) { m_printerTranslateY
= y
; }
150 inline void SetPrinterTranslation(long x
, long y
) { m_printerTranslateX
= x
; m_printerTranslateY
= y
; }
151 inline void SetPrintMode(wxPrintMode printMode
) { m_printMode
= printMode
; }
153 void operator=(const wxPrintData
& data
);
156 #if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
157 void operator=(const wxPrintSetupData
& setupData
);
161 // Convert to/from the DEVMODE structure
162 void ConvertToNative();
163 void ConvertFromNative();
164 inline void* GetNativeData() const { return m_devMode
; }
165 inline void SetNativeData(void* data
) { m_devMode
= data
; }
176 int m_printOrientation
;
179 // New members, 24/3/99
180 wxString m_printerName
;
182 wxDuplexMode m_duplexMode
;
183 wxPrintQuality m_printQuality
;
184 wxPaperSize m_paperId
;
187 // PostScript-specific data
188 wxString m_printerCommand
;
189 wxString m_previewCommand
;
190 wxString m_printerOptions
;
193 double m_printerScaleX
;
194 double m_printerScaleY
;
195 long m_printerTranslateX
;
196 long m_printerTranslateY
;
197 wxPrintMode m_printMode
;
202 * Encapsulates information displayed and edited in the printer dialog box.
203 * Contains a wxPrintData object which is filled in according to the values retrieved
207 class WXDLLEXPORT wxPrintDialogData
: public wxObject
209 DECLARE_DYNAMIC_CLASS(wxPrintDialogData
)
212 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
213 wxPrintDialogData(const wxPrintData
& printData
);
214 ~wxPrintDialogData();
216 inline int GetFromPage() const { return m_printFromPage
; };
217 inline int GetToPage() const { return m_printToPage
; };
218 inline int GetMinPage() const { return m_printMinPage
; };
219 inline int GetMaxPage() const { return m_printMaxPage
; };
220 inline int GetNoCopies() const { return m_printNoCopies
; };
221 inline bool GetAllPages() const { return m_printAllPages
; };
222 inline bool GetCollate() const { return m_printCollate
; };
223 inline bool GetPrintToFile() const { return m_printToFile
; };
224 inline bool GetSetupDialog() const { return m_printSetupDialog
; };
226 inline void SetFromPage(int v
) { m_printFromPage
= v
; };
227 inline void SetToPage(int v
) { m_printToPage
= v
; };
228 inline void SetMinPage(int v
) { m_printMinPage
= v
; };
229 inline void SetMaxPage(int v
) { m_printMaxPage
= v
; };
230 inline void SetNoCopies(int v
) { m_printNoCopies
= v
; };
231 inline void SetAllPages(bool flag
) { m_printAllPages
= flag
; };
232 inline void SetCollate(bool flag
) { m_printCollate
= flag
; };
233 inline void SetPrintToFile(bool flag
) { m_printToFile
= flag
; };
234 inline void SetSetupDialog(bool flag
) { m_printSetupDialog
= flag
; };
236 inline void EnablePrintToFile(bool flag
) { m_printEnablePrintToFile
= flag
; };
237 inline void EnableSelection(bool flag
) { m_printEnableSelection
= flag
; };
238 inline void EnablePageNumbers(bool flag
) { m_printEnablePageNumbers
= flag
; };
239 inline void EnableHelp(bool flag
) { m_printEnableHelp
= flag
; };
241 inline bool GetEnablePrintToFile() const { return m_printEnablePrintToFile
; };
242 inline bool GetEnableSelection() const { return m_printEnableSelection
; };
243 inline bool GetEnablePageNumbers() const { return m_printEnablePageNumbers
; };
244 inline bool GetEnableHelp() const { return m_printEnableHelp
; };
246 inline wxPrintData
& GetPrintData() { return m_printData
; }
247 inline void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
249 void operator=(const wxPrintDialogData
& data
);
250 void operator=(const wxPrintData
& data
); // Sets internal m_printData member
253 // Convert to/from the PRINTDLG structure
254 void ConvertToNative();
255 void ConvertFromNative();
256 void SetOwnerWindow(wxWindow
* win
);
257 inline void* GetNativeData() const { return m_printDlgData
; }
261 void* m_printDlgData
;
271 bool m_printAllPages
;
274 bool m_printEnableSelection
;
275 bool m_printEnablePageNumbers
;
276 bool m_printEnableHelp
;
277 bool m_printEnablePrintToFile
;
278 bool m_printSetupDialog
;
280 wxPrintData m_printData
;
284 * This is the data used (and returned) by the wxPageSetupDialog.
287 // Compatibility with old name
288 #define wxPageSetupData wxPageSetupDialogData
290 class WXDLLEXPORT wxPageSetupDialogData
: public wxObject
292 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData
)
295 wxPageSetupDialogData();
296 wxPageSetupDialogData(const wxPageSetupDialogData
& dialogData
);
297 wxPageSetupDialogData(const wxPrintData
& printData
);
298 ~wxPageSetupDialogData();
300 inline wxSize
GetPaperSize() const { return m_paperSize
; };
301 inline wxPaperSize
GetPaperId() const { return m_printData
.GetPaperId(); };
302 inline wxPoint
GetMinMarginTopLeft() const { return m_minMarginTopLeft
; };
303 inline wxPoint
GetMinMarginBottomRight() const { return m_minMarginBottomRight
; };
304 inline wxPoint
GetMarginTopLeft() const { return m_marginTopLeft
; };
305 inline wxPoint
GetMarginBottomRight() const { return m_marginBottomRight
; };
307 inline bool GetDefaultMinMargins() const { return m_defaultMinMargins
; };
308 inline bool GetEnableMargins() const { return m_enableMargins
; };
309 inline bool GetEnableOrientation() const { return m_enableOrientation
; };
310 inline bool GetEnablePaper() const { return m_enablePaper
; };
311 inline bool GetEnablePrinter() const { return m_enablePrinter
; };
312 inline bool GetDefaultInfo() const { return m_getDefaultInfo
; };
313 inline bool GetEnableHelp() const { return m_enableHelp
; };
315 // If a corresponding paper type is found in the paper database, will set the m_printData
316 // paper size id member as well.
317 void SetPaperSize(const wxSize
& sz
);
319 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
320 void SetPaperSize(wxPaperSize id
);
322 inline void SetMinMarginTopLeft(const wxPoint
& pt
) { m_minMarginTopLeft
= pt
; };
323 inline void SetMinMarginBottomRight(const wxPoint
& pt
) { m_minMarginBottomRight
= pt
; };
324 inline void SetMarginTopLeft(const wxPoint
& pt
) { m_marginTopLeft
= pt
; };
325 inline void SetMarginBottomRight(const wxPoint
& pt
) { m_marginBottomRight
= pt
; };
326 inline void SetDefaultMinMargins(bool flag
) { m_defaultMinMargins
= flag
; };
327 inline void SetDefaultInfo(bool flag
) { m_getDefaultInfo
= flag
; };
329 inline void EnableMargins(bool flag
) { m_enableMargins
= flag
; };
330 inline void EnableOrientation(bool flag
) { m_enableOrientation
= flag
; };
331 inline void EnablePaper(bool flag
) { m_enablePaper
= flag
; };
332 inline void EnablePrinter(bool flag
) { m_enablePrinter
= flag
; };
333 inline void EnableHelp(bool flag
) { m_enableHelp
= flag
; };
335 #if defined(__WIN95__)
336 // Convert to/from the PAGESETUPDLG structure
337 void ConvertToNative();
338 void ConvertFromNative();
339 void SetOwnerWindow(wxWindow
* win
);
340 inline void* GetNativeData() const { return m_pageSetupData
; }
343 // Use paper size defined in this object to set the wxPrintData
345 void CalculateIdFromPaperSize();
347 // Use paper id in wxPrintData to set this object's paper size
348 void CalculatePaperSizeFromId();
350 void operator=(const wxPageSetupData
& data
);
351 void operator=(const wxPrintData
& data
);
353 inline wxPrintData
& GetPrintData() { return m_printData
; }
354 inline void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
356 #if defined(__WIN95__)
357 void* m_pageSetupData
;
362 wxSize m_paperSize
; // The dimensions selected by the user (on return, same as in wxPrintData?)
363 wxPoint m_minMarginTopLeft
;
364 wxPoint m_minMarginBottomRight
;
365 wxPoint m_marginTopLeft
;
366 wxPoint m_marginBottomRight
;
369 bool m_defaultMinMargins
;
370 bool m_enableMargins
;
371 bool m_enableOrientation
;
373 bool m_enablePrinter
;
374 bool m_getDefaultInfo
; // Equiv. to PSD_RETURNDEFAULT
377 wxPrintData m_printData
;
381 // _WX_CMNDATA_H_BASE_