]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/applet/window.h
wxArray<T> macros have been changed to fix runtime problems under 64 bit
[wxWidgets.git] / contrib / include / wx / applet / window.h
1 /****************************************************************************
2 *
3 * wxWindows HTML Applet Package
4 *
5 * Copyright (C) 1991-2001 SciTech Software, Inc.
6 * All rights reserved.
7 *
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 * ========================================================================
21 *
22 * Language: ANSI C++
23 * Environment: Any
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 #include "wx/hash.h"
34 #include "wx/process.h"
35 #include "wx/toolbar.h"
36
37 // Forward declare
38 class wxApplet;
39 class wxQlet;
40 class wxLoadPageEvent;
41 class wxPageLoadedEvent;
42 class wxIncludePrep;
43 class wxToolBarBase;
44
45 // Declare a linked list of wxApplet pointers
46 WX_DECLARE_LIST(wxApplet, wxAppletList);
47
48 /*--------------------------- Class Definitions ---------------------------*/
49 class wxAppletEvent {
50 protected:
51 int m_id;
52 wxObject *m_eventObject;
53 public:
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
64
65 /****************************************************************************
66 REMARKS:
67 Defines the class for virtual-link data types
68 ****************************************************************************/
69 class VirtualData : public wxObject {
70 private:
71 DECLARE_DYNAMIC_CLASS(VirtualData);
72
73 protected:
74 wxString m_name;
75 wxString m_group;
76 wxString m_href;
77 wxString m_plugIn;
78
79 public:
80 // Ctors
81 VirtualData(
82 wxString& name,
83 wxString& group,
84 wxString& href,
85 wxString& plugin );
86
87 VirtualData();
88
89 // Gets
90 wxString GetName(){ return m_name;};
91 wxString GetGroup(){ return m_group;};
92 wxString GetHref(){ return m_href;};
93 wxString GetPlugIn(){ return m_plugIn;};
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; };
99 void SetPlugIn (wxString& s){ m_plugIn = s;};
100 void EmptyPlugIn () { m_plugIn = "";};
101 };
102
103 /****************************************************************************
104 REMARKS:
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 {
110 private:
111 DECLARE_CLASS(wxHtmlAppletWindow);
112 DECLARE_EVENT_TABLE();
113
114 bool m_mutexLock;
115 wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor
116
117 protected:
118 wxAppletList m_AppletList;
119 static wxHashTable m_Cookies;
120 bool m_NavBarEnabled;
121 wxToolBarBase *m_NavBar;
122 int m_NavBackId;
123 int m_NavForwardId;
124 wxString m_openedlast;
125
126 // Override this so we can do proper palette management!!
127 virtual void OnDraw(wxDC& dc);
128
129 public:
130 // Constructor
131 wxHtmlAppletWindow(
132 wxWindow *parent,
133 wxWindowID id = -1,
134 wxToolBarBase *navBar = NULL,
135 int navBackId = -1,
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");
141
142 // Destructor
143 ~wxHtmlAppletWindow();
144
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 &params,
150 const wxSize& size);
151
152 // Create an instance of an Qlet based on it's class name
153 bool CreatePlugIn(const wxString& classId,const wxString& cmdLine = "");
154
155 // Find an instance of an applet based on it's class name
156 wxApplet *FindApplet(const wxString& className);
157
158 // Remove an applet from the window. Called during applet destruction
159 bool RemoveApplet(const wxApplet *applet);
160
161 // Load a new URL page
162 virtual bool LoadPage(const wxString& location);
163
164 // Called when users clicked on hypertext link.
165 virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
166
167 // Handles forward navigation within the HTML stack
168 bool HistoryForward();
169
170 // Handles backwards navigation within the HTML stack
171 bool HistoryBack();
172
173 // Disables Nav bars
174 void DisableNavBar();
175
176 // Enables Nav bars
177 void EnableNavBar();
178
179 void SetNavBar(wxToolBarBase *navBar);
180
181 // Broadcast a message to all applets on the page
182 void SendAppletMessage(wxAppletEvent& msg);
183
184 // Register a cookie of data in the applet manager
185 static bool RegisterCookie(const wxString& name,wxObject *cookie);
186
187 // UnRegister a cookie of data in the applet manager
188 static bool UnRegisterCookie(const wxString& name);
189
190 // Find a cookie of data given it's public name
191 static wxObject *FindCookie(const wxString& name);
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
199 // LoadPage mutex locks
200 void Lock(){ m_mutexLock = true;};
201 void UnLock(){ m_mutexLock = false;};
202
203 // Returns TRUE if the mutex is locked, FALSE otherwise.
204 bool IsLocked(){ return m_mutexLock;};
205
206 // Tries to lock the mutex. If it can't, returns immediately with false.
207 bool TryLock();
208
209 wxString GetLastOpened() { return m_openedlast; }
210 };
211
212 /****************************************************************************
213 REMARKS:
214 Defines the class for wxHtmlAppletCell
215 ***************************************************************************/
216 class wxHtmlAppletCell : public wxHtmlCell
217 {
218 public:
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);
224
225 protected:
226 wxWindow* m_Wnd;
227 // width float is used in adjustWidth (it is in percents)
228 };
229
230 #endif // __WX_APPLET_WINDOW_H
231