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