]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/applet/window.h
correction for Mac OS X compilation
[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
34 // Forward declare
35 class wxApplet;
36 class wxLoadPageEvent;
37 class wxPageLoadedEvent;
38 class wxIncludePrep;
39
40 // Declare a linked list of wxApplet pointers
41 WX_DECLARE_LIST(wxApplet, wxAppletList);
42
43 /*--------------------------- Class Definitions ---------------------------*/
44
45 /****************************************************************************
46 REMARKS:
47 Defines the class for virtual-link data types
48 ****************************************************************************/
49 class VirtualData : public wxObject {
50 private:
51 wxString m_name;
52 wxString m_group;
53 wxString m_href;
54
55 public:
56 // Ctors
57 VirtualData(
58 wxString& name,
59 wxString& group,
60 wxString& href );
61
62 // Gets
63 wxString GetName(){ return m_name;};
64 wxString GetGroup(){ return m_group;};
65 wxString GetHref(){ return m_href;};
66
67 // Sets
68 void SetName (wxString& s){ m_name = s; };
69 void SetGroup(wxString& s){ m_group = s; };
70 void SetHref (wxString& s){ m_href = s; };
71 };
72
73 /****************************************************************************
74 REMARKS:
75 Defines the class for wxAppletWindow. This class is derived from the
76 wxHtmlWindow class and extends it with functionality to handle embedded
77 wxApplet's on the HTML pages.
78 ****************************************************************************/
79 class wxHtmlAppletWindow : public wxHtmlWindow {
80 private:
81 DECLARE_CLASS(wxHtmlAppletWindow);
82 DECLARE_EVENT_TABLE();
83
84 bool m_mutexLock;
85 wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor
86 protected:
87 wxAppletList m_AppletList;
88 static wxHashTable m_Cookies;
89 wxToolBarBase *m_NavBar;
90 int m_NavBackId;
91 int m_NavForwardId;
92
93 public:
94 // Constructor
95 wxHtmlAppletWindow(
96 wxWindow *parent,
97 wxWindowID id = -1,
98 wxToolBarBase *navBar = NULL,
99 int navBackId = -1,
100 int navForwardId = -1,
101 const wxPoint& pos = wxDefaultPosition,
102 const wxSize& size = wxDefaultSize,
103 long style = wxHW_SCROLLBAR_AUTO,
104 const wxString& name = "htmlAppletWindow");
105
106 // Destructor
107 ~wxHtmlAppletWindow();
108
109 // Create an instance of an applet based on it's class name
110 wxApplet *CreateApplet(
111 const wxString& classId,
112 const wxString& iName,
113 const wxHtmlTag &params,
114 const wxSize& size);
115
116 // Find an instance of an applet based on it's class name
117 wxApplet *FindApplet(const wxString& className);
118
119 // Remove an applet from the window. Called during applet destruction
120 bool RemoveApplet(const wxApplet *applet);
121
122 // Load a new URL page
123 virtual bool LoadPage(const wxString& location);
124
125 // Called when users clicked on hypertext link.
126 virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
127
128 // Handles forward navigation within the HTML stack
129 bool HistoryForward();
130
131 // Handles backwards navigation within the HTML stack
132 bool HistoryBack();
133
134 // Broadcast a message to all applets on the page
135 void SendMessage(wxEvent& msg);
136
137 // Register a cookie of data in the applet manager
138 bool RegisterCookie(const wxString& name,wxObject *cookie);
139
140 // UnRegister a cookie of data in the applet manager
141 bool UnRegisterCookie(const wxString& name);
142
143 // Find a cookie of data given it's public name
144 wxObject *FindCookie(const wxString& name);
145
146 // Event handlers to load a new page
147 void OnLoadPage(wxLoadPageEvent &event);
148
149 // Event handlers to load a new page
150 void OnPageLoaded(wxPageLoadedEvent &event);
151
152 // LoadPage mutex locks
153 void Lock() { m_mutexLock = true;};
154 void UnLock() { m_mutexLock = false;};
155
156 // Returns TRUE if the mutex is locked, FALSE otherwise.
157 bool IsLocked() { return m_mutexLock;};
158
159 // Tries to lock the mutex. If it can't, returns immediately with false.
160 bool TryLock();
161
162 };
163
164 #endif // __WX_APPLET_WINDOW_H
165