]>
Commit | Line | Data |
---|---|---|
2108f33a JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: doc.h | |
3 | // Purpose: Document classes | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
6aa89a22 | 8 | // Copyright: (c) Julian Smart |
2f6c54eb | 9 | // Licence: wxWindows license |
2108f33a JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
6bdf5153 VZ |
12 | #ifndef __DOC_H__ |
13 | #define __DOC_H__ | |
2108f33a JS |
14 | |
15 | #include "wx/docview.h" | |
ff8b6290 | 16 | #include "wx/cmdproc.h" |
2108f33a JS |
17 | |
18 | // Plots a line from one point to the other | |
19 | class DoodleLine: public wxObject | |
20 | { | |
6bdf5153 VZ |
21 | public: |
22 | wxInt32 x1; | |
23 | wxInt32 y1; | |
24 | wxInt32 x2; | |
25 | wxInt32 y2; | |
2108f33a JS |
26 | }; |
27 | ||
28 | // Contains a list of lines: represents a mouse-down doodle | |
29 | class DoodleSegment: public wxObject | |
30 | { | |
6bdf5153 VZ |
31 | public: |
32 | wxList m_lines; | |
2108f33a | 33 | |
6bdf5153 VZ |
34 | DoodleSegment() : wxObject() {} |
35 | DoodleSegment(const DoodleSegment&); | |
36 | virtual ~DoodleSegment(); | |
2108f33a | 37 | |
6bdf5153 | 38 | void Draw(wxDC* dc); |
958d3a7e | 39 | |
23a54e14 | 40 | #if wxUSE_STD_IOSTREAM |
6bdf5153 VZ |
41 | wxSTD ostream& SaveObject(wxSTD ostream&); |
42 | wxSTD istream& LoadObject(wxSTD istream&); | |
23a54e14 | 43 | #else |
6bdf5153 VZ |
44 | wxOutputStream& SaveObject(wxOutputStream&); |
45 | wxInputStream& LoadObject(wxInputStream&); | |
23a54e14 | 46 | #endif |
2108f33a JS |
47 | }; |
48 | ||
49 | class DrawingDocument: public wxDocument | |
50 | { | |
6bdf5153 VZ |
51 | DECLARE_DYNAMIC_CLASS(DrawingDocument) |
52 | public: | |
53 | wxList m_doodleSegments; | |
958d3a7e | 54 | |
6bdf5153 VZ |
55 | DrawingDocument() : wxDocument() {} |
56 | virtual ~DrawingDocument(); | |
2108f33a | 57 | |
23a54e14 | 58 | #if wxUSE_STD_IOSTREAM |
6bdf5153 VZ |
59 | wxSTD ostream& SaveObject(wxSTD ostream&); |
60 | wxSTD istream& LoadObject(wxSTD istream&); | |
23a54e14 | 61 | #else |
6bdf5153 VZ |
62 | wxOutputStream& SaveObject(wxOutputStream&); |
63 | wxInputStream& LoadObject(wxInputStream&); | |
23a54e14 | 64 | #endif |
2108f33a | 65 | |
6bdf5153 | 66 | inline wxList& GetDoodleSegments() const { return (wxList&) m_doodleSegments; }; |
2108f33a JS |
67 | }; |
68 | ||
69 | #define DOODLE_CUT 1 | |
70 | #define DOODLE_ADD 2 | |
71 | ||
6bdf5153 | 72 | class DrawingCommand : public wxCommand |
2108f33a | 73 | { |
6bdf5153 VZ |
74 | protected: |
75 | DoodleSegment* m_segment; | |
76 | DrawingDocument* m_doc; | |
77 | int m_cmd; | |
78 | public: | |
79 | DrawingCommand(const wxString& name, int cmd, DrawingDocument*, DoodleSegment*); | |
80 | virtual ~DrawingCommand(); | |
81 | ||
82 | bool Do(); | |
83 | bool Undo(); | |
2108f33a JS |
84 | }; |
85 | ||
6bdf5153 VZ |
86 | class TextEditView; |
87 | class TextEditDocument : public wxDocument | |
2108f33a JS |
88 | { |
89 | DECLARE_DYNAMIC_CLASS(TextEditDocument) | |
6bdf5153 | 90 | public: |
2108f33a | 91 | /* |
6bdf5153 VZ |
92 | wxSTD ostream& SaveObject(wxSTD ostream&); |
93 | wxSTD istream& LoadObject(wxSTD istream&); | |
2108f33a | 94 | */ |
6bdf5153 | 95 | TextEditView* GetFirstView() const; |
2108f33a | 96 | |
6bdf5153 VZ |
97 | virtual bool OnSaveDocument(const wxString& filename); |
98 | virtual bool OnOpenDocument(const wxString& filename); | |
99 | virtual bool IsModified() const; | |
100 | virtual void Modify(bool mod); | |
101 | ||
102 | TextEditDocument() {} | |
103 | virtual ~TextEditDocument() {} | |
2108f33a JS |
104 | }; |
105 | ||
106 | ||
107 | #endif |