Mercurial > ~dholland > hg > ag > index.cgi
comparison anagram/vaclgui/frame.hpp @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 /* | |
2 * AnaGram, A System for Syntax Directed Programming | |
3 * Copyright 1997-2002 Parsifal Software. All Rights Reserved. | |
4 * See the file COPYING for license and usage terms. | |
5 * | |
6 * frame.hpp | |
7 */ | |
8 | |
9 #ifndef FRAME_HPP | |
10 #define FRAME_HPP | |
11 | |
12 #include <iaccel.hpp> | |
13 //#include <icanvas.hpp> | |
14 #include <iclipbrd.hpp> | |
15 #include <icmdevt.hpp> | |
16 #include <icmdhdr.hpp> | |
17 #include <iframe.hpp> | |
18 #include <iframhdr.hpp> | |
19 #include <ikeyevt.hpp> | |
20 #include <ikeyhdr.hpp> | |
21 #include <imousevt.hpp> | |
22 #include <imoushdr.hpp> | |
23 //#include <imphdr.hpp> | |
24 #include <ipopmenu.hpp> | |
25 #include <isizeevt.hpp> | |
26 #include <isizehdr.hpp> | |
27 //#include <isysmenu.hpp> | |
28 #include <ititle.hpp> | |
29 //#include <windows.h> | |
30 | |
31 #include "action.h" | |
32 #include "agarray.h" | |
33 #include "agstring.h" | |
34 #include "wdata.h" | |
35 #include "windowreg.h" | |
36 | |
37 | |
38 class AgFrame; | |
39 | |
40 class AgHelpHandler : public IHandler { | |
41 public: | |
42 AgHelpHandler &handleEventsFor(IWindow *control) { | |
43 //LOGSECTION("AgHelpHandler::attach"); | |
44 //LOGV((int) control); | |
45 IHandler::handleEventsFor(control); | |
46 return *this; | |
47 } | |
48 AgHelpHandler &stopHandlingEventsFor(IWindow *control) { | |
49 //LOGSECTION("AgHelpHandler::detach"); | |
50 //LOGV((int) control); | |
51 IHandler::stopHandlingEventsFor(control); | |
52 return *this; | |
53 } | |
54 Boolean dispatchHandlerEvent(IEvent &event); | |
55 | |
56 protected: | |
57 virtual Boolean showHelp(IEvent &event);// { return false; } | |
58 }; | |
59 | |
60 class AgUserHandler : public IHandler { | |
61 public: | |
62 AgUserHandler &handleEventsFor(IWindow *control) { | |
63 IHandler::handleEventsFor(control); | |
64 return *this; | |
65 } | |
66 AgUserHandler &stopHandlingEventsFor(IWindow *control) { | |
67 IHandler::stopHandlingEventsFor(control); | |
68 return *this; | |
69 } | |
70 Boolean dispatchHandlerEvent(IEvent &event); | |
71 }; | |
72 | |
73 class HelpDemon | |
74 : public AgHelpHandler | |
75 , public IMouseHandler | |
76 { | |
77 private: | |
78 IWindow *window; | |
79 AgString topic; | |
80 | |
81 public: | |
82 HelpDemon(IWindow *w) : window(w) {} | |
83 | |
84 HelpDemon(IWindow *w, AgString t); | |
85 ~HelpDemon(); | |
86 void setTopic(AgString t); | |
87 | |
88 protected: | |
89 virtual Boolean showHelp(IEvent &event); | |
90 virtual Boolean mouseClicked(IMouseClickEvent &event); | |
91 }; | |
92 | |
93 | |
94 | |
95 class AgFrameHandler : public IFrameHandler { | |
96 protected: | |
97 Boolean dispatchHandlerEvent(IEvent &event); | |
98 | |
99 public: | |
100 AgAction deactivateAction; | |
101 AgFrameHandler &setDeactivateAction(AgAction action) { | |
102 deactivateAction = action; | |
103 return *this; | |
104 } | |
105 virtual void onDeactivate() { | |
106 deactivateAction.performDeferred(); | |
107 } | |
108 | |
109 AgAction activateAction; | |
110 AgFrameHandler &setActivateAction(AgAction action) { | |
111 activateAction = action; | |
112 return *this; | |
113 } | |
114 virtual void onActivate() { | |
115 //LOGSECTION("AgFrameHandler::onActivate"); | |
116 activateAction.performDeferred(); | |
117 } | |
118 | |
119 Boolean activated(IFrameEvent &event); | |
120 Boolean deactivated(IFrameEvent &event); | |
121 AgFrameHandler() | |
122 : activateAction(actionObject(this, onActivate)) | |
123 , deactivateAction(actionObject(this, onDeactivate)) | |
124 {} | |
125 }; | |
126 | |
127 | |
128 class AgFrame | |
129 : public IFrameWindow | |
130 , public ICommandHandler | |
131 , public IResizeHandler | |
132 , public AgHelpHandler | |
133 , public IKeyboardHandler | |
134 { | |
135 public: | |
136 AgFrame(int); | |
137 AgFrame(); | |
138 AgFrame(Style); | |
139 virtual ~AgFrame(); | |
140 | |
141 virtual AgFrame &show(Boolean showWindow = true); | |
142 virtual AgFrame &setFocus(); | |
143 | |
144 virtual void popUp(); | |
145 virtual void disconnect() {} | |
146 | |
147 virtual void registerTitle(AgString); | |
148 static WindowRegistry windowRegistry; | |
149 static AgArray<AgMenuItem> activeAuxMenu; | |
150 static IPopUpMenu *activePopUpMenu; | |
151 virtual void closeFrame(); | |
152 AgAction closeAction; | |
153 | |
154 | |
155 AgUserHandler *userHandler; | |
156 AgFrameHandler *frameHandler; | |
157 virtual Boolean showHelp(IEvent &event); | |
158 | |
159 virtual AgFrame &positionFrame(); | |
160 | |
161 virtual unsigned getLineNumber() { return 0; } | |
162 virtual void setLineNumber(unsigned) {} | |
163 virtual Boolean findNext(AgString) { return false; } | |
164 virtual Boolean findPrev(AgString) { return false; } | |
165 virtual AgString copyTitle() { return AgString(); } | |
166 virtual AgFrame ©To(IClipboard &) { return *this; } | |
167 | |
168 | |
169 static int activeWindowCount; | |
170 static AgFrame *activeWindow; | |
171 static IWindow *frameParent; | |
172 static IWindow *frameOwner; | |
173 static int menuShowingFlag; | |
174 | |
175 AgString helpTopic; | |
176 void showHelpTopic(); | |
177 | |
178 protected: | |
179 Boolean command(ICommandEvent &event); | |
180 Boolean systemCommand(ICommandEvent &event); | |
181 Boolean windowResize(IResizeEvent &event); | |
182 Boolean characterKeyPress(IKeyboardEvent &event); | |
183 Boolean virtualKeyPress(IKeyboardEvent &event); | |
184 | |
185 public: | |
186 // Child Windows | |
187 ITitle windowTitle; | |
188 int activeFlag; | |
189 int activationFlag; | |
190 int helpCursorSupported; | |
191 | |
192 IPoint initialPosition; | |
193 | |
194 // Window parameters | |
195 int windowId; | |
196 | |
197 int syntaxDependent: 1; | |
198 IFrameWindow *modalDialog; | |
199 | |
200 virtual AgFrame &closeModalDialog() { | |
201 if (modalDialog) modalDialog->close(); | |
202 return *this; | |
203 } | |
204 AgFrame &close(); | |
205 virtual AgFrame &mySetFocus(); | |
206 IAccelerator accelerator; | |
207 }; | |
208 | |
209 class AgDialog | |
210 : public IFrameWindow | |
211 , public ICommandHandler | |
212 , public AgHelpHandler | |
213 { | |
214 public: | |
215 AgDialog(IWindow *); | |
216 virtual ~AgDialog(); | |
217 | |
218 virtual Boolean showHelp(IEvent &event); | |
219 Boolean systemCommand(ICommandEvent &event); | |
220 | |
221 public: | |
222 // Child Windows | |
223 ITitle windowTitle; | |
224 | |
225 // Window parameters | |
226 int windowId; | |
227 }; | |
228 | |
229 | |
230 #endif /* FRAME_HPP */ |