]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/applet/window.h
added a few encoding convenience methods for pc-mac encoding and string handling...
[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 * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
10 * | |
11 * |This copyrighted computer code is a proprietary trade secret of |
12 * |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
13 * |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
14 * |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
15 * |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
16 * |written authorization from SciTech to possess or use this code, you |
17 * |may be subject to civil and/or criminal penalties. |
18 * | |
19 * |If you received this code in error or you would like to report |
20 * |improper use, please immediately contact SciTech Software, Inc. at |
21 * |530-894-8400. |
22 * | |
23 * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
24 * ======================================================================
25 *
26 * Language: ANSI C++
27 * Environment: Any
28 *
29 * Description: Header file for the wxHtmlAppletWindow class
30 *
31 ****************************************************************************/
32
33 #ifndef __WX_APPLET_WINDOW_H
34 #define __WX_APPLET_WINDOW_H
35
36 #include "wx/html/htmlwin.h"
37 #include "wx/process.h"
38
39 // Forward declare
40 class wxApplet;
41 class wxLoadPageEvent;
42 class wxPageLoadedEvent;
43 class wxIncludePrep;
44
45 // Declare a linked list of wxApplet pointers
46 WX_DECLARE_LIST(wxApplet, wxAppletList);
47
48 /*--------------------------- Class Definitions ---------------------------*/
49
50 /****************************************************************************
51 REMARKS:
52 Defines the class for virtual-link data types
53 ****************************************************************************/
54 class VirtualData : public wxObject {
55 private:
56 wxString m_name;
57 wxString m_group;
58 wxString m_href;
59
60 public:
61 // Ctors
62 VirtualData(
63 wxString& name,
64 wxString& group,
65 wxString& href );
66
67 // Gets
68 wxString GetName(){ return m_name;};
69 wxString GetGroup(){ return m_group;};
70 wxString GetHref(){ return m_href;};
71
72 // Sets
73 void SetName (wxString& s){ m_name = s; };
74 void SetGroup(wxString& s){ m_group = s; };
75 void SetHref (wxString& s){ m_href = s; };
76 };
77
78 /****************************************************************************
79 REMARKS:
80 Defines the class for wxAppletWindow. This class is derived from the
81 wxHtmlWindow class and extends it with functionality to handle embedded
82 wxApplet's on the HTML pages.
83 ****************************************************************************/
84 class wxHtmlAppletWindow : public wxHtmlWindow {
85 private:
86 DECLARE_CLASS(wxHtmlAppletWindow);
87 DECLARE_EVENT_TABLE();
88
89 bool m_mutexLock;
90 wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor
91 protected:
92 wxAppletList m_AppletList;
93 static wxHashTable m_Cookies;
94 wxToolBarBase *m_NavBar;
95 int m_NavBackId;
96 int m_NavForwardId;
97 wxString m_DocRoot;
98 public:
99 // Constructor
100 wxHtmlAppletWindow(
101 wxWindow *parent,
102 wxWindowID id = -1,
103 wxToolBarBase *navBar = NULL,
104 int navBackId = -1,
105 int navForwardId = -1,
106 const wxPoint& pos = wxDefaultPosition,
107 const wxSize& size = wxDefaultSize,
108 long style = wxHW_SCROLLBAR_AUTO,
109 const wxString& name = "htmlAppletWindow",
110 const wxString& docroot = "" );
111
112 // Destructor
113 ~wxHtmlAppletWindow();
114
115 // Create an instance of an applet based on it's class name
116 wxApplet *CreateApplet(
117 const wxString& classId,
118 const wxString& iName,
119 const wxHtmlTag &params,
120 const wxSize& size);
121
122 // Find an instance of an applet based on it's class name
123 wxApplet *FindApplet(const wxString& className);
124
125 // Remove an applet from the window. Called during applet destruction
126 bool RemoveApplet(const wxApplet *applet);
127
128 // Load a new URL page
129 virtual bool LoadPage(const wxString& location);
130
131 // Called when users clicked on hypertext link.
132 virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
133
134 // Handles forward navigation within the HTML stack
135 bool HistoryForward();
136
137 // Handles backwards navigation within the HTML stack
138 bool HistoryBack();
139
140 // Broadcast a message to all applets on the page
141 void SendMessage(wxEvent& msg);
142
143 // Register a cookie of data in the applet manager
144 static bool RegisterCookie(const wxString& name,wxObject *cookie);
145
146 // UnRegister a cookie of data in the applet manager
147 static bool UnRegisterCookie(const wxString& name);
148
149 // Find a cookie of data given it's public name
150 static wxObject *FindCookie(const wxString& name);
151
152 // Event handlers to load a new page
153 void OnLoadPage(wxLoadPageEvent &event);
154
155 // Event handlers to load a new page
156 void OnPageLoaded(wxPageLoadedEvent &event);
157
158 // LoadPage mutex locks
159 void Lock(){ m_mutexLock = true;};
160 void UnLock(){ m_mutexLock = false;};
161
162 // Returns TRUE if the mutex is locked, FALSE otherwise.
163 bool IsLocked(){ return m_mutexLock;};
164
165 // Tries to lock the mutex. If it can't, returns immediately with false.
166 bool TryLock();
167
168 };
169
170 /****************************************************************************
171 REMARKS:
172 Defines the class for AppetProcess
173 ***************************************************************************/
174 class AppletProcess : public wxProcess {
175 public:
176 AppletProcess(
177 wxWindow *parent)
178 : wxProcess(parent)
179 {
180 }
181
182 // instead of overriding this virtual function we might as well process the
183 // event from it in the frame class - this might be more convenient in some
184 // cases
185 virtual void OnTerminate(int pid, int status);
186
187 };
188
189
190 #endif // __WX_APPLET_WINDOW_H
191