From: Vadim Zeitlin Date: Tue, 8 Dec 2009 16:35:47 +0000 (+0000) Subject: Make wxPORTRAIT and wxLANDSCAPE elements of wxPrintOrientation enum. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/af7e24c33e1e6e00a7687ee965b921dbe60cdb36 Make wxPORTRAIT and wxLANDSCAPE elements of wxPrintOrientation enum. Change wxPrintData::SetOrientation() to take wxPrintOrientation instead of int. Closes #11393. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62823 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index a642866566..680b9e9522 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -360,6 +360,8 @@ Deprecated methods and their replacements - wxValidator::SetBellOnError() incorrectly interpreted its argument (it disabled the bell when it was true) and was replaced by SuppressBellOnError() with more expected semantics. +- wxPORTRAIT and wxLANDSCAPE are now elements of wxPrintOrientation enum and + wxPrintData::SetOrientation(int) takes wxPrintOrientation and not int. Major new features in this release diff --git a/include/wx/cmndata.h b/include/wx/cmndata.h index 31269412d8..b37b38fa0b 100644 --- a/include/wx/cmndata.h +++ b/include/wx/cmndata.h @@ -192,7 +192,7 @@ public: int GetNoCopies() const { return m_printNoCopies; } bool GetCollate() const { return m_printCollate; } - int GetOrientation() const { return m_printOrientation; } + wxPrintOrientation GetOrientation() const { return m_printOrientation; } bool IsOrientationReversed() const { return m_printOrientationReversed; } // Is this data OK for showing the print dialog? @@ -212,7 +212,11 @@ public: void SetNoCopies(int v) { m_printNoCopies = v; } void SetCollate(bool flag) { m_printCollate = flag; } - void SetOrientation(int orient) { m_printOrientation = orient; } + + // Please use the overloaded method below + wxDEPRECATED_INLINE(void SetOrientation(int orient), + m_printOrientation = (wxPrintOrientation)orient; ) + void SetOrientation(wxPrintOrientation orient) { m_printOrientation = orient; } void SetOrientationReversed(bool reversed) { m_printOrientationReversed = reversed; } void SetPrinterName(const wxString& name) { m_printerName = name; } @@ -247,7 +251,7 @@ private: wxPrintMode m_printMode; int m_printNoCopies; - int m_printOrientation; + wxPrintOrientation m_printOrientation; bool m_printOrientationReversed; bool m_printCollate; diff --git a/include/wx/defs.h b/include/wx/defs.h index 0769ee204f..7f43f5391a 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -2543,10 +2543,11 @@ typedef enum } wxPaperSize; /* Printing orientation */ -#ifndef wxPORTRAIT -#define wxPORTRAIT 1 -#define wxLANDSCAPE 2 -#endif +enum wxPrintOrientation +{ + wxPORTRAIT = 1, + wxLANDSCAPE +}; /* Duplex printing modes */ diff --git a/include/wx/motif/dcprint.h b/include/wx/motif/dcprint.h index 1292a44ea1..b100108001 100644 --- a/include/wx/motif/dcprint.h +++ b/include/wx/motif/dcprint.h @@ -21,7 +21,7 @@ public: wxPrinterDCImpl(const wxString& driver, const wxString& device, const wxString& output, bool interactive = true, - int orientation = wxPORTRAIT); + wxPrintOrientation orientation = wxPORTRAIT); virtual ~wxPrinterDC(); wxRect GetPaperRect() const; diff --git a/include/wx/palmos/dcprint.h b/include/wx/palmos/dcprint.h index b0b7b6b28f..9ca3543630 100644 --- a/include/wx/palmos/dcprint.h +++ b/include/wx/palmos/dcprint.h @@ -21,7 +21,7 @@ class WXDLLIMPEXP_CORE wxPrinterDC : public wxDC { public: // Create a printer DC (obsolete function: use wxPrintData version now) - wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT); + wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, wxPrintOrientation orientation = wxPORTRAIT); // Create from print data wxPrinterDC(const wxPrintData& data); diff --git a/include/wx/x11/dcprint.h b/include/wx/x11/dcprint.h index cfb2809b07..c532a5faf1 100644 --- a/include/wx/x11/dcprint.h +++ b/include/wx/x11/dcprint.h @@ -20,7 +20,7 @@ public: DECLARE_CLASS(wxPrinterDC) // Create a printer DC - wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT); + wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, wxPrintOrientation orientation = wxPORTRAIT); virtual ~wxPrinterDC(); }; diff --git a/interface/wx/cmndata.h b/interface/wx/cmndata.h index 81c8a126b5..4f00278e74 100644 --- a/interface/wx/cmndata.h +++ b/interface/wx/cmndata.h @@ -567,7 +567,7 @@ public: /** Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT. */ - int GetOrientation() const; + wxPrintOrientation GetOrientation() const; /** Returns the paper size id. @@ -634,7 +634,7 @@ public: /** Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT. */ - void SetOrientation(int orientation); + void SetOrientation(wxPrintOrientation orientation); /** Sets the paper id. This indicates the type of paper to be used. For a diff --git a/interface/wx/defs.h b/interface/wx/defs.h index 4c8b47a5d6..a21ccaa248 100644 --- a/interface/wx/defs.h +++ b/interface/wx/defs.h @@ -778,6 +778,15 @@ enum wxPaperSize wxPAPER_PENV_10_ROTATED ///< PRC Envelope #10 Rotated 458 x 324 m }; +/** + Printing orientation +*/ + +enum wxPrintOrientation +{ + wxPORTRAIT, + wxLANDSCAPE +}; /** Duplex printing modes. diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index 16402f760e..9ca81119cb 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -83,7 +83,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_name, const wxString& file, bool interactive, - int orientation) + wxPrintOrientation orientation) { m_isInteractive = interactive; diff --git a/src/msw/printdlg.cpp b/src/msw/printdlg.cpp index 2d6717597a..205009999b 100644 --- a/src/msw/printdlg.cpp +++ b/src/msw/printdlg.cpp @@ -201,7 +201,7 @@ bool wxWindowsPrintNativeData::TransferTo( wxPrintData &data ) //// Orientation if (devMode->dmFields & DM_ORIENTATION) - data.SetOrientation( devMode->dmOrientation ); + data.SetOrientation( (wxPrintOrientation)devMode->dmOrientation ); //// Collation if (devMode->dmFields & DM_COLLATE) diff --git a/src/palmos/dcprint.cpp b/src/palmos/dcprint.cpp index 058a2d1fe3..e39bb02e60 100644 --- a/src/palmos/dcprint.cpp +++ b/src/palmos/dcprint.cpp @@ -62,7 +62,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_name, const wxString& file, bool interactive, - int orientation) + wxPrintOrientation orientation) { }