X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f37f49b652601744a8576d94568985cba49fc784..c29c95fe24973b94fd724db767193171ca7c513d:/samples/docview/doc.h diff --git a/samples/docview/doc.h b/samples/docview/doc.h index ecc1453a38..c654398222 100644 --- a/samples/docview/doc.h +++ b/samples/docview/doc.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_DOC_H_ @@ -166,7 +166,7 @@ class wxTextDocument : public wxDocument public: wxTextDocument() : wxDocument() { } - virtual bool OnCreate(const wxString& path, long flags); + virtual bool OnCreate(const wxString& path, long flags); virtual wxTextCtrl* GetTextCtrl() const = 0; @@ -198,33 +198,53 @@ public: }; // ---------------------------------------------------------------------------- -// A basic image document class +// Image and image details document classes (both are read-only for simplicity) // ---------------------------------------------------------------------------- -class wxImageDocument : public wxDocument +// This is a normal document containing an image, just like TextEditDocument +// above contains some text. It can be created from an image file on disk as +// usual. +class ImageDocument : public wxDocument { -protected: - wxImage m_image; public: - wxImageDocument(); + ImageDocument() : wxDocument() { } - wxImage* GetImage() { return &m_image; } - const wxImage& GetImage() const { return m_image; } + virtual bool OnOpenDocument(const wxString& file); - bool SaveFile(wxOutputStream*, wxBitmapType) const; + wxImage GetImage() const { return m_image; } +protected: + virtual bool DoOpenDocument(const wxString& file); + +private: + wxImage m_image; + + wxDECLARE_NO_COPY_CLASS(ImageDocument); + DECLARE_DYNAMIC_CLASS(ImageDocument) +}; + +// This is a child document of ImageDocument: this document doesn't +// correspond to any file on disk, it's part of ImageDocument and can't be +// instantiated independently of it. +class ImageDetailsDocument : public wxDocument +{ public: - virtual ~wxImageDocument(); - virtual bool DeleteContents(); + ImageDetailsDocument(ImageDocument *parent); - virtual bool DoOpenDocument(const wxString& file); - virtual bool DoSaveDocument(const wxString& file); + // accessors for ImageDetailsView + wxSize GetSize() const { return m_size; } + unsigned long GetNumColours() const { return m_numColours; } + wxBitmapType GetType() const { return m_type; } + bool HasAlpha() const { return m_hasAlpha; } - virtual bool DoOpenDocument(wxInputStream*); - virtual bool DoSaveDocument(wxOutputStream*) const; +private: + // some information about the image we choose to show to the user + wxSize m_size; + unsigned long m_numColours; + wxBitmapType m_type; + bool m_hasAlpha; - wxDECLARE_NO_COPY_CLASS(wxImageDocument); - DECLARE_DYNAMIC_CLASS(wxImageDocument) + wxDECLARE_NO_COPY_CLASS(ImageDetailsDocument); }; #endif // _WX_SAMPLES_DOCVIEW_DOC_H_