]>
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; | |
d9b91de7 KB |
45 | |
46 | // Declare a linked list of wxApplet pointers | |
d9b91de7 KB |
47 | WX_DECLARE_LIST(wxApplet, wxAppletList); |
48 | ||
38caaa61 KB |
49 | /*--------------------------- Class Definitions ---------------------------*/ |
50 | ||
d9b91de7 | 51 | /**************************************************************************** |
38caaa61 KB |
52 | REMARKS: |
53 | Defines the class for virtual-link data types | |
54 | ****************************************************************************/ | |
55 | class VirtualData : public wxObject { | |
56 | private: | |
57 | wxString m_name; | |
58 | wxString m_group; | |
59 | wxString m_href; | |
d9b91de7 | 60 | |
38caaa61 KB |
61 | public: |
62 | // Ctors | |
63 | VirtualData( | |
64 | wxString& name, | |
65 | wxString& group, | |
66 | wxString& href ); | |
67 | ||
68 | // Gets | |
69 | wxString GetName(){ return m_name;}; | |
70 | wxString GetGroup(){ return m_group;}; | |
71 | wxString GetHref(){ return m_href;}; | |
72 | ||
73 | // Sets | |
74 | void SetName (wxString& s){ m_name = s; }; | |
75 | void SetGroup(wxString& s){ m_group = s; }; | |
76 | void SetHref (wxString& s){ m_href = s; }; | |
77 | }; | |
78 | ||
79 | /**************************************************************************** | |
d9b91de7 KB |
80 | REMARKS: |
81 | Defines the class for wxAppletWindow. This class is derived from the | |
82 | wxHtmlWindow class and extends it with functionality to handle embedded | |
83 | wxApplet's on the HTML pages. | |
84 | ****************************************************************************/ | |
85 | class wxHtmlAppletWindow : public wxHtmlWindow { | |
86 | private: | |
87 | DECLARE_CLASS(wxHtmlAppletWindow); | |
88 | DECLARE_EVENT_TABLE(); | |
38caaa61 | 89 | |
716cd410 | 90 | bool m_mutexLock; |
38caaa61 | 91 | wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor |
d9b91de7 | 92 | protected: |
38caaa61 KB |
93 | wxAppletList m_AppletList; |
94 | static wxHashTable m_Cookies; | |
95 | wxToolBarBase *m_NavBar; | |
96 | int m_NavBackId; | |
97 | int m_NavForwardId; | |
d699f48b | 98 | wxString m_DocRoot; |
d9b91de7 | 99 | public: |
67fc151d KB |
100 | // Constructor |
101 | wxHtmlAppletWindow( | |
102 | wxWindow *parent, | |
103 | wxWindowID id = -1, | |
38caaa61 KB |
104 | wxToolBarBase *navBar = NULL, |
105 | int navBackId = -1, | |
106 | int navForwardId = -1, | |
d9b91de7 | 107 | const wxPoint& pos = wxDefaultPosition, |
67fc151d KB |
108 | const wxSize& size = wxDefaultSize, |
109 | long style = wxHW_SCROLLBAR_AUTO, | |
d699f48b KB |
110 | const wxString& name = "htmlAppletWindow", |
111 | const wxString& docroot = "" ); | |
38caaa61 | 112 | |
67fc151d KB |
113 | // Destructor |
114 | ~wxHtmlAppletWindow(); | |
38caaa61 | 115 | |
67fc151d KB |
116 | // Create an instance of an applet based on it's class name |
117 | wxApplet *CreateApplet( | |
38caaa61 KB |
118 | const wxString& classId, |
119 | const wxString& iName, | |
120 | const wxHtmlTag ¶ms, | |
67fc151d | 121 | const wxSize& size); |
38caaa61 | 122 | |
505710ca KB |
123 | // Create an instance of an Qlet based on it's class name |
124 | bool CreatePlugIn(const wxString& classId ); | |
125 | ||
67fc151d | 126 | // Find an instance of an applet based on it's class name |
38caaa61 KB |
127 | wxApplet *FindApplet(const wxString& className); |
128 | ||
67fc151d | 129 | // Remove an applet from the window. Called during applet destruction |
38caaa61 | 130 | bool RemoveApplet(const wxApplet *applet); |
d9b91de7 | 131 | |
67fc151d | 132 | // Load a new URL page |
38caaa61 KB |
133 | virtual bool LoadPage(const wxString& location); |
134 | ||
67fc151d | 135 | // Called when users clicked on hypertext link. |
38caaa61 KB |
136 | virtual void OnLinkClicked(const wxHtmlLinkInfo& link); |
137 | ||
67fc151d KB |
138 | // Handles forward navigation within the HTML stack |
139 | bool HistoryForward(); | |
38caaa61 | 140 | |
67fc151d KB |
141 | // Handles backwards navigation within the HTML stack |
142 | bool HistoryBack(); | |
38caaa61 | 143 | |
67fc151d KB |
144 | // Broadcast a message to all applets on the page |
145 | void SendMessage(wxEvent& msg); | |
38caaa61 | 146 | |
67fc151d | 147 | // Register a cookie of data in the applet manager |
d699f48b | 148 | static bool RegisterCookie(const wxString& name,wxObject *cookie); |
38caaa61 | 149 | |
67fc151d | 150 | // UnRegister a cookie of data in the applet manager |
d699f48b | 151 | static bool UnRegisterCookie(const wxString& name); |
38caaa61 | 152 | |
67fc151d | 153 | // Find a cookie of data given it's public name |
d699f48b | 154 | static wxObject *FindCookie(const wxString& name); |
38caaa61 KB |
155 | |
156 | // Event handlers to load a new page | |
157 | void OnLoadPage(wxLoadPageEvent &event); | |
158 | ||
159 | // Event handlers to load a new page | |
160 | void OnPageLoaded(wxPageLoadedEvent &event); | |
161 | ||
716cd410 | 162 | // LoadPage mutex locks |
d699f48b KB |
163 | void Lock(){ m_mutexLock = true;}; |
164 | void UnLock(){ m_mutexLock = false;}; | |
716cd410 KB |
165 | |
166 | // Returns TRUE if the mutex is locked, FALSE otherwise. | |
d699f48b | 167 | bool IsLocked(){ return m_mutexLock;}; |
716cd410 KB |
168 | |
169 | // Tries to lock the mutex. If it can't, returns immediately with false. | |
170 | bool TryLock(); | |
171 | ||
67fc151d | 172 | }; |
38caaa61 | 173 | |
d699f48b KB |
174 | /**************************************************************************** |
175 | REMARKS: | |
176 | Defines the class for AppetProcess | |
177 | ***************************************************************************/ | |
178 | class AppletProcess : public wxProcess { | |
179 | public: | |
180 | AppletProcess( | |
181 | wxWindow *parent) | |
182 | : wxProcess(parent) | |
183 | { | |
184 | } | |
185 | ||
186 | // instead of overriding this virtual function we might as well process the | |
187 | // event from it in the frame class - this might be more convenient in some | |
188 | // cases | |
189 | virtual void OnTerminate(int pid, int status); | |
190 | ||
191 | }; | |
192 | ||
505710ca KB |
193 | /**************************************************************************** |
194 | REMARKS: | |
195 | Defines the class for wxHtmlAppletCell | |
196 | ***************************************************************************/ | |
197 | class wxHtmlAppletCell : public wxHtmlCell | |
198 | { | |
199 | public: | |
200 | wxHtmlAppletCell(wxWindow *wnd, int w = 0); | |
201 | ~wxHtmlAppletCell() { m_Wnd->Destroy(); } | |
202 | virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); | |
203 | virtual void DrawInvisible(wxDC& dc, int x, int y); | |
204 | virtual void Layout(int w); | |
205 | ||
206 | protected: | |
207 | wxWindow* m_Wnd; | |
208 | // width float is used in adjustWidth (it is in percents) | |
209 | }; | |
210 | ||
d699f48b | 211 | |
d9b91de7 KB |
212 | #endif // __WX_APPLET_WINDOW_H |
213 |