]> git.saurik.com Git - wxWidgets.git/blob - samples/docvwmdi/doc.h
Applied wxImage::Scale() patch,
[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 wxInt32 x1;
26 wxInt32 y1;
27 wxInt32 x2;
28 wxInt32 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
43 #if wxUSE_STD_IOSTREAM
44 wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
45 wxSTD istream& LoadObject(wxSTD istream& text_stream);
46 #else
47 wxOutputStream& SaveObject(wxOutputStream& stream);
48 wxInputStream& LoadObject(wxInputStream& stream);
49 #endif
50 };
51
52 class DrawingDocument: public wxDocument
53 {
54 DECLARE_DYNAMIC_CLASS(DrawingDocument)
55 private:
56 public:
57 wxList doodleSegments;
58
59 DrawingDocument(void);
60 ~DrawingDocument(void);
61
62 #if wxUSE_STD_IOSTREAM
63 wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
64 wxSTD istream& LoadObject(wxSTD istream& text_stream);
65 #else
66 wxOutputStream& SaveObject(wxOutputStream& stream);
67 wxInputStream& LoadObject(wxInputStream& stream);
68 #endif
69
70 inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; };
71 };
72
73 #define DOODLE_CUT 1
74 #define DOODLE_ADD 2
75
76 class DrawingCommand: public wxCommand
77 {
78 protected:
79 DoodleSegment *segment;
80 DrawingDocument *doc;
81 int cmd;
82 public:
83 DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg);
84 ~DrawingCommand(void);
85
86 bool Do(void);
87 bool Undo(void);
88 };
89
90 class TextEditDocument: public wxDocument
91 {
92 DECLARE_DYNAMIC_CLASS(TextEditDocument)
93 private:
94 public:
95 /*
96 wxSTD ostream& SaveObject(wxSTD ostream& stream);
97 wxSTD istream& LoadObject(wxSTD istream& stream);
98 */
99 virtual bool OnSaveDocument(const wxString& filename);
100 virtual bool OnOpenDocument(const wxString& filename);
101 virtual bool IsModified(void) const;
102 virtual void Modify(bool mod);
103
104 TextEditDocument(void) {}
105 ~TextEditDocument(void) {}
106 };
107
108
109 #endif