]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/cmndata.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of common wx*Data classes (font, colour, print)
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 This class holds a variety of information related to font dialogs.
17 @see @ref overview_cmndlg_font, wxFont, wxFontDialog
19 class wxFontData
: public wxObject
23 Constructor. Initializes @e fontColour to black, @e showHelp to @false,
24 @e allowSymbols to @true, @e enableEffects to @true, @e minSize to 0
30 Enables or disables "effects" under Windows or generic only. This
31 refers to the controls for manipulating colour, strikeout and underline
34 The default value is @true.
36 void EnableEffects(bool enable
);
39 Under Windows, returns a flag determining whether symbol fonts can be
40 selected. Has no effect on other platforms.
42 The default value is @true.
44 bool GetAllowSymbols() const;
47 Gets the font chosen by the user if the user pressed OK
48 (wxFontDialog::ShowModal() returned wxID_OK).
50 wxFont
GetChosenFont() const;
53 Gets the colour associated with the font dialog.
55 The default value is black.
57 wxColour
& GetColour();
60 Determines whether "effects" are enabled under Windows. This refers to
61 the controls for manipulating colour, strikeout and underline
64 The default value is @true.
66 bool GetEnableEffects() const;
69 Gets the font that will be initially used by the font dialog. This
70 should have previously been set by the application.
72 wxFont
GetInitialFont() const;
75 Returns @true if the Help button will be shown (Windows only).
77 The default value is @false.
79 bool GetShowHelp() const;
82 Under Windows, determines whether symbol fonts can be selected. Has no
83 effect on other platforms.
85 The default value is @true.
87 void SetAllowSymbols(bool allowSymbols
);
90 Sets the font that will be returned to the user (for internal use
93 void SetChosenFont(const wxFont
& font
);
96 Sets the colour that will be used for the font foreground colour.
98 The default colour is black.
100 void SetColour(const wxColour
& colour
);
103 Sets the font that will be initially used by the font dialog.
105 void SetInitialFont(const wxFont
& font
);
108 Sets the valid range for the font point size (Windows only).
110 The default is 0, 0 (unrestricted range).
112 void SetRange(int min
, int max
);
115 Determines whether the Help button will be displayed in the font dialog
118 The default value is @false.
120 void SetShowHelp(bool showHelp
);
123 Assignment operator for the font data.
125 void operator =(const wxFontData
& data
);
131 @class wxPageSetupDialogData
133 This class holds a variety of information related to wxPageSetupDialog.
135 It contains a wxPrintData member which is used to hold basic printer
136 configuration data (as opposed to the user-interface configuration settings
137 stored by wxPageSetupDialogData).
142 @see @ref overview_printing, wxPageSetupDialog
144 class wxPageSetupDialogData
: public wxObject
150 wxPageSetupDialogData();
155 wxPageSetupDialogData(wxPageSetupDialogData
& data
);
158 Construct an object from a print data object.
160 wxPageSetupDialogData(wxPrintData
& printData
);
165 virtual ~wxPageSetupDialogData();
168 Enables or disables the "Help" button (Windows only).
170 void EnableHelp(bool flag
);
173 Enables or disables the margin controls (Windows only).
175 void EnableMargins(bool flag
);
178 Enables or disables the orientation control (Windows only).
180 void EnableOrientation(bool flag
);
183 Enables or disables the paper size control (Windows only).
185 void EnablePaper(bool flag
);
188 Enables or disables the "Printer" button, which invokes a printer setup
191 void EnablePrinter(bool flag
);
194 Returns @true if the dialog will simply return default printer
195 information (such as orientation) instead of showing a dialog (Windows
198 bool GetDefaultInfo() const;
201 Returns @true if the page setup dialog will take its minimum margin
202 values from the currently selected printer properties (Windows only).
204 bool GetDefaultMinMargins() const;
207 Returns @true if the printer setup button is enabled.
209 bool GetEnableHelp() const;
212 Returns @true if the margin controls are enabled (Windows only).
214 bool GetEnableMargins() const;
217 Returns @true if the orientation control is enabled (Windows only).
219 bool GetEnableOrientation() const;
222 Returns @true if the paper size control is enabled (Windows only).
224 bool GetEnablePaper() const;
227 Returns @true if the printer setup button is enabled.
229 bool GetEnablePrinter() const;
232 Returns the right (x) and bottom (y) margins in millimetres.
234 wxPoint
GetMarginBottomRight() const;
237 Returns the left (x) and top (y) margins in millimetres.
239 wxPoint
GetMarginTopLeft() const;
242 Returns the right (x) and bottom (y) minimum margins the user can enter
243 (Windows only). Units are in millimetres.
245 wxPoint
GetMinMarginBottomRight() const;
248 Returns the left (x) and top (y) minimum margins the user can enter
249 (Windows only). Units are in millimetres.
251 wxPoint
GetMinMarginTopLeft() const;
254 Returns the paper id (stored in the internal wxPrintData object).
256 @see wxPrintData::SetPaperId()
258 wxPaperSize
GetPaperId() const;
261 Returns the paper size in millimetres.
263 wxSize
GetPaperSize() const;
266 Returns a reference to the print data associated with this object.
268 wxPrintData
GetPrintData();
271 Returns @true if the print data associated with the dialog data is
272 valid. This can return @false on Windows if the current printer is not
273 set, for example. On all other platforms, it returns @true.
278 Pass @true if the dialog will simply return default printer information
279 (such as orientation) instead of showing a dialog (Windows only).
281 void SetDefaultInfo(bool flag
);
284 Pass @true if the page setup dialog will take its minimum margin values
285 from the currently selected printer properties (Windows only). Units
288 void SetDefaultMinMargins(bool flag
);
291 Sets the right (x) and bottom (y) margins in millimetres.
293 void SetMarginBottomRight(const wxPoint
& pt
);
296 Sets the left (x) and top (y) margins in millimetres.
298 void SetMarginTopLeft(const wxPoint
& pt
);
301 Sets the right (x) and bottom (y) minimum margins the user can enter
302 (Windows only). Units are in millimetres.
304 void SetMinMarginBottomRight(const wxPoint
& pt
);
307 Sets the left (x) and top (y) minimum margins the user can enter
308 (Windows only). Units are in millimetres.
310 void SetMinMarginTopLeft(const wxPoint
& pt
);
313 Sets the paper size id. Calling this function overrides the explicit
314 paper dimensions passed in SetPaperSize().
316 @see wxPrintData::SetPaperId()
318 void SetPaperId(wxPaperSize
& id
);
321 Sets the paper size in millimetres. If a corresponding paper id is
322 found, it will be set in the internal wxPrintData object, otherwise the
323 paper size overrides the paper id.
325 void SetPaperSize(const wxSize
& size
);
328 Sets the print data associated with this object.
330 void SetPrintData(const wxPrintData
& printData
);
333 Assigns print data to this object.
335 void operator =(const wxPrintData
& data
);
338 Assigns page setup data to this object.
340 void operator =(const wxPageSetupDialogData
& data
);
348 This class holds a variety of information related to colour dialogs.
353 @see wxColour, wxColourDialog, @ref overview_cmndlg_colour
355 class wxColourData
: public wxObject
359 Constructor. Initializes the custom colours to @c wxNullColour, the
360 @e data colour setting to black, and the @e choose full setting to
368 virtual ~wxColourData();
371 Under Windows, determines whether the Windows colour dialog will
372 display the full dialog with custom colour selection controls. Under
373 PalmOS, determines whether colour dialog will display full rgb colour
374 picker or only available palette indexer. Has no meaning under other
377 The default value is @true.
379 bool GetChooseFull() const;
382 Gets the current colour associated with the colour dialog.
384 The default colour is black.
386 wxColour
& GetColour();
389 Returns custom colours associated with the colour dialog.
392 An integer between 0 and 15, being any of the 15 custom colours
393 that the user has saved. The default custom colours are invalid
396 wxColour
GetCustomColour(int i
) const;
399 Under Windows, tells the Windows colour dialog to display the full
400 dialog with custom colour selection controls. Under other platforms,
403 The default value is @true.
405 void SetChooseFull(const bool flag
);
408 Sets the default colour for the colour dialog.
410 The default colour is black.
412 void SetColour(const wxColour
& colour
);
415 Sets custom colours for the colour dialog.
418 An integer between 0 and 15 for whatever custom colour you want to
419 set. The default custom colours are invalid colours.
421 void SetCustomColour(int i
, const wxColour
& colour
);
424 Assignment operator for the colour data.
426 void operator =(const wxColourData
& data
);
429 /** @todo document these */
430 wxString
wxColourData::ToString() const;
431 bool wxColourData::FromString(const wxString
& str
);
437 Enumeration of various printer bin sources.
439 @see wxPrintData::SetBin()
450 wxPRINTBIN_ENVMANUAL
,
455 wxPRINTBIN_LARGECAPACITY
,
457 wxPRINTBIN_FORMSOURCE
,
465 This class holds a variety of information related to printers and printer
466 device contexts. This class is used to create a wxPrinterDC and a
467 wxPostScriptDC. It is also used as a data member of wxPrintDialogData and
468 wxPageSetupDialogData, as part of the mechanism for transferring data
469 between the print dialogs and the application.
473 The following functions are specific to PostScript printing and have not
477 const wxString& GetPrinterCommand() const ;
478 const wxString& GetPrinterOptions() const ;
479 const wxString& GetPreviewCommand() const ;
480 const wxString& GetFilename() const ;
481 const wxString& GetFontMetricPath() const ;
482 double GetPrinterScaleX() const ;
483 double GetPrinterScaleY() const ;
484 long GetPrinterTranslateX() const ;
485 long GetPrinterTranslateY() const ;
486 // wxPRINT_MODE_PREVIEW, wxPRINT_MODE_FILE, wxPRINT_MODE_PRINTER
487 wxPrintMode GetPrintMode() const ;
489 void SetPrinterCommand(const wxString& command) ;
490 void SetPrinterOptions(const wxString& options) ;
491 void SetPreviewCommand(const wxString& command) ;
492 void SetFilename(const wxString& filename) ;
493 void SetFontMetricPath(const wxString& path) ;
494 void SetPrinterScaleX(double x) ;
495 void SetPrinterScaleY(double y) ;
496 void SetPrinterScaling(double x, double y) ;
497 void SetPrinterTranslateX(long x) ;
498 void SetPrinterTranslateY(long y) ;
499 void SetPrinterTranslation(long x, long y) ;
500 void SetPrintMode(wxPrintMode printMode) ;
506 @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
507 wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
508 wxPrinterDC, wxPostScriptDC
510 class wxPrintData
: public wxObject
521 wxPrintData(const wxPrintData
& data
);
526 virtual ~wxPrintData();
529 Returns the current bin (papersource). By default, the system is left
530 to select the bin (@c wxPRINTBIN_DEFAULT is returned).
532 See SetBin() for the full list of bin values.
534 wxPrintBin
GetBin() const;
537 Returns @true if collation is on.
539 bool GetCollate() const;
542 Returns @true if colour printing is on.
544 bool GetColour() const;
547 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
550 wxDuplexMode
GetDuplex() const;
553 Returns the number of copies requested by the user.
555 int GetNoCopies() const;
558 Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
560 int GetOrientation() const;
563 Returns the paper size id.
567 wxPaperSize
GetPaperId() const;
570 Returns the printer name. If the printer name is the empty string, it
571 indicates that the default printer should be used.
573 const wxString
GetPrinterName() const;
576 Returns the current print quality. This can be a positive integer,
577 denoting the number of dots per inch, or one of the following
580 - wxPRINT_QUALITY_HIGH
581 - wxPRINT_QUALITY_MEDIUM
582 - wxPRINT_QUALITY_LOW
583 - wxPRINT_QUALITY_DRAFT
585 On input you should pass one of these identifiers, but on return you
586 may get back a positive integer indicating the current resolution
589 wxPrintQuality
GetQuality() const;
592 Returns @true if the print data is valid for using in print dialogs.
593 This can return @false on Windows if the current printer is not set,
594 for example. On all other platforms, it returns @true.
599 Sets the current bin.
601 void SetBin(wxPrintBin flag
);
604 Sets collation to on or off.
606 void SetCollate(bool flag
);
609 Sets colour printing on or off.
611 void SetColour(bool flag
);
614 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
617 void SetDuplex(wxDuplexMode mode
);
620 Sets the default number of copies to be printed out.
622 void SetNoCopies(int n
);
625 Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
627 void SetOrientation(int orientation
);
630 Sets the paper id. This indicates the type of paper to be used. For a
631 mapping between paper id, paper size and string name, see
632 wxPrintPaperDatabase in @c "paper.h" (not yet documented).
634 void SetPaperId(wxPaperSize paperId
);
637 Sets the printer name. This can be the empty string to indicate that
638 the default printer should be used.
640 void SetPrinterName(const wxString
& printerName
);
643 Sets the desired print quality. This can be a positive integer,
644 denoting the number of dots per inch, or one of the following
647 - wxPRINT_QUALITY_HIGH
648 - wxPRINT_QUALITY_MEDIUM
649 - wxPRINT_QUALITY_LOW
650 - wxPRINT_QUALITY_DRAFT
652 On input you should pass one of these identifiers, but on return you
653 may get back a positive integer indicating the current resolution
656 void SetQuality(wxPrintQuality quality
);
659 Assigns print data to this object.
661 void operator =(const wxPrintData
& data
);
667 @class wxPrintDialogData
669 This class holds information related to the visual characteristics of
670 wxPrintDialog. It contains a wxPrintData object with underlying printing
676 @see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
678 class wxPrintDialogData
: public wxObject
689 wxPrintDialogData(wxPrintDialogData
& dialogData
);
692 Construct an object from a print dialog data object.
694 wxPrintDialogData(wxPrintData
& printData
);
699 virtual ~wxPrintDialogData();
702 Enables or disables the "Help" button.
704 void EnableHelp(bool flag
);
707 Enables or disables the "Page numbers" controls.
709 void EnablePageNumbers(bool flag
);
712 Enables or disables the "Print to file" checkbox.
714 void EnablePrintToFile(bool flag
);
717 Enables or disables the "Selection" radio button.
719 void EnableSelection(bool flag
);
722 Returns @true if the user requested that all pages be printed.
724 bool GetAllPages() const;
727 Returns @true if the user requested that the document(s) be collated.
729 bool GetCollate() const;
732 Returns the @e from page number, as entered by the user.
734 int GetFromPage() const;
737 Returns the @e maximum page number.
739 int GetMaxPage() const;
742 Returns the @e minimum page number.
744 int GetMinPage() const;
747 Returns the number of copies requested by the user.
749 int GetNoCopies() const;
752 Returns a reference to the internal wxPrintData object.
754 wxPrintData
& GetPrintData();
757 Returns @true if the user has selected printing to a file.
759 bool GetPrintToFile() const;
762 Returns @true if the user requested that the selection be printed
763 (where "selection" is a concept specific to the application).
765 bool GetSelection() const;
768 Returns the @e "print to" page number, as entered by the user.
770 int GetToPage() const;
773 Returns @true if the print data is valid for using in print dialogs.
774 This can return @false on Windows if the current printer is not set,
775 for example. On all other platforms, it returns @true.
780 Sets the "Collate" checkbox to @true or @false.
782 void SetCollate(bool flag
);
785 Sets the @e from page number.
787 void SetFromPage(int page
);
790 Sets the @e maximum page number.
792 void SetMaxPage(int page
);
795 Sets the @e minimum page number.
797 void SetMinPage(int page
);
800 Sets the default number of copies the user has requested to be printed
803 void SetNoCopies(int n
);
806 Sets the internal wxPrintData.
808 void SetPrintData(const wxPrintData
& printData
);
811 Sets the "Print to file" checkbox to @true or @false.
813 void SetPrintToFile(bool flag
);
816 Selects the "Selection" radio button. The effect of printing the
817 selection depends on how the application implements this command, if at
820 void SetSelection(bool flag
);
823 @deprecated This function has been deprecated since version 2.5.4.
825 Determines whether the dialog to be shown will be the Print dialog
826 (pass @false) or Print Setup dialog (pass @true).
829 void SetSetupDialog(bool flag
);
832 Sets the @e "print to" page number.
834 void SetToPage(int page
);
837 Assigns print data to this object.
839 void operator =(const wxPrintData
& data
);
842 Assigns another print dialog data object to this object.
844 void operator =(const wxPrintDialogData
& data
);