]> git.saurik.com Git - wxWidgets.git/blame - samples/docvwmdi/doc.h
Rebake for 2.6.2
[wxWidgets.git] / samples / docvwmdi / doc.h
CommitLineData
2108f33a
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
2108f33a
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13// #pragma interface
14#endif
15
16#ifndef __DOCSAMPLEH__
17#define __DOCSAMPLEH__
18
19#include "wx/docview.h"
ff8b6290 20#include "wx/cmdproc.h"
2108f33a
JS
21
22// Plots a line from one point to the other
23class DoodleLine: public wxObject
24{
25 public:
23a54e14
RR
26 wxInt32 x1;
27 wxInt32 y1;
28 wxInt32 x2;
29 wxInt32 y2;
2108f33a
JS
30};
31
32// Contains a list of lines: represents a mouse-down doodle
33class DoodleSegment: public wxObject
34{
35 public:
36 wxList lines;
37
958d3a7e 38 DoodleSegment(void){};
2108f33a
JS
39 DoodleSegment(DoodleSegment& seg);
40 ~DoodleSegment(void);
41
42 void Draw(wxDC *dc);
958d3a7e 43
23a54e14 44#if wxUSE_STD_IOSTREAM
dd107c50
VZ
45 wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
46 wxSTD istream& LoadObject(wxSTD istream& text_stream);
23a54e14
RR
47#else
48 wxOutputStream& SaveObject(wxOutputStream& stream);
49 wxInputStream& LoadObject(wxInputStream& stream);
50#endif
2108f33a
JS
51};
52
53class DrawingDocument: public wxDocument
54{
55 DECLARE_DYNAMIC_CLASS(DrawingDocument)
56 private:
57 public:
58 wxList doodleSegments;
958d3a7e
WS
59
60 DrawingDocument(void){};
2108f33a
JS
61 ~DrawingDocument(void);
62
23a54e14 63#if wxUSE_STD_IOSTREAM
dd107c50
VZ
64 wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
65 wxSTD istream& LoadObject(wxSTD istream& text_stream);
23a54e14
RR
66#else
67 wxOutputStream& SaveObject(wxOutputStream& stream);
68 wxInputStream& LoadObject(wxInputStream& stream);
69#endif
2108f33a
JS
70
71 inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; };
72};
73
74#define DOODLE_CUT 1
75#define DOODLE_ADD 2
76
77class DrawingCommand: public wxCommand
78{
79 protected:
80 DoodleSegment *segment;
81 DrawingDocument *doc;
82 int cmd;
83 public:
84 DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg);
85 ~DrawingCommand(void);
86
87 bool Do(void);
88 bool Undo(void);
89};
90
91class TextEditDocument: public wxDocument
92{
93 DECLARE_DYNAMIC_CLASS(TextEditDocument)
94 private:
95 public:
96/*
dd107c50
VZ
97 wxSTD ostream& SaveObject(wxSTD ostream& stream);
98 wxSTD istream& LoadObject(wxSTD istream& stream);
2108f33a
JS
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 TextEditDocument(void) {}
106 ~TextEditDocument(void) {}
107};
108
109
110#endif