]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/docview/view.h
Also reset DatePicker property editor's global pointer (fixes #11787)
[wxWidgets.git] / samples / docview / view.h
index c7209f28fae2e624c7559adca6e76a7eb10744e8..8018ee429b5ae7f0c7f54c59f56b8af3859b7dbc 100644 (file)
@@ -7,7 +7,7 @@
 // RCS-ID:      $Id$
 // Copyright:   (c) 1998 Julian Smart
 //              (c) 2008 Vadim Zeitlin
 // RCS-ID:      $Id$
 // Copyright:   (c) 1998 Julian Smart
 //              (c) 2008 Vadim Zeitlin
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_SAMPLES_DOCVIEW_VIEW_H_
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_SAMPLES_DOCVIEW_VIEW_H_
@@ -114,4 +114,61 @@ private:
     DECLARE_DYNAMIC_CLASS(TextEditView)
 };
 
     DECLARE_DYNAMIC_CLASS(TextEditView)
 };
 
+// ----------------------------------------------------------------------------
+// ImageCanvas
+// ----------------------------------------------------------------------------
+
+class ImageCanvas : public wxScrolledWindow
+{
+public:
+    ImageCanvas(wxView*, wxWindow* parent);
+
+    virtual void OnDraw(wxDC& dc);
+
+    // in a normal multiple document application a canvas is associated with
+    // one view from the beginning until the end, but to support the single
+    // document mode in which all documents reuse the same MyApp::GetCanvas()
+    // we need to allow switching the canvas from one view to another one
+
+    void SetView(wxView* view)
+    {
+        wxASSERT_MSG( !m_view, "shouldn't be already associated with a view" );
+
+        m_view = view;
+    }
+
+    void ResetView()
+    {
+        wxASSERT_MSG( m_view, "should be associated with a view" );
+
+        m_view = NULL;
+    }
+
+private:
+    wxView *m_view;
+};
+
+// ----------------------------------------------------------------------------
+// ImageView
+// ----------------------------------------------------------------------------
+
+class ImageView : public wxView
+{
+public:
+    ImageView() : wxView(), m_frame(NULL) {}
+
+    virtual bool OnCreate(wxDocument*, long flags);
+    virtual void OnDraw(wxDC*);
+    virtual bool OnClose(bool deleteWindow = true);
+    virtual void OnUpdate(wxView *sender, wxObject *hint = NULL);
+
+    ImageDocument* GetDocument();
+
+private:
+    wxFrame* m_frame;
+    ImageCanvas* m_canvas;
+
+    DECLARE_DYNAMIC_CLASS(ImageView)
+};
+
 #endif // _WX_SAMPLES_DOCVIEW_VIEW_H_
 #endif // _WX_SAMPLES_DOCVIEW_VIEW_H_