]> git.saurik.com Git - wxWidgets.git/blob - samples/docvwmdi/doc.h
add wxSocket::IsClosed(), use it to implement Eof() in wxSocketStream
[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
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __DOC_H__
13 #define __DOC_H__
14
15 #include "wx/docview.h"
16 #include "wx/cmdproc.h"
17
18 // Plots a line from one point to the other
19 class DoodleLine: public wxObject
20 {
21 public:
22 wxInt32 x1;
23 wxInt32 y1;
24 wxInt32 x2;
25 wxInt32 y2;
26 };
27
28 // Contains a list of lines: represents a mouse-down doodle
29 class DoodleSegment: public wxObject
30 {
31 public:
32 wxList m_lines;
33
34 DoodleSegment() : wxObject() {}
35 DoodleSegment(const DoodleSegment&);
36 virtual ~DoodleSegment();
37
38 void Draw(wxDC* dc);
39
40 #if wxUSE_STD_IOSTREAM
41 wxSTD ostream& SaveObject(wxSTD ostream&);
42 wxSTD istream& LoadObject(wxSTD istream&);
43 #else
44 wxOutputStream& SaveObject(wxOutputStream&);
45 wxInputStream& LoadObject(wxInputStream&);
46 #endif
47 };
48
49 class DrawingDocument: public wxDocument
50 {
51 DECLARE_DYNAMIC_CLASS(DrawingDocument)
52 public:
53 wxList m_doodleSegments;
54
55 DrawingDocument() : wxDocument() {}
56 virtual ~DrawingDocument();
57
58 #if wxUSE_STD_IOSTREAM
59 wxSTD ostream& SaveObject(wxSTD ostream&);
60 wxSTD istream& LoadObject(wxSTD istream&);
61 #else
62 wxOutputStream& SaveObject(wxOutputStream&);
63 wxInputStream& LoadObject(wxInputStream&);
64 #endif
65
66 inline wxList& GetDoodleSegments() const { return (wxList&) m_doodleSegments; };
67 };
68
69 #define DOODLE_CUT 1
70 #define DOODLE_ADD 2
71
72 class DrawingCommand : public wxCommand
73 {
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();
84 };
85
86 class TextEditView;
87 class TextEditDocument : public wxDocument
88 {
89 DECLARE_DYNAMIC_CLASS(TextEditDocument)
90 public:
91 /*
92 wxSTD ostream& SaveObject(wxSTD ostream&);
93 wxSTD istream& LoadObject(wxSTD istream&);
94 */
95 TextEditView* GetFirstView() const;
96
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() {}
104 };
105
106
107 #endif