Set page range in the print preview correctly.

The valid pages range was set too early before, we need to postpone it until
after the OnPreparePrinting() call of the user-defined wxPrintout object as
only it can determine the number of pages (after running the pagination
algorithm) in general.

Set the pages range during the first call to RenderPageIntoDC() to fix this.

Also add wxPrintPageMaxCtrl class for symmetry with the existing
wxPrintPageTextCtrl and use a shared constant MAX_PAGE_NUMBER instead of hard
coded 99999. Slightly improve the layout of wxPrintPageMaxCtrl too.

Closes #12965.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67580 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-04-23 10:49:48 +00:00
parent a78d2fbab1
commit d7cfeeb49c
2 changed files with 110 additions and 31 deletions

View File

@@ -40,6 +40,7 @@ class WXDLLIMPEXP_FWD_CORE wxPreviewFrame;
class WXDLLIMPEXP_FWD_CORE wxPrintFactory;
class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase;
class WXDLLIMPEXP_FWD_CORE wxPrintPreview;
class wxPrintPageMaxCtrl;
class wxPrintPageTextCtrl;
//----------------------------------------------------------------------------
@@ -453,6 +454,7 @@ public:
virtual ~wxPreviewControlBar();
virtual void CreateButtons();
virtual void SetPageInfo(int minPage, int maxPage);
virtual void SetZoomControl(int zoom);
virtual int GetZoomControl();
virtual wxPrintPreviewBase *GetPrintPreview() const
@@ -496,7 +498,8 @@ protected:
wxPrintPreviewBase* m_printPreview;
wxButton* m_closeButton;
wxChoice* m_zoomControl;
wxPrintPageTextCtrl* m_currentPageText;
wxPrintPageTextCtrl* m_currentPageText;
wxPrintPageMaxCtrl* m_maxPageText;
long m_buttonFlags;