]> git.saurik.com Git - wxWidgets.git/blob - samples/docvwmdi/doc.h
*** empty log message ***
[wxWidgets.git] / samples / docvwmdi / doc.h
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$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 // #pragma interface
14 #endif
15
16 #ifndef __DOCSAMPLEH__
17 #define __DOCSAMPLEH__
18
19 #include "wx/docview.h"
20
21 // Plots a line from one point to the other
22 class DoodleLine: public wxObject
23 {
24 public:
25 long x1;
26 long y1;
27 long x2;
28 long y2;
29 };
30
31 // Contains a list of lines: represents a mouse-down doodle
32 class DoodleSegment: public wxObject
33 {
34 public:
35 wxList lines;
36
37 DoodleSegment(void);
38 DoodleSegment(DoodleSegment& seg);
39 ~DoodleSegment(void);
40
41 void Draw(wxDC *dc);
42 ostream& SaveObject(ostream& stream);
43 istream& LoadObject(istream& stream);
44 };
45
46 class DrawingDocument: public wxDocument
47 {
48 DECLARE_DYNAMIC_CLASS(DrawingDocument)
49 private:
50 public:
51 wxList doodleSegments;
52
53 DrawingDocument(void);
54 ~DrawingDocument(void);
55
56 ostream& SaveObject(ostream& stream);
57 istream& LoadObject(istream& stream);
58
59 inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; };
60 };
61
62 #define DOODLE_CUT 1
63 #define DOODLE_ADD 2
64
65 class DrawingCommand: public wxCommand
66 {
67 protected:
68 DoodleSegment *segment;
69 DrawingDocument *doc;
70 int cmd;
71 public:
72 DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg);
73 ~DrawingCommand(void);
74
75 bool Do(void);
76 bool Undo(void);
77 };
78
79 class TextEditDocument: public wxDocument
80 {
81 DECLARE_DYNAMIC_CLASS(TextEditDocument)
82 private:
83 public:
84 /*
85 ostream& SaveObject(ostream& stream);
86 istream& LoadObject(istream& stream);
87 */
88 virtual bool OnSaveDocument(const wxString& filename);
89 virtual bool OnOpenDocument(const wxString& filename);
90 virtual bool IsModified(void) const;
91 virtual void Modify(bool mod);
92
93 TextEditDocument(void) {}
94 ~TextEditDocument(void) {}
95 };
96
97
98 #endif