-#if wxUSE_STD_IOSTREAM
- ostream& SaveObject(ostream& stream);
- istream& LoadObject(istream& stream);
-#else
- bool SaveObject(wxOutputStream& stream);
- bool LoadObject(wxInputStream& stream);
-#endif
-
- inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; };
+// The command for adding a new segment
+class DrawingAddSegmentCommand : public DrawingCommand
+{
+public:
+ DrawingAddSegmentCommand(DrawingDocument *doc, const DoodleSegment& segment)
+ : DrawingCommand(doc, "Add new segment", segment)
+ {
+ }
+
+ virtual bool Do() { return DoAdd(); }
+ virtual bool Undo() { return DoRemove(); }
+};
+
+// The command for removing the last segment
+class DrawingRemoveSegmentCommand : public DrawingCommand
+{
+public:
+ DrawingRemoveSegmentCommand(DrawingDocument *doc)
+ : DrawingCommand(doc, "Remove last segment")
+ {
+ }
+
+ virtual bool Do() { return DoRemove(); }
+ virtual bool Undo() { return DoAdd(); }
+};
+
+
+// ----------------------------------------------------------------------------
+// wxTextDocument: wxDocument and wxTextCtrl married
+// ----------------------------------------------------------------------------
+
+class wxTextDocument : public wxDocument
+{
+public:
+ wxTextDocument() : wxDocument() { }
+
+ virtual bool OnCreate(const wxString& path, long flags);
+
+ virtual wxTextCtrl* GetTextCtrl() const = 0;
+
+ virtual bool IsModified() const;
+ virtual void Modify(bool mod);
+
+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)