2001-05-03 13:20:52 -04:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
2001-05-03 13:33:16 -04:00
|
|
|
* wxWindows HTML Applet Package
|
2001-05-03 13:20:52 -04:00
|
|
|
*
|
|
|
|
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
2001-06-12 14:52:03 -04:00
|
|
|
* ========================================================================
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the wxWindows License
|
|
|
|
* Version 3.0 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.wxwindows.org/licence3.txt
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an
|
|
|
|
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* ========================================================================
|
2001-05-03 13:20:52 -04:00
|
|
|
*
|
2001-05-03 13:33:16 -04:00
|
|
|
* Language: ANSI C++
|
|
|
|
* Environment: Any
|
2001-05-03 13:20:52 -04:00
|
|
|
*
|
|
|
|
* Description: Header file for the wxHtmlAppletWindow class
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __WX_APPLET_WINDOW_H
|
|
|
|
#define __WX_APPLET_WINDOW_H
|
|
|
|
|
|
|
|
#include "wx/html/htmlwin.h"
|
|
|
|
|
2001-06-08 15:37:56 -04:00
|
|
|
// Forward declare
|
|
|
|
class wxApplet;
|
|
|
|
class wxLoadPageEvent;
|
|
|
|
class wxPageLoadedEvent;
|
|
|
|
class wxIncludePrep;
|
2001-05-03 13:20:52 -04:00
|
|
|
|
|
|
|
// Declare a linked list of wxApplet pointers
|
|
|
|
WX_DECLARE_LIST(wxApplet, wxAppletList);
|
|
|
|
|
2001-06-08 15:37:56 -04:00
|
|
|
/*--------------------------- Class Definitions ---------------------------*/
|
|
|
|
|
2001-05-03 13:20:52 -04:00
|
|
|
/****************************************************************************
|
2001-06-08 15:37:56 -04:00
|
|
|
REMARKS:
|
|
|
|
Defines the class for virtual-link data types
|
|
|
|
****************************************************************************/
|
|
|
|
class VirtualData : public wxObject {
|
|
|
|
private:
|
|
|
|
wxString m_name;
|
|
|
|
wxString m_group;
|
|
|
|
wxString m_href;
|
2001-05-03 13:20:52 -04:00
|
|
|
|
2001-06-08 15:37:56 -04:00
|
|
|
public:
|
|
|
|
// Ctors
|
|
|
|
VirtualData(
|
|
|
|
wxString& name,
|
|
|
|
wxString& group,
|
|
|
|
wxString& href );
|
|
|
|
|
|
|
|
// Gets
|
|
|
|
wxString GetName(){ return m_name;};
|
|
|
|
wxString GetGroup(){ return m_group;};
|
|
|
|
wxString GetHref(){ return m_href;};
|
|
|
|
|
|
|
|
// Sets
|
|
|
|
void SetName (wxString& s){ m_name = s; };
|
|
|
|
void SetGroup(wxString& s){ m_group = s; };
|
|
|
|
void SetHref (wxString& s){ m_href = s; };
|
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
2001-05-03 13:20:52 -04:00
|
|
|
REMARKS:
|
|
|
|
Defines the class for wxAppletWindow. This class is derived from the
|
|
|
|
wxHtmlWindow class and extends it with functionality to handle embedded
|
|
|
|
wxApplet's on the HTML pages.
|
|
|
|
****************************************************************************/
|
|
|
|
class wxHtmlAppletWindow : public wxHtmlWindow {
|
|
|
|
private:
|
|
|
|
DECLARE_CLASS(wxHtmlAppletWindow);
|
|
|
|
DECLARE_EVENT_TABLE();
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-06-12 14:52:03 -04:00
|
|
|
bool m_mutexLock;
|
2001-06-08 15:37:56 -04:00
|
|
|
wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor
|
2001-05-03 13:20:52 -04:00
|
|
|
protected:
|
2001-06-08 15:37:56 -04:00
|
|
|
wxAppletList m_AppletList;
|
|
|
|
static wxHashTable m_Cookies;
|
|
|
|
wxToolBarBase *m_NavBar;
|
|
|
|
int m_NavBackId;
|
|
|
|
int m_NavForwardId;
|
|
|
|
|
2001-05-03 13:20:52 -04:00
|
|
|
public:
|
2001-05-03 13:33:16 -04:00
|
|
|
// Constructor
|
|
|
|
wxHtmlAppletWindow(
|
|
|
|
wxWindow *parent,
|
|
|
|
wxWindowID id = -1,
|
2001-06-08 15:37:56 -04:00
|
|
|
wxToolBarBase *navBar = NULL,
|
|
|
|
int navBackId = -1,
|
|
|
|
int navForwardId = -1,
|
2001-05-03 13:20:52 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2001-05-03 13:33:16 -04:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxHW_SCROLLBAR_AUTO,
|
|
|
|
const wxString& name = "htmlAppletWindow");
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Destructor
|
|
|
|
~wxHtmlAppletWindow();
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Create an instance of an applet based on it's class name
|
|
|
|
wxApplet *CreateApplet(
|
2001-06-08 15:37:56 -04:00
|
|
|
const wxString& classId,
|
|
|
|
const wxString& iName,
|
|
|
|
const wxHtmlTag ¶ms,
|
2001-05-03 13:33:16 -04:00
|
|
|
const wxSize& size);
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Find an instance of an applet based on it's class name
|
2001-06-08 15:37:56 -04:00
|
|
|
wxApplet *FindApplet(const wxString& className);
|
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Remove an applet from the window. Called during applet destruction
|
2001-06-08 15:37:56 -04:00
|
|
|
bool RemoveApplet(const wxApplet *applet);
|
2001-05-03 13:20:52 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Load a new URL page
|
2001-06-08 15:37:56 -04:00
|
|
|
virtual bool LoadPage(const wxString& location);
|
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Called when users clicked on hypertext link.
|
2001-06-08 15:37:56 -04:00
|
|
|
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
|
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Handles forward navigation within the HTML stack
|
|
|
|
bool HistoryForward();
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Handles backwards navigation within the HTML stack
|
|
|
|
bool HistoryBack();
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Broadcast a message to all applets on the page
|
|
|
|
void SendMessage(wxEvent& msg);
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Register a cookie of data in the applet manager
|
|
|
|
bool RegisterCookie(const wxString& name,wxObject *cookie);
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// UnRegister a cookie of data in the applet manager
|
|
|
|
bool UnRegisterCookie(const wxString& name);
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Find a cookie of data given it's public name
|
|
|
|
wxObject *FindCookie(const wxString& name);
|
2001-06-08 15:37:56 -04:00
|
|
|
|
|
|
|
// Event handlers to load a new page
|
|
|
|
void OnLoadPage(wxLoadPageEvent &event);
|
|
|
|
|
|
|
|
// Event handlers to load a new page
|
|
|
|
void OnPageLoaded(wxPageLoadedEvent &event);
|
|
|
|
|
2001-06-12 14:52:03 -04:00
|
|
|
// LoadPage mutex locks
|
|
|
|
void Lock() { m_mutexLock = true;};
|
|
|
|
void UnLock() { m_mutexLock = false;};
|
|
|
|
|
|
|
|
// Returns TRUE if the mutex is locked, FALSE otherwise.
|
|
|
|
bool IsLocked() { return m_mutexLock;};
|
|
|
|
|
|
|
|
// Tries to lock the mutex. If it can't, returns immediately with false.
|
|
|
|
bool TryLock();
|
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
};
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:20:52 -04:00
|
|
|
#endif // __WX_APPLET_WINDOW_H
|
|
|
|
|