]> git.saurik.com Git - wxWidgets.git/blob - samples/docview/doc.h
check that string passed to FromUTF8() is valid even in release build, this is safer...
[wxWidgets.git] / samples / docview / 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& seg);
36 virtual ~DoodleSegment();
37
38 void Draw(wxDC *dc);
39 #if wxUSE_STD_IOSTREAM
40 wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
41 wxSTD istream& LoadObject(wxSTD istream& text_stream);
42 #else
43 wxOutputStream& SaveObject(wxOutputStream& stream);
44 wxInputStream& LoadObject(wxInputStream& stream);
45 #endif
46
47 };
48
49 class DrawingDocument : public wxDocument
50 {
51 DECLARE_DYNAMIC_CLASS(DrawingDocument)
52 private:
53 public:
54 wxList m_doodleSegments;
55
56 DrawingDocument() : wxDocument() {}
57 virtual ~DrawingDocument();
58
59 #if wxUSE_STD_IOSTREAM
60 wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
61 wxSTD istream& LoadObject(wxSTD istream& text_stream);
62 #else
63 wxOutputStream& SaveObject(wxOutputStream& stream);
64 wxInputStream& LoadObject(wxInputStream& stream);
65 #endif
66
67 inline wxList& GetDoodleSegments() const { return (wxList&) m_doodleSegments; };
68 };
69
70 #define DOODLE_CUT 1
71 #define DOODLE_ADD 2
72
73 class DrawingCommand : public wxCommand
74 {
75 protected:
76 DoodleSegment* m_segment;
77 DrawingDocument* m_doc;
78 int m_cmd;
79 public:
80 DrawingCommand(const wxString& name, int cmd, DrawingDocument*, DoodleSegment*);
81 virtual ~DrawingCommand();
82
83 bool Do(void);
84 bool Undo(void);
85 };
86
87 class TextEditView;
88 class TextEditDocument : public wxDocument
89 {
90 DECLARE_DYNAMIC_CLASS(TextEditDocument)
91 public:
92 TextEditDocument() : wxDocument() {}
93 virtual ~TextEditDocument() {}
94 /*
95 wxSTD ostream& SaveObject(wxSTD ostream&);
96 wxSTD istream& LoadObject(wxSTD istream&);
97 */
98 TextEditView* GetFirstView() const;
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
106
107 #endif