4e833bbee920baf543be4dce5979c21038f15f4f
[ctsim.git] / src / views.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          view.h
5 **   Purpose:       Header file for View & Canvas routines of CTSim program
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  July 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2000 Kevin Rosenberg
11 **
12 **  $Id: views.h,v 1.1 2000/07/13 07:01:59 kevin Exp $
13 **
14 **  This program is free software; you can redistribute it and/or modify
15 **  it under the terms of the GNU General Public License (version 2) as
16 **  published by the Free Software Foundation.
17 **
18 **  This program is distributed in the hope that it will be useful,
19 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 **  GNU General Public License for more details.
22 **
23 **  You should have received a copy of the GNU General Public License
24 **  along with this program; if not, write to the Free Software
25 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 ******************************************************************************/
27
28 #ifdef __GNUG__
29 // #pragma interface
30 #endif
31
32 #ifndef __VIEWSH__
33 #define __VIEWSH__
34
35 #include "wx/wx.h"
36 #include "imagefile.h"
37
38 class ImageFileCanvas;
39 class ImageFileView : public wxView
40 {
41     DECLARE_DYNAMIC_CLASS(ImageFileView)
42
43     wxMemoryDC m_memoryDC;
44     wxBitmap* m_pBitmap;
45
46 private:
47     ImageFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
48     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
49
50     ImageFileCanvas *m_canvas;
51     wxFrame *m_frame;
52     bool m_bMinSpecified;
53     bool m_bMaxSpecified;
54     double m_minPixel;
55     double m_maxPixel;
56
57     static bool m_bPColoursInitialized;
58     static wxColour* m_pColours[256];
59
60 public:
61     ImageFileView(void);
62     ~ImageFileView(void);
63
64     bool OnCreate(wxDocument *doc, long flags);
65     void OnDraw(wxDC* dc);
66     void OnUpdate(wxView *sender, wxObject *hint = NULL);
67     bool OnClose (bool deleteWindow = true);
68     void OnProperties (wxCommandEvent& event);
69
70     DECLARE_EVENT_TABLE()
71 };
72
73 class ImageFileCanvas: public wxScrolledWindow
74 {
75 public:
76     ImageFileView* m_pView;
77     
78     ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
79     virtual void OnDraw(wxDC& dc);
80     void OnMouseEvent(wxMouseEvent& event);
81
82     DECLARE_EVENT_TABLE()
83 };
84
85
86 class MyTextWindow: public wxTextCtrl
87 {
88 public:
89     wxView *m_pView;
90     
91     MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
92 };
93
94
95 class TextEditView: public wxView
96 {
97     DECLARE_DYNAMIC_CLASS(TextEditView)
98 private:
99     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
100
101 public:
102     wxFrame *frame;
103     MyTextWindow *textsw;
104     
105     TextEditView(): wxView() { frame = (wxFrame *) NULL; textsw = (MyTextWindow *) NULL; }
106     ~TextEditView(void) {}
107     
108     bool OnCreate(wxDocument *doc, long flags);
109     void OnDraw(wxDC* dc);
110     void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
111     bool OnClose(bool deleteWindow = TRUE);
112 };
113
114 class ProjectionFileCanvas;
115 class ProjectionFileView : public wxView
116 {
117     DECLARE_DYNAMIC_CLASS(ProjectionFileView)
118
119     wxMemoryDC m_memoryDC;
120     wxBitmap* m_pBitmap;
121
122 private:
123     ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
124     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
125
126     ProjectionFileCanvas *m_canvas;
127     wxFrame *m_frame;
128
129     static bool m_bPColoursInitialized;
130     static wxColour* m_pColours[256];
131
132 public:
133     ProjectionFileView(void);
134     ~ProjectionFileView(void);
135
136     bool OnCreate(wxDocument *doc, long flags);
137     void OnDraw(wxDC* dc);
138     void OnUpdate(wxView *sender, wxObject *hint = NULL);
139     bool OnClose (bool deleteWindow = true);
140     void OnProperties (wxCommandEvent& event);
141     void OnReconstruct (wxCommandEvent& event);
142
143     DECLARE_EVENT_TABLE()
144 };
145
146 class ProjectionFileCanvas: public wxScrolledWindow
147 {
148 public:
149     ProjectionFileView* m_pView;
150     
151     ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
152     virtual void OnDraw(wxDC& dc);
153 };
154
155
156 #endif