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(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__)) && wxUSE_POSTSCRIPT
25 class WXDLLEXPORT wxPrintSetupData
;
28 class WXDLLEXPORT wxColourData
: public wxObject
30 DECLARE_DYNAMIC_CLASS(wxColourData
)
33 wxColourData(const wxColourData
& data
);
36 void SetChooseFull(bool flag
) { chooseFull
= flag
; }
37 bool GetChooseFull() const { return chooseFull
; }
38 void SetColour(wxColour
& colour
) { dataColour
= colour
; }
39 wxColour
&GetColour() { return dataColour
; }
41 // Array of 16 custom colours
42 void SetCustomColour(int i
, wxColour
& colour
);
43 wxColour
GetCustomColour(int i
);
45 void operator=(const wxColourData
& data
);
49 wxColour custColours
[16];
53 class WXDLLEXPORT wxFontData
: public wxObject
55 DECLARE_DYNAMIC_CLASS(wxFontData
)
58 wxFontData(const wxFontData
& fontData
);
61 void SetAllowSymbols(bool flag
) { allowSymbols
= flag
; }
62 bool GetAllowSymbols() const { return allowSymbols
; }
64 void SetColour(const wxColour
& colour
) { fontColour
= colour
; }
65 wxColour
&GetColour() { return fontColour
; }
67 void SetShowHelp(bool flag
) { showHelp
= flag
; }
68 bool GetShowHelp() const { return showHelp
; }
70 void EnableEffects(bool flag
) { enableEffects
= flag
; }
71 bool GetEnableEffects() const { return enableEffects
; }
73 void SetInitialFont(const wxFont
& font
) { initialFont
= font
; }
74 wxFont
GetInitialFont() const { return initialFont
; }
76 void SetChosenFont(const wxFont
& font
) { chosenFont
= font
; }
77 wxFont
GetChosenFont() const { return chosenFont
; }
79 void SetRange(int minRange
, int maxRange
) { minSize
= minRange
; maxSize
= maxRange
; }
81 void operator=(const wxFontData
& data
);
94 #if wxUSE_PRINTING_ARCHITECTURE
97 * Encapsulates printer information (not printer dialog information)
100 class WXDLLEXPORT wxPrintData
: public wxObject
102 DECLARE_DYNAMIC_CLASS(wxPrintData
)
105 wxPrintData(const wxPrintData
& printData
);
108 int GetNoCopies() const { return m_printNoCopies
; };
109 bool GetCollate() const { return m_printCollate
; };
110 int GetOrientation() const { return m_printOrientation
; };
112 const wxString
& GetPrinterName() const { return m_printerName
; }
113 bool GetColour() const { return m_colour
; }
114 wxDuplexMode
GetDuplex() const { return m_duplexMode
; }
115 wxPaperSize
GetPaperId() const { return m_paperId
; }
116 const wxSize
& GetPaperSize() const { return m_paperSize
; } // Not used yet: confusable with paper size
117 // in wxPageSetupDialogData
118 wxPrintQuality
GetQuality() const { return m_printQuality
; }
120 void SetNoCopies(int v
) { m_printNoCopies
= v
; };
121 void SetCollate(bool flag
) { m_printCollate
= flag
; };
122 void SetOrientation(int orient
) { m_printOrientation
= orient
; };
124 void SetPrinterName(const wxString
& name
) { m_printerName
= name
; }
125 void SetColour(bool colour
) { m_colour
= colour
; }
126 void SetDuplex(wxDuplexMode duplex
) { m_duplexMode
= duplex
; }
127 void SetPaperId(wxPaperSize sizeId
) { m_paperId
= sizeId
; }
128 void SetPaperSize(const wxSize
& sz
) { m_paperSize
= sz
; }
129 void SetQuality(wxPrintQuality quality
) { m_printQuality
= quality
; }
131 // PostScript-specific data
132 const wxString
& GetPrinterCommand() const { return m_printerCommand
; }
133 const wxString
& GetPrinterOptions() const { return m_printerOptions
; }
134 const wxString
& GetPreviewCommand() const { return m_previewCommand
; }
135 const wxString
& GetFilename() const { return m_filename
; }
136 const wxString
& GetFontMetricPath() const { return m_afmPath
; }
137 double GetPrinterScaleX() const { return m_printerScaleX
; }
138 double GetPrinterScaleY() const { return m_printerScaleY
; }
139 long GetPrinterTranslateX() const { return m_printerTranslateX
; }
140 long GetPrinterTranslateY() const { return m_printerTranslateY
; }
141 wxPrintMode
GetPrintMode() const { return m_printMode
; }
143 void SetPrinterCommand(const wxString
& command
) { m_printerCommand
= command
; }
144 void SetPrinterOptions(const wxString
& options
) { m_printerOptions
= options
; }
145 void SetPreviewCommand(const wxString
& command
) { m_previewCommand
= command
; }
146 void SetFilename(const wxString
& filename
) { m_filename
= filename
; }
147 void SetFontMetricPath(const wxString
& path
) { m_afmPath
= path
; }
148 void SetPrinterScaleX(double x
) { m_printerScaleX
= x
; }
149 void SetPrinterScaleY(double y
) { m_printerScaleY
= y
; }
150 void SetPrinterScaling(double x
, double y
) { m_printerScaleX
= x
; m_printerScaleY
= y
; }
151 void SetPrinterTranslateX(long x
) { m_printerTranslateX
= x
; }
152 void SetPrinterTranslateY(long y
) { m_printerTranslateY
= y
; }
153 void SetPrinterTranslation(long x
, long y
) { m_printerTranslateX
= x
; m_printerTranslateY
= y
; }
154 void SetPrintMode(wxPrintMode printMode
) { m_printMode
= printMode
; }
156 void operator=(const wxPrintData
& data
);
159 #if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__)) && wxUSE_POSTSCRIPT
160 void operator=(const wxPrintSetupData
& setupData
);
163 #if defined(__WXMSW__)
164 // Convert to/from the DEVMODE structure
165 void ConvertToNative();
166 void ConvertFromNative();
167 void* GetNativeData() const { return m_devMode
; }
168 void SetNativeData(void* data
) { m_devMode
= data
; }
179 int m_printOrientation
;
182 // New members, 24/3/99
183 wxString m_printerName
;
185 wxDuplexMode m_duplexMode
;
186 wxPrintQuality m_printQuality
;
187 wxPaperSize m_paperId
;
190 // PostScript-specific data
191 wxString m_printerCommand
;
192 wxString m_previewCommand
;
193 wxString m_printerOptions
;
196 double m_printerScaleX
;
197 double m_printerScaleY
;
198 long m_printerTranslateX
;
199 long m_printerTranslateY
;
200 wxPrintMode m_printMode
;
205 * Encapsulates information displayed and edited in the printer dialog box.
206 * Contains a wxPrintData object which is filled in according to the values retrieved
210 class WXDLLEXPORT wxPrintDialogData
: public wxObject
212 DECLARE_DYNAMIC_CLASS(wxPrintDialogData
)
215 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
216 wxPrintDialogData(const wxPrintData
& printData
);
217 ~wxPrintDialogData();
219 int GetFromPage() const { return m_printFromPage
; };
220 int GetToPage() const { return m_printToPage
; };
221 int GetMinPage() const { return m_printMinPage
; };
222 int GetMaxPage() const { return m_printMaxPage
; };
223 int GetNoCopies() const { return m_printNoCopies
; };
224 bool GetAllPages() const { return m_printAllPages
; };
225 bool GetSelection() const { return m_printSelection
; };
226 bool GetCollate() const { return m_printCollate
; };
227 bool GetPrintToFile() const { return m_printToFile
; };
228 bool GetSetupDialog() const { return m_printSetupDialog
; };
230 void SetFromPage(int v
) { m_printFromPage
= v
; };
231 void SetToPage(int v
) { m_printToPage
= v
; };
232 void SetMinPage(int v
) { m_printMinPage
= v
; };
233 void SetMaxPage(int v
) { m_printMaxPage
= v
; };
234 void SetNoCopies(int v
) { m_printNoCopies
= v
; };
235 void SetAllPages(bool flag
) { m_printAllPages
= flag
; };
236 void SetSelection(bool flag
) { m_printSelection
= flag
; };
237 void SetCollate(bool flag
) { m_printCollate
= flag
; };
238 void SetPrintToFile(bool flag
) { m_printToFile
= flag
; };
239 void SetSetupDialog(bool flag
) { m_printSetupDialog
= flag
; };
241 void EnablePrintToFile(bool flag
) { m_printEnablePrintToFile
= flag
; };
242 void EnableSelection(bool flag
) { m_printEnableSelection
= flag
; };
243 void EnablePageNumbers(bool flag
) { m_printEnablePageNumbers
= flag
; };
244 void EnableHelp(bool flag
) { m_printEnableHelp
= flag
; };
246 bool GetEnablePrintToFile() const { return m_printEnablePrintToFile
; };
247 bool GetEnableSelection() const { return m_printEnableSelection
; };
248 bool GetEnablePageNumbers() const { return m_printEnablePageNumbers
; };
249 bool GetEnableHelp() const { return m_printEnableHelp
; };
251 wxPrintData
& GetPrintData() { return m_printData
; }
252 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
254 void operator=(const wxPrintDialogData
& data
);
255 void operator=(const wxPrintData
& data
); // Sets internal m_printData member
258 // Convert to/from the PRINTDLG structure
259 void ConvertToNative();
260 void ConvertFromNative();
261 void SetOwnerWindow(wxWindow
* win
);
262 void* GetNativeData() const { return m_printDlgData
; }
266 void* m_printDlgData
;
276 bool m_printAllPages
;
279 bool m_printSelection
;
280 bool m_printEnableSelection
;
281 bool m_printEnablePageNumbers
;
282 bool m_printEnableHelp
;
283 bool m_printEnablePrintToFile
;
284 bool m_printSetupDialog
;
286 wxPrintData m_printData
;
290 * This is the data used (and returned) by the wxPageSetupDialog.
293 // Compatibility with old name
294 #define wxPageSetupData wxPageSetupDialogData
296 class WXDLLEXPORT wxPageSetupDialogData
: public wxObject
298 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData
)
301 wxPageSetupDialogData();
302 wxPageSetupDialogData(const wxPageSetupDialogData
& dialogData
);
303 wxPageSetupDialogData(const wxPrintData
& printData
);
304 ~wxPageSetupDialogData();
306 wxSize
GetPaperSize() const { return m_paperSize
; };
307 wxPaperSize
GetPaperId() const { return m_printData
.GetPaperId(); };
308 wxPoint
GetMinMarginTopLeft() const { return m_minMarginTopLeft
; };
309 wxPoint
GetMinMarginBottomRight() const { return m_minMarginBottomRight
; };
310 wxPoint
GetMarginTopLeft() const { return m_marginTopLeft
; };
311 wxPoint
GetMarginBottomRight() const { return m_marginBottomRight
; };
313 bool GetDefaultMinMargins() const { return m_defaultMinMargins
; };
314 bool GetEnableMargins() const { return m_enableMargins
; };
315 bool GetEnableOrientation() const { return m_enableOrientation
; };
316 bool GetEnablePaper() const { return m_enablePaper
; };
317 bool GetEnablePrinter() const { return m_enablePrinter
; };
318 bool GetDefaultInfo() const { return m_getDefaultInfo
; };
319 bool GetEnableHelp() const { return m_enableHelp
; };
321 // If a corresponding paper type is found in the paper database, will set the m_printData
322 // paper size id member as well.
323 void SetPaperSize(const wxSize
& sz
);
325 void SetPaperId(wxPaperSize
& id
) { m_printData
.SetPaperId(id
); };
327 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
328 void SetPaperSize(wxPaperSize id
);
330 void SetMinMarginTopLeft(const wxPoint
& pt
) { m_minMarginTopLeft
= pt
; };
331 void SetMinMarginBottomRight(const wxPoint
& pt
) { m_minMarginBottomRight
= pt
; };
332 void SetMarginTopLeft(const wxPoint
& pt
) { m_marginTopLeft
= pt
; };
333 void SetMarginBottomRight(const wxPoint
& pt
) { m_marginBottomRight
= pt
; };
334 void SetDefaultMinMargins(bool flag
) { m_defaultMinMargins
= flag
; };
335 void SetDefaultInfo(bool flag
) { m_getDefaultInfo
= flag
; };
337 void EnableMargins(bool flag
) { m_enableMargins
= flag
; };
338 void EnableOrientation(bool flag
) { m_enableOrientation
= flag
; };
339 void EnablePaper(bool flag
) { m_enablePaper
= flag
; };
340 void EnablePrinter(bool flag
) { m_enablePrinter
= flag
; };
341 void EnableHelp(bool flag
) { m_enableHelp
= flag
; };
343 #if defined(__WIN95__)
344 // Convert to/from the PAGESETUPDLG structure
345 void ConvertToNative();
346 void ConvertFromNative();
347 void SetOwnerWindow(wxWindow
* win
);
348 void* GetNativeData() const { return m_pageSetupData
; }
351 // Use paper size defined in this object to set the wxPrintData
353 void CalculateIdFromPaperSize();
355 // Use paper id in wxPrintData to set this object's paper size
356 void CalculatePaperSizeFromId();
358 void operator=(const wxPageSetupData
& data
);
359 void operator=(const wxPrintData
& data
);
361 wxPrintData
& GetPrintData() { return m_printData
; }
362 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
364 #if defined(__WIN95__)
365 void* m_pageSetupData
;
370 wxSize m_paperSize
; // The dimensions selected by the user (on return, same as in wxPrintData?)
371 wxPoint m_minMarginTopLeft
;
372 wxPoint m_minMarginBottomRight
;
373 wxPoint m_marginTopLeft
;
374 wxPoint m_marginBottomRight
;
377 bool m_defaultMinMargins
;
378 bool m_enableMargins
;
379 bool m_enableOrientation
;
381 bool m_enablePrinter
;
382 bool m_getDefaultInfo
; // Equiv. to PSD_RETURNDEFAULT
385 wxPrintData m_printData
;
388 #endif // wxUSE_PRINTING_ARCHITECTURE
391 // _WX_CMNDATA_H_BASE_