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