Commited latest SciTech changes into CVS. This includes updates to the
applet code (with changes copyright headers) as well as updates to the wxImage and dib.cpp modules to use virtual file systems so that we can load these objects from ZIP files correctly. The dib.cpp module was also extensively cleaned up (although the DIB writing code does not presently use file streams as we couldn't figure out if it was possible to write to a ZIP file stream). The code has been tested and functions correctly for both regular files and ZIP files. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10551 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5,23 +5,19 @@
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ======================================================================
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* | |
|
||||
* |This copyrighted computer code is a proprietary trade secret of |
|
||||
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
|
||||
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
|
||||
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
|
||||
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
|
||||
* |written authorization from SciTech to possess or use this code, you |
|
||||
* |may be subject to civil and/or criminal penalties. |
|
||||
* | |
|
||||
* |If you received this code in error or you would like to report |
|
||||
* |improper use, please immediately contact SciTech Software, Inc. at |
|
||||
* |530-894-8400. |
|
||||
* | |
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* ======================================================================
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
@@ -51,7 +47,7 @@ private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
protected:
|
||||
wxHtmlAppletWindow *m_parent;
|
||||
//wxHtmlAppletWindow *m_parent;
|
||||
|
||||
// Special handler for background erase messages
|
||||
void OnEraseBackground(wxEraseEvent&);
|
||||
|
95
contrib/include/wx/applet/echovar.h
Normal file
95
contrib/include/wx/applet/echovar.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Header file for wxEchoVariable Class, Dynamically constructed
|
||||
* objects representing variables in SSI #echo directive
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __WX_ECHOVAR_H
|
||||
#define __WX_ECHOVAR_H
|
||||
|
||||
/*--------------------------- Class Definitions ---------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
wxEchoVariable class Definition
|
||||
****************************************************************************/
|
||||
class wxEchoVariable : public wxObject {
|
||||
private:
|
||||
DECLARE_ABSTRACT_CLASS(wxEchoVariable);
|
||||
|
||||
public:
|
||||
wxEchoVariable() : wxObject() {}
|
||||
~wxEchoVariable() {}
|
||||
|
||||
/****************************************************************************
|
||||
RETURNS:
|
||||
The boolean value of the variable
|
||||
|
||||
PARAMETERS:
|
||||
parms - Optional parameter string passed from parm= field in HTML
|
||||
|
||||
REMARKS:
|
||||
To create new variables for the #echo HTML preprocessing directives
|
||||
you need to derive classes from wxEchoVariable and override the
|
||||
pure virtual GetValue function. However this should not be done directly
|
||||
but by using the BEGIN_ECHO_VARIABLE and END_ECHO_VARIABLE macros
|
||||
|
||||
SEE ALSO:
|
||||
wxEchoPrep, BEGIN_ECHO_VARIABLE, END_ECHO_VARIABLE
|
||||
****************************************************************************/
|
||||
virtual wxString GetValue(const char *parms = NULL) const = 0;
|
||||
|
||||
|
||||
public:
|
||||
// static function to retrieve any variable avaliable
|
||||
static wxString GetValue(const wxString &cls, const char *parms = NULL);
|
||||
};
|
||||
|
||||
/*--------------------------------- MACROS --------------------------------*/
|
||||
|
||||
#define ECHO_PARM (_BEV_parm)
|
||||
#define BEGIN_ECHO_VARIABLE(name) \
|
||||
class wxEchoVariable##name : public wxEchoVariable { \
|
||||
private: \
|
||||
DECLARE_DYNAMIC_CLASS(wxEchoVariable##name##); \
|
||||
public: \
|
||||
wxEchoVariable##name##() : wxEchoVariable() {} \
|
||||
virtual wxString GetValue(const char *parms = NULL) const; \
|
||||
}; \
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxEchoVariable##name##, wxEchoVariable); \
|
||||
wxString wxEchoVariable##name :: GetValue(const char *parms) const { \
|
||||
wxString _BEV_parm = wxString(parms);
|
||||
|
||||
#define END_ECHO_VARIABLE(name, returnval) \
|
||||
return returnval; \
|
||||
}
|
||||
|
||||
#define STRING_ECHO_VARIABLE(name, string) \
|
||||
BEGIN_ECHO_VARIABLE(##name##); \
|
||||
END_ECHO_VARIABLE(##name##, wxString(##string##))
|
||||
|
||||
#endif // __WX_ECHOVAR_H
|
||||
|
95
contrib/include/wx/applet/ifelsevar.h
Normal file
95
contrib/include/wx/applet/ifelsevar.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Header file for wxIfElseVariable Class, Dynamically constructed
|
||||
* objects representing variables in SSI #if, #else and #endif directives
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __WX_IFELSEVAR_H
|
||||
#define __WX_IFELSEVAR_H
|
||||
|
||||
/*--------------------------- Class Definitions ---------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
This class is used to create variables for the HTML preprocessor #if, #else,
|
||||
and #endif directives.
|
||||
|
||||
SEE ALSO:
|
||||
wxIfElsePrep
|
||||
****************************************************************************/
|
||||
class wxIfElseVariable : public wxObject {
|
||||
private:
|
||||
DECLARE_ABSTRACT_CLASS(wxIfElseVariable);
|
||||
|
||||
public:
|
||||
wxIfElseVariable() : wxObject() {}
|
||||
~wxIfElseVariable() {}
|
||||
|
||||
/****************************************************************************
|
||||
RETURNS:
|
||||
The boolean value of the variable
|
||||
|
||||
REMARKS:
|
||||
To create new variables for the #if, #else and #endif HTML preprocessing
|
||||
blocks you need to derive classes from wxIfElseVariable and override the
|
||||
pure virtual GetValue function. However this should not be done directly
|
||||
but by using the BEGIN_IFELSE_VARIABLE and END_IFELSE_VARIABLE macros
|
||||
|
||||
SEE ALSO:
|
||||
wxIfElsePrep, BEGIN_IFELSE_VARIABLE, END_IFELSE_VARIABLE
|
||||
****************************************************************************/
|
||||
virtual bool GetValue() const = 0;
|
||||
|
||||
|
||||
public:
|
||||
// static function to retrieve any variable avaliable
|
||||
static bool GetValue(const wxString &cls);
|
||||
};
|
||||
|
||||
/*--------------------------------- MACROS --------------------------------*/
|
||||
|
||||
#define BEGIN_IFELSE_VARIABLE(name) \
|
||||
class wxIfElseVariable##name : public wxIfElseVariable { \
|
||||
private: \
|
||||
DECLARE_DYNAMIC_CLASS(wxIfElseVariable##name##); \
|
||||
public: \
|
||||
wxIfElseVariable##name##() : wxIfElseVariable() {} \
|
||||
virtual bool GetValue() const; \
|
||||
}; \
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxIfElseVariable##name##, wxIfElseVariable); \
|
||||
bool wxIfElseVariable##name :: GetValue() const {
|
||||
|
||||
#define END_IFELSE_VARIABLE(name, returnval) \
|
||||
return returnval; \
|
||||
}
|
||||
|
||||
#define IFELSE_VARIABLE(name, state) \
|
||||
BEGIN_IFELSE_VARIABLE(##name##); \
|
||||
END_IFELSE_VARIABLE(##name##, bool (state))
|
||||
|
||||
|
||||
#endif // __WX_IFELSEVAR_H
|
||||
|
109
contrib/include/wx/applet/loadpage.h
Normal file
109
contrib/include/wx/applet/loadpage.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Header file for the wxLoadPage Event class
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __WX_LOAD_PAGE_H
|
||||
#define __WX_LOAD_PAGE_H
|
||||
|
||||
#include "wx/html/htmlwin.h"
|
||||
|
||||
// Forward declaration
|
||||
class wxHtmlAppletWindow;
|
||||
|
||||
// If we are compiling this code into a library that links against
|
||||
// the DLL, we need to remove all the __declspec(dllimports) that
|
||||
// would declare our classes below incorrectly.
|
||||
|
||||
#ifndef WXMAKINGDLL
|
||||
#undef WXDLLEXPORT
|
||||
#define WXDLLEXPORT
|
||||
#endif
|
||||
// Declare our local load page event type
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE(wxEVT_LOAD_PAGE, wxEVT_USER_FIRST+1)
|
||||
DECLARE_EVENT_TYPE(wxEVT_PAGE_LOADED, wxEVT_USER_FIRST+2)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
/*--------------------------- Class Definitions ---------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Defines the class for load page events.
|
||||
****************************************************************************/
|
||||
class wxLoadPageEvent : public wxEvent {
|
||||
DECLARE_DYNAMIC_CLASS(wxLoadPageEvent);
|
||||
|
||||
protected:
|
||||
wxString m_hRef;
|
||||
wxHtmlAppletWindow *m_htmlWindow;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
wxLoadPageEvent(const wxString &hRef = "",wxHtmlAppletWindow *htmlWindow = NULL);
|
||||
|
||||
// Destructor
|
||||
~wxLoadPageEvent() {}
|
||||
|
||||
// Return the hmtl window for the load page operation
|
||||
wxHtmlAppletWindow *GetHtmlWindow() { return m_htmlWindow; };
|
||||
|
||||
// Get the hRef string for the load page operation
|
||||
const wxString & GetHRef() { return m_hRef; };
|
||||
|
||||
// Copy constructor for the object
|
||||
void CopyObject(wxObject& obj) const;
|
||||
};
|
||||
|
||||
|
||||
// Define the macro to create our event type
|
||||
typedef void (wxEvtHandler::*wxLoadPageEventFunction)(wxLoadPageEvent&);
|
||||
#define EVT_LOAD_PAGE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_LOAD_PAGE, -1, -1, (wxObjectEventFunction)(wxEventFunction)(wxLoadPageEventFunction) & fn, (wxObject *) NULL ),
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Defines the class for pageloaded events.
|
||||
****************************************************************************/
|
||||
class wxPageLoadedEvent : public wxEvent {
|
||||
DECLARE_DYNAMIC_CLASS(wxPageLoadedEvent);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
wxPageLoadedEvent();
|
||||
|
||||
// Destructor
|
||||
~wxPageLoadedEvent() {}
|
||||
|
||||
// Copy constructor for the object
|
||||
void CopyObject(wxObject& obj) const;
|
||||
};
|
||||
|
||||
// Define the macro to create our event type
|
||||
typedef void (wxEvtHandler::*wxPageLoadedEventFunction)(wxPageLoadedEvent&);
|
||||
#define EVT_PAGE_LOADED(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_PAGE_LOADED, -1, -1, (wxObjectEventFunction)(wxEventFunction)(wxPageLoadedEventFunction) & fn, (wxObject *) NULL ),
|
||||
|
||||
|
||||
#endif // __WX_LOAD_PAGE_H
|
59
contrib/include/wx/applet/prepecho.h
Normal file
59
contrib/include/wx/applet/prepecho.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Header file for the Preprocessor of the #echo directive
|
||||
* in wxHTML.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __WX_PREPECHO_H
|
||||
#define __WX_PREPECHO_H
|
||||
|
||||
#include "wx/html/htmlproc.h"
|
||||
|
||||
/*--------------------------- Class Definitions ---------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Echo Preprocessor class Definition
|
||||
****************************************************************************/
|
||||
class wxEchoPrep : public wxHtmlProcessor {
|
||||
private:
|
||||
//DECLARE_DYNAMIC_CLASS(wxEchoPrep);
|
||||
|
||||
public:
|
||||
wxEchoPrep() : wxHtmlProcessor() {}
|
||||
~wxEchoPrep() {}
|
||||
|
||||
// Process input text and return processed result
|
||||
wxString Process(const wxString& text) const;
|
||||
|
||||
// Return priority value of this processor. The higher, the sooner
|
||||
// is the processor applied to the text.
|
||||
int GetPriority() const { return wxHTML_PRIORITY_SYSTEM-2; }
|
||||
};
|
||||
|
||||
|
||||
#endif // __WX_PREPECHO_H
|
||||
|
59
contrib/include/wx/applet/prepifelse.h
Normal file
59
contrib/include/wx/applet/prepifelse.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Header file for the Preprocessor of the #if SSI directive
|
||||
* in wxHTML.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __WX_PREPIFELSE_H
|
||||
#define __WX_PREPIFELSE_H
|
||||
|
||||
#include "wx/html/htmlproc.h"
|
||||
|
||||
/*--------------------------- Class Definitions ---------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
If Else Preprocessor class Definition
|
||||
****************************************************************************/
|
||||
class wxIfElsePrep : public wxHtmlProcessor {
|
||||
private:
|
||||
//DECLARE_DYNAMIC_CLASS(wxIfElsePrep);
|
||||
|
||||
public:
|
||||
wxIfElsePrep() : wxHtmlProcessor() {}
|
||||
~wxIfElsePrep() {}
|
||||
|
||||
// Process input text and return processed result
|
||||
wxString Process(const wxString& text) const;
|
||||
|
||||
// Return priority value of this processor. The higher, the sooner
|
||||
// is the processor applied to the text.
|
||||
int GetPriority() const { return wxHTML_PRIORITY_SYSTEM-2; }
|
||||
};
|
||||
|
||||
|
||||
#endif // __WX_PREPECHO_H
|
||||
|
63
contrib/include/wx/applet/prepinclude.h
Normal file
63
contrib/include/wx/applet/prepinclude.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Header file for the Preprocessor of the #include directive
|
||||
* in wxHTML.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __WX_PREPINCLUDE_H
|
||||
#define __WX_PREPINCLUDE_H
|
||||
|
||||
#include "wx/html/htmlproc.h"
|
||||
|
||||
/*--------------------------- Class Definitions ---------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
wxIncludePrep class Definition
|
||||
****************************************************************************/
|
||||
class wxIncludePrep : public wxHtmlProcessor {
|
||||
private:
|
||||
//DECLARE_DYNAMIC_CLASS(wxIncludePrep);
|
||||
wxString DOC_ROOT;
|
||||
|
||||
public:
|
||||
wxIncludePrep() : wxHtmlProcessor() {DOC_ROOT = wxString("");}
|
||||
~wxIncludePrep() {}
|
||||
|
||||
// Process input text and return processed result
|
||||
wxString Process(const wxString& text) const;
|
||||
|
||||
// Return priority value of this processor. The higher, the sooner
|
||||
// is the processor applied to the text.
|
||||
int GetPriority() const { return wxHTML_PRIORITY_SYSTEM; }
|
||||
|
||||
void ChangeDirectory(const wxString &dir);
|
||||
wxString GetDirectory() { return DOC_ROOT; }
|
||||
};
|
||||
|
||||
|
||||
#endif // __WX_PREPINCLUDE_H
|
||||
|
@@ -5,23 +5,19 @@
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ======================================================================
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* | |
|
||||
* |This copyrighted computer code is a proprietary trade secret of |
|
||||
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
|
||||
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
|
||||
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
|
||||
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
|
||||
* |written authorization from SciTech to possess or use this code, you |
|
||||
* |may be subject to civil and/or criminal penalties. |
|
||||
* | |
|
||||
* |If you received this code in error or you would like to report |
|
||||
* |improper use, please immediately contact SciTech Software, Inc. at |
|
||||
* |530-894-8400. |
|
||||
* | |
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* ======================================================================
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
@@ -85,6 +81,7 @@ private:
|
||||
DECLARE_CLASS(wxHtmlAppletWindow);
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
bool m_mutexLock;
|
||||
wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor
|
||||
protected:
|
||||
wxAppletList m_AppletList;
|
||||
@@ -152,6 +149,16 @@ public:
|
||||
// Event handlers to load a new page
|
||||
void OnPageLoaded(wxPageLoadedEvent &event);
|
||||
|
||||
// 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();
|
||||
|
||||
};
|
||||
|
||||
#endif // __WX_APPLET_WINDOW_H
|
||||
|
@@ -2,22 +2,21 @@
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* The contents of this file are subject to the wxWindows licence; 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/licence.htm
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001 SciTech Software, Inc.
|
||||
*
|
||||
* The Initial Developer of the Original Code is SciTech Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
@@ -77,17 +76,17 @@ MyFrame::MyFrame(
|
||||
menuFile->Append(Minimal_Quit, "E&xit");
|
||||
menuNav->Append(Minimal_Back, "Go &back");
|
||||
menuNav->Append(Minimal_Forward, "Go &forward");
|
||||
|
||||
|
||||
// Now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(menuNav, "&Navigate");
|
||||
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
CreateStatusBar(2);
|
||||
|
||||
// Create the HTML window
|
||||
// Create the HTML window
|
||||
html = new wxHtmlAppletWindow(this);
|
||||
html->SetRelatedFrame(this, "wxApplet Demo: '%s'");
|
||||
html->SetRelatedStatusBar(1);
|
||||
|
@@ -2,22 +2,21 @@
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* The contents of this file are subject to the wxWindows licence; 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/licence.htm
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001 SciTech Software, Inc.
|
||||
*
|
||||
* The Initial Developer of the Original Code is SciTech Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
@@ -37,7 +36,7 @@ enum {
|
||||
Minimal_About,
|
||||
Minimal_Back,
|
||||
Minimal_Forward,
|
||||
|
||||
|
||||
// Controls start here (the numbers are, of course, arbitrary)
|
||||
Minimal_Text = 1000,
|
||||
};
|
||||
|
@@ -2,22 +2,21 @@
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* The contents of this file are subject to the wxWindows licence; 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/licence.htm
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001 SciTech Software, Inc.
|
||||
*
|
||||
* The Initial Developer of the Original Code is SciTech Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
@@ -77,7 +76,7 @@ void ComboBox::Select(int n)
|
||||
m_ListBox->Select(n);
|
||||
m_TextCtrl->SetValue(GetStringSelection());
|
||||
}
|
||||
|
||||
|
||||
void ComboBox::Deselect(int n)
|
||||
{
|
||||
m_ListBox->Deselect(n);
|
||||
@@ -86,7 +85,7 @@ void ComboBox::Deselect(int n)
|
||||
void ComboBox::Insert(const wxString& item, int pos)
|
||||
{
|
||||
m_ListBox->Insert(item,pos);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboBox::Insert(const wxString& item, int pos, void *clientData)
|
||||
{
|
||||
@@ -130,13 +129,13 @@ void ComboBox::SetFirstItem(int n)
|
||||
m_ListBox->SetFirstItem(n);
|
||||
m_TextCtrl->SetValue(GetStringSelection());
|
||||
}
|
||||
|
||||
|
||||
void ComboBox::SetFirstItem(const wxString &s)
|
||||
{
|
||||
m_ListBox->SetFirstItem(s);
|
||||
m_TextCtrl->SetValue(GetStringSelection());
|
||||
}
|
||||
|
||||
|
||||
void ComboBox::Append(const wxString &item)
|
||||
{
|
||||
m_ListBox->Append(item);
|
||||
@@ -155,12 +154,12 @@ void ComboBox::Append(const wxString& item, wxClientData *clientData)
|
||||
m_TextCtrl->SetValue(GetStringSelection());
|
||||
}
|
||||
|
||||
void ComboBox::Clear()
|
||||
void ComboBox::Clear()
|
||||
{
|
||||
m_ListBox->Clear();
|
||||
m_TextCtrl->SetValue(GetStringSelection());
|
||||
}
|
||||
|
||||
|
||||
void ComboBox::Delete(int n)
|
||||
{
|
||||
m_ListBox->Delete(n);
|
||||
|
@@ -2,22 +2,21 @@
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* The contents of this file are subject to the wxWindows licence; 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/licence.htm
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001 SciTech Software, Inc.
|
||||
*
|
||||
* The Initial Developer of the Original Code is SciTech Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
@@ -52,45 +51,45 @@ private:
|
||||
public:
|
||||
// Constructor
|
||||
ComboBox(wxWindow *parent, int,int);
|
||||
|
||||
|
||||
// Returns the id of the listbox: listBoxId.
|
||||
int GetListBoxId();
|
||||
|
||||
|
||||
// Inserts: Used to insert items into the listbox
|
||||
void Insert(const wxString& item, int pos);
|
||||
void Insert(const wxString& item, int pos, void *clientData);
|
||||
void Insert(const wxString& item, int pos, wxClientData *clientData);
|
||||
void InsertItems(int nItems, const wxString *items, int pos);
|
||||
void InsertItems(const wxArrayString& items, int pos);
|
||||
|
||||
|
||||
// Sets: Used to set items in the combo box
|
||||
void Set(int n, const wxString* items, void **clientData );
|
||||
void Set(const wxArrayString& items, void **clientData);
|
||||
int FindString(const wxString &s);
|
||||
|
||||
|
||||
// Selections: Used to get/de/select items in the listbox
|
||||
void Select(int n);
|
||||
void Deselect(int n);
|
||||
int GetSelection();
|
||||
int GetSelection();
|
||||
wxString GetStringSelection();
|
||||
bool SetStringSelection(const wxString& s, bool select);
|
||||
|
||||
|
||||
// Set the specified item at the first visible item or scroll to max
|
||||
// range.
|
||||
void SetFirstItem(int n);
|
||||
void SetFirstItem(const wxString& s);
|
||||
|
||||
|
||||
// Append items to the listbox
|
||||
void Append(const wxString& item);
|
||||
void Append(const wxString& item, void *clientData);
|
||||
void Append(const wxString& item, wxClientData *clientData);
|
||||
|
||||
|
||||
// Deleting items from the list box
|
||||
void Clear();
|
||||
void Clear();
|
||||
void Delete(int n);
|
||||
|
||||
|
||||
// OnChange event function (called from SDD dialog box code, see: dialog.h) Mimic
|
||||
// msw combobox behavior: Click on listbox item it shows in textbox.
|
||||
// msw combobox behavior: Click on listbox item it shows in textbox.
|
||||
void OnChange(wxCommandEvent &event);
|
||||
};
|
||||
|
||||
|
@@ -5,23 +5,19 @@
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ======================================================================
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* | |
|
||||
* |This copyrighted computer code is a proprietary trade secret of |
|
||||
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
|
||||
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
|
||||
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
|
||||
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
|
||||
* |written authorization from SciTech to possess or use this code, you |
|
||||
* |may be subject to civil and/or criminal penalties. |
|
||||
* | |
|
||||
* |If you received this code in error or you would like to report |
|
||||
* |improper use, please immediately contact SciTech Software, Inc. at |
|
||||
* |530-894-8400. |
|
||||
* | |
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* ======================================================================
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
@@ -41,7 +37,7 @@
|
||||
|
||||
// Implement the dynamic class so it can be constructed dynamically
|
||||
IMPLEMENT_DYNAMIC_CLASS(MonitorApplet, wxApplet);
|
||||
|
||||
|
||||
// Event handler table.
|
||||
BEGIN_EVENT_TABLE(MonitorApplet, wxApplet)
|
||||
EVT_LISTBOX(ID_LISTBOX_MFTR, MonitorApplet::OnChange)
|
||||
@@ -51,8 +47,8 @@ END_EVENT_TABLE()
|
||||
// Include database of known monitors. Normally this would come from a
|
||||
// real database on disk, but for this simple example we hard code all
|
||||
// the values into a table.
|
||||
#include "monitors.c"
|
||||
|
||||
#include "monitors.c"
|
||||
|
||||
/*------------------------- Implementation --------------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
@@ -62,7 +58,7 @@ internal values for the class so that it can be properly created later
|
||||
via the virtual Create member function.
|
||||
****************************************************************************/
|
||||
MonitorApplet::MonitorApplet()
|
||||
{
|
||||
{
|
||||
m_Mfr = NULL;
|
||||
m_Model = NULL;
|
||||
m_Data = NULL;
|
||||
@@ -85,7 +81,7 @@ bool MonitorApplet::Create(
|
||||
memset(&m_Data->m_Monitor,0,sizeof(m_Data->m_Monitor));
|
||||
parent->RegisterCookie(MONITOR_COOKIE_NAME,m_Data);
|
||||
}
|
||||
|
||||
|
||||
// Create all the controls and initialise them
|
||||
MonitorDialogFunc(this,true,true);
|
||||
if ((m_Mfr = new ComboBox(this , ID_LISTBOX_MFTR, ID_TEXTCTRL_MFTR)) == NULL)
|
||||
@@ -97,7 +93,7 @@ bool MonitorApplet::Create(
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Destructor for the MonitorApplet class.
|
||||
@@ -124,11 +120,11 @@ REMARKS:
|
||||
Handles user navigation away from the applet via an HTML link
|
||||
****************************************************************************/
|
||||
void MonitorApplet::OnLinkClicked(
|
||||
const wxHtmlLinkInfo&)
|
||||
const wxHtmlLinkInfo&)
|
||||
{
|
||||
SaveCurrentState();
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Handles user navigation away from the applet via the history forward command
|
||||
@@ -137,7 +133,7 @@ void MonitorApplet::OnHistoryForward()
|
||||
{
|
||||
SaveCurrentState();
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Handles user navigation away from the applet via the history back command
|
||||
@@ -146,12 +142,12 @@ void MonitorApplet::OnHistoryBack()
|
||||
{
|
||||
SaveCurrentState();
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Handles inter applet communication messages
|
||||
****************************************************************************/
|
||||
void MonitorApplet::OnMessage(
|
||||
void MonitorApplet::OnMessage(
|
||||
wxEvent& msg)
|
||||
{
|
||||
msg.Skip(true);
|
||||
@@ -168,7 +164,7 @@ void MonitorApplet::OnChange(
|
||||
ReadModelList(true);
|
||||
}
|
||||
else if (evt.GetId() == m_Model->GetListBoxId()) {
|
||||
m_Model->OnChange(evt);
|
||||
m_Model->OnChange(evt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +173,7 @@ REMARKS:
|
||||
Updates the manufacturer list for the dialog box from the database.
|
||||
****************************************************************************/
|
||||
void MonitorApplet::ReadMfrList()
|
||||
{
|
||||
{
|
||||
char buf[80] = "";
|
||||
int i,selected = 0;
|
||||
MonitorEntry *m;
|
||||
@@ -202,11 +198,11 @@ manufacturer type.
|
||||
****************************************************************************/
|
||||
void MonitorApplet::ReadModelList(
|
||||
bool selectCurrent)
|
||||
{
|
||||
{
|
||||
int i,selected = 0;
|
||||
MonitorEntry *m;
|
||||
wxString mfrStr;
|
||||
|
||||
|
||||
mfrStr = m_Mfr->GetStringSelection();
|
||||
m_Model->Clear();
|
||||
for (m = m_Monitors,i = 0; m->m_Mfr[0] != 0; m++) {
|
||||
|
@@ -1,25 +1,23 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ======================================================================
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* | |
|
||||
* |This copyrighted computer code is a proprietary trade secret of |
|
||||
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
|
||||
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
|
||||
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
|
||||
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
|
||||
* |written authorization from SciTech to possess or use this code, you |
|
||||
* |may be subject to civil and/or criminal penalties. |
|
||||
* | |
|
||||
* |If you received this code in error or you would like to report |
|
||||
* |improper use, please immediately contact SciTech Software, Inc. at |
|
||||
* |530-894-8400. |
|
||||
* | |
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* ======================================================================
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
@@ -56,9 +54,9 @@ public:
|
||||
MonitorEntry m_Monitor;
|
||||
};
|
||||
|
||||
// Name used to track the monitor data cookie
|
||||
#define MONITOR_COOKIE_NAME "MonitorData"
|
||||
|
||||
// Name used to track the monitor data cookie
|
||||
#define MONITOR_COOKIE_NAME "MonitorData"
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Defines our wxMonitor applet class
|
||||
@@ -67,16 +65,16 @@ class MonitorApplet : public wxApplet {
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(MonitorApplet);
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
|
||||
protected:
|
||||
ComboBox *m_Mfr;
|
||||
ComboBox *m_Mfr;
|
||||
ComboBox *m_Model;
|
||||
MonitorData *m_Data;
|
||||
MonitorData *m_Data;
|
||||
static MonitorEntry m_Monitors[];
|
||||
|
||||
|
||||
// Flush the current state to a cookie
|
||||
void SaveCurrentState();
|
||||
|
||||
|
||||
public:
|
||||
// Constructor (called during dynamic creation)
|
||||
MonitorApplet();
|
||||
@@ -86,19 +84,19 @@ public:
|
||||
wxHtmlAppletWindow *parent,
|
||||
const wxSize& size,
|
||||
long style);
|
||||
|
||||
|
||||
// Virtual destructor
|
||||
virtual ~MonitorApplet();
|
||||
|
||||
// Handle HTML navigation to a new URL
|
||||
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
|
||||
|
||||
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
|
||||
|
||||
// Handle HTML navigation forward command in applet
|
||||
virtual void OnHistoryForward();
|
||||
|
||||
|
||||
// Handle HTML navigation back command in applet
|
||||
virtual void OnHistoryBack();
|
||||
|
||||
|
||||
// Handle messages from the wxAppletManager and other applets
|
||||
virtual void OnMessage(wxEvent& msg);
|
||||
|
||||
@@ -106,9 +104,9 @@ public:
|
||||
void ReadMfrList();
|
||||
void ReadModelList(bool selectCurrent);
|
||||
|
||||
// Event handlers
|
||||
// Event handlers
|
||||
void OnChange(wxCommandEvent &event);
|
||||
};
|
||||
|
||||
|
||||
#endif // __WX_MONITORAPPLET_H
|
||||
|
||||
|
@@ -5,23 +5,19 @@
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ======================================================================
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* | |
|
||||
* |This copyrighted computer code is a proprietary trade secret of |
|
||||
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
|
||||
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
|
||||
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
|
||||
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
|
||||
* |written authorization from SciTech to possess or use this code, you |
|
||||
* |may be subject to civil and/or criminal penalties. |
|
||||
* | |
|
||||
* |If you received this code in error or you would like to report |
|
||||
* |improper use, please immediately contact SciTech Software, Inc. at |
|
||||
* |530-894-8400. |
|
||||
* | |
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* ======================================================================
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
@@ -72,7 +68,7 @@ Destructor for the wxApplet class.
|
||||
****************************************************************************/
|
||||
wxApplet::~wxApplet()
|
||||
{
|
||||
m_parent->RemoveApplet(this);
|
||||
((wxHtmlAppletWindow *) m_parent)->RemoveApplet(this);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@@ -5,23 +5,19 @@
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ======================================================================
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* | |
|
||||
* |This copyrighted computer code is a proprietary trade secret of |
|
||||
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
|
||||
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
|
||||
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
|
||||
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
|
||||
* |written authorization from SciTech to possess or use this code, you |
|
||||
* |may be subject to civil and/or criminal penalties. |
|
||||
* | |
|
||||
* |If you received this code in error or you would like to report |
|
||||
* |improper use, please immediately contact SciTech Software, Inc. at |
|
||||
* |530-894-8400. |
|
||||
* | |
|
||||
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
|
||||
* ======================================================================
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
@@ -82,7 +78,10 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
|
||||
const wxString& name)
|
||||
: wxHtmlWindow(parent,id,pos,size,style,name)
|
||||
{
|
||||
//setup client navbars
|
||||
// Init our locks
|
||||
UnLock();
|
||||
|
||||
// setup client navbars
|
||||
if (navBar) {
|
||||
m_NavBar = navBar;
|
||||
m_NavBackId = navBackId;
|
||||
@@ -92,7 +91,7 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
|
||||
m_NavBar = NULL;
|
||||
}
|
||||
|
||||
//Add HTML preprocessors
|
||||
// Add HTML preprocessors
|
||||
// deleting preprocessors is done by the code within the window
|
||||
|
||||
incPreprocessor = new wxIncludePrep(); // #include preprocessor
|
||||
@@ -102,8 +101,6 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
|
||||
this->AddProcessor(incPreprocessor);
|
||||
this->AddProcessor(echoPreprocessor);
|
||||
this->AddProcessor(ifPreprocessor);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -240,23 +237,21 @@ bool wxHtmlAppletWindow::LoadPage(
|
||||
}
|
||||
}
|
||||
|
||||
// Grab the directory from the string for use in the include preprocessor
|
||||
// make sure we get either type of / or \.
|
||||
int ch = link.Find('\\', true);
|
||||
if (ch == -1) ch = link.Find('/', true);
|
||||
if (ch != -1) {
|
||||
wxFileSystem fs;
|
||||
wxString tmp = link.Mid(0, ch+1);
|
||||
fs.ChangePathTo(incPreprocessor->GetDirectory(), true);
|
||||
fs.ChangePathTo(tmp, true);
|
||||
incPreprocessor->ChangeDirectory(fs.GetPath());
|
||||
}
|
||||
// Make a copy of the current path the translate for <!-- include files from what will be the new path
|
||||
// we cannot just grab this value from the base class since it is not correct until after LoadPage is
|
||||
// called. And we need the incPreprocessor to know the right path before LoadPage.
|
||||
wxFileSystem fs;
|
||||
fs.ChangePathTo(m_FS->GetPath(), true);
|
||||
fs.ChangePathTo(link);
|
||||
incPreprocessor->ChangeDirectory(fs.GetPath());
|
||||
|
||||
// Inform all the applets that the new page is being loaded
|
||||
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
|
||||
(node->GetData())->OnLinkClicked(wxHtmlLinkInfo(href));
|
||||
bool stat = wxHtmlWindow::LoadPage(href);
|
||||
|
||||
|
||||
|
||||
// Enable/Dis the navbar tools
|
||||
if (m_NavBar) {
|
||||
m_NavBar->EnableTool(m_NavForwardId,HistoryCanForward());
|
||||
@@ -431,10 +426,20 @@ need to change the page for the current window to a new window.
|
||||
void wxHtmlAppletWindow::OnLoadPage(
|
||||
wxLoadPageEvent &event)
|
||||
{
|
||||
if (event.GetHtmlWindow() == this){
|
||||
if (LoadPage(event.GetHRef())){
|
||||
wxPageLoadedEvent evt;
|
||||
// Test the mutex lock. We have to do this here because wxHTML constantly
|
||||
// calls wxYield which processes the message queue. This in turns means
|
||||
// that we may end up processing a new 'loadPage' event while the new
|
||||
// page is still loading! We need to avoid this so we use a simple
|
||||
// lock to avoid loading a page while presently loading another page.
|
||||
if (TryLock()) {
|
||||
if (event.GetHtmlWindow() == this){
|
||||
if (LoadPage(event.GetHRef())){
|
||||
// wxPageLoadedEvent evt;
|
||||
// NOTE: This is reserved for later use as we might need to send
|
||||
// page loaded events to applets.
|
||||
}
|
||||
}
|
||||
UnLock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,6 +457,23 @@ void wxHtmlAppletWindow::OnPageLoaded(
|
||||
Enable(true);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
none
|
||||
|
||||
REMARKS:
|
||||
This function tries to lock the mutex. If it can't, returns
|
||||
immediately with false.
|
||||
***************************************************************************/
|
||||
bool wxHtmlAppletWindow::TryLock()
|
||||
{
|
||||
if (!m_mutexLock) {
|
||||
m_mutexLock = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
name - name of the last applet that changed the data in this object
|
||||
|
180
contrib/src/applet/echovar.cpp
Normal file
180
contrib/src/applet/echovar.cpp
Normal file
@@ -0,0 +1,180 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Implementation of wxEchoVariable Class, Dynamically constructed
|
||||
* objects representing variables in SSI #echo directive
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// For compilers that support precompilation
|
||||
#include "wx/wxprec.h"
|
||||
#include "wx/html/forcelnk.h"
|
||||
|
||||
// Include private headers
|
||||
#include "wx/applet/echovar.h"
|
||||
|
||||
/*---------------------------- Global variables ---------------------------*/
|
||||
|
||||
// Implement the dynamic class so it can be constructed dynamically
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxEchoVariable, wxObject);
|
||||
|
||||
/*----------------------------- Implementation ----------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
cls - The String name of the class
|
||||
parms - an optional parameter string to pass off to the child class
|
||||
|
||||
RETURNS:
|
||||
The string value of the variable
|
||||
|
||||
REMARKS:
|
||||
To grab a value from any class which is derived from this one simple use this
|
||||
static function and the name of the derived class to get the value.
|
||||
This static function is the only function implemented in this base class
|
||||
basically this is provided for an easier method of grabbing a variable. We
|
||||
keep all the dynamic object handling in this class to avoid confusing the source
|
||||
where these are used.
|
||||
|
||||
SEE ALSO:
|
||||
wxEchoPrep
|
||||
****************************************************************************/
|
||||
static wxString wxEchoVariable::GetValue(
|
||||
const wxString &cls,
|
||||
const char *parms)
|
||||
{
|
||||
wxObject * tmpclass;
|
||||
|
||||
tmpclass = wxCreateDynamicObject(wxString("wxEchoVariable") + cls);
|
||||
if (!tmpclass) {
|
||||
#ifdef CHECKED
|
||||
wxMessageBox(wxString("wxHTML #echo error: Class not found (") + cls + wxString(")."),"Error",wxICON_ERROR);
|
||||
#endif
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
wxEchoVariable * ev = wxDynamicCast(tmpclass, wxEchoVariable);
|
||||
|
||||
if (!ev) {
|
||||
#ifdef CHECKED
|
||||
wxMessageBox(wxString("wxHTML #echo error: Class is not a valid echo variable (") + cls + wxString(")."),"Error",wxICON_ERROR);
|
||||
#endif
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
return ev->GetValue(parms);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------ Macro Documentation ---------------------------*/
|
||||
|
||||
// Here we declare some fake functions to get doc-jet to properly document the macros
|
||||
|
||||
#undef ECHO_PARM
|
||||
/****************************************************************************
|
||||
RETURNS:
|
||||
The value of the parameter string from the HTML parm= field
|
||||
|
||||
REMARKS:
|
||||
This is a macro to retrieve the parameter string passed in the parm= field.
|
||||
Use this macro to get the correct variable within a BEGIN_ECHO_VARIABLE and
|
||||
END_ECHO_VARIABLE block.
|
||||
|
||||
SEE ALSO:
|
||||
wxEchoVariable, wxEchoPrep, BEGIN_ECHO_VARIABLE, END_ECHO_VARIABLE
|
||||
****************************************************************************/
|
||||
wxString ECHO_PARM();
|
||||
|
||||
|
||||
#undef BEGIN_ECHO_VARIABLE
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
name - The name of the variable to create
|
||||
|
||||
REMARKS:
|
||||
This macro is used to create variables for use by the #echo directive
|
||||
the HTML preprocessor.
|
||||
To create a new variable include the code necessary to get the value of the
|
||||
variable between a block of BEGIN_ECHO_VARIABLE and END_ECHO_VARIABLE macros.
|
||||
Use the ECHO_PARM macro to grab the optional parameter string passed from the
|
||||
'parm=' field in the html file.
|
||||
|
||||
EXAMPLE:
|
||||
BEGIN_ECHO_VARIABLE(UserName)
|
||||
// Get username from nucleus
|
||||
wxString tmp = GA_GetUserName();
|
||||
END_ECHO_VARIABLE(UserName, tmp)
|
||||
|
||||
SEE ALSO:
|
||||
wxEchoVariable, wxEchoPrep, END_ECHO_VARIABLE, ECHO_PARM, STRING_ECHO_VARIABLE
|
||||
****************************************************************************/
|
||||
void BEGIN_ECHO_VARIABLE(
|
||||
const char *name);
|
||||
|
||||
#undef END_ECHO_VARIABLE
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
name - The name of the variable to end
|
||||
returnval - The value which should be sent back as the value of the variable
|
||||
|
||||
REMARKS:
|
||||
This macro is used to create variables for use by the #echo directive
|
||||
the HTML preprocessor.
|
||||
To create a new variable include the code necessary to get the value of the
|
||||
variable between a block of BEGIN_ECHO_VARIABLE and END_ECHO_VARIABLE macros.
|
||||
|
||||
EXAMPLE:
|
||||
BEGIN_ECHO_VARIABLE(UserName)
|
||||
// Get username from nucleus
|
||||
wxString tmp = GA_GetUserName();
|
||||
END_ECHO_VARIABLE(UserName, tmp)
|
||||
|
||||
SEE ALSO:
|
||||
wxEchoVariable, wxEchoPrep, BEGIN_ECHO_VARIABLE, ECHO_PARM, STRING_ECHO_VARIABLE
|
||||
****************************************************************************/
|
||||
void END_ECHO_VARIABLE(
|
||||
const char *name,
|
||||
wxString returnval);
|
||||
|
||||
#undef STRING_ECHO_VARIABLE
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
name - The name of the variable
|
||||
returnval - String to return as the value of the variable
|
||||
|
||||
REMARKS:
|
||||
This macro is used to create constant string variables for use by the #echo
|
||||
directive in the HTML preprocessor.
|
||||
This MACRO creates a variable that simply returns the given string and is
|
||||
not modifiable.
|
||||
|
||||
SEE ALSO:
|
||||
wxEchoVariable, wxEchoPrep, BEGIN_ECHO_VARIABLE, END_ECHO_VARIABLE
|
||||
****************************************************************************/
|
||||
void STRING_ECHO_VARIABLE(
|
||||
const char *name,
|
||||
wxString string);
|
||||
|
||||
// hack to make this file link
|
||||
FORCE_LINK_ME(echovar)
|
159
contrib/src/applet/ifelsevar.cpp
Normal file
159
contrib/src/applet/ifelsevar.cpp
Normal file
@@ -0,0 +1,159 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Implementation of wxIfElseVariable Class, Dynamically constructed
|
||||
* objects representing variables in SSI #if, #else, and #endif directives
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// For compilers that support precompilation
|
||||
#include "wx/wxprec.h"
|
||||
#include "wx/html/forcelnk.h"
|
||||
|
||||
// Include private headers
|
||||
#include "wx/applet/ifelsevar.h"
|
||||
|
||||
/*---------------------------- Global variables ---------------------------*/
|
||||
|
||||
// Implement the dynamic class so it can be constructed dynamically
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxIfElseVariable, wxObject);
|
||||
|
||||
/*----------------------------- Implementation ----------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
cls - The String name of the class
|
||||
|
||||
RETURNS:
|
||||
The boolean value of the variable
|
||||
|
||||
REMARKS:
|
||||
To grab a value from any class which is derived from this one simple use this
|
||||
static function and the name of the derived class to get the value.
|
||||
This static function is the only function implemented in this base class
|
||||
basically this is provided for an easier method of grabbing a variable. We
|
||||
keep all the dynamic object handling in this class to avoid confusing the source
|
||||
where these are used.
|
||||
|
||||
SEE ALSO:
|
||||
wxIfElsePrep
|
||||
****************************************************************************/
|
||||
static bool wxIfElseVariable::GetValue(
|
||||
const wxString &cls)
|
||||
{
|
||||
wxObject * tmpclass;
|
||||
|
||||
tmpclass = wxCreateDynamicObject(wxString("wxIfElseVariable") + cls);
|
||||
if (!tmpclass) {
|
||||
#ifdef CHECKED
|
||||
wxMessageBox(wxString("wxHTML #if error: Class not found (") + cls + wxString(")."),"Error",wxICON_ERROR);
|
||||
#endif
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
wxIfElseVariable * ev = wxDynamicCast(tmpclass, wxIfElseVariable);
|
||||
|
||||
if (!ev) {
|
||||
#ifdef CHECKED
|
||||
wxMessageBox(wxString("wxHTML #if error: Class is not a valid ifelse variable (") + cls + wxString(")."),"Error",wxICON_ERROR);
|
||||
#endif
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
return ev->GetValue();
|
||||
}
|
||||
|
||||
/*------------------------ Macro Documentation ---------------------------*/
|
||||
|
||||
// Here we declare some fake functions to get doc-jet to properly document the macros
|
||||
|
||||
#undef BEGIN_IFELSE_VARIABLE
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
name - The name of the variable to create
|
||||
|
||||
REMARKS:
|
||||
This macro is used to create variables for use by the #if, #else and #endif
|
||||
blocks in the HTML preprocessor.
|
||||
To create a new variable include the code necessary to get the value of the
|
||||
variable between a block of BEGIN_IFELSE_VARIABLE and END_IFELSE_VARIABLE macros.
|
||||
|
||||
EXAMPLE:
|
||||
BEGIN_IFELSE_VARIABLE(UserName)
|
||||
// Get username from nucleus
|
||||
bool tmp = GA_HasRegistered();
|
||||
END_IFELSE_VARIABLE(UserName, tmp)
|
||||
|
||||
SEE ALSO:
|
||||
wxIfElseVariable, wxIfElsePrep, END_IFELSE_VARIABLE, IFELSE_VARIABLE
|
||||
****************************************************************************/
|
||||
void BEGIN_IFELSE_VARIABLE(
|
||||
const char *name);
|
||||
|
||||
#undef END_IFELSE_VARIABLE
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
name - The name of the variable to end
|
||||
returnval - The boolean value which is the value of the variable
|
||||
|
||||
REMARKS:
|
||||
This macro is used to create variables for use by the #if, #else and #endif
|
||||
blocks in the HTML preprocessor.
|
||||
To create a new variable include the code necessary to get the value of the
|
||||
variable between a block of BEGIN_IFELSE_VARIABLE and END_IFELSE_VARIABLE macros.
|
||||
|
||||
EXAMPLE:
|
||||
BEGIN_IFELSE_VARIABLE(UserName)
|
||||
// Get username from nucleus
|
||||
bool tmp = GA_HasRegistered();
|
||||
END_IFELSE_VARIABLE(UserName, tmp)
|
||||
|
||||
SEE ALSO:
|
||||
wxIfElseVariable, wxIfElsePrep, BEGIN_IFELSE_VARIABLE, IFELSE_VARIABLE
|
||||
****************************************************************************/
|
||||
void END_IFELSE_VARIABLE(
|
||||
const char *name,
|
||||
bool returnval);
|
||||
|
||||
#undef IFELSE_VARIABLE
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
name - The name of the variable
|
||||
state - value of the variable
|
||||
|
||||
REMARKS:
|
||||
This macro is used to create constant boolean variables for use by the
|
||||
#if, #else and #endif blocks in the HTML preprocessor.
|
||||
This MACRO creates a variable that simply returns the given state and is
|
||||
not modifiable.
|
||||
|
||||
SEE ALSO:
|
||||
wxIfElseVariable, wxIfElsePrep, BEGIN_IFELSE_VARIABLE, END_IFELSE_VARIABLE
|
||||
****************************************************************************/
|
||||
void IFELSE_VARIABLE(
|
||||
const char *name,
|
||||
bool state);
|
||||
|
||||
|
||||
FORCE_LINK_ME(ifelsevar)
|
98
contrib/src/applet/loadpage.cpp
Normal file
98
contrib/src/applet/loadpage.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Loadpage event class implementation
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// For compilers that support precompilation
|
||||
#include "wx/wxprec.h"
|
||||
#include "wx/html/forcelnk.h"
|
||||
|
||||
// Include private headers
|
||||
#include "wx/applet/loadpage.h"
|
||||
|
||||
/*------------------------- Implementation --------------------------------*/
|
||||
|
||||
// Implement the class functions for wxLoadPageEvent
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxLoadPageEvent, wxEvent)
|
||||
|
||||
// Implement the class functions for wxPageLoadedEvent
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPageLoadedEvent, wxEvent)
|
||||
|
||||
// Define our custom event ID for load page
|
||||
DEFINE_EVENT_TYPE(wxEVT_LOAD_PAGE);
|
||||
|
||||
// Define our custom event ID for page loaded
|
||||
DEFINE_EVENT_TYPE(wxEVT_PAGE_LOADED);
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Constructor for the wxLoadPageEvent class
|
||||
****************************************************************************/
|
||||
wxLoadPageEvent::wxLoadPageEvent(
|
||||
const wxString &hRef,
|
||||
wxHtmlAppletWindow *htmlWindow)
|
||||
: m_hRef(hRef), m_htmlWindow(htmlWindow)
|
||||
{
|
||||
m_eventType = wxEVT_LOAD_PAGE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Function to copy the wxLoadPageEvent object
|
||||
****************************************************************************/
|
||||
void wxLoadPageEvent::CopyObject(
|
||||
wxObject& obj_d) const
|
||||
{
|
||||
wxLoadPageEvent *obj = (wxLoadPageEvent*)&obj_d;
|
||||
wxEvent::CopyObject(obj_d);
|
||||
obj->m_hRef = m_hRef;
|
||||
obj->m_htmlWindow = m_htmlWindow;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Constructor for the wxPageLoadedEvent class
|
||||
****************************************************************************/
|
||||
wxPageLoadedEvent::wxPageLoadedEvent()
|
||||
{
|
||||
m_eventType = wxEVT_LOAD_PAGE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Function to copy the wxPageLoadedEvent object
|
||||
****************************************************************************/
|
||||
void wxPageLoadedEvent::CopyObject(
|
||||
wxObject& obj_d) const
|
||||
{
|
||||
wxPageLoadedEvent *obj = (wxPageLoadedEvent*)&obj_d;
|
||||
wxEvent::CopyObject(obj_d);
|
||||
}
|
||||
|
||||
// This is out little force link hack
|
||||
FORCE_LINK_ME(loadpage)
|
||||
|
128
contrib/src/applet/prepecho.cpp
Normal file
128
contrib/src/applet/prepecho.cpp
Normal file
@@ -0,0 +1,128 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: This file is the implementation of the Preprocessor object
|
||||
* for parsing the <!--#echo directive
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// For compilers that support precompilation
|
||||
#include "wx/wxprec.h"
|
||||
#include "wx/html/forcelnk.h"
|
||||
|
||||
// Include private headers
|
||||
#include "wx/applet/prepecho.h"
|
||||
#include "wx/applet/echovar.h"
|
||||
|
||||
/*---------------------------- Global variables ---------------------------*/
|
||||
|
||||
|
||||
/*----------------------------- Implementation ----------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
text - HTML to process for echo directives
|
||||
|
||||
RETURNS:
|
||||
The string containing the processed HTML
|
||||
|
||||
REMARKS:
|
||||
This function replaces #echo directives with a variable retrieved from the
|
||||
class given in the HTML directive. These classes are created by making a sub
|
||||
class of wxEchoVariable. Dynamic class construction is used at run time
|
||||
internally to create an instance of this class and access the value of the
|
||||
variable.
|
||||
|
||||
SEE ALSO:
|
||||
wxEchoVariable
|
||||
****************************************************************************/
|
||||
wxString wxEchoPrep::Process(
|
||||
const wxString& text) const
|
||||
{
|
||||
int i;
|
||||
char ft[] = "<!--#echo ";
|
||||
|
||||
// make a copy so we can replace text as we go without affecting the original
|
||||
wxString output = text;
|
||||
|
||||
while ((i = (output.Lower()).Find(ft)) != -1) {
|
||||
// Loop until every #echo directive is found
|
||||
|
||||
int n, c, end;
|
||||
wxString cname, parms;
|
||||
wxString tag;
|
||||
|
||||
// grab the tag and remove it from the file
|
||||
end = (output.Mid(i)).Find("-->");
|
||||
if (end == -1) {
|
||||
#ifdef CHECKED
|
||||
wxMessageBox("wxHTML #echo error: Premature end of file while parsing #echo.","Error",wxICON_ERROR);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
end += 3;
|
||||
tag = output.Mid(i, end);
|
||||
output.Remove(i, end);
|
||||
|
||||
n = (tag.Lower()).Find(" parm=");
|
||||
c = tag.Find("-->");
|
||||
if (n == -1) {
|
||||
n = c;
|
||||
// find the classname
|
||||
c = (tag.Mid(10, n-10)).Find(" ");
|
||||
if (c == -1) n -= 10;
|
||||
else n = c;
|
||||
cname = tag.Mid(10, n);
|
||||
|
||||
// grab the value from the class, put it in tag since the data is no longer needed
|
||||
tag = wxEchoVariable::GetValue(cname, NULL);
|
||||
}
|
||||
else {
|
||||
// Find the parms
|
||||
parms = tag.Mid(n+6, c-n-6);
|
||||
// Clip off any quotation marks if they exist. (don't die if there arn't any)
|
||||
c = parms.Find("\"");
|
||||
if (c != -1) parms = parms.Mid(c+1);
|
||||
c = parms.Find("\"");
|
||||
if (c != -1) parms = parms.Mid(0, c);
|
||||
// find the classname
|
||||
c = (tag.Mid(10, n-10)).Find(" ");
|
||||
if (c == -1) n -= 10;
|
||||
else n = c;
|
||||
cname = tag.Mid(10, n);
|
||||
|
||||
// grab the value from the class, put it in tag since the data is no longer needed
|
||||
tag = wxEchoVariable::GetValue(cname, parms.c_str());
|
||||
}
|
||||
|
||||
|
||||
output = (output.Mid(0,i) + tag + output.Mid(i));
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
FORCE_LINK(echovar)
|
||||
|
171
contrib/src/applet/prepifelse.cpp
Normal file
171
contrib/src/applet/prepifelse.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: This file is the implementation of the Preprocessor object
|
||||
* for parsing the <!--#if directive
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// For compilers that support precompilation
|
||||
#include "wx/wxprec.h"
|
||||
#include "wx/html/forcelnk.h"
|
||||
|
||||
// Include private headers
|
||||
#include "wx/applet/prepifelse.h"
|
||||
#include "wx/applet/ifelsevar.h"
|
||||
|
||||
/*---------------------------- Global variables ---------------------------*/
|
||||
|
||||
|
||||
/*----------------------------- Implementation ----------------------------*/
|
||||
|
||||
/* {SECRET} */
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
None of the Reverse Find functions in wxWindows appear to work in a way that
|
||||
can be used by our code. This includes the libstr rfind implementations which
|
||||
do not correctly pass the given return value.
|
||||
****************************************************************************/
|
||||
int ReverseFind(
|
||||
const wxString &tstr,
|
||||
const wxString &str)
|
||||
{
|
||||
wxASSERT( str.GetStringData()->IsValid() );
|
||||
|
||||
// TODO could be made much quicker than that
|
||||
int p = tstr.Len()-str.Len()-1;
|
||||
while ( p >= 0 ) {
|
||||
if ( wxStrncmp(tstr.c_str() + p, str.c_str(), str.Len()) == 0 )
|
||||
return p;
|
||||
p--;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
text - HTML to process for if/else blocks
|
||||
|
||||
RETURNS:
|
||||
The string containing the processed HTML
|
||||
|
||||
REMARKS:
|
||||
This function replaces #if, #else, and #endif directives with the text
|
||||
contained within the blocks, dependant on the value of the given boolean
|
||||
variable. The variable is created by making a sub class of wxIfElseVariable.
|
||||
Dynamic class construction is used at run time internally to create an instance
|
||||
of this class and access the value of the variable.
|
||||
|
||||
SEE ALSO:
|
||||
wxIfElseVariable
|
||||
****************************************************************************/
|
||||
wxString wxIfElsePrep::Process(
|
||||
const wxString& text) const
|
||||
{
|
||||
int b;
|
||||
char ft[] = "<!--#if ";
|
||||
|
||||
// make a copy so we can replace text as we go without affecting the original
|
||||
wxString output = text;
|
||||
while ((b = ReverseFind(output.Lower(), ft)) != -1) {
|
||||
// Loop until every #echo directive is found
|
||||
// We search from the end of the string so that #if statements will properly recurse
|
||||
// and we avoid the hassle of matching statements with the correct <!--#endif-->
|
||||
int end, c, n;
|
||||
wxString usecode, code;
|
||||
wxString cname;
|
||||
wxString tag;
|
||||
bool value;
|
||||
|
||||
code = wxString("");
|
||||
|
||||
// grab the tag and get the name of the variable
|
||||
end = (output.Mid(b)).Find("-->");
|
||||
if (end == -1) {
|
||||
#ifdef CHECKED
|
||||
wxMessageBox("wxHTML #if error: Premature end of file while parsing #if.","Error",wxICON_ERROR);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
end += 3;
|
||||
tag = output.Mid(b, end);
|
||||
output.Remove(b, end);
|
||||
|
||||
c = tag.Find("-->");
|
||||
n = c;
|
||||
|
||||
// find the classname
|
||||
c = (tag.Mid(8, n-8)).Find(" ");
|
||||
if (c == -1) n -= 8;
|
||||
else n = c;
|
||||
cname = tag.Mid(8, n);
|
||||
|
||||
cname.Trim(false);
|
||||
c = cname.Find("\"");
|
||||
if (c != -1) cname = cname.Mid(c+1);
|
||||
c = cname.Find("\"");
|
||||
if (c != -1) cname = cname.Mid(0, c);
|
||||
|
||||
// Grab the value from the variable class identified by cname
|
||||
value = wxIfElseVariable::GetValue(cname);
|
||||
|
||||
// Find the end of the tag (<!--#endif-->) and copy it all into the variable code
|
||||
end = ((output.Mid(b)).Lower()).Find("<!--#endif-->");
|
||||
if (end == -1) {
|
||||
#ifdef CHECKED
|
||||
wxMessageBox("wxHTML #if error: Premature end of file while searching for matching #endif.","Error",wxICON_ERROR);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
code = output.Mid(b, end);
|
||||
output.Remove(b, end+13); // remove the entire #if block from original document
|
||||
|
||||
// Find out if there is an else statement
|
||||
end = (code.Lower()).Find("<!--#else-->");
|
||||
if (end != -1) {
|
||||
if (!value) {
|
||||
// Use the else statement
|
||||
usecode = code.Mid(end+12);
|
||||
}
|
||||
else {
|
||||
// Use statement before #else
|
||||
usecode = code.Mid(0, end);
|
||||
}
|
||||
}
|
||||
else if (value) {
|
||||
// There is no #else statement
|
||||
usecode = code;
|
||||
}
|
||||
|
||||
if (usecode != wxString(""))
|
||||
output = (output.Mid(0,b) + usecode + output.Mid(b));
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
FORCE_LINK(ifelsevar)
|
146
contrib/src/applet/prepinclude.cpp
Normal file
146
contrib/src/applet/prepinclude.cpp
Normal file
@@ -0,0 +1,146 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* wxWindows HTML Applet Package
|
||||
*
|
||||
* Copyright (C) 1991-2001 SciTech Software, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C++
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: This file is the implementation of the Preprocessor object
|
||||
* for parsing the <!--#include
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// For compilers that support precompilation
|
||||
#include "wx/wxprec.h"
|
||||
//#include "wx/file.h"
|
||||
#include "wx/filesys.h"
|
||||
// Include private headers
|
||||
#include "wx/applet/prepinclude.h"
|
||||
|
||||
#define RECURSE_LIMIT 50
|
||||
/*---------------------------- Global variables ---------------------------*/
|
||||
|
||||
|
||||
/*----------------------------- Implementation ----------------------------*/
|
||||
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
text - HTML to process for include directives
|
||||
|
||||
RETURNS:
|
||||
The string containing the processed HTML
|
||||
|
||||
REMARKS:
|
||||
This is the only implemented method of the Preprocessor class. It is a constant
|
||||
function that parses a string. Basically we load the string search for include
|
||||
statements then replace them with the correct file. Wash rinse and repeat until
|
||||
all recursive cases are handled.
|
||||
****************************************************************************/
|
||||
wxString wxIncludePrep::Process(
|
||||
const wxString& text) const
|
||||
{
|
||||
int i;
|
||||
char ft[] = "<!--#include virtual=";
|
||||
|
||||
wxFileSystem *fs = new wxFileSystem;
|
||||
fs->ChangePathTo(DOC_ROOT, true);
|
||||
|
||||
int openedcount = 0;
|
||||
|
||||
// make a copy so we can replace text as we go without affecting the original
|
||||
wxString output = text;
|
||||
while ((i = (output.Lower()).Find(ft)) != -1) {
|
||||
// This loop makes more recursion unnecessary since each iteration adds
|
||||
// the new include files to output.
|
||||
int n, c;
|
||||
wxString fname;
|
||||
|
||||
n = (output.Mid(i+21)).Find("-->");
|
||||
|
||||
if (n == -1) {
|
||||
#ifdef CHECKED
|
||||
wxMessageBox("wxHTML #include error: Could not read filename. Premature end of file.","Error",wxICON_ERROR);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
fname = output.Mid(i+21, n);
|
||||
|
||||
// Clip off any quotation marks if they exist. (don't die if there arn't any)
|
||||
c = fname.Find("\"");
|
||||
if (c != -1) fname = fname.Mid(c+1);
|
||||
c = fname.Find("\"");
|
||||
if (c != -1) fname = fname.Mid(0, c);
|
||||
|
||||
// remove the #include tag
|
||||
output.Remove(i, n+21+3);
|
||||
|
||||
wxFSFile * file = fs->OpenFile(fname);
|
||||
|
||||
if (!file) {
|
||||
#ifdef CHECKED
|
||||
wxMessageBox(wxString("wxHTML #include error: File not Found ") + fname + wxString("."),"Error",wxICON_ERROR);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
wxString tmp;
|
||||
|
||||
|
||||
do {
|
||||
char tmp2[257];
|
||||
(file->GetStream())->Read(tmp2, 256);
|
||||
c = (file->GetStream())->LastRead();
|
||||
tmp2[c] = 0;
|
||||
tmp += wxString(tmp2);
|
||||
} while (c == 256);
|
||||
|
||||
output = (output.Mid(0,i) + tmp + output.Mid(i));
|
||||
|
||||
#ifdef CHECKED
|
||||
if (openedcount > RECURSE_LIMIT) {
|
||||
wxMessageBox(wxString("wxHTML #include error: More than RECURSE_LIMIT files have been #included you may have a file that is directly or indirectly including itself, causing an endless loop"), "Error" ,wxICON_ERROR);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
openedcount++;
|
||||
delete file;
|
||||
}
|
||||
|
||||
delete fs;
|
||||
return output;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
PARAMETERS:
|
||||
dir - Default directory to get included HTML files from
|
||||
|
||||
REMARKS:
|
||||
This function sets the directory to get included HTML files from. The default
|
||||
value is the current directory. Directorys may be given as a relative path.
|
||||
****************************************************************************/
|
||||
void wxIncludePrep::ChangeDirectory(
|
||||
const wxString &dir)
|
||||
{
|
||||
|
||||
DOC_ROOT = dir;
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "wx/log.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/filesys.h"
|
||||
#include "wx/wfstream.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/module.h"
|
||||
@@ -762,18 +763,19 @@ bool wxImage::HasOption(const wxString& name) const
|
||||
bool wxImage::LoadFile( const wxString& filename, long type )
|
||||
{
|
||||
#if wxUSE_STREAMS
|
||||
if (wxFileExists(filename))
|
||||
{
|
||||
wxFileInputStream stream(filename);
|
||||
wxBufferedInputStream bstream( stream );
|
||||
return LoadFile(bstream, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() );
|
||||
|
||||
// We want to use wxFileSystem for virtual FS compatibility
|
||||
wxFileSystem fsys;
|
||||
wxFSFile *file = fsys.OpenFile(filename);
|
||||
if (!file) {
|
||||
wxLogError(_("Can't open file '%s'"), filename);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
wxInputStream *stream = file->GetStream();
|
||||
if (!stream) {
|
||||
wxLogError(_("Can't open stream for file '%s'"), filename);
|
||||
return FALSE;
|
||||
}
|
||||
return LoadFile(*stream, type);
|
||||
#else // !wxUSE_STREAMS
|
||||
return FALSE;
|
||||
#endif // wxUSE_STREAMS
|
||||
@@ -782,18 +784,19 @@ bool wxImage::LoadFile( const wxString& filename, long type )
|
||||
bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype )
|
||||
{
|
||||
#if wxUSE_STREAMS
|
||||
if (wxFileExists(filename))
|
||||
{
|
||||
wxFileInputStream stream(filename);
|
||||
wxBufferedInputStream bstream( stream );
|
||||
return LoadFile(bstream, mimetype);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() );
|
||||
|
||||
// We want to use wxFileSystem for virtual FS compatibility
|
||||
wxFileSystem fsys;
|
||||
wxFSFile *file = fsys.OpenFile(filename);
|
||||
if (!file) {
|
||||
wxLogError(_("Can't open file '%s'"), filename);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
wxInputStream *stream = file->GetStream();
|
||||
if (!stream) {
|
||||
wxLogError(_("Can't open stream for file '%s'"), filename);
|
||||
return FALSE;
|
||||
}
|
||||
return LoadFile(*stream, mimetype);
|
||||
#else // !wxUSE_STREAMS
|
||||
return FALSE;
|
||||
#endif // wxUSE_STREAMS
|
||||
|
1041
src/msw/dib.cpp
1041
src/msw/dib.cpp
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user