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 class WXDLLEXPORT wxColourData
: public wxObject
28 wxColourData(const wxColourData
& data
);
31 void SetChooseFull(bool flag
) { chooseFull
= flag
; }
32 bool GetChooseFull() const { return chooseFull
; }
33 void SetColour(const wxColour
& colour
) { dataColour
= colour
; }
34 const wxColour
& GetColour() const { return dataColour
; }
35 wxColour
& GetColour() { return dataColour
; }
37 // Array of 16 custom colours
38 void SetCustomColour(int i
, const wxColour
& colour
);
39 wxColour
GetCustomColour(int i
);
41 void operator=(const wxColourData
& data
);
45 wxColour custColours
[16];
49 DECLARE_DYNAMIC_CLASS(wxColourData
)
52 class WXDLLEXPORT wxFontData
: public wxObject
58 wxFontData(const wxFontData
& data
)
60 , fontColour(data
.fontColour
)
61 , showHelp(data
.showHelp
)
62 , allowSymbols(data
.allowSymbols
)
63 , enableEffects(data
.enableEffects
)
64 , initialFont(data
.initialFont
)
65 , chosenFont(data
.chosenFont
)
66 , minSize(data
.minSize
)
67 , maxSize(data
.maxSize
)
68 , m_encoding(data
.m_encoding
)
69 , m_encodingInfo(data
.m_encodingInfo
)
73 wxFontData
& operator=(const wxFontData
& data
)
75 wxObject::operator=(data
);
76 fontColour
= data
.fontColour
;
77 showHelp
= data
.showHelp
;
78 allowSymbols
= data
.allowSymbols
;
79 enableEffects
= data
.enableEffects
;
80 initialFont
= data
.initialFont
;
81 chosenFont
= data
.chosenFont
;
82 minSize
= data
.minSize
;
83 maxSize
= data
.maxSize
;
84 m_encoding
= data
.m_encoding
;
85 m_encodingInfo
= data
.m_encodingInfo
;
89 void SetAllowSymbols(bool flag
) { allowSymbols
= flag
; }
90 bool GetAllowSymbols() const { return allowSymbols
; }
92 void SetColour(const wxColour
& colour
) { fontColour
= colour
; }
93 wxColour
&GetColour() { return fontColour
; }
95 void SetShowHelp(bool flag
) { showHelp
= flag
; }
96 bool GetShowHelp() const { return showHelp
; }
98 void EnableEffects(bool flag
) { enableEffects
= flag
; }
99 bool GetEnableEffects() const { return enableEffects
; }
101 void SetInitialFont(const wxFont
& font
) { initialFont
= font
; }
102 wxFont
GetInitialFont() const { return initialFont
; }
104 void SetChosenFont(const wxFont
& font
) { chosenFont
= font
; }
105 wxFont
GetChosenFont() const { return chosenFont
; }
107 void SetRange(int minRange
, int maxRange
) { minSize
= minRange
; maxSize
= maxRange
; }
109 // encoding info is split into 2 parts: the logical wxWin encoding
110 // (wxFontEncoding) and a structure containing the native parameters for
111 // it (wxNativeEncodingInfo)
112 wxFontEncoding
GetEncoding() const { return m_encoding
; }
113 void SetEncoding(wxFontEncoding encoding
) { m_encoding
= encoding
; }
115 wxNativeEncodingInfo
& EncodingInfo() { return m_encodingInfo
; }
128 wxFontEncoding m_encoding
;
129 wxNativeEncodingInfo m_encodingInfo
;
132 DECLARE_DYNAMIC_CLASS(wxFontData
)
135 #if wxUSE_PRINTING_ARCHITECTURE
138 * Encapsulates printer information (not printer dialog information)
141 class WXDLLEXPORT wxPrintData
: public wxObject
145 wxPrintData(const wxPrintData
& printData
);
148 int GetNoCopies() const { return m_printNoCopies
; };
149 bool GetCollate() const { return m_printCollate
; };
150 int GetOrientation() const { return m_printOrientation
; };
152 // Is this data OK for showing the print dialog?
155 const wxString
& GetPrinterName() const { return m_printerName
; }
156 bool GetColour() const { return m_colour
; }
157 wxDuplexMode
GetDuplex() const { return m_duplexMode
; }
158 wxPaperSize
GetPaperId() const { return m_paperId
; }
159 const wxSize
& GetPaperSize() const { return m_paperSize
; } // Not used yet: confusable with paper size
160 // in wxPageSetupDialogData
161 wxPrintQuality
GetQuality() const { return m_printQuality
; }
163 void SetNoCopies(int v
) { m_printNoCopies
= v
; };
164 void SetCollate(bool flag
) { m_printCollate
= flag
; };
165 void SetOrientation(int orient
) { m_printOrientation
= orient
; };
167 void SetPrinterName(const wxString
& name
) { m_printerName
= name
; }
168 void SetColour(bool colour
) { m_colour
= colour
; }
169 void SetDuplex(wxDuplexMode duplex
) { m_duplexMode
= duplex
; }
170 void SetPaperId(wxPaperSize sizeId
) { m_paperId
= sizeId
; }
171 void SetPaperSize(const wxSize
& sz
) { m_paperSize
= sz
; }
172 void SetQuality(wxPrintQuality quality
) { m_printQuality
= quality
; }
174 // PostScript-specific data
175 const wxString
& GetPrinterCommand() const { return m_printerCommand
; }
176 const wxString
& GetPrinterOptions() const { return m_printerOptions
; }
177 const wxString
& GetPreviewCommand() const { return m_previewCommand
; }
178 const wxString
& GetFilename() const { return m_filename
; }
179 const wxString
& GetFontMetricPath() const { return m_afmPath
; }
180 double GetPrinterScaleX() const { return m_printerScaleX
; }
181 double GetPrinterScaleY() const { return m_printerScaleY
; }
182 long GetPrinterTranslateX() const { return m_printerTranslateX
; }
183 long GetPrinterTranslateY() const { return m_printerTranslateY
; }
184 wxPrintMode
GetPrintMode() const { return m_printMode
; }
186 void SetPrinterCommand(const wxString
& command
) { m_printerCommand
= command
; }
187 void SetPrinterOptions(const wxString
& options
) { m_printerOptions
= options
; }
188 void SetPreviewCommand(const wxString
& command
) { m_previewCommand
= command
; }
189 void SetFilename(const wxString
& filename
) { m_filename
= filename
; }
190 void SetFontMetricPath(const wxString
& path
) { m_afmPath
= path
; }
191 void SetPrinterScaleX(double x
) { m_printerScaleX
= x
; }
192 void SetPrinterScaleY(double y
) { m_printerScaleY
= y
; }
193 void SetPrinterScaling(double x
, double y
) { m_printerScaleX
= x
; m_printerScaleY
= y
; }
194 void SetPrinterTranslateX(long x
) { m_printerTranslateX
= x
; }
195 void SetPrinterTranslateY(long y
) { m_printerTranslateY
= y
; }
196 void SetPrinterTranslation(long x
, long y
) { m_printerTranslateX
= x
; m_printerTranslateY
= y
; }
197 void SetPrintMode(wxPrintMode printMode
) { m_printMode
= printMode
; }
199 void operator=(const wxPrintData
& data
);
201 #if defined(__WXMSW__)
202 // Convert to/from the DEVMODE structure
203 void ConvertToNative();
204 void ConvertFromNative();
205 void* GetNativeData() const { return m_devMode
; }
206 void SetNativeData(void* data
) { m_devMode
= data
; }
207 void* GetNativeDataDevNames() const { return m_devNames
; }
208 void SetNativeDataDevNames(void* data
) { m_devNames
= data
; }
209 #elif defined(__WXMAC__)
210 void ConvertToNative();
211 void ConvertFromNative();
215 #if defined(__WXMSW__)
218 #elif defined(__WXMAC__)
219 void* m_macPageFormat
;
220 void* m_macPrintSettings
;
225 int m_printOrientation
;
228 // New members, 24/3/99
229 wxString m_printerName
;
231 wxDuplexMode m_duplexMode
;
232 wxPrintQuality m_printQuality
;
233 wxPaperSize m_paperId
;
236 // PostScript-specific data
237 wxString m_printerCommand
;
238 wxString m_previewCommand
;
239 wxString m_printerOptions
;
242 double m_printerScaleX
;
243 double m_printerScaleY
;
244 long m_printerTranslateX
;
245 long m_printerTranslateY
;
246 wxPrintMode m_printMode
;
249 DECLARE_DYNAMIC_CLASS(wxPrintData
)
254 * Encapsulates information displayed and edited in the printer dialog box.
255 * Contains a wxPrintData object which is filled in according to the values retrieved
259 class WXDLLEXPORT wxPrintDialogData
: public wxObject
263 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
264 wxPrintDialogData(const wxPrintData
& printData
);
265 ~wxPrintDialogData();
267 int GetFromPage() const { return m_printFromPage
; };
268 int GetToPage() const { return m_printToPage
; };
269 int GetMinPage() const { return m_printMinPage
; };
270 int GetMaxPage() const { return m_printMaxPage
; };
271 int GetNoCopies() const { return m_printNoCopies
; };
272 bool GetAllPages() const { return m_printAllPages
; };
273 bool GetSelection() const { return m_printSelection
; };
274 bool GetCollate() const { return m_printCollate
; };
275 bool GetPrintToFile() const { return m_printToFile
; };
276 bool GetSetupDialog() const { return m_printSetupDialog
; };
278 void SetFromPage(int v
) { m_printFromPage
= v
; };
279 void SetToPage(int v
) { m_printToPage
= v
; };
280 void SetMinPage(int v
) { m_printMinPage
= v
; };
281 void SetMaxPage(int v
) { m_printMaxPage
= v
; };
282 void SetNoCopies(int v
) { m_printNoCopies
= v
; };
283 void SetAllPages(bool flag
) { m_printAllPages
= flag
; };
284 void SetSelection(bool flag
) { m_printSelection
= flag
; };
285 void SetCollate(bool flag
) { m_printCollate
= flag
; };
286 void SetPrintToFile(bool flag
) { m_printToFile
= flag
; };
287 void SetSetupDialog(bool flag
) { m_printSetupDialog
= flag
; };
289 void EnablePrintToFile(bool flag
) { m_printEnablePrintToFile
= flag
; };
290 void EnableSelection(bool flag
) { m_printEnableSelection
= flag
; };
291 void EnablePageNumbers(bool flag
) { m_printEnablePageNumbers
= flag
; };
292 void EnableHelp(bool flag
) { m_printEnableHelp
= flag
; };
294 bool GetEnablePrintToFile() const { return m_printEnablePrintToFile
; };
295 bool GetEnableSelection() const { return m_printEnableSelection
; };
296 bool GetEnablePageNumbers() const { return m_printEnablePageNumbers
; };
297 bool GetEnableHelp() const { return m_printEnableHelp
; };
299 // Is this data OK for showing the print dialog?
300 bool Ok() const { return m_printData
.Ok() ; }
302 wxPrintData
& GetPrintData() { return m_printData
; }
303 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
305 void operator=(const wxPrintDialogData
& data
);
306 void operator=(const wxPrintData
& data
); // Sets internal m_printData member
309 // Convert to/from the PRINTDLG structure
310 void ConvertToNative();
311 void ConvertFromNative();
312 void SetOwnerWindow(wxWindow
* win
);
313 void* GetNativeData() const { return m_printDlgData
; }
314 #elif defined(__WXMAC__)
315 void ConvertToNative();
316 void ConvertFromNative();
320 void* m_printDlgData
;
329 bool m_printAllPages
;
332 bool m_printSelection
;
333 bool m_printEnableSelection
;
334 bool m_printEnablePageNumbers
;
335 bool m_printEnableHelp
;
336 bool m_printEnablePrintToFile
;
337 bool m_printSetupDialog
;
338 wxPrintData m_printData
;
341 DECLARE_DYNAMIC_CLASS(wxPrintDialogData
)
345 * This is the data used (and returned) by the wxPageSetupDialog.
348 // Compatibility with old name
349 #define wxPageSetupData wxPageSetupDialogData
351 class WXDLLEXPORT wxPageSetupDialogData
: public wxObject
354 wxPageSetupDialogData();
355 wxPageSetupDialogData(const wxPageSetupDialogData
& dialogData
);
356 wxPageSetupDialogData(const wxPrintData
& printData
);
357 ~wxPageSetupDialogData();
359 wxSize
GetPaperSize() const { return m_paperSize
; };
360 wxPaperSize
GetPaperId() const { return m_printData
.GetPaperId(); };
361 wxPoint
GetMinMarginTopLeft() const { return m_minMarginTopLeft
; };
362 wxPoint
GetMinMarginBottomRight() const { return m_minMarginBottomRight
; };
363 wxPoint
GetMarginTopLeft() const { return m_marginTopLeft
; };
364 wxPoint
GetMarginBottomRight() const { return m_marginBottomRight
; };
366 bool GetDefaultMinMargins() const { return m_defaultMinMargins
; };
367 bool GetEnableMargins() const { return m_enableMargins
; };
368 bool GetEnableOrientation() const { return m_enableOrientation
; };
369 bool GetEnablePaper() const { return m_enablePaper
; };
370 bool GetEnablePrinter() const { return m_enablePrinter
; };
371 bool GetDefaultInfo() const { return m_getDefaultInfo
; };
372 bool GetEnableHelp() const { return m_enableHelp
; };
374 // Is this data OK for showing the page setup dialog?
375 bool Ok() const { return m_printData
.Ok() ; }
377 // If a corresponding paper type is found in the paper database, will set the m_printData
378 // paper size id member as well.
379 void SetPaperSize(const wxSize
& sz
);
381 void SetPaperId(wxPaperSize id
) { m_printData
.SetPaperId(id
); };
383 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
384 void SetPaperSize(wxPaperSize id
);
386 void SetMinMarginTopLeft(const wxPoint
& pt
) { m_minMarginTopLeft
= pt
; };
387 void SetMinMarginBottomRight(const wxPoint
& pt
) { m_minMarginBottomRight
= pt
; };
388 void SetMarginTopLeft(const wxPoint
& pt
) { m_marginTopLeft
= pt
; };
389 void SetMarginBottomRight(const wxPoint
& pt
) { m_marginBottomRight
= pt
; };
390 void SetDefaultMinMargins(bool flag
) { m_defaultMinMargins
= flag
; };
391 void SetDefaultInfo(bool flag
) { m_getDefaultInfo
= flag
; };
393 void EnableMargins(bool flag
) { m_enableMargins
= flag
; };
394 void EnableOrientation(bool flag
) { m_enableOrientation
= flag
; };
395 void EnablePaper(bool flag
) { m_enablePaper
= flag
; };
396 void EnablePrinter(bool flag
) { m_enablePrinter
= flag
; };
397 void EnableHelp(bool flag
) { m_enableHelp
= flag
; };
399 #if defined(__WIN95__)
400 // Convert to/from the PAGESETUPDLG structure
401 void ConvertToNative();
402 void ConvertFromNative();
403 void SetOwnerWindow(wxWindow
* win
);
404 void* GetNativeData() const { return m_pageSetupData
; }
405 #elif defined(__WXMAC__)
406 void ConvertToNative();
407 void ConvertFromNative();
410 // Use paper size defined in this object to set the wxPrintData
412 void CalculateIdFromPaperSize();
414 // Use paper id in wxPrintData to set this object's paper size
415 void CalculatePaperSizeFromId();
417 wxPageSetupDialogData
& operator=(const wxPageSetupData
& data
);
418 wxPageSetupDialogData
& operator=(const wxPrintData
& data
);
420 wxPrintData
& GetPrintData() { return m_printData
; }
421 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
423 #if defined(__WIN95__)
424 void* m_pageSetupData
;
428 wxSize m_paperSize
; // The dimensions selected by the user (on return, same as in wxPrintData?)
429 wxPoint m_minMarginTopLeft
;
430 wxPoint m_minMarginBottomRight
;
431 wxPoint m_marginTopLeft
;
432 wxPoint m_marginBottomRight
;
433 bool m_defaultMinMargins
;
434 bool m_enableMargins
;
435 bool m_enableOrientation
;
437 bool m_enablePrinter
;
438 bool m_getDefaultInfo
; // Equiv. to PSD_RETURNDEFAULT
440 wxPrintData m_printData
;
443 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData
)
446 #endif // wxUSE_PRINTING_ARCHITECTURE
449 // _WX_CMNDATA_H_BASE_