]>
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();
47 Gets the font chosen by the user if the user pressed OK
48 (wxFontDialog::ShowModal() returned wxID_OK).
50 wxFont
GetChosenFont();
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();
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();
75 Returns @true if the Help button will be shown (Windows only).
77 The default value is @false.
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 ~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
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() const;
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
);
432 Enumeration of various printer bin sources.
434 @see wxPrintData::SetBin()
445 wxPRINTBIN_ENVMANUAL
,
450 wxPRINTBIN_LARGECAPACITY
,
452 wxPRINTBIN_FORMSOURCE
,
460 This class holds a variety of information related to printers and printer
461 device contexts. This class is used to create a wxPrinterDC and a
462 wxPostScriptDC. It is also used as a data member of wxPrintDialogData and
463 wxPageSetupDialogData, as part of the mechanism for transferring data
464 between the print dialogs and the application.
468 The following functions are specific to PostScript printing and have not
472 const wxString& GetPrinterCommand() const ;
473 const wxString& GetPrinterOptions() const ;
474 const wxString& GetPreviewCommand() const ;
475 const wxString& GetFilename() const ;
476 const wxString& GetFontMetricPath() const ;
477 double GetPrinterScaleX() const ;
478 double GetPrinterScaleY() const ;
479 long GetPrinterTranslateX() const ;
480 long GetPrinterTranslateY() const ;
481 // wxPRINT_MODE_PREVIEW, wxPRINT_MODE_FILE, wxPRINT_MODE_PRINTER
482 wxPrintMode GetPrintMode() const ;
484 void SetPrinterCommand(const wxString& command) ;
485 void SetPrinterOptions(const wxString& options) ;
486 void SetPreviewCommand(const wxString& command) ;
487 void SetFilename(const wxString& filename) ;
488 void SetFontMetricPath(const wxString& path) ;
489 void SetPrinterScaleX(double x) ;
490 void SetPrinterScaleY(double y) ;
491 void SetPrinterScaling(double x, double y) ;
492 void SetPrinterTranslateX(long x) ;
493 void SetPrinterTranslateY(long y) ;
494 void SetPrinterTranslation(long x, long y) ;
495 void SetPrintMode(wxPrintMode printMode) ;
501 @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
502 wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
503 wxPrinterDC, wxPostScriptDC
505 class wxPrintData
: public wxObject
516 wxPrintData(const wxPrintData
& data
);
524 Returns the current bin (papersource). By default, the system is left
525 to select the bin (@c wxPRINTBIN_DEFAULT is returned).
527 See SetBin() for the full list of bin values.
529 wxPrintBin
GetBin() const;
532 Returns @true if collation is on.
534 bool GetCollate() const;
537 Returns @true if colour printing is on.
539 bool GetColour() const;
542 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
545 wxDuplexMode
GetDuplex() const;
548 Returns the number of copies requested by the user.
550 int GetNoCopies() const;
553 Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
555 int GetOrientation() const;
558 Returns the paper size id.
562 wxPaperSize
GetPaperId() const;
565 Returns the printer name. If the printer name is the empty string, it
566 indicates that the default printer should be used.
568 const wxString
GetPrinterName() const;
571 Returns the current print quality. This can be a positive integer,
572 denoting the number of dots per inch, or one of the following
575 - wxPRINT_QUALITY_HIGH
576 - wxPRINT_QUALITY_MEDIUM
577 - wxPRINT_QUALITY_LOW
578 - wxPRINT_QUALITY_DRAFT
580 On input you should pass one of these identifiers, but on return you
581 may get back a positive integer indicating the current resolution
584 wxPrintQuality
GetQuality() const;
587 Returns @true if the print data is valid for using in print dialogs.
588 This can return @false on Windows if the current printer is not set,
589 for example. On all other platforms, it returns @true.
594 Sets the current bin.
596 void SetBin(wxPrintBin flag
);
599 Sets collation to on or off.
601 void SetCollate(bool flag
);
604 Sets colour printing on or off.
606 void SetColour(bool flag
);
609 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
612 void SetDuplex(wxDuplexMode mode
);
615 Sets the default number of copies to be printed out.
617 void SetNoCopies(int n
);
620 Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
622 void SetOrientation(int orientation
);
625 Sets the paper id. This indicates the type of paper to be used. For a
626 mapping between paper id, paper size and string name, see
627 wxPrintPaperDatabase in @c "paper.h" (not yet documented).
629 void SetPaperId(wxPaperSize paperId
);
632 Sets the printer name. This can be the empty string to indicate that
633 the default printer should be used.
635 void SetPrinterName(const wxString
& printerName
);
638 Sets the desired print quality. This can be a positive integer,
639 denoting the number of dots per inch, or one of the following
642 - wxPRINT_QUALITY_HIGH
643 - wxPRINT_QUALITY_MEDIUM
644 - wxPRINT_QUALITY_LOW
645 - wxPRINT_QUALITY_DRAFT
647 On input you should pass one of these identifiers, but on return you
648 may get back a positive integer indicating the current resolution
651 void SetQuality(wxPrintQuality quality
);
654 Assigns print data to this object.
656 void operator =(const wxPrintData
& data
);
662 @class wxPrintDialogData
664 This class holds information related to the visual characteristics of
665 wxPrintDialog. It contains a wxPrintData object with underlying printing
671 @see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
673 class wxPrintDialogData
: public wxObject
684 wxPrintDialogData(wxPrintDialogData
& dialogData
);
687 Construct an object from a print dialog data object.
689 wxPrintDialogData(wxPrintData
& printData
);
694 ~wxPrintDialogData();
697 Enables or disables the "Help" button.
699 void EnableHelp(bool flag
);
702 Enables or disables the "Page numbers" controls.
704 void EnablePageNumbers(bool flag
);
707 Enables or disables the "Print to file" checkbox.
709 void EnablePrintToFile(bool flag
);
712 Enables or disables the "Selection" radio button.
714 void EnableSelection(bool flag
);
717 Returns @true if the user requested that all pages be printed.
719 bool GetAllPages() const;
722 Returns @true if the user requested that the document(s) be collated.
724 bool GetCollate() const;
727 Returns the @e from page number, as entered by the user.
729 int GetFromPage() const;
732 Returns the @e maximum page number.
734 int GetMaxPage() const;
737 Returns the @e minimum page number.
739 int GetMinPage() const;
742 Returns the number of copies requested by the user.
744 int GetNoCopies() const;
747 Returns a reference to the internal wxPrintData object.
749 wxPrintData
& GetPrintData();
752 Returns @true if the user has selected printing to a file.
754 bool GetPrintToFile() const;
757 Returns @true if the user requested that the selection be printed
758 (where "selection" is a concept specific to the application).
760 bool GetSelection() const;
763 Returns the @e "print to" page number, as entered by the user.
765 int GetToPage() const;
768 Returns @true if the print data is valid for using in print dialogs.
769 This can return @false on Windows if the current printer is not set,
770 for example. On all other platforms, it returns @true.
775 Sets the "Collate" checkbox to @true or @false.
777 void SetCollate(bool flag
);
780 Sets the @e from page number.
782 void SetFromPage(int page
);
785 Sets the @e maximum page number.
787 void SetMaxPage(int page
);
790 Sets the @e minimum page number.
792 void SetMinPage(int page
);
795 Sets the default number of copies the user has requested to be printed
798 void SetNoCopies(int n
);
801 Sets the internal wxPrintData.
803 void SetPrintData(const wxPrintData
& printData
);
806 Sets the "Print to file" checkbox to @true or @false.
808 void SetPrintToFile(bool flag
);
811 Selects the "Selection" radio button. The effect of printing the
812 selection depends on how the application implements this command, if at
815 void SetSelection(bool flag
);
818 @deprecated This function has been deprecated since version 2.5.4.
820 Determines whether the dialog to be shown will be the Print dialog
821 (pass @false) or Print Setup dialog (pass @true).
824 void SetSetupDialog(bool flag
);
827 Sets the @e "print to" page number.
829 void SetToPage(int page
);
832 Assigns print data to this object.
834 void operator =(const wxPrintData
& data
);
837 Assigns another print dialog data object to this object.
839 void operator =(const wxPrintDialogData
& data
);