]> git.saurik.com Git - wxWidgets.git/blame - samples/docview/doc.h
CodeWarrior dislikes #include <> syntax for in-tree headers, prefer ""
[wxWidgets.git] / samples / docview / doc.h
CommitLineData
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
23class DoodleLine: public wxObject
24{
f6bcfd97
BP
25public:
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
33class DoodleSegment: public wxObject
34{
f6bcfd97
BP
35public:
36 wxList lines;
958d3a7e
WS
37
38 DoodleSegment(void){};
f6bcfd97
BP
39 DoodleSegment(DoodleSegment& seg);
40 ~DoodleSegment(void);
958d3a7e 41
f6bcfd97 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
958d3a7e 50
457814b5
JS
51};
52
53class DrawingDocument: public wxDocument
54{
f6bcfd97
BP
55 DECLARE_DYNAMIC_CLASS(DrawingDocument)
56private:
57public:
58 wxList doodleSegments;
958d3a7e
WS
59
60 DrawingDocument(void){};
f6bcfd97 61 ~DrawingDocument(void);
958d3a7e 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
958d3a7e 70
f6bcfd97 71 inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; };
457814b5
JS
72};
73
74#define DOODLE_CUT 1
75#define DOODLE_ADD 2
76
77class DrawingCommand: public wxCommand
78{
f6bcfd97
BP
79protected:
80 DoodleSegment *segment;
81 DrawingDocument *doc;
82 int cmd;
83public:
84 DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg);
85 ~DrawingCommand(void);
958d3a7e 86
f6bcfd97
BP
87 bool Do(void);
88 bool Undo(void);
457814b5
JS
89};
90
91class TextEditDocument: public wxDocument
92{
f6bcfd97
BP
93 DECLARE_DYNAMIC_CLASS(TextEditDocument)
94private:
95public:
457814b5 96/*
dd107c50
VZ
97wxSTD ostream& SaveObject(wxSTD ostream& stream);
98wxSTD 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);
958d3a7e 104
f6bcfd97
BP
105 TextEditDocument(void) {}
106 ~TextEditDocument(void) {}
457814b5
JS
107};
108
109
110#endif