]>
Commit | Line | Data |
---|---|---|
457814b5 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 |
457814b5 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifdef __GNUG__ | |
13 | // #pragma interface | |
14 | #endif | |
15 | ||
16 | #ifndef __DOCSAMPLEH__ | |
17 | #define __DOCSAMPLEH__ | |
18 | ||
19 | #include "wx/docview.h" | |
606b005f | 20 | #include "wx/cmdproc.h" |
457814b5 JS |
21 | |
22 | // Plots a line from one point to the other | |
23 | class DoodleLine: public wxObject | |
24 | { | |
f6bcfd97 BP |
25 | public: |
26 | wxInt32 x1; | |
27 | wxInt32 y1; | |
28 | wxInt32 x2; | |
29 | wxInt32 y2; | |
457814b5 JS |
30 | }; |
31 | ||
32 | // Contains a list of lines: represents a mouse-down doodle | |
33 | class DoodleSegment: public wxObject | |
34 | { | |
f6bcfd97 BP |
35 | public: |
36 | wxList lines; | |
37 | ||
38 | DoodleSegment(void); | |
39 | DoodleSegment(DoodleSegment& seg); | |
40 | ~DoodleSegment(void); | |
41 | ||
42 | void Draw(wxDC *dc); | |
56d7679d | 43 | #if wxUSE_STD_IOSTREAM |
dd107c50 VZ |
44 | wxSTD ostream& SaveObject(wxSTD ostream& text_stream); |
45 | wxSTD istream& LoadObject(wxSTD istream& text_stream); | |
56d7679d | 46 | #else |
f6bcfd97 BP |
47 | wxOutputStream& SaveObject(wxOutputStream& stream); |
48 | wxInputStream& LoadObject(wxInputStream& stream); | |
56d7679d | 49 | #endif |
f6bcfd97 | 50 | |
457814b5 JS |
51 | }; |
52 | ||
53 | class DrawingDocument: public wxDocument | |
54 | { | |
f6bcfd97 BP |
55 | DECLARE_DYNAMIC_CLASS(DrawingDocument) |
56 | private: | |
57 | public: | |
58 | wxList doodleSegments; | |
59 | ||
60 | DrawingDocument(void); | |
61 | ~DrawingDocument(void); | |
62 | ||
56d7679d | 63 | #if wxUSE_STD_IOSTREAM |
dd107c50 VZ |
64 | wxSTD ostream& SaveObject(wxSTD ostream& text_stream); |
65 | wxSTD istream& LoadObject(wxSTD istream& text_stream); | |
56d7679d | 66 | #else |
f6bcfd97 BP |
67 | wxOutputStream& SaveObject(wxOutputStream& stream); |
68 | wxInputStream& LoadObject(wxInputStream& stream); | |
56d7679d | 69 | #endif |
f6bcfd97 BP |
70 | |
71 | inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; }; | |
457814b5 JS |
72 | }; |
73 | ||
74 | #define DOODLE_CUT 1 | |
75 | #define DOODLE_ADD 2 | |
76 | ||
77 | class DrawingCommand: public wxCommand | |
78 | { | |
f6bcfd97 BP |
79 | protected: |
80 | DoodleSegment *segment; | |
81 | DrawingDocument *doc; | |
82 | int cmd; | |
83 | public: | |
84 | DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg); | |
85 | ~DrawingCommand(void); | |
86 | ||
87 | bool Do(void); | |
88 | bool Undo(void); | |
457814b5 JS |
89 | }; |
90 | ||
91 | class TextEditDocument: public wxDocument | |
92 | { | |
f6bcfd97 BP |
93 | DECLARE_DYNAMIC_CLASS(TextEditDocument) |
94 | private: | |
95 | public: | |
457814b5 | 96 | /* |
dd107c50 VZ |
97 | wxSTD ostream& SaveObject(wxSTD ostream& stream); |
98 | wxSTD istream& LoadObject(wxSTD istream& stream); | |
f6bcfd97 BP |
99 | */ |
100 | virtual bool OnSaveDocument(const wxString& filename); | |
101 | virtual bool OnOpenDocument(const wxString& filename); | |
102 | virtual bool IsModified(void) const; | |
103 | virtual void Modify(bool mod); | |
104 | ||
105 | TextEditDocument(void) {} | |
106 | ~TextEditDocument(void) {} | |
457814b5 JS |
107 | }; |
108 | ||
109 | ||
110 | #endif |