X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f37f49b652601744a8576d94568985cba49fc784..3717eeaf39f7145ab6d09a326dedb2c09b1219e8:/samples/docview/view.h diff --git a/samples/docview/view.h b/samples/docview/view.h index f2df562f7f..3ba84d8847 100644 --- a/samples/docview/view.h +++ b/samples/docview/view.h @@ -7,7 +7,7 @@ // RCS-ID: $Id$ // Copyright: (c) 1998 Julian Smart // (c) 2008 Vadim Zeitlin -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SAMPLES_DOCVIEW_VIEW_H_ @@ -25,7 +25,7 @@ class MyCanvas : public wxScrolledWindow public: // view may be NULL if we're not associated with one yet, but parent must // be a valid pointer - MyCanvas(wxView *view, wxWindow *parent); + MyCanvas(wxView *view, wxWindow *parent = NULL); virtual ~MyCanvas(); virtual void OnDraw(wxDC& dc); @@ -67,7 +67,7 @@ private: class DrawingView : public wxView { public: - DrawingView() { m_canvas = NULL; m_frame = NULL; } + DrawingView() : wxView(), m_canvas(NULL) {} virtual bool OnCreate(wxDocument *doc, long flags); virtual void OnDraw(wxDC *dc); @@ -79,7 +79,6 @@ public: private: void OnCut(wxCommandEvent& event); - wxFrame *m_frame; MyCanvas *m_canvas; DECLARE_EVENT_TABLE() @@ -94,7 +93,7 @@ private: class TextEditView : public wxView { public: - TextEditView() : wxView() { m_frame = NULL; m_text = NULL; } + TextEditView() : wxView(), m_text(NULL) {} virtual bool OnCreate(wxDocument *doc, long flags); virtual void OnDraw(wxDC *dc); @@ -107,7 +106,6 @@ private: void OnPaste(wxCommandEvent& WXUNUSED(event)) { m_text->Paste(); } void OnSelectAll(wxCommandEvent& WXUNUSED(event)) { m_text->SelectAll(); } - wxFrame *m_frame; wxTextCtrl *m_text; DECLARE_EVENT_TABLE() @@ -115,64 +113,57 @@ private: }; // ---------------------------------------------------------------------------- -// wxImageCanvas +// ImageCanvas // ---------------------------------------------------------------------------- -class wxImageCanvas : public wxScrolledWindow +class ImageCanvas : public wxScrolledWindow { public: - wxImageCanvas(wxView*, wxWindow* parent); + ImageCanvas(wxView*); 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; - } - -protected: +private: wxView *m_view; - - DECLARE_EVENT_TABLE() }; // ---------------------------------------------------------------------------- -// wxImageView +// ImageView // ---------------------------------------------------------------------------- -class wxImageDocument; -class wxImageView : public wxView +class ImageView : public wxView { public: - wxImageView() : wxView(), m_frame(NULL) {} + ImageView() : wxView() {} virtual bool OnCreate(wxDocument*, long flags); virtual void OnDraw(wxDC*); virtual bool OnClose(bool deleteWindow = true); virtual void OnUpdate(wxView *sender, wxObject *hint = NULL); - wxImageDocument* GetDocument(); + ImageDocument* GetDocument(); + +private: + ImageCanvas* m_canvas; -protected: - wxFrame* m_frame; - wxImageCanvas* m_canvas; + DECLARE_DYNAMIC_CLASS(ImageView) +}; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxImageView) +// ---------------------------------------------------------------------------- +// ImageDetailsView +// ---------------------------------------------------------------------------- + +class ImageDetailsView : public wxView +{ +public: + ImageDetailsView(ImageDetailsDocument *doc); + + virtual void OnDraw(wxDC *dc); + virtual bool OnClose(bool deleteWindow); + +private: + wxFrame *m_frame; + + wxDECLARE_NO_COPY_CLASS(ImageDetailsView); }; #endif // _WX_SAMPLES_DOCVIEW_VIEW_H_