]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow overriding print preview frame creation in docview.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 25 Mar 2010 20:07:58 +0000 (20:07 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 25 Mar 2010 20:07:58 +0000 (20:07 +0000)
Add a virtual wxDocManager::CreatePreviewFrame() which can be overridden to
customize the print preview used by docview framework.

Closes #11390.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/docview.h
interface/wx/docview.h
src/common/docview.cpp

index 1bfa022e3d877906dd3edf248cd53a5559ef055e..0092794978ca3ca824f620c984caeb39b00e372a 100644 (file)
@@ -498,6 +498,7 @@ All (GUI):
 - Show pages icons in window list menu in wxAuiNotebook (Ronny Krüger).
 - Add "initial selection" parameter to wxGetSingleChoice() (Nikolay Tjushkov).
 - Implement wxDocument::Revert() (troelsk).
+- Allow overriding print preview frame creation in docview (troelsk).
 
 GTK:
 
index bf9a54d35704b0061f2d0aa10d1f01afc912266b..f921f9b5040dd2da1c7ee22aa56b96c449255073 100644 (file)
@@ -478,6 +478,12 @@ public:
 #endif // WXWIN_COMPATIBILITY_2_6
 
 protected:
+#if wxUSE_PRINTING_ARCHITECTURE
+    virtual wxPreviewFrame* CreatePreviewFrame(wxPrintPreviewBase* preview,
+                                               wxWindow *parent,
+                                               const wxString& title);
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
     // hook the currently active view into event handlers chain here
     virtual bool TryBefore(wxEvent& event);
 
index e857d57304aa06f6278c5a38ed10fa4ade074531..d7f44487549250fba7b6bf5a58e285de34c17b2a 100644 (file)
@@ -516,6 +516,24 @@ public:
     */
     wxList& GetTemplates();
 
+    /**
+        Create the frame used for print preview.
+
+        This method can be overridden if you need to change the behaviour or
+        appearance of the preview window. By default, a standard wxPreviewFrame
+        is created.
+
+        @since 2.9.1
+
+        @param preview The associated preview object.
+        @param parent The parent window for the frame.
+        @param title The suggested title for the print preview frame.
+        @return A new print preview frame, must not return @NULL.
+    */
+    virtual wxPreviewFrame* CreatePreviewFrame(wxPrintPreviewBase* preview,
+                                               wxWindow* parent,
+                                               const wxString& title);
+
     /**
         Initializes data; currently just calls OnCreateFileHistory().
 
index 265a6e54a6ef09d18357b89dd9d70e639fff08dc..8350a4117f711d7650852aea408f2814769ebcf6 100644 (file)
@@ -1114,6 +1114,15 @@ void wxDocManager::OnPrint(wxCommandEvent& WXUNUSED(event))
 #endif // wxUSE_PRINTING_ARCHITECTURE
 }
 
+#if wxUSE_PRINTING_ARCHITECTURE
+wxPreviewFrame* wxDocManager::CreatePreviewFrame(wxPrintPreviewBase* preview,
+                                                 wxWindow *parent,
+                                                 const wxString& title)
+{
+    return new wxPreviewFrame(preview, parent, title);
+}
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
 void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event))
 {
 #if wxUSE_PRINTING_ARCHITECTURE
@@ -1135,9 +1144,11 @@ void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event))
             return;
         }
 
-        wxPreviewFrame *
-            frame = new wxPreviewFrame(preview, wxTheApp->GetTopWindow(),
-                                       _("Print Preview"));
+        wxPreviewFrame* frame = CreatePreviewFrame(preview,
+                                                   wxTheApp->GetTopWindow(),
+                                                   _("Print Preview"));
+        wxCHECK_RET( frame, "should create a print preview frame" );
+
         frame->Centre(wxBOTH);
         frame->Initialize();
         frame->Show(true);