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-10-17 18:25:56 -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"
|
2002-01-13 12:37:23 -05:00
|
|
|
#include "wx/hash.h"
|
2001-07-31 13:50:16 -04:00
|
|
|
#include "wx/process.h"
|
2002-01-13 12:37:23 -05:00
|
|
|
#include "wx/toolbar.h"
|
2001-05-03 13:20:52 -04:00
|
|
|
|
2001-06-08 15:37:56 -04:00
|
|
|
// Forward declare
|
|
|
|
class wxApplet;
|
2001-09-07 16:08:05 -04:00
|
|
|
class wxQlet;
|
2001-06-08 15:37:56 -04:00
|
|
|
class wxLoadPageEvent;
|
|
|
|
class wxPageLoadedEvent;
|
|
|
|
class wxIncludePrep;
|
2001-09-28 03:00:13 -04:00
|
|
|
class wxToolBarBase;
|
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 ---------------------------*/
|
2002-02-07 13:46:31 -05:00
|
|
|
class wxAppletEvent {
|
|
|
|
protected:
|
|
|
|
int m_id;
|
|
|
|
wxObject *m_eventObject;
|
|
|
|
public:
|
|
|
|
wxAppletEvent(int id) { m_eventObject=NULL; m_id = id; }
|
|
|
|
|
|
|
|
int GetId() const { return m_id; }
|
|
|
|
void SetId(int Id) { m_id = Id; }
|
|
|
|
|
|
|
|
wxObject *GetEventObject() const { return m_eventObject; }
|
|
|
|
void SetEventObject(wxObject *obj) { m_eventObject = obj; }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2001-06-08 15:37:56 -04:00
|
|
|
|
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:
|
2002-02-07 13:46:31 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(VirtualData);
|
|
|
|
|
|
|
|
protected:
|
2001-06-08 15:37:56 -04:00
|
|
|
wxString m_name;
|
|
|
|
wxString m_group;
|
|
|
|
wxString m_href;
|
2002-02-07 13:46:31 -05:00
|
|
|
wxString m_plugIn;
|
2001-05-03 13:20:52 -04:00
|
|
|
|
2001-06-08 15:37:56 -04:00
|
|
|
public:
|
|
|
|
// Ctors
|
|
|
|
VirtualData(
|
|
|
|
wxString& name,
|
|
|
|
wxString& group,
|
2002-02-07 13:46:31 -05:00
|
|
|
wxString& href,
|
|
|
|
wxString& plugin );
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-10-17 18:25:56 -04:00
|
|
|
VirtualData();
|
|
|
|
|
2001-06-08 15:37:56 -04:00
|
|
|
// Gets
|
|
|
|
wxString GetName(){ return m_name;};
|
|
|
|
wxString GetGroup(){ return m_group;};
|
|
|
|
wxString GetHref(){ return m_href;};
|
2002-02-07 13:46:31 -05:00
|
|
|
wxString GetPlugIn(){ return m_plugIn;};
|
2001-06-08 15:37:56 -04:00
|
|
|
|
|
|
|
// Sets
|
|
|
|
void SetName (wxString& s){ m_name = s; };
|
|
|
|
void SetGroup(wxString& s){ m_group = s; };
|
|
|
|
void SetHref (wxString& s){ m_href = s; };
|
2002-02-07 13:46:31 -05:00
|
|
|
void SetPlugIn (wxString& s){ m_plugIn = s;};
|
|
|
|
void EmptyPlugIn () { m_plugIn = "";};
|
2001-06-08 15:37:56 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
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-10-17 18:25:56 -04:00
|
|
|
bool m_mutexLock;
|
|
|
|
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;
|
2001-10-17 18:25:56 -04:00
|
|
|
bool m_NavBarEnabled;
|
2001-06-08 15:37:56 -04:00
|
|
|
wxToolBarBase *m_NavBar;
|
|
|
|
int m_NavBackId;
|
|
|
|
int m_NavForwardId;
|
2002-02-07 13:46:31 -05:00
|
|
|
wxString m_openedlast;
|
2001-10-17 18:25:56 -04:00
|
|
|
|
|
|
|
// Override this so we can do proper palette management!!
|
|
|
|
virtual void OnDraw(wxDC& dc);
|
|
|
|
|
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,
|
2002-02-07 13:46:31 -05:00
|
|
|
const wxString& name = "htmlAppletWindow");
|
2001-06-08 15:37:56 -04:00
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Destructor
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~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-09-07 16:08:05 -04:00
|
|
|
// Create an instance of an Qlet based on it's class name
|
2002-02-07 13:46:31 -05:00
|
|
|
bool CreatePlugIn(const wxString& classId,const wxString& cmdLine = "");
|
2001-09-07 16:08:05 -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-10-17 18:25:56 -04:00
|
|
|
// Disables Nav bars
|
|
|
|
void DisableNavBar();
|
|
|
|
|
|
|
|
// Enables Nav bars
|
|
|
|
void EnableNavBar();
|
|
|
|
|
|
|
|
void SetNavBar(wxToolBarBase *navBar);
|
|
|
|
|
2001-05-03 13:33:16 -04:00
|
|
|
// Broadcast a message to all applets on the page
|
2002-02-07 13:46:31 -05:00
|
|
|
void SendAppletMessage(wxAppletEvent& 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
|
2001-07-31 13:50:16 -04:00
|
|
|
static 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
|
2001-07-31 13:50:16 -04:00
|
|
|
static 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
|
2001-07-31 13:50:16 -04:00
|
|
|
static 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
|
2001-07-31 13:50:16 -04:00
|
|
|
void Lock(){ m_mutexLock = true;};
|
|
|
|
void UnLock(){ m_mutexLock = false;};
|
2001-06-12 14:52:03 -04:00
|
|
|
|
|
|
|
// Returns TRUE if the mutex is locked, FALSE otherwise.
|
2001-07-31 13:50:16 -04:00
|
|
|
bool IsLocked(){ return m_mutexLock;};
|
2001-06-12 14:52:03 -04:00
|
|
|
|
|
|
|
// Tries to lock the mutex. If it can't, returns immediately with false.
|
|
|
|
bool TryLock();
|
|
|
|
|
2002-02-07 13:46:31 -05:00
|
|
|
wxString GetLastOpened() { return m_openedlast; }
|
2001-07-31 13:50:16 -04:00
|
|
|
};
|
|
|
|
|
2001-09-07 16:08:05 -04:00
|
|
|
/****************************************************************************
|
|
|
|
REMARKS:
|
|
|
|
Defines the class for wxHtmlAppletCell
|
|
|
|
***************************************************************************/
|
|
|
|
class wxHtmlAppletCell : public wxHtmlCell
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxHtmlAppletCell(wxWindow *wnd, int w = 0);
|
2002-02-07 13:46:31 -05:00
|
|
|
virtual ~wxHtmlAppletCell();
|
2001-09-07 16:08:05 -04:00
|
|
|
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
|
|
|
virtual void DrawInvisible(wxDC& dc, int x, int y);
|
|
|
|
virtual void Layout(int w);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxWindow* m_Wnd;
|
|
|
|
// width float is used in adjustWidth (it is in percents)
|
|
|
|
};
|
|
|
|
|
2001-05-03 13:20:52 -04:00
|
|
|
#endif // __WX_APPLET_WINDOW_H
|
|
|
|
|