making wxHTML 8.3 compliant

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
1999-10-02 18:19:46 +00:00
parent 47f631042b
commit 69941f0586
41 changed files with 331 additions and 321 deletions

View File

@@ -1,9 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: forcelink.h
// Name: forcelnk.h
// Purpose: see bellow
// Author: Vaclav Slavik
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
// RCS-ID: $Id$
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
@@ -36,8 +37,8 @@ See mod_*.cpp and htmlwin.cpp for example :-)
*/
#ifndef __FORCELINK_H__
#define __FORCELINK_H__
#ifndef _WX_FORCELNK_H_
#define _WX_FORCELNK_H_
@@ -56,4 +57,4 @@ See mod_*.cpp and htmlwin.cpp for example :-)
_link_dummy_func_##module_name ();
#endif // __FORCELINK_H__
#endif // _WX_FORCELNK_H_

View File

@@ -4,8 +4,7 @@
// Notes: Based on htmlhelp.cpp, implementing a monolithic
// HTML Help controller class, by Vaclav Slavik
// Author: Harm van der Heijden and Vaclav Slavik
// Created:
// RCS-ID:
// RCS-ID: $Id$
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -16,7 +15,7 @@
#include "wx/defs.h"
#ifdef __GNUG__
#pragma interface "helpctrl.h"
#pragma interface
#endif
#if wxUSE_HTML

View File

@@ -4,8 +4,7 @@
// Notes: Based on htmlhelp.cpp, implementing a monolithic
// HTML Help controller class, by Vaclav Slavik
// Author: Harm van der Heijden and Vaclav Slavik
// Created:
// RCS-ID:
// RCS-ID: $Id$
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -14,7 +13,7 @@
#define _WX_HELPDATA_H_
#ifdef __GNUG__
#pragma interface "helpdata.h"
#pragma interface
#endif
#include "wx/defs.h"

View File

@@ -4,8 +4,7 @@
// Notes: Based on htmlhelp.cpp, implementing a monolithic
// HTML Help controller class, by Vaclav Slavik
// Author: Harm van der Heijden and Vaclav Slavik
// Created:
// RCS-ID:
// RCS-ID: $Id$
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -14,7 +13,7 @@
#define _WX_HELPFRM_H_
#ifdef __GNUG__
#pragma interface "helpfrm.h"
#pragma interface
#endif
#include "wx/defs.h"

View File

@@ -3,16 +3,17 @@
// Purpose: wxHtmlCell class is used by wxHtmlWindow/wxHtmlWinParser
// as a basic visual element of HTML page
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __HTMLCELL_H__
#define __HTMLCELL_H__
#ifndef _WX_HTMLCELL_H_
#define _WX_HTMLCELL_H_
#ifdef __GNUG__
#pragma interface "htmlcell.h"
#pragma interface
#endif
#include "wx/defs.h"
@@ -36,19 +37,6 @@ class wxHtmlContainerCell;
class WXDLLEXPORT wxHtmlCell : public wxObject
{
protected:
wxHtmlCell *m_Next;
// pointer to the next cell
wxHtmlContainerCell *m_Parent;
// pointer to parent cell
long m_Width, m_Height, m_Descent;
// dimensions of fragment
// m_Descent is used to position text&images..
long m_PosX, m_PosY;
// position where the fragment is drawn
wxString m_Link;
// destination address if this fragment is hypertext link, "" otherwise
public:
wxHtmlCell() : wxObject() {m_Next = NULL; m_Parent = NULL; m_Width = m_Height = m_Descent = 0;};
virtual ~wxHtmlCell() {if (m_Next) delete m_Next;};
@@ -106,6 +94,21 @@ class WXDLLEXPORT wxHtmlCell : public wxObject
// Parent is pointer to wxHtmlWindow that generated the event
// HINT: if this handling is not enough for you you should use
// wxHtmlBinderCell
protected:
wxHtmlCell *m_Next;
// pointer to the next cell
wxHtmlContainerCell *m_Parent;
// pointer to parent cell
long m_Width, m_Height, m_Descent;
// dimensions of fragment
// m_Descent is used to position text&images..
long m_PosX, m_PosY;
// position where the fragment is drawn
wxString m_Link;
// destination address if this fragment is hypertext link, "" otherwise
};
@@ -281,15 +284,7 @@ class WXDLLEXPORT wxHtmlWidgetCell : public wxHtmlCell
#endif // __HTMLCELL_H__
#endif
#endif // _WX_HTMLCELL_H_

View File

@@ -2,13 +2,14 @@
// Name: htmldefs.h
// Purpose: constants for wxhtml library
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __HTMLDEFS_H__
#define __HTMLDEFS_H__
#ifndef _WX_HTMLDEFS_H_
#define _WX_HTMLDEFS_H_
#include "wx/defs.h"
@@ -95,4 +96,4 @@
/* steps of array reallocation */
#endif
#endif
#endif

View File

@@ -1,17 +1,18 @@
/////////////////////////////////////////////////////////////////////////////
// Name: htmlfilter.h
// Name: htmlfilt.h
// Purpose: filters
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __HTMLFILTER_H__
#define __HTMLFILTER_H__
#ifndef _WX_HTMLFILT_H_
#define _WX_HTMLFILT_H_
#ifdef __GNUG__
#pragma interface "htmlfilter.h"
#pragma interface
#endif
#include "wx/defs.h"
@@ -65,7 +66,6 @@ class WXDLLEXPORT wxHtmlFilterPlainText : public wxHtmlFilter
#endif
#endif // _WX_HTMLFILT_H_
#endif // __HTMLFILTER_H__
#endif

View File

@@ -1,14 +1,15 @@
/////////////////////////////////////////////////////////////////////////////
// Name: htmlparser.h
// Name: htmlpars.h
// Purpose: wxHtmlParser class (generic parser)
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __HTMLPARSER_H__
#define __HTMLPARSER_H__
#ifndef _WX_HTMLPARS_H_
#define _WX_HTMLPARS_H_
#ifdef __GNUG__
#pragma interface
@@ -17,8 +18,8 @@
#include "wx/defs.h"
#if wxUSE_HTML
#include <wx/html/htmltag.h>
#include <wx/filesys.h>
#include "wx/html/htmltag.h"
#include "wx/filesys.h"
class wxHtmlParser;
class wxHtmlTagHandler;
@@ -35,25 +36,6 @@ class WXDLLEXPORT wxHtmlParser : public wxObject
{
DECLARE_ABSTRACT_CLASS(wxHtmlParser)
protected:
wxString m_Source;
// source being parsed
wxHtmlTagsCache *m_Cache;
// tags cache, used during parsing.
wxHashTable m_HandlersHash;
wxList m_HandlersList;
// handlers that handle particular tags. The table is accessed by
// key = tag's name.
// This attribute MUST be filled by derived class otherwise it would
// be empty and no tags would be recognized
// (see wxHtmlWinParser for details about filling it)
// m_HandlersHash is for random access based on knowledge of tag name (BR, P, etc.)
// it may (and often does) contain more references to one object
// m_HandlersList is list of all handlers and it is guaranteed to contain
// only one reference to each handler instance.
wxFileSystem *m_FS;
// class for opening files (file system)
public:
wxHtmlParser() : wxObject(), m_HandlersHash(wxKEY_STRING) {m_FS = NULL; m_Cache = NULL;}
virtual ~wxHtmlParser();
@@ -115,6 +97,27 @@ class WXDLLEXPORT wxHtmlParser : public wxObject
// Default behavior is that it looks for proper handler in m_Handlers. The tag is
// ignored if no hander is found.
// Derived class is *responsible* for filling in m_Handlers table.
protected:
wxString m_Source;
// source being parsed
wxHtmlTagsCache *m_Cache;
// tags cache, used during parsing.
wxHashTable m_HandlersHash;
wxList m_HandlersList;
// handlers that handle particular tags. The table is accessed by
// key = tag's name.
// This attribute MUST be filled by derived class otherwise it would
// be empty and no tags would be recognized
// (see wxHtmlWinParser for details about filling it)
// m_HandlersHash is for random access based on knowledge of tag name (BR, P, etc.)
// it may (and often does) contain more references to one object
// m_HandlersList is list of all handlers and it is guaranteed to contain
// only one reference to each handler instance.
wxFileSystem *m_FS;
// class for opening files (file system)
};
@@ -170,7 +173,6 @@ class WXDLLEXPORT wxHtmlTagHandler : public wxObject
#endif // __HTMLPARSER_H__
#endif
#endif // _WX_HTMLPARS_H_

View File

@@ -2,13 +2,14 @@
// Name: htmltag.h
// Purpose: wxHtmlTag class (represents single tag)
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __HTMLTAG_H__
#define __HTMLTAG_H__
#ifndef _WX_HTMLTAG_H_
#define _WX_HTMLTAG_H_
#ifdef __GNUG__
#pragma interface
@@ -71,18 +72,13 @@ class WXDLLEXPORT wxHtmlTag : public wxObject
{
DECLARE_CLASS(wxHtmlTag)
private:
wxString m_Name, m_Params;
int m_Begin, m_End1, m_End2;
bool m_Ending;
public:
wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
// constructs wxHtmlTag object based on HTML tag.
// The tag begins (with '<' character) at position pos in source
// end_pos is position where parsing ends (usually end of document)
inline wxString GetName() const {return m_Name;};
inline wxString GetName() const {return m_Name;}
// Returns tag's name in uppercase.
bool HasParam(const wxString& par) const;
@@ -106,34 +102,40 @@ class WXDLLEXPORT wxHtmlTag : public wxObject
// NOTE: unlike scanf family, this function only accepts
// *one* parameter !
inline const wxString& GetAllParams() const {return m_Params;};
inline const wxString& GetAllParams() const {return m_Params;}
// Returns string containing all params.
inline bool IsEnding() const {return m_Ending;};
inline bool IsEnding() const {return m_Ending;}
// return TRUE if this is ending tag (</something>) or FALSE
// if it isn't (<something>)
inline bool HasEnding() const {return m_End1 >= 0;};
inline bool HasEnding() const {return m_End1 >= 0;}
// return TRUE if this is ending tag (</something>) or FALSE
// if it isn't (<something>)
inline int GetBeginPos() const {return m_Begin;};
inline int GetBeginPos() const {return m_Begin;}
// returns beginning position of _internal_ block of text
// See explanation (returned value is marked with *):
// bla bla bla <MYTAG>* bla bla intenal text</MYTAG> bla bla
inline int GetEndPos1() const {return m_End1;};
inline int GetEndPos1() const {return m_End1;}
// returns ending position of _internal_ block of text.
// bla bla bla <MYTAG> bla bla intenal text*</MYTAG> bla bla
inline int GetEndPos2() const {return m_End2;};
inline int GetEndPos2() const {return m_End2;}
// returns end position 2 :
// bla bla bla <MYTAG> bla bla internal text</MYTAG>* bla bla
private:
wxString m_Name, m_Params;
int m_Begin, m_End1, m_End2;
bool m_Ending;
};
#endif // __HTMLTAG_H__
#endif
#endif // _WX_HTMLTAG_H_

View File

@@ -2,13 +2,14 @@
// Name: htmlwin.h
// Purpose: wxHtmlWindow class for parsing & displaying HTML
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __HTMLWIN_H__
#define __HTMLWIN_H__
#ifndef _WX_HTMLWIN_H_
#define _WX_HTMLWIN_H_
#ifdef __GNUG__
#pragma interface
@@ -17,14 +18,14 @@
#include "wx/defs.h"
#if wxUSE_HTML
#include <wx/window.h>
#include <wx/scrolwin.h>
#include <wx/config.h>
#include <wx/treectrl.h>
#include <wx/html/htmlwinparser.h>
#include <wx/html/htmlcell.h>
#include <wx/filesys.h>
#include <wx/html/htmlfilter.h>
#include "wx/window.h"
#include "wx/scrolwin.h"
#include "wx/config.h"
#include "wx/treectrl.h"
#include "wx/html/winpars.h"
#include "wx/html/htmlcell.h"
#include "wx/filesys.h"
#include "wx/html/htmlfilt.h"
//--------------------------------------------------------------------------------
@@ -42,17 +43,17 @@
// item of history list
class WXDLLEXPORT HtmlHistoryItem : public wxObject
{
private:
wxString m_Page;
wxString m_Anchor;
int m_Pos;
public:
HtmlHistoryItem(const wxString& p, const wxString& a) {m_Page = p, m_Anchor = a, m_Pos = 0;}
int GetPos() const {return m_Pos;}
void SetPos(int p) {m_Pos = p;}
const wxString& GetPage() const {return m_Page;}
const wxString& GetAnchor() const {return m_Anchor;}
private:
wxString m_Page;
wxString m_Anchor;
int m_Pos;
};
#undef WXDLLEXPORTLOCAL
@@ -69,34 +70,6 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
{
DECLARE_DYNAMIC_CLASS(wxHtmlWindow)
protected:
wxHtmlContainerCell *m_Cell;
// This is pointer to the first cell in parsed data.
// (Note: the first cell is usually top one = all other cells are sub-cells of this one)
wxHtmlWinParser *m_Parser;
// parser which is used to parse HTML input.
// Each wxHtmlWindow has it's own parser because sharing one global
// parser would be problematic (because of reentrancy)
wxString m_OpenedPage;
// contains name of actualy opened page or empty string if no page opened
wxString m_OpenedAnchor;
// contains name of current anchor within m_OpenedPage
wxFileSystem* m_FS;
// class for opening files (file system)
wxFrame *m_RelatedFrame;
wxString m_TitleFormat;
int m_RelatedStatusBar;
// frame in which page title should be displayed & number of it's statusbar
// reserved for usage with this html window
int m_Borders;
// borders (free space between text and window borders)
// defaults to 10 pixels.
int m_Style;
private:
bool m_tmpMouseMoved;
// a flag indicated if mouse moved
@@ -215,14 +188,38 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;}
// returns new filter (will be stored into m_DefaultFilter variable)
protected:
wxHtmlContainerCell *m_Cell;
// This is pointer to the first cell in parsed data.
// (Note: the first cell is usually top one = all other cells are sub-cells of this one)
wxHtmlWinParser *m_Parser;
// parser which is used to parse HTML input.
// Each wxHtmlWindow has it's own parser because sharing one global
// parser would be problematic (because of reentrancy)
wxString m_OpenedPage;
// contains name of actualy opened page or empty string if no page opened
wxString m_OpenedAnchor;
// contains name of current anchor within m_OpenedPage
wxFileSystem* m_FS;
// class for opening files (file system)
wxFrame *m_RelatedFrame;
wxString m_TitleFormat;
int m_RelatedStatusBar;
// frame in which page title should be displayed & number of it's statusbar
// reserved for usage with this html window
int m_Borders;
// borders (free space between text and window borders)
// defaults to 10 pixels.
int m_Style;
DECLARE_EVENT_TABLE()
};
#endif // __HTMLWIN_H__
#endif
#endif // _WX_HTMLWIN_H_

View File

@@ -1,9 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: mod_templ.h
// Purpose: wxHtml tags module generic "template"
// Name: m_templ.h
// Purpose: Modules template file
// Author: Vaclav Slavik
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
// RCS-ID: $Id$
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
@@ -18,8 +19,8 @@ I STRONGLY recommend reading and understanding these macros!!
*/
#ifndef __MOD_TEMPL_H__
#define __MOD_TEMPL_H__
#ifndef _WX_M_TEMPL_H_
#define _WX_M_TEMPL_H_
#include "wx/defs.h"
#if wxUSE_HTML
@@ -43,7 +44,7 @@ I STRONGLY recommend reading and understanding these macros!!
#include <wx/html/htmlwinparser.h>
#include "wx/html/winpars.h"
#define TAG_HANDLER_BEGIN(name,tags) \
@@ -99,4 +100,4 @@ I STRONGLY recommend reading and understanding these macros!!
#endif
#endif
#endif

View File

@@ -1,14 +1,15 @@
/////////////////////////////////////////////////////////////////////////////
// Name: htmlwinparser.h
// Name: winpars.h
// Purpose: wxHtmlWinParser class (parser to be used with wxHtmlWindow)
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __HTMLWINPARSER_H__
#define __HTMLWINPARSER_H__
#ifndef _WX_WINPARS_H_
#define _WX_WINPARS_H_
#ifdef __GNUG__
#pragma interface
@@ -17,9 +18,9 @@
#include "wx/defs.h"
#if wxUSE_HTML
#include <wx/module.h>
#include <wx/html/htmlparser.h>
#include <wx/html/htmlcell.h>
#include "wx/module.h"
#include "wx/html/htmlpars.h"
#include "wx/html/htmlcell.h"
class wxHtmlWinParser;
class wxHtmlWinTagHandler;
@@ -38,44 +39,6 @@ class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser
friend class wxHtmlWindow;
private:
wxWindow *m_Window;
// window we're parsing for
wxDC *m_DC;
// Device Context we're parsing for
static wxList m_Modules;
// list of tags modules (see wxHtmlTagsModule for details)
// This list is used to initialize m_Handlers member.
wxHtmlContainerCell *m_Container;
// actual container. See Open/CloseContainer for details.
int m_FontBold, m_FontItalic, m_FontUnderlined, m_FontFixed; // this is not TRUE,FALSE but 1,0, we need it for indexing
int m_FontSize; /* -2 to +4, 0 is default */
wxColour m_LinkColor;
wxColour m_ActualColor;
// basic font parameters.
wxString m_Link;
// actual hypertext link or empty string
bool m_UseLink;
// TRUE if m_Link is not empty
long m_CharHeight, m_CharWidth;
// average height of normal-sized text
int m_Align;
// actual alignment
wxFont *m_FontsTable[2][2][2][2][7];
// table of loaded fonts. 1st four indexes are 0 or 1, depending on on/off
// state of these flags (from left to right):
// [bold][italic][underlined][fixed_size]
// last index is font size : from 0 to 7 (remapped from html sizes -2 to +4)
// Note : this table covers all possible combinations of fonts, but not
// all of them are used, so many items in table are usually NULL.
int m_FontsSizes[7];
wxString m_FontFaceFixed, m_FontFaceNormal;
int m_ItalicModeFixed, m_ItalicModeNormal;
// html font sizes and faces of fixed and proportional fonts
public:
wxHtmlWinParser() : wxHtmlParser() {wxHtmlWinParser(NULL);}
wxHtmlWinParser(wxWindow *wnd);
@@ -151,6 +114,42 @@ class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser
private:
bool m_tmpLastWasSpace;
// temporary variable used by AddText
wxWindow *m_Window;
// window we're parsing for
wxDC *m_DC;
// Device Context we're parsing for
static wxList m_Modules;
// list of tags modules (see wxHtmlTagsModule for details)
// This list is used to initialize m_Handlers member.
wxHtmlContainerCell *m_Container;
// actual container. See Open/CloseContainer for details.
int m_FontBold, m_FontItalic, m_FontUnderlined, m_FontFixed; // this is not TRUE,FALSE but 1,0, we need it for indexing
int m_FontSize; /* -2 to +4, 0 is default */
wxColour m_LinkColor;
wxColour m_ActualColor;
// basic font parameters.
wxString m_Link;
// actual hypertext link or empty string
bool m_UseLink;
// TRUE if m_Link is not empty
long m_CharHeight, m_CharWidth;
// average height of normal-sized text
int m_Align;
// actual alignment
wxFont *m_FontsTable[2][2][2][2][7];
// table of loaded fonts. 1st four indexes are 0 or 1, depending on on/off
// state of these flags (from left to right):
// [bold][italic][underlined][fixed_size]
// last index is font size : from 0 to 7 (remapped from html sizes -2 to +4)
// Note : this table covers all possible combinations of fonts, but not
// all of them are used, so many items in table are usually NULL.
int m_FontsSizes[7];
wxString m_FontFaceFixed, m_FontFaceNormal;
int m_ItalicModeFixed, m_ItalicModeNormal;
// html font sizes and faces of fixed and proportional fonts
};
@@ -169,14 +168,14 @@ class WXDLLEXPORT wxHtmlWinTagHandler : public wxHtmlTagHandler
{
DECLARE_ABSTRACT_CLASS(wxHtmlWinTagHandler)
protected:
wxHtmlWinParser *m_WParser;
// same as m_Parser, but overcasted
public:
wxHtmlWinTagHandler() : wxHtmlTagHandler() {};
virtual void SetParser(wxHtmlParser *parser) {wxHtmlTagHandler::SetParser(parser); m_WParser = (wxHtmlWinParser*) parser;};
protected:
wxHtmlWinParser *m_WParser;
// same as m_Parser, but overcasted
};
@@ -210,10 +209,10 @@ class WXDLLEXPORT wxHtmlTagsModule : public wxModule
};
#endif // __HTMLWINPARSER_H__
#endif
#endif // _WX_WINPARS_H_