1 /****************************************************************************
3 * wxWindows HTML Applet Package
5 * Copyright (C) 1991-2001 SciTech Software, Inc.
8 * ========================================================================
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
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.
20 * ========================================================================
25 * Description: Header file for the wxHtmlAppletWindow class
27 ****************************************************************************/
29 #ifndef __WX_APPLET_WINDOW_H
30 #define __WX_APPLET_WINDOW_H
32 #include "wx/html/htmlwin.h"
34 #include "wx/process.h"
35 #include "wx/toolbar.h"
40 class wxLoadPageEvent
;
41 class wxPageLoadedEvent
;
45 // Declare a linked list of wxApplet pointers
46 WX_DECLARE_LIST(wxApplet
, wxAppletList
);
48 /*--------------------------- Class Definitions ---------------------------*/
50 /****************************************************************************
52 Defines the class for virtual-link data types
53 ****************************************************************************/
54 class VirtualData
: public wxObject
{
70 wxString
GetName(){ return m_name
;};
71 wxString
GetGroup(){ return m_group
;};
72 wxString
GetHref(){ return m_href
;};
75 void SetName (wxString
& s
){ m_name
= s
; };
76 void SetGroup(wxString
& s
){ m_group
= s
; };
77 void SetHref (wxString
& s
){ m_href
= s
; };
80 /****************************************************************************
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
{
88 DECLARE_CLASS(wxHtmlAppletWindow
);
89 DECLARE_EVENT_TABLE();
92 wxIncludePrep
*incPreprocessor
; // deleted by list it is added too in constructor
95 wxAppletList m_AppletList
;
96 static wxHashTable m_Cookies
;
98 wxToolBarBase
*m_NavBar
;
101 wxPalette m_globalPalette
;
103 // Override this so we can do proper palette management!!
104 virtual void OnDraw(wxDC
& dc
);
111 wxToolBarBase
*navBar
= NULL
,
113 int navForwardId
= -1,
114 const wxPoint
& pos
= wxDefaultPosition
,
115 const wxSize
& size
= wxDefaultSize
,
116 long style
= wxHW_SCROLLBAR_AUTO
,
117 const wxString
& name
= "htmlAppletWindow",
118 const wxPalette
& globalPalette
= wxNullPalette
);
121 ~wxHtmlAppletWindow();
123 // Create an instance of an applet based on it's class name
124 wxApplet
*CreateApplet(
125 const wxString
& classId
,
126 const wxString
& iName
,
127 const wxHtmlTag
¶ms
,
130 // Create an instance of an Qlet based on it's class name
131 bool CreatePlugIn(const wxString
& classId
);
133 // Find an instance of an applet based on it's class name
134 wxApplet
*FindApplet(const wxString
& className
);
136 // Remove an applet from the window. Called during applet destruction
137 bool RemoveApplet(const wxApplet
*applet
);
139 // Load a new URL page
140 virtual bool LoadPage(const wxString
& location
);
142 // Called when users clicked on hypertext link.
143 virtual void OnLinkClicked(const wxHtmlLinkInfo
& link
);
145 // Handles forward navigation within the HTML stack
146 bool HistoryForward();
148 // Handles backwards navigation within the HTML stack
152 void DisableNavBar();
157 void SetNavBar(wxToolBarBase
*navBar
);
159 // Broadcast a message to all applets on the page
160 void SendMessage(wxEvent
& msg
);
162 // Register a cookie of data in the applet manager
163 static bool RegisterCookie(const wxString
& name
,wxObject
*cookie
);
165 // UnRegister a cookie of data in the applet manager
166 static bool UnRegisterCookie(const wxString
& name
);
168 // Find a cookie of data given it's public name
169 static wxObject
*FindCookie(const wxString
& name
);
171 // Event handlers to load a new page
172 void OnLoadPage(wxLoadPageEvent
&event
);
174 // Event handlers to load a new page
175 void OnPageLoaded(wxPageLoadedEvent
&event
);
177 // LoadPage mutex locks
178 void Lock(){ m_mutexLock
= true;};
179 void UnLock(){ m_mutexLock
= false;};
181 // Returns TRUE if the mutex is locked, FALSE otherwise.
182 bool IsLocked(){ return m_mutexLock
;};
184 // Tries to lock the mutex. If it can't, returns immediately with false.
189 /****************************************************************************
191 Defines the class for AppetProcess
192 ***************************************************************************/
193 class AppletProcess
: public wxProcess
{
201 // instead of overriding this virtual function we might as well process the
202 // event from it in the frame class - this might be more convenient in some
204 virtual void OnTerminate(int pid
, int status
);
208 /****************************************************************************
210 Defines the class for wxHtmlAppletCell
211 ***************************************************************************/
212 class wxHtmlAppletCell
: public wxHtmlCell
215 wxHtmlAppletCell(wxWindow
*wnd
, int w
= 0);
216 ~wxHtmlAppletCell() { m_Wnd
->Destroy(); }
217 virtual void Draw(wxDC
& dc
, int x
, int y
, int view_y1
, int view_y2
);
218 virtual void DrawInvisible(wxDC
& dc
, int x
, int y
);
219 virtual void Layout(int w
);
223 // width float is used in adjustWidth (it is in percents)
227 #endif // __WX_APPLET_WINDOW_H