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