]>
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 | * | |
19193a2c KB |
8 | * ======================================================================== |
9 | * | |
10 | * The contents of this file are subject to the wxWindows License | |
11 | * Version 3.0 (the "License"); you may not use this file except in | |
12 | * compliance with the License. You may obtain a copy of the License at | |
13 | * http://www.wxwindows.org/licence3.txt | |
14 | * | |
15 | * Software distributed under the License is distributed on an | |
16 | * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | |
17 | * implied. See the License for the specific language governing | |
18 | * rights and limitations under the License. | |
19 | * | |
20 | * ======================================================================== | |
d9b91de7 | 21 | * |
67fc151d KB |
22 | * Language: ANSI C++ |
23 | * Environment: Any | |
d9b91de7 KB |
24 | * |
25 | * Description: Header file for the wxHtmlAppletWindow class | |
26 | * | |
27 | ****************************************************************************/ | |
28 | ||
29 | #ifndef __WX_APPLET_WINDOW_H | |
30 | #define __WX_APPLET_WINDOW_H | |
31 | ||
32 | #include "wx/html/htmlwin.h" | |
d699f48b | 33 | #include "wx/process.h" |
d9b91de7 | 34 | |
38caaa61 KB |
35 | // Forward declare |
36 | class wxApplet; | |
505710ca | 37 | class wxQlet; |
38caaa61 KB |
38 | class wxLoadPageEvent; |
39 | class wxPageLoadedEvent; | |
40 | class wxIncludePrep; | |
3a922bb4 | 41 | class wxToolBarBase; |
d9b91de7 KB |
42 | |
43 | // Declare a linked list of wxApplet pointers | |
d9b91de7 KB |
44 | WX_DECLARE_LIST(wxApplet, wxAppletList); |
45 | ||
38caaa61 KB |
46 | /*--------------------------- Class Definitions ---------------------------*/ |
47 | ||
d9b91de7 | 48 | /**************************************************************************** |
38caaa61 KB |
49 | REMARKS: |
50 | Defines the class for virtual-link data types | |
51 | ****************************************************************************/ | |
52 | class VirtualData : public wxObject { | |
53 | private: | |
54 | wxString m_name; | |
55 | wxString m_group; | |
56 | wxString m_href; | |
d9b91de7 | 57 | |
38caaa61 KB |
58 | public: |
59 | // Ctors | |
60 | VirtualData( | |
61 | wxString& name, | |
62 | wxString& group, | |
63 | wxString& href ); | |
64 | ||
19193a2c KB |
65 | VirtualData(); |
66 | ||
38caaa61 KB |
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 | |
19193a2c KB |
89 | bool m_mutexLock; |
90 | wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor | |
91 | ||
d9b91de7 | 92 | protected: |
38caaa61 KB |
93 | wxAppletList m_AppletList; |
94 | static wxHashTable m_Cookies; | |
19193a2c | 95 | bool m_NavBarEnabled; |
38caaa61 KB |
96 | wxToolBarBase *m_NavBar; |
97 | int m_NavBackId; | |
98 | int m_NavForwardId; | |
19193a2c KB |
99 | wxPalette m_globalPalette; |
100 | ||
101 | // Override this so we can do proper palette management!! | |
102 | virtual void OnDraw(wxDC& dc); | |
103 | ||
d9b91de7 | 104 | public: |
67fc151d KB |
105 | // Constructor |
106 | wxHtmlAppletWindow( | |
107 | wxWindow *parent, | |
108 | wxWindowID id = -1, | |
38caaa61 KB |
109 | wxToolBarBase *navBar = NULL, |
110 | int navBackId = -1, | |
111 | int navForwardId = -1, | |
d9b91de7 | 112 | const wxPoint& pos = wxDefaultPosition, |
67fc151d KB |
113 | const wxSize& size = wxDefaultSize, |
114 | long style = wxHW_SCROLLBAR_AUTO, | |
d699f48b | 115 | const wxString& name = "htmlAppletWindow", |
19193a2c | 116 | const wxPalette& globalPalette = wxNullPalette); |
38caaa61 | 117 | |
67fc151d KB |
118 | // Destructor |
119 | ~wxHtmlAppletWindow(); | |
38caaa61 | 120 | |
67fc151d KB |
121 | // Create an instance of an applet based on it's class name |
122 | wxApplet *CreateApplet( | |
38caaa61 KB |
123 | const wxString& classId, |
124 | const wxString& iName, | |
125 | const wxHtmlTag ¶ms, | |
67fc151d | 126 | const wxSize& size); |
38caaa61 | 127 | |
505710ca KB |
128 | // Create an instance of an Qlet based on it's class name |
129 | bool CreatePlugIn(const wxString& classId ); | |
130 | ||
67fc151d | 131 | // Find an instance of an applet based on it's class name |
38caaa61 KB |
132 | wxApplet *FindApplet(const wxString& className); |
133 | ||
67fc151d | 134 | // Remove an applet from the window. Called during applet destruction |
38caaa61 | 135 | bool RemoveApplet(const wxApplet *applet); |
d9b91de7 | 136 | |
67fc151d | 137 | // Load a new URL page |
38caaa61 KB |
138 | virtual bool LoadPage(const wxString& location); |
139 | ||
67fc151d | 140 | // Called when users clicked on hypertext link. |
38caaa61 KB |
141 | virtual void OnLinkClicked(const wxHtmlLinkInfo& link); |
142 | ||
67fc151d KB |
143 | // Handles forward navigation within the HTML stack |
144 | bool HistoryForward(); | |
38caaa61 | 145 | |
67fc151d KB |
146 | // Handles backwards navigation within the HTML stack |
147 | bool HistoryBack(); | |
38caaa61 | 148 | |
19193a2c KB |
149 | // Disables Nav bars |
150 | void DisableNavBar(); | |
151 | ||
152 | // Enables Nav bars | |
153 | void EnableNavBar(); | |
154 | ||
155 | void SetNavBar(wxToolBarBase *navBar); | |
156 | ||
67fc151d KB |
157 | // Broadcast a message to all applets on the page |
158 | void SendMessage(wxEvent& msg); | |
38caaa61 | 159 | |
67fc151d | 160 | // Register a cookie of data in the applet manager |
d699f48b | 161 | static bool RegisterCookie(const wxString& name,wxObject *cookie); |
38caaa61 | 162 | |
67fc151d | 163 | // UnRegister a cookie of data in the applet manager |
d699f48b | 164 | static bool UnRegisterCookie(const wxString& name); |
38caaa61 | 165 | |
67fc151d | 166 | // Find a cookie of data given it's public name |
d699f48b | 167 | static wxObject *FindCookie(const wxString& name); |
38caaa61 KB |
168 | |
169 | // Event handlers to load a new page | |
170 | void OnLoadPage(wxLoadPageEvent &event); | |
171 | ||
172 | // Event handlers to load a new page | |
173 | void OnPageLoaded(wxPageLoadedEvent &event); | |
174 | ||
716cd410 | 175 | // LoadPage mutex locks |
d699f48b KB |
176 | void Lock(){ m_mutexLock = true;}; |
177 | void UnLock(){ m_mutexLock = false;}; | |
716cd410 KB |
178 | |
179 | // Returns TRUE if the mutex is locked, FALSE otherwise. | |
d699f48b | 180 | bool IsLocked(){ return m_mutexLock;}; |
716cd410 KB |
181 | |
182 | // Tries to lock the mutex. If it can't, returns immediately with false. | |
183 | bool TryLock(); | |
184 | ||
67fc151d | 185 | }; |
38caaa61 | 186 | |
d699f48b KB |
187 | /**************************************************************************** |
188 | REMARKS: | |
189 | Defines the class for AppetProcess | |
190 | ***************************************************************************/ | |
191 | class AppletProcess : public wxProcess { | |
192 | public: | |
193 | AppletProcess( | |
194 | wxWindow *parent) | |
195 | : wxProcess(parent) | |
196 | { | |
197 | } | |
198 | ||
199 | // instead of overriding this virtual function we might as well process the | |
200 | // event from it in the frame class - this might be more convenient in some | |
201 | // cases | |
202 | virtual void OnTerminate(int pid, int status); | |
203 | ||
204 | }; | |
205 | ||
505710ca KB |
206 | /**************************************************************************** |
207 | REMARKS: | |
208 | Defines the class for wxHtmlAppletCell | |
209 | ***************************************************************************/ | |
210 | class wxHtmlAppletCell : public wxHtmlCell | |
211 | { | |
212 | public: | |
213 | wxHtmlAppletCell(wxWindow *wnd, int w = 0); | |
214 | ~wxHtmlAppletCell() { m_Wnd->Destroy(); } | |
215 | virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); | |
216 | virtual void DrawInvisible(wxDC& dc, int x, int y); | |
217 | virtual void Layout(int w); | |
218 | ||
219 | protected: | |
220 | wxWindow* m_Wnd; | |
221 | // width float is used in adjustWidth (it is in percents) | |
222 | }; | |
223 | ||
d699f48b | 224 | |
d9b91de7 KB |
225 | #endif // __WX_APPLET_WINDOW_H |
226 |