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 ---------------------------*/
52 wxObject
*m_eventObject
;
54 wxAppletEvent(int id
) { m_eventObject
=NULL
; m_id
= id
; }
56 int GetId() const { return m_id
; }
57 void SetId(int Id
) { m_id
= Id
; }
59 wxObject
*GetEventObject() const { return m_eventObject
; }
60 void SetEventObject(wxObject
*obj
) { m_eventObject
= obj
; }
65 /****************************************************************************
67 Defines the class for virtual-link data types
68 ****************************************************************************/
69 class VirtualData
: public wxObject
{
71 DECLARE_DYNAMIC_CLASS(VirtualData
);
90 wxString
GetName(){ return m_name
;};
91 wxString
GetGroup(){ return m_group
;};
92 wxString
GetHref(){ return m_href
;};
93 wxString
GetPlugIn(){ return m_plugIn
;};
96 void SetName (wxString
& s
){ m_name
= s
; };
97 void SetGroup(wxString
& s
){ m_group
= s
; };
98 void SetHref (wxString
& s
){ m_href
= s
; };
99 void SetPlugIn (wxString
& s
){ m_plugIn
= s
;};
100 void EmptyPlugIn () { m_plugIn
= "";};
103 /****************************************************************************
105 Defines the class for wxAppletWindow. This class is derived from the
106 wxHtmlWindow class and extends it with functionality to handle embedded
107 wxApplet's on the HTML pages.
108 ****************************************************************************/
109 class wxHtmlAppletWindow
: public wxHtmlWindow
{
111 DECLARE_CLASS(wxHtmlAppletWindow
);
112 DECLARE_EVENT_TABLE();
115 wxIncludePrep
*incPreprocessor
; // deleted by list it is added too in constructor
118 wxAppletList m_AppletList
;
119 static wxHashTable m_Cookies
;
120 bool m_NavBarEnabled
;
121 wxToolBarBase
*m_NavBar
;
124 wxString m_openedlast
;
126 // Override this so we can do proper palette management!!
127 virtual void OnDraw(wxDC
& dc
);
134 wxToolBarBase
*navBar
= NULL
,
136 int navForwardId
= -1,
137 const wxPoint
& pos
= wxDefaultPosition
,
138 const wxSize
& size
= wxDefaultSize
,
139 long style
= wxHW_SCROLLBAR_AUTO
,
140 const wxString
& name
= "htmlAppletWindow");
143 virtual ~wxHtmlAppletWindow();
145 // Create an instance of an applet based on it's class name
146 wxApplet
*CreateApplet(
147 const wxString
& classId
,
148 const wxString
& iName
,
149 const wxHtmlTag
¶ms
,
152 // Create an instance of an Qlet based on it's class name
153 bool CreatePlugIn(const wxString
& classId
,const wxString
& cmdLine
= "");
155 // Find an instance of an applet based on it's class name
156 wxApplet
*FindApplet(const wxString
& className
);
158 // Remove an applet from the window. Called during applet destruction
159 bool RemoveApplet(const wxApplet
*applet
);
161 // Load a new URL page
162 virtual bool LoadPage(const wxString
& location
);
164 // Called when users clicked on hypertext link.
165 virtual void OnLinkClicked(const wxHtmlLinkInfo
& link
);
167 // Handles forward navigation within the HTML stack
168 bool HistoryForward();
170 // Handles backwards navigation within the HTML stack
174 void DisableNavBar();
179 void SetNavBar(wxToolBarBase
*navBar
);
181 // Broadcast a message to all applets on the page
182 void SendAppletMessage(wxAppletEvent
& msg
);
184 // Register a cookie of data in the applet manager
185 static bool RegisterCookie(const wxString
& name
,wxObject
*cookie
);
187 // UnRegister a cookie of data in the applet manager
188 static bool UnRegisterCookie(const wxString
& name
);
190 // Find a cookie of data given it's public name
191 static wxObject
*FindCookie(const wxString
& name
);
193 // Event handlers to load a new page
194 void OnLoadPage(wxLoadPageEvent
&event
);
196 // Event handlers to load a new page
197 void OnPageLoaded(wxPageLoadedEvent
&event
);
199 // LoadPage mutex locks
200 void Lock(){ m_mutexLock
= true;};
201 void UnLock(){ m_mutexLock
= false;};
203 // Returns TRUE if the mutex is locked, FALSE otherwise.
204 bool IsLocked(){ return m_mutexLock
;};
206 // Tries to lock the mutex. If it can't, returns immediately with false.
209 wxString
GetLastOpened() { return m_openedlast
; }
212 /****************************************************************************
214 Defines the class for wxHtmlAppletCell
215 ***************************************************************************/
216 class wxHtmlAppletCell
: public wxHtmlCell
219 wxHtmlAppletCell(wxWindow
*wnd
, int w
= 0);
220 virtual ~wxHtmlAppletCell();
221 virtual void Draw(wxDC
& dc
, int x
, int y
, int view_y1
, int view_y2
);
222 virtual void DrawInvisible(wxDC
& dc
, int x
, int y
);
223 virtual void Layout(int w
);
227 // width float is used in adjustWidth (it is in percents)
230 #endif // __WX_APPLET_WINDOW_H