X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0c133e13b36a923c65f94499554e432bc3a0daa..fdb97de42b8a1491257566fb7bbd343916f1f2b8:/samples/docview/doc.h diff --git a/samples/docview/doc.h b/samples/docview/doc.h index 8365009d5c..ecc1453a38 100644 --- a/samples/docview/doc.h +++ b/samples/docview/doc.h @@ -16,6 +16,7 @@ #include "wx/docview.h" #include "wx/cmdproc.h" #include "wx/vector.h" +#include "wx/image.h" // This sample is written to build both with wxUSE_STD_IOSTREAM==0 and 1, which // somewhat complicates its code but is necessary in order to support building @@ -164,6 +165,9 @@ class wxTextDocument : public wxDocument { public: wxTextDocument() : wxDocument() { } + + virtual bool OnCreate(const wxString& path, long flags); + virtual wxTextCtrl* GetTextCtrl() const = 0; virtual bool IsModified() const; @@ -173,6 +177,8 @@ protected: virtual bool DoSaveDocument(const wxString& filename); virtual bool DoOpenDocument(const wxString& filename); + void OnTextChange(wxCommandEvent& event); + wxDECLARE_NO_COPY_CLASS(wxTextDocument); DECLARE_CLASS(wxTextDocument) }; @@ -191,4 +197,34 @@ public: DECLARE_DYNAMIC_CLASS(TextEditDocument) }; +// ---------------------------------------------------------------------------- +// A basic image document class +// ---------------------------------------------------------------------------- + +class wxImageDocument : public wxDocument +{ +protected: + wxImage m_image; +public: + wxImageDocument(); + + wxImage* GetImage() { return &m_image; } + const wxImage& GetImage() const { return m_image; } + + bool SaveFile(wxOutputStream*, wxBitmapType) const; + +public: + virtual ~wxImageDocument(); + virtual bool DeleteContents(); + + virtual bool DoOpenDocument(const wxString& file); + virtual bool DoSaveDocument(const wxString& file); + + virtual bool DoOpenDocument(wxInputStream*); + virtual bool DoSaveDocument(wxOutputStream*) const; + + wxDECLARE_NO_COPY_CLASS(wxImageDocument); + DECLARE_DYNAMIC_CLASS(wxImageDocument) +}; + #endif // _WX_SAMPLES_DOCVIEW_DOC_H_