]> git.saurik.com Git - wxWidgets.git/blame_incremental - samples/docvwmdi/doc.h
2.8.0
[wxWidgets.git] / samples / docvwmdi / doc.h
... / ...
CommitLineData
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 __DOCSAMPLEH__
13#define __DOCSAMPLEH__
14
15#include "wx/docview.h"
16#include "wx/cmdproc.h"
17
18// Plots a line from one point to the other
19class 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
29class DoodleSegment: public wxObject
30{
31 public:
32 wxList lines;
33
34 DoodleSegment(void){};
35 DoodleSegment(const DoodleSegment& seg);
36 ~DoodleSegment(void);
37
38 void Draw(wxDC *dc);
39
40#if wxUSE_STD_IOSTREAM
41 wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
42 wxSTD istream& LoadObject(wxSTD istream& text_stream);
43#else
44 wxOutputStream& SaveObject(wxOutputStream& stream);
45 wxInputStream& LoadObject(wxInputStream& stream);
46#endif
47};
48
49class DrawingDocument: public wxDocument
50{
51 DECLARE_DYNAMIC_CLASS(DrawingDocument)
52 private:
53 public:
54 wxList doodleSegments;
55
56 DrawingDocument(void){};
57 ~DrawingDocument(void);
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(void) const { return (wxList&) doodleSegments; };
68};
69
70#define DOODLE_CUT 1
71#define DOODLE_ADD 2
72
73class DrawingCommand: public wxCommand
74{
75 protected:
76 DoodleSegment *segment;
77 DrawingDocument *doc;
78 int cmd;
79 public:
80 DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg);
81 ~DrawingCommand(void);
82
83 bool Do(void);
84 bool Undo(void);
85};
86
87class TextEditDocument: public wxDocument
88{
89 DECLARE_DYNAMIC_CLASS(TextEditDocument)
90 private:
91 public:
92/*
93 wxSTD ostream& SaveObject(wxSTD ostream& stream);
94 wxSTD istream& LoadObject(wxSTD istream& stream);
95*/
96 virtual bool OnSaveDocument(const wxString& filename);
97 virtual bool OnOpenDocument(const wxString& filename);
98 virtual bool IsModified(void) const;
99 virtual void Modify(bool mod);
100
101 TextEditDocument(void) {}
102 ~TextEditDocument(void) {}
103};
104
105
106#endif