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