]> git.saurik.com Git - wxWidgets.git/blame - samples/docview/doc.h
fixed bug in mouse handling
[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$
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
22class DoodleLine: public wxObject
23{
f6bcfd97
BP
24public:
25 wxInt32 x1;
26 wxInt32 y1;
27 wxInt32 x2;
28 wxInt32 y2;
457814b5
JS
29};
30
31// Contains a list of lines: represents a mouse-down doodle
32class DoodleSegment: public wxObject
33{
f6bcfd97
BP
34public:
35 wxList lines;
36
37 DoodleSegment(void);
38 DoodleSegment(DoodleSegment& seg);
39 ~DoodleSegment(void);
40
41 void Draw(wxDC *dc);
56d7679d 42#if wxUSE_STD_IOSTREAM
f6bcfd97
BP
43 ostream& SaveObject(ostream& text_stream);
44 istream& LoadObject(istream& text_stream);
56d7679d 45#else
f6bcfd97
BP
46 wxOutputStream& SaveObject(wxOutputStream& stream);
47 wxInputStream& LoadObject(wxInputStream& stream);
56d7679d 48#endif
f6bcfd97 49
457814b5
JS
50};
51
52class DrawingDocument: public wxDocument
53{
f6bcfd97
BP
54 DECLARE_DYNAMIC_CLASS(DrawingDocument)
55private:
56public:
57 wxList doodleSegments;
58
59 DrawingDocument(void);
60 ~DrawingDocument(void);
61
56d7679d 62#if wxUSE_STD_IOSTREAM
f6bcfd97
BP
63 ostream& SaveObject(ostream& text_stream);
64 istream& LoadObject(istream& text_stream);
56d7679d 65#else
f6bcfd97
BP
66 wxOutputStream& SaveObject(wxOutputStream& stream);
67 wxInputStream& LoadObject(wxInputStream& stream);
56d7679d 68#endif
f6bcfd97
BP
69
70 inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; };
457814b5
JS
71};
72
73#define DOODLE_CUT 1
74#define DOODLE_ADD 2
75
76class DrawingCommand: public wxCommand
77{
f6bcfd97
BP
78protected:
79 DoodleSegment *segment;
80 DrawingDocument *doc;
81 int cmd;
82public:
83 DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg);
84 ~DrawingCommand(void);
85
86 bool Do(void);
87 bool Undo(void);
457814b5
JS
88};
89
90class TextEditDocument: public wxDocument
91{
f6bcfd97
BP
92 DECLARE_DYNAMIC_CLASS(TextEditDocument)
93private:
94public:
457814b5 95/*
f6bcfd97
BP
96ostream& SaveObject(ostream& stream);
97istream& LoadObject(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) {}
457814b5
JS
106};
107
108
109#endif