+namespace
+{
+
+// This is by the controls in the print preview as the maximal (and hence
+// longest) page number we may have to display.
+enum { MAX_PAGE_NUMBER = 99999 };
+
+} // anonymous namespace
+
+// ----------------------------------------------------------------------------
+// wxPrintPageMaxCtrl
+// ----------------------------------------------------------------------------
+
+// A simple static control showing the maximal number of pages.
+class wxPrintPageMaxCtrl : public wxStaticText
+{
+public:
+ wxPrintPageMaxCtrl(wxWindow *parent)
+ : wxStaticText(
+ parent,
+ wxID_ANY,
+ wxString(),
+ wxDefaultPosition,
+ wxSize
+ (
+ parent->GetTextExtent(MaxAsString(MAX_PAGE_NUMBER)).x,
+ wxDefaultCoord
+ ),
+ wxST_NO_AUTORESIZE | wxALIGN_CENTRE
+ )
+ {
+ }
+
+ // Set the maximal page to display once we really know what it is.
+ void SetMaxPage(int maxPage)
+ {
+ SetLabel(MaxAsString(maxPage));
+ }
+
+private:
+ static wxString MaxAsString(int maxPage)
+ {
+ return wxString::Format("/ %d", maxPage);
+ }
+
+ wxDECLARE_NO_COPY_CLASS(wxPrintPageMaxCtrl);
+};
+