]>
Commit | Line | Data |
---|---|---|
d9b91de7 KB |
1 | /**************************************************************************** |
2 | * | |
67fc151d | 3 | * wxWindows HTML Applet Package |
d9b91de7 KB |
4 | * |
5 | * Copyright (C) 1991-2001 SciTech Software, Inc. | |
6 | * All rights reserved. | |
7 | * | |
d699f48b KB |
8 | * ====================================================================== |
9 | * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW| | |
10 | * | | | |
11 | * |This copyrighted computer code is a proprietary trade secret of | | |
12 | * |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 | | |
13 | * |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, | | |
14 | * |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS | | |
15 | * |STRICTLY PROHIBITED BY LAW. Unless you have current, express | | |
16 | * |written authorization from SciTech to possess or use this code, you | | |
17 | * |may be subject to civil and/or criminal penalties. | | |
18 | * | | | |
19 | * |If you received this code in error or you would like to report | | |
20 | * |improper use, please immediately contact SciTech Software, Inc. at | | |
21 | * |530-894-8400. | | |
22 | * | | | |
23 | * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW| | |
24 | * ====================================================================== | |
d9b91de7 | 25 | * |
67fc151d KB |
26 | * Language: ANSI C++ |
27 | * Environment: Any | |
d9b91de7 KB |
28 | * |
29 | * Description: Header file for the wxHtmlAppletWindow class | |
30 | * | |
31 | ****************************************************************************/ | |
32 | ||
33 | #ifndef __WX_APPLET_WINDOW_H | |
34 | #define __WX_APPLET_WINDOW_H | |
35 | ||
36 | #include "wx/html/htmlwin.h" | |
d699f48b | 37 | #include "wx/process.h" |
d9b91de7 | 38 | |
38caaa61 KB |
39 | // Forward declare |
40 | class wxApplet; | |
505710ca | 41 | class wxQlet; |
38caaa61 KB |
42 | class wxLoadPageEvent; |
43 | class wxPageLoadedEvent; | |
44 | class wxIncludePrep; | |
3a922bb4 | 45 | class wxToolBarBase; |
d9b91de7 KB |
46 | |
47 | // Declare a linked list of wxApplet pointers | |
d9b91de7 KB |
48 | WX_DECLARE_LIST(wxApplet, wxAppletList); |
49 | ||
38caaa61 KB |
50 | /*--------------------------- Class Definitions ---------------------------*/ |
51 | ||
d9b91de7 | 52 | /**************************************************************************** |
38caaa61 KB |
53 | REMARKS: |
54 | Defines the class for virtual-link data types | |
55 | ****************************************************************************/ | |
56 | class VirtualData : public wxObject { | |
57 | private: | |
58 | wxString m_name; | |
59 | wxString m_group; | |
60 | wxString m_href; | |
d9b91de7 | 61 | |
38caaa61 KB |
62 | public: |
63 | // Ctors | |
64 | VirtualData( | |
65 | wxString& name, | |
66 | wxString& group, | |
67 | wxString& href ); | |
68 | ||
69 | // Gets | |
70 | wxString GetName(){ return m_name;}; | |
71 | wxString GetGroup(){ return m_group;}; | |
72 | wxString GetHref(){ return m_href;}; | |
73 | ||
74 | // Sets | |
75 | void SetName (wxString& s){ m_name = s; }; | |
76 | void SetGroup(wxString& s){ m_group = s; }; | |
77 | void SetHref (wxString& s){ m_href = s; }; | |
78 | }; | |
79 | ||
80 | /**************************************************************************** | |
d9b91de7 KB |
81 | REMARKS: |
82 | Defines the class for wxAppletWindow. This class is derived from the | |
83 | wxHtmlWindow class and extends it with functionality to handle embedded | |
84 | wxApplet's on the HTML pages. | |
85 | ****************************************************************************/ | |
86 | class wxHtmlAppletWindow : public wxHtmlWindow { | |
87 | private: | |
88 | DECLARE_CLASS(wxHtmlAppletWindow); | |
89 | DECLARE_EVENT_TABLE(); | |
38caaa61 | 90 | |
716cd410 | 91 | bool m_mutexLock; |
38caaa61 | 92 | wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor |
d9b91de7 | 93 | protected: |
38caaa61 KB |
94 | wxAppletList m_AppletList; |
95 | static wxHashTable m_Cookies; | |
96 | wxToolBarBase *m_NavBar; | |
97 | int m_NavBackId; | |
98 | int m_NavForwardId; | |
d699f48b | 99 | wxString m_DocRoot; |
d9b91de7 | 100 | public: |
67fc151d KB |
101 | // Constructor |
102 | wxHtmlAppletWindow( | |
103 | wxWindow *parent, | |
104 | wxWindowID id = -1, | |
38caaa61 KB |
105 | wxToolBarBase *navBar = NULL, |
106 | int navBackId = -1, | |
107 | int navForwardId = -1, | |
d9b91de7 | 108 | const wxPoint& pos = wxDefaultPosition, |
67fc151d KB |
109 | const wxSize& size = wxDefaultSize, |
110 | long style = wxHW_SCROLLBAR_AUTO, | |
d699f48b KB |
111 | const wxString& name = "htmlAppletWindow", |
112 | const wxString& docroot = "" ); | |
38caaa61 | 113 | |
67fc151d KB |
114 | // Destructor |
115 | ~wxHtmlAppletWindow(); | |
38caaa61 | 116 | |
67fc151d KB |
117 | // Create an instance of an applet based on it's class name |
118 | wxApplet *CreateApplet( | |
38caaa61 KB |
119 | const wxString& classId, |
120 | const wxString& iName, | |
121 | const wxHtmlTag ¶ms, | |
67fc151d | 122 | const wxSize& size); |
38caaa61 | 123 | |
505710ca KB |
124 | // Create an instance of an Qlet based on it's class name |
125 | bool CreatePlugIn(const wxString& classId ); | |
126 | ||
67fc151d | 127 | // Find an instance of an applet based on it's class name |
38caaa61 KB |
128 | wxApplet *FindApplet(const wxString& className); |
129 | ||
67fc151d | 130 | // Remove an applet from the window. Called during applet destruction |
38caaa61 | 131 | bool RemoveApplet(const wxApplet *applet); |
d9b91de7 | 132 | |
67fc151d | 133 | // Load a new URL page |
38caaa61 KB |
134 | virtual bool LoadPage(const wxString& location); |
135 | ||
67fc151d | 136 | // Called when users clicked on hypertext link. |
38caaa61 KB |
137 | virtual void OnLinkClicked(const wxHtmlLinkInfo& link); |
138 | ||
67fc151d KB |
139 | // Handles forward navigation within the HTML stack |
140 | bool HistoryForward(); | |
38caaa61 | 141 | |
67fc151d KB |
142 | // Handles backwards navigation within the HTML stack |
143 | bool HistoryBack(); | |
38caaa61 | 144 | |
67fc151d KB |
145 | // Broadcast a message to all applets on the page |
146 | void SendMessage(wxEvent& msg); | |
38caaa61 | 147 | |
67fc151d | 148 | // Register a cookie of data in the applet manager |
d699f48b | 149 | static bool RegisterCookie(const wxString& name,wxObject *cookie); |
38caaa61 | 150 | |
67fc151d | 151 | // UnRegister a cookie of data in the applet manager |
d699f48b | 152 | static bool UnRegisterCookie(const wxString& name); |
38caaa61 | 153 | |
67fc151d | 154 | // Find a cookie of data given it's public name |
d699f48b | 155 | static wxObject *FindCookie(const wxString& name); |
38caaa61 KB |
156 | |
157 | // Event handlers to load a new page | |
158 | void OnLoadPage(wxLoadPageEvent &event); | |
159 | ||
160 | // Event handlers to load a new page | |
161 | void OnPageLoaded(wxPageLoadedEvent &event); | |
162 | ||
716cd410 | 163 | // LoadPage mutex locks |
d699f48b KB |
164 | void Lock(){ m_mutexLock = true;}; |
165 | void UnLock(){ m_mutexLock = false;}; | |
716cd410 KB |
166 | |
167 | // Returns TRUE if the mutex is locked, FALSE otherwise. | |
d699f48b | 168 | bool IsLocked(){ return m_mutexLock;}; |
716cd410 KB |
169 | |
170 | // Tries to lock the mutex. If it can't, returns immediately with false. | |
171 | bool TryLock(); | |
172 | ||
67fc151d | 173 | }; |
38caaa61 | 174 | |
d699f48b KB |
175 | /**************************************************************************** |
176 | REMARKS: | |
177 | Defines the class for AppetProcess | |
178 | ***************************************************************************/ | |
179 | class AppletProcess : public wxProcess { | |
180 | public: | |
181 | AppletProcess( | |
182 | wxWindow *parent) | |
183 | : wxProcess(parent) | |
184 | { | |
185 | } | |
186 | ||
187 | // instead of overriding this virtual function we might as well process the | |
188 | // event from it in the frame class - this might be more convenient in some | |
189 | // cases | |
190 | virtual void OnTerminate(int pid, int status); | |
191 | ||
192 | }; | |
193 | ||
505710ca KB |
194 | /**************************************************************************** |
195 | REMARKS: | |
196 | Defines the class for wxHtmlAppletCell | |
197 | ***************************************************************************/ | |
198 | class wxHtmlAppletCell : public wxHtmlCell | |
199 | { | |
200 | public: | |
201 | wxHtmlAppletCell(wxWindow *wnd, int w = 0); | |
202 | ~wxHtmlAppletCell() { m_Wnd->Destroy(); } | |
203 | virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); | |
204 | virtual void DrawInvisible(wxDC& dc, int x, int y); | |
205 | virtual void Layout(int w); | |
206 | ||
207 | protected: | |
208 | wxWindow* m_Wnd; | |
209 | // width float is used in adjustWidth (it is in percents) | |
210 | }; | |
211 | ||
d699f48b | 212 | |
d9b91de7 KB |
213 | #endif // __WX_APPLET_WINDOW_H |
214 |