]>
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 const wxColour
& GetColour() const;
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 wxFontData
& 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(const wxPageSetupDialogData
& data
);
158 Construct an object from a print data object.
160 wxPageSetupDialogData(const 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();
269 const wxPrintData
& GetPrintData() const;
272 Returns @true if the print data associated with the dialog data is
273 valid. This can return @false on Windows if the current printer is not
274 set, for example. On all other platforms, it returns @true.
279 Pass @true if the dialog will simply return default printer information
280 (such as orientation) instead of showing a dialog (Windows only).
282 void SetDefaultInfo(bool flag
);
285 Pass @true if the page setup dialog will take its minimum margin values
286 from the currently selected printer properties (Windows only). Units
289 void SetDefaultMinMargins(bool flag
);
292 Sets the right (x) and bottom (y) margins in millimetres.
294 void SetMarginBottomRight(const wxPoint
& pt
);
297 Sets the left (x) and top (y) margins in millimetres.
299 void SetMarginTopLeft(const wxPoint
& pt
);
302 Sets the right (x) and bottom (y) minimum margins the user can enter
303 (Windows only). Units are in millimetres.
305 void SetMinMarginBottomRight(const wxPoint
& pt
);
308 Sets the left (x) and top (y) minimum margins the user can enter
309 (Windows only). Units are in millimetres.
311 void SetMinMarginTopLeft(const wxPoint
& pt
);
314 Sets the paper size id. Calling this function overrides the explicit
315 paper dimensions passed in SetPaperSize().
317 @see wxPrintData::SetPaperId()
319 void SetPaperId(wxPaperSize id
);
322 Sets the paper size in millimetres. If a corresponding paper id is
323 found, it will be set in the internal wxPrintData object, otherwise the
324 paper size overrides the paper id.
326 void SetPaperSize(const wxSize
& size
);
329 Sets the print data associated with this object.
331 void SetPrintData(const wxPrintData
& printData
);
334 Assigns print data to this object.
336 wxPageSetupDialogData
& operator =(const wxPrintData
& data
);
339 Assigns page setup data to this object.
341 wxPageSetupDialogData
& operator =(const wxPageSetupDialogData
& data
);
349 This class holds a variety of information related to colour dialogs.
354 @see wxColour, wxColourDialog, @ref overview_cmndlg_colour
356 class wxColourData
: public wxObject
360 Constructor. Initializes the custom colours to @c wxNullColour, the
361 @e data colour setting to black, and the @e choose full setting to
369 virtual ~wxColourData();
372 Under Windows, determines whether the Windows colour dialog will
373 display the full dialog with custom colour selection controls. Under
374 PalmOS, determines whether colour dialog will display full rgb colour
375 picker or only available palette indexer. Has no meaning under other
378 The default value is @true.
380 bool GetChooseFull() const;
383 Gets the current colour associated with the colour dialog.
385 The default colour is black.
387 wxColour
& GetColour();
390 Returns custom colours associated with the colour dialog.
393 An integer between 0 and 15, being any of the 15 custom colours
394 that the user has saved. The default custom colours are invalid
397 wxColour
GetCustomColour(int i
) const;
400 Under Windows, tells the Windows colour dialog to display the full
401 dialog with custom colour selection controls. Under other platforms,
404 The default value is @true.
406 void SetChooseFull(bool flag
);
409 Sets the default colour for the colour dialog.
411 The default colour is black.
413 void SetColour(const wxColour
& colour
);
416 Sets custom colours for the colour dialog.
419 An integer between 0 and 15 for whatever custom colour you want to
420 set. The default custom colours are invalid colours.
424 void SetCustomColour(int i
, const wxColour
& colour
);
427 Converts the colours saved in this class in a string form, separing
428 the various colours with a comma.
430 wxString
ToString() const;
433 Decodes the given string, which should be in the same format returned
434 by ToString(), and sets the internal colours.
436 bool FromString(const wxString
& str
);
439 Assignment operator for the colour data.
441 wxColourData
& operator =(const wxColourData
& data
);
447 Enumeration of various printer bin sources.
449 @see wxPrintData::SetBin()
460 wxPRINTBIN_ENVMANUAL
,
465 wxPRINTBIN_LARGECAPACITY
,
467 wxPRINTBIN_FORMSOURCE
,
475 This class holds a variety of information related to printers and printer
476 device contexts. This class is used to create a wxPrinterDC and a
477 wxPostScriptDC. It is also used as a data member of wxPrintDialogData and
478 wxPageSetupDialogData, as part of the mechanism for transferring data
479 between the print dialogs and the application.
483 The following functions are specific to PostScript printing and have not
487 const wxString& GetPrinterCommand() const ;
488 const wxString& GetPrinterOptions() const ;
489 const wxString& GetPreviewCommand() const ;
490 const wxString& GetFilename() const ;
491 const wxString& GetFontMetricPath() const ;
492 double GetPrinterScaleX() const ;
493 double GetPrinterScaleY() const ;
494 long GetPrinterTranslateX() const ;
495 long GetPrinterTranslateY() const ;
496 // wxPRINT_MODE_PREVIEW, wxPRINT_MODE_FILE, wxPRINT_MODE_PRINTER
497 wxPrintMode GetPrintMode() const ;
499 void SetPrinterCommand(const wxString& command) ;
500 void SetPrinterOptions(const wxString& options) ;
501 void SetPreviewCommand(const wxString& command) ;
502 void SetFilename(const wxString& filename) ;
503 void SetFontMetricPath(const wxString& path) ;
504 void SetPrinterScaleX(double x) ;
505 void SetPrinterScaleY(double y) ;
506 void SetPrinterScaling(double x, double y) ;
507 void SetPrinterTranslateX(long x) ;
508 void SetPrinterTranslateY(long y) ;
509 void SetPrinterTranslation(long x, long y) ;
510 void SetPrintMode(wxPrintMode printMode) ;
516 @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
517 wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
518 wxPrinterDC, wxPostScriptDC
520 class wxPrintData
: public wxObject
531 wxPrintData(const wxPrintData
& data
);
536 virtual ~wxPrintData();
539 Returns the current bin (papersource). By default, the system is left
540 to select the bin (@c wxPRINTBIN_DEFAULT is returned).
542 See SetBin() for the full list of bin values.
544 wxPrintBin
GetBin() const;
547 Returns @true if collation is on.
549 bool GetCollate() const;
552 Returns @true if colour printing is on.
554 bool GetColour() const;
557 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
560 wxDuplexMode
GetDuplex() const;
563 Returns the number of copies requested by the user.
565 int GetNoCopies() const;
568 Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
570 int GetOrientation() const;
573 Returns the paper size id.
577 wxPaperSize
GetPaperId() const;
580 Returns the printer name. If the printer name is the empty string, it
581 indicates that the default printer should be used.
583 const wxString
& GetPrinterName() const;
586 Returns the current print quality. This can be a positive integer,
587 denoting the number of dots per inch, or one of the following
590 - wxPRINT_QUALITY_HIGH
591 - wxPRINT_QUALITY_MEDIUM
592 - wxPRINT_QUALITY_LOW
593 - wxPRINT_QUALITY_DRAFT
595 On input you should pass one of these identifiers, but on return you
596 may get back a positive integer indicating the current resolution
599 wxPrintQuality
GetQuality() const;
602 Returns @true if the print data is valid for using in print dialogs.
603 This can return @false on Windows if the current printer is not set,
604 for example. On all other platforms, it returns @true.
609 Sets the current bin.
611 void SetBin(wxPrintBin flag
);
614 Sets collation to on or off.
616 void SetCollate(bool flag
);
619 Sets colour printing on or off.
621 void SetColour(bool flag
);
624 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
627 void SetDuplex(wxDuplexMode mode
);
630 Sets the default number of copies to be printed out.
632 void SetNoCopies(int n
);
635 Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
637 void SetOrientation(int orientation
);
640 Sets the paper id. This indicates the type of paper to be used. For a
641 mapping between paper id, paper size and string name, see
642 wxPrintPaperDatabase in @c "paper.h" (not yet documented).
644 void SetPaperId(wxPaperSize paperId
);
647 Sets the printer name. This can be the empty string to indicate that
648 the default printer should be used.
650 void SetPrinterName(const wxString
& printerName
);
653 Sets the desired print quality. This can be a positive integer,
654 denoting the number of dots per inch, or one of the following
657 - wxPRINT_QUALITY_HIGH
658 - wxPRINT_QUALITY_MEDIUM
659 - wxPRINT_QUALITY_LOW
660 - wxPRINT_QUALITY_DRAFT
662 On input you should pass one of these identifiers, but on return you
663 may get back a positive integer indicating the current resolution
666 void SetQuality(wxPrintQuality quality
);
669 Assigns print data to this object.
671 wxPrintData
& operator =(const wxPrintData
& data
);
677 @class wxPrintDialogData
679 This class holds information related to the visual characteristics of
680 wxPrintDialog. It contains a wxPrintData object with underlying printing
686 @see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
688 class wxPrintDialogData
: public wxObject
699 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
702 Construct an object from a print dialog data object.
704 wxPrintDialogData(const wxPrintData
& printData
);
709 virtual ~wxPrintDialogData();
712 Enables or disables the "Help" button.
714 void EnableHelp(bool flag
);
717 Enables or disables the "Page numbers" controls.
719 void EnablePageNumbers(bool flag
);
722 Enables or disables the "Print to file" checkbox.
724 void EnablePrintToFile(bool flag
);
727 Enables or disables the "Selection" radio button.
729 void EnableSelection(bool flag
);
732 Returns @true if the user requested that all pages be printed.
734 bool GetAllPages() const;
737 Returns @true if the user requested that the document(s) be collated.
739 bool GetCollate() const;
742 Returns the @e from page number, as entered by the user.
744 int GetFromPage() const;
747 Returns the @e maximum page number.
749 int GetMaxPage() const;
752 Returns the @e minimum page number.
754 int GetMinPage() const;
757 Returns the number of copies requested by the user.
759 int GetNoCopies() const;
762 Returns a reference to the internal wxPrintData object.
764 wxPrintData
& GetPrintData();
767 Returns @true if the user has selected printing to a file.
769 bool GetPrintToFile() const;
772 Returns @true if the user requested that the selection be printed
773 (where "selection" is a concept specific to the application).
775 bool GetSelection() const;
778 Returns the @e "print to" page number, as entered by the user.
780 int GetToPage() const;
783 Returns @true if the print data is valid for using in print dialogs.
784 This can return @false on Windows if the current printer is not set,
785 for example. On all other platforms, it returns @true.
790 Sets the "Collate" checkbox to @true or @false.
792 void SetCollate(bool flag
);
795 Sets the @e from page number.
797 void SetFromPage(int page
);
800 Sets the @e maximum page number.
802 void SetMaxPage(int page
);
805 Sets the @e minimum page number.
807 void SetMinPage(int page
);
810 Sets the default number of copies the user has requested to be printed
813 void SetNoCopies(int n
);
816 Sets the internal wxPrintData.
818 void SetPrintData(const wxPrintData
& printData
);
821 Sets the "Print to file" checkbox to @true or @false.
823 void SetPrintToFile(bool flag
);
826 Selects the "Selection" radio button. The effect of printing the
827 selection depends on how the application implements this command, if at
830 void SetSelection(bool flag
);
833 @deprecated This function has been deprecated since version 2.5.4.
835 Determines whether the dialog to be shown will be the Print dialog
836 (pass @false) or Print Setup dialog (pass @true).
839 void SetSetupDialog(bool flag
);
842 Sets the @e "print to" page number.
844 void SetToPage(int page
);
847 Assigns print data to this object.
849 void operator =(const wxPrintData
& data
);
852 Assigns another print dialog data object to this object.
854 void operator =(const wxPrintDialogData
& data
);