]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/applet/window.h
Include wx/dialog.h according to precompiled headers of wx/wx.h (with other minor...
[wxWidgets.git] / contrib / include / wx / applet / window.h
CommitLineData
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"
8cdb648e 33#include "wx/hash.h"
d699f48b 34#include "wx/process.h"
8cdb648e 35#include "wx/toolbar.h"
d9b91de7 36
38caaa61
KB
37// Forward declare
38class wxApplet;
505710ca 39class wxQlet;
38caaa61
KB
40class wxLoadPageEvent;
41class wxPageLoadedEvent;
42class wxIncludePrep;
3a922bb4 43class wxToolBarBase;
d9b91de7
KB
44
45// Declare a linked list of wxApplet pointers
d9b91de7
KB
46WX_DECLARE_LIST(wxApplet, wxAppletList);
47
38caaa61 48/*--------------------------- Class Definitions ---------------------------*/
574c939e
KB
49class wxAppletEvent {
50protected:
51 int m_id;
52 wxObject *m_eventObject;
53public:
54 wxAppletEvent(int id) { m_eventObject=NULL; m_id = id; }
55
56 int GetId() const { return m_id; }
57 void SetId(int Id) { m_id = Id; }
58
59 wxObject *GetEventObject() const { return m_eventObject; }
60 void SetEventObject(wxObject *obj) { m_eventObject = obj; }
61
62};
63
38caaa61 64
d9b91de7 65/****************************************************************************
38caaa61
KB
66REMARKS:
67Defines the class for virtual-link data types
68****************************************************************************/
69class VirtualData : public wxObject {
70private:
574c939e
KB
71 DECLARE_DYNAMIC_CLASS(VirtualData);
72
73protected:
38caaa61
KB
74 wxString m_name;
75 wxString m_group;
76 wxString m_href;
574c939e 77 wxString m_plugIn;
d9b91de7 78
38caaa61
KB
79public:
80 // Ctors
81 VirtualData(
82 wxString& name,
83 wxString& group,
574c939e
KB
84 wxString& href,
85 wxString& plugin );
38caaa61 86
19193a2c
KB
87 VirtualData();
88
38caaa61
KB
89 // Gets
90 wxString GetName(){ return m_name;};
91 wxString GetGroup(){ return m_group;};
92 wxString GetHref(){ return m_href;};
574c939e 93 wxString GetPlugIn(){ return m_plugIn;};
38caaa61
KB
94
95 // Sets
96 void SetName (wxString& s){ m_name = s; };
97 void SetGroup(wxString& s){ m_group = s; };
98 void SetHref (wxString& s){ m_href = s; };
574c939e
KB
99 void SetPlugIn (wxString& s){ m_plugIn = s;};
100 void EmptyPlugIn () { m_plugIn = "";};
38caaa61
KB
101 };
102
103/****************************************************************************
d9b91de7
KB
104REMARKS:
105Defines the class for wxAppletWindow. This class is derived from the
106wxHtmlWindow class and extends it with functionality to handle embedded
107wxApplet's on the HTML pages.
108****************************************************************************/
109class wxHtmlAppletWindow : public wxHtmlWindow {
110private:
111 DECLARE_CLASS(wxHtmlAppletWindow);
112 DECLARE_EVENT_TABLE();
38caaa61 113
19193a2c
KB
114 bool m_mutexLock;
115 wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor
116
d9b91de7 117protected:
38caaa61
KB
118 wxAppletList m_AppletList;
119 static wxHashTable m_Cookies;
19193a2c 120 bool m_NavBarEnabled;
38caaa61
KB
121 wxToolBarBase *m_NavBar;
122 int m_NavBackId;
123 int m_NavForwardId;
574c939e 124 wxString m_openedlast;
19193a2c
KB
125
126 // Override this so we can do proper palette management!!
127 virtual void OnDraw(wxDC& dc);
128
d9b91de7 129public:
67fc151d
KB
130 // Constructor
131 wxHtmlAppletWindow(
132 wxWindow *parent,
133 wxWindowID id = -1,
38caaa61
KB
134 wxToolBarBase *navBar = NULL,
135 int navBackId = -1,
136 int navForwardId = -1,
d9b91de7 137 const wxPoint& pos = wxDefaultPosition,
67fc151d
KB
138 const wxSize& size = wxDefaultSize,
139 long style = wxHW_SCROLLBAR_AUTO,
574c939e 140 const wxString& name = "htmlAppletWindow");
38caaa61 141
67fc151d
KB
142 // Destructor
143 ~wxHtmlAppletWindow();
38caaa61 144
67fc151d
KB
145 // Create an instance of an applet based on it's class name
146 wxApplet *CreateApplet(
38caaa61
KB
147 const wxString& classId,
148 const wxString& iName,
149 const wxHtmlTag &params,
67fc151d 150 const wxSize& size);
38caaa61 151
505710ca 152 // Create an instance of an Qlet based on it's class name
574c939e 153 bool CreatePlugIn(const wxString& classId,const wxString& cmdLine = "");
505710ca 154
67fc151d 155 // Find an instance of an applet based on it's class name
38caaa61
KB
156 wxApplet *FindApplet(const wxString& className);
157
67fc151d 158 // Remove an applet from the window. Called during applet destruction
38caaa61 159 bool RemoveApplet(const wxApplet *applet);
d9b91de7 160
67fc151d 161 // Load a new URL page
38caaa61
KB
162 virtual bool LoadPage(const wxString& location);
163
67fc151d 164 // Called when users clicked on hypertext link.
38caaa61
KB
165 virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
166
67fc151d
KB
167 // Handles forward navigation within the HTML stack
168 bool HistoryForward();
38caaa61 169
67fc151d
KB
170 // Handles backwards navigation within the HTML stack
171 bool HistoryBack();
38caaa61 172
19193a2c
KB
173 // Disables Nav bars
174 void DisableNavBar();
175
176 // Enables Nav bars
177 void EnableNavBar();
178
179 void SetNavBar(wxToolBarBase *navBar);
180
67fc151d 181 // Broadcast a message to all applets on the page
574c939e 182 void SendAppletMessage(wxAppletEvent& msg);
38caaa61 183
67fc151d 184 // Register a cookie of data in the applet manager
d699f48b 185 static bool RegisterCookie(const wxString& name,wxObject *cookie);
38caaa61 186
67fc151d 187 // UnRegister a cookie of data in the applet manager
d699f48b 188 static bool UnRegisterCookie(const wxString& name);
38caaa61 189
67fc151d 190 // Find a cookie of data given it's public name
d699f48b 191 static wxObject *FindCookie(const wxString& name);
38caaa61
KB
192
193 // Event handlers to load a new page
194 void OnLoadPage(wxLoadPageEvent &event);
195
196 // Event handlers to load a new page
197 void OnPageLoaded(wxPageLoadedEvent &event);
198
716cd410 199 // LoadPage mutex locks
d699f48b
KB
200 void Lock(){ m_mutexLock = true;};
201 void UnLock(){ m_mutexLock = false;};
716cd410
KB
202
203 // Returns TRUE if the mutex is locked, FALSE otherwise.
d699f48b 204 bool IsLocked(){ return m_mutexLock;};
716cd410
KB
205
206 // Tries to lock the mutex. If it can't, returns immediately with false.
207 bool TryLock();
208
574c939e 209 wxString GetLastOpened() { return m_openedlast; }
d699f48b
KB
210 };
211
505710ca
KB
212/****************************************************************************
213REMARKS:
214Defines the class for wxHtmlAppletCell
215***************************************************************************/
216class wxHtmlAppletCell : public wxHtmlCell
217{
218public:
219 wxHtmlAppletCell(wxWindow *wnd, int w = 0);
574c939e 220 virtual ~wxHtmlAppletCell();
505710ca
KB
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);
224
225protected:
226 wxWindow* m_Wnd;
227 // width float is used in adjustWidth (it is in percents)
228};
229
d9b91de7
KB
230#endif // __WX_APPLET_WINDOW_H
231