]>
git.saurik.com Git - wxWidgets.git/blob - interface/cmndata.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of common wx*Data classes (font, colour, print)
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 This class holds a variety of information related to font dialogs.
18 @see @ref overview_cmndlg_font, wxFont, wxFontDialog
20 class wxFontData
: public wxObject
24 Constructor. Initializes @e fontColour to black, @e showHelp to @false,
25 @e allowSymbols to @true, @e enableEffects to @true, @e minSize to 0
31 Enables or disables "effects" under Windows or generic only. This
32 refers to the controls for manipulating colour, strikeout and underline
35 The default value is @true.
37 void EnableEffects(bool enable
);
40 Under Windows, returns a flag determining whether symbol fonts can be
41 selected. Has no effect on other platforms.
43 The default value is @true.
45 bool GetAllowSymbols();
48 Gets the font chosen by the user if the user pressed OK
49 (wxFontDialog::ShowModal() returned wxID_OK).
51 wxFont
GetChosenFont();
54 Gets the colour associated with the font dialog.
56 The default value is black.
58 wxColour
& GetColour();
61 Determines whether "effects" are enabled under Windows. This refers to
62 the controls for manipulating colour, strikeout and underline
65 The default value is @true.
67 bool GetEnableEffects();
70 Gets the font that will be initially used by the font dialog. This
71 should have previously been set by the application.
73 wxFont
GetInitialFont();
76 Returns @true if the Help button will be shown (Windows only).
78 The default value is @false.
83 Under Windows, determines whether symbol fonts can be selected. Has no
84 effect on other platforms.
86 The default value is @true.
88 void SetAllowSymbols(bool allowSymbols
);
91 Sets the font that will be returned to the user (for internal use
94 void SetChosenFont(const wxFont
& font
);
97 Sets the colour that will be used for the font foreground colour.
99 The default colour is black.
101 void SetColour(const wxColour
& colour
);
104 Sets the font that will be initially used by the font dialog.
106 void SetInitialFont(const wxFont
& font
);
109 Sets the valid range for the font point size (Windows only).
111 The default is 0, 0 (unrestricted range).
113 void SetRange(int min
, int max
);
116 Determines whether the Help button will be displayed in the font dialog
119 The default value is @false.
121 void SetShowHelp(bool showHelp
);
124 Assignment operator for the font data.
126 void operator =(const wxFontData
& data
);
132 @class wxPageSetupDialogData
135 This class holds a variety of information related to wxPageSetupDialog.
137 It contains a wxPrintData member which is used to hold basic printer
138 configuration data (as opposed to the user-interface configuration settings
139 stored by wxPageSetupDialogData).
144 @see @ref overview_printing, wxPageSetupDialog
146 class wxPageSetupDialogData
: public wxObject
152 wxPageSetupDialogData();
157 wxPageSetupDialogData(wxPageSetupDialogData
& data
);
160 Construct an object from a print data object.
162 wxPageSetupDialogData(wxPrintData
& printData
);
167 ~wxPageSetupDialogData();
170 Enables or disables the "Help" button (Windows only).
172 void EnableHelp(bool flag
);
175 Enables or disables the margin controls (Windows only).
177 void EnableMargins(bool flag
);
180 Enables or disables the orientation control (Windows only).
182 void EnableOrientation(bool flag
);
185 Enables or disables the paper size control (Windows only).
187 void EnablePaper(bool flag
);
190 Enables or disables the "Printer" button, which invokes a printer setup
193 void EnablePrinter(bool flag
);
196 Returns @true if the dialog will simply return default printer
197 information (such as orientation) instead of showing a dialog (Windows
200 bool GetDefaultInfo() const;
203 Returns @true if the page setup dialog will take its minimum margin
204 values from the currently selected printer properties (Windows only).
206 bool GetDefaultMinMargins() const;
209 Returns @true if the printer setup button is enabled.
211 bool GetEnableHelp() const;
214 Returns @true if the margin controls are enabled (Windows only).
216 bool GetEnableMargins() const;
219 Returns @true if the orientation control is enabled (Windows only).
221 bool GetEnableOrientation() const;
224 Returns @true if the paper size control is enabled (Windows only).
226 bool GetEnablePaper() const;
229 Returns @true if the printer setup button is enabled.
231 bool GetEnablePrinter() const;
234 Returns the right (x) and bottom (y) margins in millimetres.
236 wxPoint
GetMarginBottomRight() const;
239 Returns the left (x) and top (y) margins in millimetres.
241 wxPoint
GetMarginTopLeft() const;
244 Returns the right (x) and bottom (y) minimum margins the user can enter
245 (Windows only). Units are in millimetres.
247 wxPoint
GetMinMarginBottomRight() const;
250 Returns the left (x) and top (y) minimum margins the user can enter
251 (Windows only). Units are in millimetres.
253 wxPoint
GetMinMarginTopLeft() const;
256 Returns the paper id (stored in the internal wxPrintData object).
258 @see wxPrintData::SetPaperId()
260 wxPaperSize
GetPaperId() const;
263 Returns the paper size in millimetres.
265 wxSize
GetPaperSize() const;
268 Returns a reference to the print data associated with this object.
270 wxPrintData
GetPrintData();
273 Returns @true if the print data associated with the dialog data is
274 valid. This can return @false on Windows if the current printer is not
275 set, for example. On all other platforms, it returns @true.
280 Pass @true if the dialog will simply return default printer information
281 (such as orientation) instead of showing a dialog (Windows only).
283 void SetDefaultInfo(bool flag
);
286 Pass @true if the page setup dialog will take its minimum margin values
287 from the currently selected printer properties (Windows only). Units
290 void SetDefaultMinMargins(bool flag
);
293 Sets the right (x) and bottom (y) margins in millimetres.
295 void SetMarginBottomRight(const wxPoint
& pt
);
298 Sets the left (x) and top (y) margins in millimetres.
300 void SetMarginTopLeft(const wxPoint
& pt
);
303 Sets the right (x) and bottom (y) minimum margins the user can enter
304 (Windows only). Units are in millimetres.
306 void SetMinMarginBottomRight(const wxPoint
& pt
);
309 Sets the left (x) and top (y) minimum margins the user can enter
310 (Windows only). Units are in millimetres.
312 void SetMinMarginTopLeft(const wxPoint
& pt
);
315 Sets the paper size id. Calling this function overrides the explicit
316 paper dimensions passed in SetPaperSize().
318 @see wxPrintData::SetPaperId()
320 void SetPaperId(wxPaperSize
& id
);
323 Sets the paper size in millimetres. If a corresponding paper id is
324 found, it will be set in the internal wxPrintData object, otherwise the
325 paper size overrides the paper id.
327 void SetPaperSize(const wxSize
& size
);
330 Sets the print data associated with this object.
332 void SetPrintData(const wxPrintData
& printData
);
335 Assigns print data to this object.
337 void operator =(const wxPrintData
& data
);
340 Assigns page setup data to this object.
342 void operator =(const wxPageSetupDialogData
& data
);
351 This class holds a variety of information related to colour dialogs.
356 @see wxColour, wxColourDialog, @ref overview_cmndlg_colour
358 class wxColourData
: public wxObject
362 Constructor. Initializes the custom colours to @c wxNullColour, the
363 @e data colour setting to black, and the @e choose full setting to
374 Under Windows, determines whether the Windows colour dialog will
375 display the full dialog with custom colour selection controls. Under
376 PalmOS, determines whether colour dialog will display full rgb colour
377 picker or only available palette indexer. Has no meaning under other
380 The default value is @true.
382 bool GetChooseFull() const;
385 Gets the current colour associated with the colour dialog.
387 The default colour is black.
389 wxColour
& GetColour() const;
392 Returns custom colours associated with the colour dialog.
395 An integer between 0 and 15, being any of the 15 custom colours
396 that the user has saved. The default custom colours are invalid
399 wxColour
& GetCustomColour(int i
) const;
402 Under Windows, tells the Windows colour dialog to display the full
403 dialog with custom colour selection controls. Under other platforms,
406 The default value is @true.
408 void SetChooseFull(const bool flag
);
411 Sets the default colour for the colour dialog.
413 The default colour is black.
415 void SetColour(const wxColour
& colour
);
418 Sets custom colours for the colour dialog.
421 An integer between 0 and 15 for whatever custom colour you want to
422 set. The default custom colours are invalid colours.
424 void SetCustomColour(int i
, const wxColour
& colour
);
427 Assignment operator for the colour data.
429 void operator =(const wxColourData
& data
);
435 Enumeration of various printer bin sources.
437 @see wxPrintData::SetBin()
448 wxPRINTBIN_ENVMANUAL
,
453 wxPRINTBIN_LARGECAPACITY
,
455 wxPRINTBIN_FORMSOURCE
,
464 This class holds a variety of information related to printers and printer
465 device contexts. This class is used to create a wxPrinterDC and a
466 wxPostScriptDC. It is also used as a data member of wxPrintDialogData and
467 wxPageSetupDialogData, as part of the mechanism for transferring data
468 between the print dialogs and the application.
472 The following functions are specific to PostScript printing and have not
476 const wxString& GetPrinterCommand() const ;
477 const wxString& GetPrinterOptions() const ;
478 const wxString& GetPreviewCommand() const ;
479 const wxString& GetFilename() const ;
480 const wxString& GetFontMetricPath() const ;
481 double GetPrinterScaleX() const ;
482 double GetPrinterScaleY() const ;
483 long GetPrinterTranslateX() const ;
484 long GetPrinterTranslateY() const ;
485 // wxPRINT_MODE_PREVIEW, wxPRINT_MODE_FILE, wxPRINT_MODE_PRINTER
486 wxPrintMode GetPrintMode() const ;
488 void SetPrinterCommand(const wxString& command) ;
489 void SetPrinterOptions(const wxString& options) ;
490 void SetPreviewCommand(const wxString& command) ;
491 void SetFilename(const wxString& filename) ;
492 void SetFontMetricPath(const wxString& path) ;
493 void SetPrinterScaleX(double x) ;
494 void SetPrinterScaleY(double y) ;
495 void SetPrinterScaling(double x, double y) ;
496 void SetPrinterTranslateX(long x) ;
497 void SetPrinterTranslateY(long y) ;
498 void SetPrinterTranslation(long x, long y) ;
499 void SetPrintMode(wxPrintMode printMode) ;
505 @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
506 wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
507 wxPrinterDC, wxPostScriptDC
509 class wxPrintData
: public wxObject
520 wxPrintData(const wxPrintData
& data
);
528 Returns the current bin (papersource). By default, the system is left
529 to select the bin (@c wxPRINTBIN_DEFAULT is returned).
531 See SetBin() for the full list of bin values.
533 wxPrintBin
GetBin() const;
536 Returns @true if collation is on.
538 bool GetCollate() const;
541 Returns @true if colour printing is on.
543 bool GetColour() const;
546 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
549 wxDuplexMode
GetDuplex() const;
552 Returns the number of copies requested by the user.
554 int GetNoCopies() const;
557 Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
559 int GetOrientation() const;
562 Returns the paper size id.
566 wxPaperSize
GetPaperId() const;
569 Returns the printer name. If the printer name is the empty string, it
570 indicates that the default printer should be used.
572 const wxString
GetPrinterName() const;
575 Returns the current print quality. This can be a positive integer,
576 denoting the number of dots per inch, or one of the following
579 - wxPRINT_QUALITY_HIGH
580 - wxPRINT_QUALITY_MEDIUM
581 - wxPRINT_QUALITY_LOW
582 - wxPRINT_QUALITY_DRAFT
584 On input you should pass one of these identifiers, but on return you
585 may get back a positive integer indicating the current resolution
588 wxPrintQuality
GetQuality() const;
591 Returns @true if the print data is valid for using in print dialogs.
592 This can return @false on Windows if the current printer is not set,
593 for example. On all other platforms, it returns @true.
598 Sets the current bin.
600 void SetBin(wxPrintBin flag
);
603 Sets collation to on or off.
605 void SetCollate(bool flag
);
608 Sets colour printing on or off.
610 void SetColour(bool flag
);
613 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
616 void SetDuplex(wxDuplexMode mode
);
619 Sets the default number of copies to be printed out.
621 void SetNoCopies(int n
);
624 Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
626 void SetOrientation(int orientation
);
629 Sets the paper id. This indicates the type of paper to be used. For a
630 mapping between paper id, paper size and string name, see
631 wxPrintPaperDatabase in @c "paper.h" (not yet documented).
633 void SetPaperId(wxPaperSize paperId
);
636 Sets the printer name. This can be the empty string to indicate that
637 the default printer should be used.
639 void SetPrinterName(const wxString
& printerName
);
642 Sets the desired print quality. This can be a positive integer,
643 denoting the number of dots per inch, or one of the following
646 - wxPRINT_QUALITY_HIGH
647 - wxPRINT_QUALITY_MEDIUM
648 - wxPRINT_QUALITY_LOW
649 - wxPRINT_QUALITY_DRAFT
651 On input you should pass one of these identifiers, but on return you
652 may get back a positive integer indicating the current resolution
655 void SetQuality(wxPrintQuality quality
);
658 Assigns print data to this object.
660 void operator =(const wxPrintData
& data
);
666 @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 ~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
);