]> git.saurik.com Git - wxWidgets.git/blame_incremental - samples/docvwmdi/doc.h
do *NOT* make the window of the size of its parent initially, fixes missing EVT_SIZE...
[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 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#include "wx/cmdproc.h"
21
22// Plots a line from one point to the other
23class DoodleLine: public wxObject
24{
25 public:
26 wxInt32 x1;
27 wxInt32 y1;
28 wxInt32 x2;
29 wxInt32 y2;
30};
31
32// Contains a list of lines: represents a mouse-down doodle
33class DoodleSegment: public wxObject
34{
35 public:
36 wxList lines;
37
38 DoodleSegment(void);
39 DoodleSegment(DoodleSegment& seg);
40 ~DoodleSegment(void);
41
42 void Draw(wxDC *dc);
43
44#if wxUSE_STD_IOSTREAM
45 wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
46 wxSTD istream& LoadObject(wxSTD istream& text_stream);
47#else
48 wxOutputStream& SaveObject(wxOutputStream& stream);
49 wxInputStream& LoadObject(wxInputStream& stream);
50#endif
51};
52
53class DrawingDocument: public wxDocument
54{
55 DECLARE_DYNAMIC_CLASS(DrawingDocument)
56 private:
57 public:
58 wxList doodleSegments;
59
60 DrawingDocument(void);
61 ~DrawingDocument(void);
62
63#if wxUSE_STD_IOSTREAM
64 wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
65 wxSTD istream& LoadObject(wxSTD istream& text_stream);
66#else
67 wxOutputStream& SaveObject(wxOutputStream& stream);
68 wxInputStream& LoadObject(wxInputStream& stream);
69#endif
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/*
97 wxSTD ostream& SaveObject(wxSTD ostream& stream);
98 wxSTD istream& LoadObject(wxSTD istream& stream);
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