]> git.saurik.com Git - wxWidgets.git/blame - samples/docview/doc.h
custom info.plist with supported document types
[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
6bdf5153
VZ
12#ifndef __DOC_H__
13#define __DOC_H__
457814b5
JS
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
6bdf5153 19class DoodleLine : public wxObject
457814b5 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
6bdf5153 29class DoodleSegment : public wxObject
457814b5 30{
f6bcfd97 31public:
6bdf5153 32 wxList m_lines;
958d3a7e 33
6bdf5153 34 DoodleSegment() : wxObject() {}
fbfb8bcc 35 DoodleSegment(const DoodleSegment& seg);
6bdf5153 36 virtual ~DoodleSegment();
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
6bdf5153 49class DrawingDocument : public wxDocument
457814b5 50{
f6bcfd97
BP
51 DECLARE_DYNAMIC_CLASS(DrawingDocument)
52private:
53public:
6bdf5153 54 wxList m_doodleSegments;
958d3a7e 55
6bdf5153
VZ
56 DrawingDocument() : wxDocument() {}
57 virtual ~DrawingDocument();
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
6bdf5153 67 inline wxList& GetDoodleSegments() const { return (wxList&) m_doodleSegments; };
457814b5
JS
68};
69
70#define DOODLE_CUT 1
71#define DOODLE_ADD 2
72
6bdf5153 73class DrawingCommand : public wxCommand
457814b5 74{
f6bcfd97 75protected:
6bdf5153
VZ
76 DoodleSegment* m_segment;
77 DrawingDocument* m_doc;
78 int m_cmd;
f6bcfd97 79public:
6bdf5153
VZ
80 DrawingCommand(const wxString& name, int cmd, DrawingDocument*, DoodleSegment*);
81 virtual ~DrawingCommand();
958d3a7e 82
f6bcfd97
BP
83 bool Do(void);
84 bool Undo(void);
457814b5
JS
85};
86
6bdf5153
VZ
87class TextEditView;
88class TextEditDocument : public wxDocument
457814b5 89{
f6bcfd97 90 DECLARE_DYNAMIC_CLASS(TextEditDocument)
f6bcfd97 91public:
6bdf5153
VZ
92 TextEditDocument() : wxDocument() {}
93 virtual ~TextEditDocument() {}
457814b5 94/*
6bdf5153
VZ
95 wxSTD ostream& SaveObject(wxSTD ostream&);
96 wxSTD istream& LoadObject(wxSTD istream&);
97*/
98 TextEditView* GetFirstView() const;
99
f6bcfd97
BP
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);
457814b5
JS
104};
105
106
107#endif