cleanup and reformatting to match indentation style of the rest of wx

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-04-29 17:57:59 +00:00
parent dad9554b4c
commit 9749497156
10 changed files with 893 additions and 902 deletions

View File

@@ -15,7 +15,7 @@
#include "wx/defs.h" #include "wx/defs.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "helpctrl.h"
#endif #endif
#if wxUSE_HTML #if wxUSE_HTML
@@ -27,7 +27,7 @@ class WXDLLEXPORT wxHtmlHelpController : public wxHelpControllerBase // wxEvtHan
{ {
DECLARE_DYNAMIC_CLASS(wxHtmlHelpController) DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
public: public:
wxHtmlHelpController(int style = wxHF_DEFAULTSTYLE); wxHtmlHelpController(int style = wxHF_DEFAULTSTYLE);
virtual ~wxHtmlHelpController(); virtual ~wxHtmlHelpController();
@@ -91,7 +91,8 @@ class WXDLLEXPORT wxHtmlHelpController : public wxHelpControllerBase // wxEvtHan
virtual void OnQuit() {}; virtual void OnQuit() {};
void OnCloseFrame(wxCloseEvent& evt); void OnCloseFrame(wxCloseEvent& evt);
protected:
protected:
virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data); virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data);
virtual void CreateHelpWindow(); virtual void CreateHelpWindow();

View File

@@ -13,7 +13,7 @@
#define _WX_HELPDATA_H_ #define _WX_HELPDATA_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "helpdata.h"
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
@@ -26,13 +26,15 @@
#include "wx/dynarray.h" #include "wx/dynarray.h"
#include "wx/font.h" #include "wx/font.h"
class WXDLLEXPORT wxHtmlHelpData;
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// helper classes & structs // helper classes & structs
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
class WXDLLEXPORT wxHtmlBookRecord : public wxObject class WXDLLEXPORT wxHtmlBookRecord : public wxObject
{ {
public: public:
wxHtmlBookRecord(const wxString& basepath, const wxString& title, wxHtmlBookRecord(const wxString& basepath, const wxString& title,
const wxString& start) const wxString& start)
{ {
@@ -58,7 +60,7 @@ class WXDLLEXPORT wxHtmlBookRecord : public wxObject
void SetBasePath(const wxString& path) { m_BasePath = path; } void SetBasePath(const wxString& path) { m_BasePath = path; }
void SetStart(const wxString& start) { m_Start = start; } void SetStart(const wxString& start) { m_Start = start; }
protected: protected:
wxString m_BasePath; wxString m_BasePath;
wxString m_Title; wxString m_Title;
wxString m_Start; wxString m_Start;
@@ -70,41 +72,40 @@ class WXDLLEXPORT wxHtmlBookRecord : public wxObject
WX_DECLARE_EXPORTED_OBJARRAY(wxHtmlBookRecord, wxHtmlBookRecArray); WX_DECLARE_EXPORTED_OBJARRAY(wxHtmlBookRecord, wxHtmlBookRecArray);
typedef struct struct wxHtmlContentsItem
{ {
short int m_Level; short int m_Level;
int m_ID; int m_ID;
wxChar* m_Name; wxChar* m_Name;
wxChar* m_Page; wxChar* m_Page;
wxHtmlBookRecord *m_Book; wxHtmlBookRecord *m_Book;
} };
wxHtmlContentsItem;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// wxSearchEngine // wxSearchEngine
// This class takes input streams and scans them for occurence // This class takes input streams and scans them for occurence
// of keyword(s) // of keyword(s)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
class WXDLLEXPORT wxSearchEngine : public wxObject class WXDLLEXPORT wxSearchEngine : public wxObject
{ {
public: public:
wxSearchEngine() : wxObject() {m_Keyword = NULL; } wxSearchEngine() : wxObject() {m_Keyword = NULL; }
~wxSearchEngine() {if (m_Keyword) delete[] m_Keyword; } ~wxSearchEngine() {if (m_Keyword) delete[] m_Keyword; }
virtual void LookFor(const wxString& keyword, bool case_sensitive, bool whole_words_only);
// Sets the keyword we will be searching for // Sets the keyword we will be searching for
virtual void LookFor(const wxString& keyword, bool case_sensitive, bool whole_words_only);
virtual bool Scan(wxInputStream *stream);
// Scans the stream for the keyword. // Scans the stream for the keyword.
// Returns TRUE if the stream contains keyword, fALSE otherwise // Returns TRUE if the stream contains keyword, fALSE otherwise
virtual bool Scan(wxInputStream *stream);
private: private:
wxChar *m_Keyword; wxChar *m_Keyword;
bool m_CaseSensitive; bool m_CaseSensitive;
bool m_WholeWords; bool m_WholeWords;
}; };
class wxHtmlHelpData;
// State information of a search action. I'd have prefered to make this a nested // State information of a search action. I'd have prefered to make this a nested
// class inside wxHtmlHelpData, but that's against coding standards :-( // class inside wxHtmlHelpData, but that's against coding standards :-(
@@ -112,10 +113,9 @@ class wxHtmlHelpData;
// wxHtmlHelpData::PrepareKeywordSearch(const wxString& key) // wxHtmlHelpData::PrepareKeywordSearch(const wxString& key)
class WXDLLEXPORT wxHtmlSearchStatus class WXDLLEXPORT wxHtmlSearchStatus
{ {
public: public:
// constructor; supply wxHtmlHelpData ptr, the keyword and (optionally) the // constructor; supply wxHtmlHelpData ptr, the keyword and (optionally) the
// title of the book to search. By default, all books are searched. // title of the book to search. By default, all books are searched.
wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword, wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword,
bool case_sensitive, bool whole_words_only, bool case_sensitive, bool whole_words_only,
const wxString& book = wxEmptyString); const wxString& book = wxEmptyString);
@@ -126,7 +126,7 @@ class WXDLLEXPORT wxHtmlSearchStatus
const wxString& GetName() { return m_Name; } const wxString& GetName() { return m_Name; }
wxHtmlContentsItem* GetContentsItem() { return m_ContentsItem; } wxHtmlContentsItem* GetContentsItem() { return m_ContentsItem; }
private: private:
wxHtmlHelpData* m_Data; wxHtmlHelpData* m_Data;
wxSearchEngine m_Engine; wxSearchEngine m_Engine;
wxString m_Keyword, m_Name; wxString m_Keyword, m_Name;
@@ -141,22 +141,21 @@ class WXDLLEXPORT wxHtmlSearchStatus
class WXDLLEXPORT wxHtmlHelpData : public wxObject class WXDLLEXPORT wxHtmlHelpData : public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxHtmlHelpData) DECLARE_DYNAMIC_CLASS(wxHtmlHelpData)
friend class wxHtmlSearchStatus; friend class wxHtmlSearchStatus;
public: public:
wxHtmlHelpData(); wxHtmlHelpData();
~wxHtmlHelpData(); ~wxHtmlHelpData();
void SetTempDir(const wxString& path);
// Sets directory where temporary files are stored. // Sets directory where temporary files are stored.
// These temp files are index & contents file in binary (much faster to read) // These temp files are index & contents file in binary (much faster to read)
// form. These files are NOT deleted on program's exit. // form. These files are NOT deleted on program's exit.
void SetTempDir(const wxString& path);
bool AddBook(const wxString& book);
// Adds new book. 'book' is location of .htb file (stands for "html book"). // Adds new book. 'book' is location of .htb file (stands for "html book").
// See documentation for details on its format. // See documentation for details on its format.
// Returns success. // Returns success.
bool AddBook(const wxString& book);
bool AddBookParam(const wxFSFile& bookfile, bool AddBookParam(const wxFSFile& bookfile,
wxFontEncoding encoding, wxFontEncoding encoding,
const wxString& title, const wxString& contfile, const wxString& title, const wxString& contfile,
@@ -164,11 +163,12 @@ class WXDLLEXPORT wxHtmlHelpData : public wxObject
const wxString& deftopic = wxEmptyString, const wxString& deftopic = wxEmptyString,
const wxString& path = wxEmptyString); const wxString& path = wxEmptyString);
// Some accessing stuff // Some accessing stuff:
wxString FindPageByName(const wxString& page);
// returns URL of page on basis of (file)name // returns URL of page on basis of (file)name
wxString FindPageById(int id); wxString FindPageByName(const wxString& page);
// returns URL of page on basis of MS id // returns URL of page on basis of MS id
wxString FindPageById(int id);
const wxHtmlBookRecArray& GetBookRecArray() { return m_BookRecords; } const wxHtmlBookRecArray& GetBookRecArray() { return m_BookRecords; }
wxHtmlContentsItem* GetContents() { return m_Contents; } wxHtmlContentsItem* GetContents() { return m_Contents; }
@@ -176,26 +176,24 @@ class WXDLLEXPORT wxHtmlHelpData : public wxObject
wxHtmlContentsItem* GetIndex() { return m_Index; } wxHtmlContentsItem* GetIndex() { return m_Index; }
int GetIndexCnt() { return m_IndexCnt; } int GetIndexCnt() { return m_IndexCnt; }
protected: protected:
wxString m_TempPath; wxString m_TempPath;
wxHtmlBookRecArray m_BookRecords; wxHtmlBookRecArray m_BookRecords;
// each book has one record in this array // each book has one record in this array:
wxHtmlContentsItem* m_Contents; wxHtmlContentsItem* m_Contents;
int m_ContentsCnt; int m_ContentsCnt;
// list of all available books and pages. wxHtmlContentsItem* m_Index; // list of all available books and pages.
wxHtmlContentsItem* m_Index; int m_IndexCnt; // list of index items
int m_IndexCnt;
// list of index items
protected: protected:
// Imports .hhp files (MS HTML Help Workshop)
bool LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, bool LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys,
const wxString& indexfile, const wxString& contentsfile); const wxString& indexfile, const wxString& contentsfile);
// Imports .hhp files (MS HTML Help Workshop)
bool LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f);
// Reads binary book // Reads binary book
bool SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f); bool LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f);
// Writes binary book // Writes binary book
bool SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f);
}; };
// Utility function // Utility function

View File

@@ -13,7 +13,7 @@
#define _WX_HELPFRM_H_ #define _WX_HELPFRM_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "helpfrm.h"
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
@@ -77,17 +77,15 @@ enum
wxID_HTML_SEARCHCHOICE, wxID_HTML_SEARCHCHOICE,
wxID_HTML_COUNTINFO, wxID_HTML_COUNTINFO,
wxID_HTML_HELPFRAME // the id of wxHtmlHelpController's helpframe wxID_HTML_HELPFRAME // the id of wxHtmlHelpController's helpframe
} };
;
typedef struct struct wxHtmlHelpFrameCfg
{ {
int x, y, w, h; int x, y, w, h;
long sashpos; long sashpos;
bool navig_on; bool navig_on;
} };
wxHtmlHelpFrameCfg;
class WXDLLEXPORT wxHelpControllerBase; class WXDLLEXPORT wxHelpControllerBase;
@@ -96,7 +94,7 @@ class WXDLLEXPORT wxHtmlHelpFrame : public wxFrame
{ {
DECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame) DECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame)
public: public:
wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); } wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); }
wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID, wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID,
const wxString& title = wxEmptyString, const wxString& title = wxEmptyString,
@@ -109,11 +107,10 @@ class WXDLLEXPORT wxHtmlHelpFrame : public wxFrame
wxHelpControllerBase* GetController() const { return m_helpController; } wxHelpControllerBase* GetController() const { return m_helpController; }
void SetController(wxHelpControllerBase* controller) { m_helpController = controller; } void SetController(wxHelpControllerBase* controller) { m_helpController = controller; }
void SetTitleFormat(const wxString& format);
// Sets format of title of the frame. Must contain exactly one "%s" // Sets format of title of the frame. Must contain exactly one "%s"
// (for title of displayed HTML page) // (for title of displayed HTML page)
void SetTitleFormat(const wxString& format);
bool Display(const wxString& x);
// Displays page x. If not found it will offect the user a choice of // Displays page x. If not found it will offect the user a choice of
// searching books. // searching books.
// Looking for the page runs in these steps: // Looking for the page runs in these steps:
@@ -121,17 +118,18 @@ class WXDLLEXPORT wxHtmlHelpFrame : public wxFrame
// 2. try to open starting page of book x // 2. try to open starting page of book x
// 3. try to find x in contents (if x is for example "How To ...") // 3. try to find x in contents (if x is for example "How To ...")
// 4. try to find x in index (if x is for example "How To ...") // 4. try to find x in index (if x is for example "How To ...")
bool Display(const int id); bool Display(const wxString& x);
// Alternative version that works with numeric ID. // Alternative version that works with numeric ID.
// (uses extension to MS format, <param name="ID" value=id>, see docs) // (uses extension to MS format, <param name="ID" value=id>, see docs)
bool Display(const int id);
bool DisplayContents();
// Displays help window and focuses contents. // Displays help window and focuses contents.
bool DisplayContents();
bool DisplayIndex();
// Displays help window and focuses index. // Displays help window and focuses index.
bool DisplayIndex();
bool KeywordSearch(const wxString& keyword);
// Searches for keyword. Returns TRUE and display page if found, return // Searches for keyword. Returns TRUE and display page if found, return
// FALSE otherwise // FALSE otherwise
// Syntax of keyword is Altavista-like: // Syntax of keyword is Altavista-like:
@@ -140,6 +138,7 @@ class WXDLLEXPORT wxHtmlHelpFrame : public wxFrame
// * word may be pretended by + or - // * word may be pretended by + or -
// (+ : page must contain the word ; - : page can't contain the word) // (+ : page must contain the word ; - : page can't contain the word)
// * if there is no + or - before the word, + is default // * if there is no + or - before the word, + is default
bool KeywordSearch(const wxString& keyword);
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString) void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString)
{ {
@@ -148,36 +147,35 @@ class WXDLLEXPORT wxHtmlHelpFrame : public wxFrame
ReadCustomization(config, rootpath); ReadCustomization(config, rootpath);
} }
void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); // Saves custom settings into cfg config. it will use the path 'path'
// saves custom settings into cfg config. it will use the path 'path'
// if given, otherwise it will save info into currently selected path. // if given, otherwise it will save info into currently selected path.
// saved values : things set by SetFonts, SetBorders. // saved values : things set by SetFonts, SetBorders.
void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
// ...
void NotifyPageChanged();
// call this to let wxHtmlHelpFrame know page changed // call this to let wxHtmlHelpFrame know page changed
void NotifyPageChanged();
protected: protected:
void Init(wxHtmlHelpData* data = NULL); void Init(wxHtmlHelpData* data = NULL);
void RefreshLists();
// Refreshes Contents and Index tabs // Refreshes Contents and Index tabs
void RefreshLists();
void CreateContents();
// Adds items to m_Contents tree control // Adds items to m_Contents tree control
void CreateContents();
void CreateIndex();
// Adds items to m_IndexList // Adds items to m_IndexList
void CreateIndex();
void CreateSearch();
// Add books to search choice panel // Add books to search choice panel
void CreateSearch();
virtual void AddToolbarButtons(wxToolBar *toolBar, int style);
// Add custom buttons to toolbar // Add custom buttons to toolbar
virtual void AddToolbarButtons(wxToolBar *toolBar, int style);
virtual void OptionsDialog();
// Displays options dialog (fonts etc.) // Displays options dialog (fonts etc.)
virtual void OptionsDialog();
void OnToolbar(wxCommandEvent& event); void OnToolbar(wxCommandEvent& event);
void OnContentsSel(wxTreeEvent& event); void OnContentsSel(wxTreeEvent& event);
@@ -197,7 +195,7 @@ class WXDLLEXPORT wxHtmlHelpFrame : public wxFrame
IMG_RootFolder IMG_RootFolder
}; };
protected: protected:
wxHtmlHelpData* m_Data; wxHtmlHelpData* m_Data;
bool m_DataCreated; // m_Data created by frame, or supplied? bool m_DataCreated; // m_Data created by frame, or supplied?
wxString m_TitleFormat; // title of the help frame wxString m_TitleFormat; // title of the help frame

View File

@@ -13,7 +13,7 @@
#define _WX_HTMLCELL_H_ #define _WX_HTMLCELL_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "htmlcell.h"
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
@@ -39,7 +39,7 @@ class WXDLLEXPORT wxHtmlContainerCell;
class WXDLLEXPORT wxHtmlCell : public wxObject class WXDLLEXPORT wxHtmlCell : public wxObject
{ {
public: public:
wxHtmlCell(); wxHtmlCell();
virtual ~wxHtmlCell(); virtual ~wxHtmlCell();
@@ -51,33 +51,33 @@ class WXDLLEXPORT wxHtmlCell : public wxObject
int GetWidth() const {return m_Width;} int GetWidth() const {return m_Width;}
int GetHeight() const {return m_Height;} int GetHeight() const {return m_Height;}
int GetDescent() const {return m_Descent;} int GetDescent() const {return m_Descent;}
virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0,
int WXUNUSED(y) = 0) const
{ return m_Link; }
// returns the link associated with this cell. The position is position within // returns the link associated with this cell. The position is position within
// the cell so it varies from 0 to m_Width, from 0 to m_Height // the cell so it varies from 0 to m_Width, from 0 to m_Height
wxHtmlCell *GetNext() const {return m_Next;} virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0, int WXUNUSED(y) = 0) const
// members access methods { return m_Link; }
// members access methods
wxHtmlCell *GetNext() const {return m_Next;}
// members writin methods
virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;} virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;}
void SetLink(const wxHtmlLinkInfo& link); void SetLink(const wxHtmlLinkInfo& link);
void SetNext(wxHtmlCell *cell) {m_Next = cell;} void SetNext(wxHtmlCell *cell) {m_Next = cell;}
// members writin methods
virtual void Layout(int w);
// 1. adjust cell's width according to the fact that maximal possible width is w. // 1. adjust cell's width according to the fact that maximal possible width is w.
// (this has sense when working with horizontal lines, tables etc.) // (this has sense when working with horizontal lines, tables etc.)
// 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height) members) // 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height) members)
// = place items to fit window, according to the width w // = place items to fit window, according to the width w
virtual void Layout(int w);
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
// renders the cell // renders the cell
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
virtual void DrawInvisible(wxDC& dc, int x, int y);
// proceed drawing actions in case the cell is not visible (scrolled out of screen). // proceed drawing actions in case the cell is not visible (scrolled out of screen).
// This is needed to change fonts, colors and so on // This is needed to change fonts, colors and so on
virtual void DrawInvisible(wxDC& dc, int x, int y);
virtual const wxHtmlCell* Find(int condition, const void* param) const;
// This method returns pointer to the FIRST cell for that // This method returns pointer to the FIRST cell for that
// the condition // the condition
// is true. It first checks if the condition is true for this // is true. It first checks if the condition is true for this
@@ -88,16 +88,16 @@ class WXDLLEXPORT wxHtmlCell : public wxObject
// and param is optional parameter // and param is optional parameter
// Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news"); // Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news");
// returns pointer to anchor news // returns pointer to anchor news
virtual const wxHtmlCell* Find(int condition, const void* param) const;
virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event);
// This function is called when mouse button is clicked over the cell. // This function is called when mouse button is clicked over the cell.
// left, middle, right are flags indicating whether the button was or wasn't // left, middle, right are flags indicating whether the button was or wasn't
// pressed. // pressed.
// Parent is pointer to wxHtmlWindow that generated the event // Parent is pointer to wxHtmlWindow that generated the event
// HINT: if this handling is not enough for you you should use // HINT: if this handling is not enough for you you should use
// wxHtmlBinderCell // wxHtmlBinderCell
virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event);
virtual bool AdjustPagebreak(int *pagebreak) const;
// This method used to adjust pagebreak position. The parameter is // This method used to adjust pagebreak position. The parameter is
// variable that contains y-coordinate of page break (= horizontal line that // variable that contains y-coordinate of page break (= horizontal line that
// should not be crossed by words, images etc.). If this cell cannot be divided // should not be crossed by words, images etc.). If this cell cannot be divided
@@ -106,13 +106,14 @@ class WXDLLEXPORT wxHtmlCell : public wxObject
// //
// Returned value : true if pagebreak was modified, false otherwise // Returned value : true if pagebreak was modified, false otherwise
// Usage : while (container->AdjustPagebreak(&p)) {} // Usage : while (container->AdjustPagebreak(&p)) {}
virtual bool AdjustPagebreak(int *pagebreak) const;
void SetCanLiveOnPagebreak(bool can) {m_CanLiveOnPagebreak = can;}
// Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default // Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default
// is true - the cell can be split on two pages // is true - the cell can be split on two pages
void SetCanLiveOnPagebreak(bool can) {m_CanLiveOnPagebreak = can;}
protected: protected:
wxHtmlCell *m_Next; wxHtmlCell *m_Next;
// pointer to the next cell // pointer to the next cell
wxHtmlContainerCell *m_Parent; wxHtmlContainerCell *m_Parent;
@@ -126,7 +127,6 @@ class WXDLLEXPORT wxHtmlCell : public wxObject
// destination address if this fragment is hypertext link, "" otherwise // destination address if this fragment is hypertext link, "" otherwise
bool m_CanLiveOnPagebreak; bool m_CanLiveOnPagebreak;
// true if this cell can be placed on pagebreak, false otherwise // true if this cell can be placed on pagebreak, false otherwise
}; };
@@ -144,11 +144,11 @@ class WXDLLEXPORT wxHtmlCell : public wxObject
class WXDLLEXPORT wxHtmlWordCell : public wxHtmlCell class WXDLLEXPORT wxHtmlWordCell : public wxHtmlCell
{ {
public: public:
wxHtmlWordCell(const wxString& word, wxDC& dc); wxHtmlWordCell(const wxString& word, wxDC& dc);
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
protected: protected:
wxString m_Word; wxString m_Word;
}; };
@@ -163,7 +163,7 @@ class WXDLLEXPORT wxHtmlWordCell : public wxHtmlCell
class WXDLLEXPORT wxHtmlContainerCell : public wxHtmlCell class WXDLLEXPORT wxHtmlContainerCell : public wxHtmlCell
{ {
public: public:
wxHtmlContainerCell(wxHtmlContainerCell *parent); wxHtmlContainerCell(wxHtmlContainerCell *parent);
~wxHtmlContainerCell(); ~wxHtmlContainerCell();
@@ -172,39 +172,43 @@ class WXDLLEXPORT wxHtmlContainerCell : public wxHtmlCell
virtual void DrawInvisible(wxDC& dc, int x, int y); virtual void DrawInvisible(wxDC& dc, int x, int y);
virtual bool AdjustPagebreak(int *pagebreak) const; virtual bool AdjustPagebreak(int *pagebreak) const;
void InsertCell(wxHtmlCell *cell);
// insert cell at the end of m_Cells list // insert cell at the end of m_Cells list
void InsertCell(wxHtmlCell *cell);
// sets horizontal/vertical alignment
void SetAlignHor(int al) {m_AlignHor = al; m_LastLayout = -1;} void SetAlignHor(int al) {m_AlignHor = al; m_LastLayout = -1;}
int GetAlignHor() const {return m_AlignHor;} int GetAlignHor() const {return m_AlignHor;}
void SetAlignVer(int al) {m_AlignVer = al; m_LastLayout = -1;} void SetAlignVer(int al) {m_AlignVer = al; m_LastLayout = -1;}
// sets horizontal/vertical alignment
int GetAlignVer() const {return m_AlignVer;} int GetAlignVer() const {return m_AlignVer;}
void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
// sets left-border indentation. units is one of wxHTML_UNITS_* constants // sets left-border indentation. units is one of wxHTML_UNITS_* constants
// what is combination of wxHTML_INDENT_* // what is combination of wxHTML_INDENT_*
int GetIndent(int ind) const; void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
// returns the indentation. ind is one of wxHTML_INDENT_* constants // returns the indentation. ind is one of wxHTML_INDENT_* constants
int GetIndentUnits(int ind) const; int GetIndent(int ind) const;
// returns type of value returned by GetIndent(ind) // returns type of value returned by GetIndent(ind)
void SetAlign(const wxHtmlTag& tag); int GetIndentUnits(int ind) const;
// sets alignment info based on given tag's params // sets alignment info based on given tag's params
void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units; m_LastLayout = -1;} void SetAlign(const wxHtmlTag& tag);
void SetWidthFloat(const wxHtmlTag& tag, double pixel_scale = 1.0);
// sets floating width adjustment // sets floating width adjustment
// (examples : 32 percent of parent container, // (examples : 32 percent of parent container,
// -15 pixels percent (this means 100 % - 15 pixels) // -15 pixels percent (this means 100 % - 15 pixels)
void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;} void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units; m_LastLayout = -1;}
void SetWidthFloat(const wxHtmlTag& tag, double pixel_scale = 1.0);
// sets minimal height of this container. // sets minimal height of this container.
void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;}
void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = TRUE; m_BkColour = clr;} void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = TRUE; m_BkColour = clr;}
void SetBorder(const wxColour& clr1, const wxColour& clr2) {m_UseBorder = TRUE; m_BorderColour1 = clr1, m_BorderColour2 = clr2;} void SetBorder(const wxColour& clr1, const wxColour& clr2) {m_UseBorder = TRUE; m_BorderColour1 = clr1, m_BorderColour2 = clr2;}
virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const; virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const;
virtual const wxHtmlCell* Find(int condition, const void* param) const; virtual const wxHtmlCell* Find(int condition, const void* param) const;
virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event); virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event);
wxHtmlCell* GetFirstCell() const {return m_Cells;}
// returns pointer to the first cell in container or NULL // returns pointer to the first cell in container or NULL
wxHtmlCell* GetFirstCell() const {return m_Cells;}
protected: protected:
int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom; int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom;
// indentation of subcells. There is always m_Indent pixels // indentation of subcells. There is always m_Indent pixels
// big space between given border of the container and the subcells // big space between given border of the container and the subcells
@@ -240,12 +244,12 @@ class WXDLLEXPORT wxHtmlContainerCell : public wxHtmlCell
class WXDLLEXPORT wxHtmlColourCell : public wxHtmlCell class WXDLLEXPORT wxHtmlColourCell : public wxHtmlCell
{ {
public: public:
wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;} wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;}
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
virtual void DrawInvisible(wxDC& dc, int x, int y); virtual void DrawInvisible(wxDC& dc, int x, int y);
protected: protected:
wxColour m_Colour; wxColour m_Colour;
unsigned m_Flags; unsigned m_Flags;
}; };
@@ -260,12 +264,12 @@ class WXDLLEXPORT wxHtmlColourCell : public wxHtmlCell
class WXDLLEXPORT wxHtmlFontCell : public wxHtmlCell class WXDLLEXPORT wxHtmlFontCell : public wxHtmlCell
{ {
public: public:
wxHtmlFontCell(wxFont *font) : wxHtmlCell() { m_Font = (*font); } wxHtmlFontCell(wxFont *font) : wxHtmlCell() { m_Font = (*font); }
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
virtual void DrawInvisible(wxDC& dc, int x, int y); virtual void DrawInvisible(wxDC& dc, int x, int y);
protected: protected:
wxFont m_Font; wxFont m_Font;
}; };
@@ -283,18 +287,18 @@ class WXDLLEXPORT wxHtmlFontCell : public wxHtmlCell
class WXDLLEXPORT wxHtmlWidgetCell : public wxHtmlCell class WXDLLEXPORT wxHtmlWidgetCell : public wxHtmlCell
{ {
public: public:
wxHtmlWidgetCell(wxWindow *wnd, int w = 0);
// !!! wnd must have correct parent! // !!! wnd must have correct parent!
// if w != 0 then the m_Wnd has 'floating' width - it adjust // if w != 0 then the m_Wnd has 'floating' width - it adjust
// it's width according to parent container's width // it's width according to parent container's width
// (w is percent of parent's width) // (w is percent of parent's width)
wxHtmlWidgetCell(wxWindow *wnd, int w = 0);
~wxHtmlWidgetCell() { m_Wnd->Destroy(); } ~wxHtmlWidgetCell() { m_Wnd->Destroy(); }
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
virtual void DrawInvisible(wxDC& dc, int x, int y); virtual void DrawInvisible(wxDC& dc, int x, int y);
virtual void Layout(int w); virtual void Layout(int w);
protected: protected:
wxWindow* m_Wnd; wxWindow* m_Wnd;
int m_WidthFloat; int m_WidthFloat;
// width float is used in adjustWidth (it is in percents) // width float is used in adjustWidth (it is in percents)
@@ -309,15 +313,17 @@ class WXDLLEXPORT wxHtmlWidgetCell : public wxHtmlCell
class WXDLLEXPORT wxHtmlLinkInfo : public wxObject class WXDLLEXPORT wxHtmlLinkInfo : public wxObject
{ {
public: public:
wxHtmlLinkInfo() : wxObject() wxHtmlLinkInfo() : wxObject()
{ m_Href = m_Target = wxEmptyString; m_Event = NULL, m_Cell = NULL; } { m_Href = m_Target = wxEmptyString; m_Event = NULL, m_Cell = NULL; }
wxHtmlLinkInfo(const wxString& href, const wxString& target = wxEmptyString) : wxObject() wxHtmlLinkInfo(const wxString& href, const wxString& target = wxEmptyString) : wxObject()
{ m_Href = href; m_Target = target; m_Event = NULL, m_Cell = NULL; } { m_Href = href; m_Target = target; m_Event = NULL, m_Cell = NULL; }
wxHtmlLinkInfo(const wxHtmlLinkInfo& l) : wxObject() wxHtmlLinkInfo(const wxHtmlLinkInfo& l) : wxObject()
{ m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event, m_Cell = l.m_Cell; } { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event;
m_Cell = l.m_Cell; }
wxHtmlLinkInfo& operator=(const wxHtmlLinkInfo& l) wxHtmlLinkInfo& operator=(const wxHtmlLinkInfo& l)
{ m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event, m_Cell = l.m_Cell; return *this; } { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event;
m_Cell = l.m_Cell; return *this; }
void SetEvent(const wxMouseEvent *e) { m_Event = e; } void SetEvent(const wxMouseEvent *e) { m_Event = e; }
void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; } void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; }
@@ -327,7 +333,7 @@ class WXDLLEXPORT wxHtmlLinkInfo : public wxObject
const wxMouseEvent* GetEvent() const { return m_Event; } const wxMouseEvent* GetEvent() const { return m_Event; }
const wxHtmlCell* GetHtmlCell() const { return m_Cell; } const wxHtmlCell* GetHtmlCell() const { return m_Cell; }
private: private:
wxString m_Href, m_Target; wxString m_Href, m_Target;
const wxMouseEvent *m_Event; const wxMouseEvent *m_Event;
const wxHtmlCell *m_Cell; const wxHtmlCell *m_Cell;

View File

@@ -12,7 +12,7 @@
#define _WX_HTMLPARS_H_ #define _WX_HTMLPARS_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "htmlpars.h"
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"

View File

@@ -12,56 +12,38 @@
#define _WX_HTMLTAG_H_ #define _WX_HTMLTAG_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "htmltag.h"
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
#if wxUSE_HTML #if wxUSE_HTML
//-----------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// wxHtmlTagsCache // wxHtmlTagsCache
// !! INTERNAL STRUCTURE !! Do not use in your program! // - internal wxHTML class, do not use!
// This structure contains information on positions of tags //-----------------------------------------------------------------------------
// in the string being parsed
//--------------------------------------------------------------------------------
typedef struct {
int Key;
// this is "pos" value passed to wxHtmlTag's constructor.
// it is position of '<' character of the tag
int End1, End2;
// end positions for the tag:
// end1 is '<' of ending tag,
// end2 is '>' or both are
// -1 if there is no ending tag for this one...
// or -2 if this is ending tag </...>
wxChar *Name;
// name of this tag
} sCacheItem;
struct wxHtmlCacheItem;
class wxHtmlTagsCache : public wxObject class wxHtmlTagsCache : public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxHtmlTagsCache) DECLARE_DYNAMIC_CLASS(wxHtmlTagsCache)
private: private:
sCacheItem *m_Cache; wxHtmlCacheItem *m_Cache;
int m_CacheSize; int m_CacheSize;
int m_CachePos; int m_CachePos;
public: public:
wxHtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;} wxHtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;}
wxHtmlTagsCache(const wxString& source); wxHtmlTagsCache(const wxString& source);
~wxHtmlTagsCache() {free(m_Cache);} ~wxHtmlTagsCache() {free(m_Cache);}
void QueryTag(int at, int* end1, int* end2);
// Finds parameters for tag starting at at and fills the variables // Finds parameters for tag starting at at and fills the variables
void QueryTag(int at, int* end1, int* end2);
}; };
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// wxHtmlTag // wxHtmlTag
// This represents single tag. It is used as internal structure // This represents single tag. It is used as internal structure
@@ -72,28 +54,27 @@ class WXDLLEXPORT wxHtmlTag : public wxObject
{ {
DECLARE_CLASS(wxHtmlTag) DECLARE_CLASS(wxHtmlTag)
public: public:
wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
// constructs wxHtmlTag object based on HTML tag. // constructs wxHtmlTag object based on HTML tag.
// The tag begins (with '<' character) at position pos in source // The tag begins (with '<' character) at position pos in source
// end_pos is position where parsing ends (usually end of document) // end_pos is position where parsing ends (usually end of document)
wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
inline wxString GetName() const {return m_Name;}
// Returns tag's name in uppercase. // Returns tag's name in uppercase.
inline wxString GetName() const {return m_Name;}
bool HasParam(const wxString& par) const;
// Returns TRUE if the tag has given parameter. Parameter // Returns TRUE if the tag has given parameter. Parameter
// should always be in uppercase. // should always be in uppercase.
// Example : <IMG SRC="test.jpg"> HasParam("SRC") returns TRUE // Example : <IMG SRC="test.jpg"> HasParam("SRC") returns TRUE
bool HasParam(const wxString& par) const;
wxString GetParam(const wxString& par, bool with_commas = FALSE) const;
// Returns value of the param. Value is in uppercase unless it is // Returns value of the param. Value is in uppercase unless it is
// enclosed with " // enclosed with "
// Example : <P align=right> GetParam("ALIGN") returns (RIGHT) // Example : <P align=right> GetParam("ALIGN") returns (RIGHT)
// <P IMG SRC="WhaT.jpg"> GetParam("SRC") returns (WhaT.jpg) // <P IMG SRC="WhaT.jpg"> GetParam("SRC") returns (WhaT.jpg)
// (or ("WhaT.jpg") if with_commas == TRUE) // (or ("WhaT.jpg") if with_commas == TRUE)
wxString GetParam(const wxString& par, bool with_commas = FALSE) const;
int ScanParam(const wxString& par, wxChar *format, void *param) const;
// Scans param like scanf() functions family do. // Scans param like scanf() functions family do.
// Example : ScanParam("COLOR", "\"#%X\"", &clr); // Example : ScanParam("COLOR", "\"#%X\"", &clr);
// This is always with with_commas=FALSE // This is always with with_commas=FALSE
@@ -101,34 +82,34 @@ class WXDLLEXPORT wxHtmlTag : public wxObject
// (like sscanf() does) // (like sscanf() does)
// NOTE: unlike scanf family, this function only accepts // NOTE: unlike scanf family, this function only accepts
// *one* parameter ! // *one* parameter !
int ScanParam(const wxString& par, wxChar *format, void *param) const;
inline const wxString& GetAllParams() const {return m_Params;}
// Returns string containing all params. // Returns string containing all params.
inline const wxString& GetAllParams() const {return m_Params;}
// return TRUE if this is ending tag (</something>) or FALSE
// if it isn't (<something>)
inline bool IsEnding() const {return m_Ending;} inline bool IsEnding() const {return m_Ending;}
// return TRUE if this is ending tag (</something>) or FALSE // return TRUE if this is ending tag (</something>) or FALSE
// if it isn't (<something>) // 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;}
// returns beginning position of _internal_ block of text // returns beginning position of _internal_ block of text
// See explanation (returned value is marked with *): // See explanation (returned value is marked with *):
// bla bla bla <MYTAG>* bla bla intenal text</MYTAG> bla bla // bla bla bla <MYTAG>* bla bla intenal text</MYTAG> bla bla
inline int GetEndPos1() const {return m_End1;} inline int GetBeginPos() const {return m_Begin;}
// returns ending position of _internal_ block of text. // returns ending position of _internal_ block of text.
// bla bla bla <MYTAG> bla bla intenal text*</MYTAG> bla bla // bla bla bla <MYTAG> bla bla intenal text*</MYTAG> bla bla
inline int GetEndPos2() const {return m_End2;} inline int GetEndPos1() const {return m_End1;}
// returns end position 2 : // returns end position 2 :
// bla bla bla <MYTAG> bla bla internal text</MYTAG>* bla bla // bla bla bla <MYTAG> bla bla internal text</MYTAG>* bla bla
inline int GetEndPos2() const {return m_End2;}
private: private:
wxString m_Name, m_Params; wxString m_Name, m_Params;
int m_Begin, m_End1, m_End2; int m_Begin, m_End1, m_End2;
bool m_Ending; bool m_Ending;
}; };

View File

@@ -12,7 +12,7 @@
#define _WX_HTMLWIN_H_ #define _WX_HTMLWIN_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "htmlwin.h"
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
@@ -43,14 +43,14 @@
// item of history list // item of history list
class WXDLLEXPORT HtmlHistoryItem : public wxObject class WXDLLEXPORT HtmlHistoryItem : public wxObject
{ {
public: public:
HtmlHistoryItem(const wxString& p, const wxString& a) {m_Page = p, m_Anchor = a, m_Pos = 0;} HtmlHistoryItem(const wxString& p, const wxString& a) {m_Page = p, m_Anchor = a, m_Pos = 0;}
int GetPos() const {return m_Pos;} int GetPos() const {return m_Pos;}
void SetPos(int p) {m_Pos = p;} void SetPos(int p) {m_Pos = p;}
const wxString& GetPage() const {return m_Page;} const wxString& GetPage() const {return m_Page;}
const wxString& GetAnchor() const {return m_Anchor;} const wxString& GetAnchor() const {return m_Anchor;}
private: private:
wxString m_Page; wxString m_Page;
wxString m_Anchor; wxString m_Anchor;
int m_Pos; int m_Pos;
@@ -64,24 +64,23 @@ class wxHtmlWinModule;
class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
{ {
DECLARE_DYNAMIC_CLASS(wxHtmlWindow) DECLARE_DYNAMIC_CLASS(wxHtmlWindow)
friend class wxHtmlWinModule; friend class wxHtmlWinModule;
public: public:
wxHtmlWindow() : wxScrolledWindow() {}; wxHtmlWindow() : wxScrolledWindow() {};
wxHtmlWindow(wxWindow *parent, wxWindowID id = -1, wxHtmlWindow(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHW_SCROLLBAR_AUTO, long style = wxHW_SCROLLBAR_AUTO,
const wxString& name = "htmlWindow"); const wxString& name = "htmlWindow");
~wxHtmlWindow(); ~wxHtmlWindow();
bool SetPage(const wxString& source);
// Set HTML page and display it. !! source is HTML document itself, // Set HTML page and display it. !! source is HTML document itself,
// it is NOT address/filename of HTML document. If you want to // it is NOT address/filename of HTML document. If you want to
// specify document location, use LoadPage() istead // specify document location, use LoadPage() istead
// Return value : FALSE if an error occured, TRUE otherwise // Return value : FALSE if an error occured, TRUE otherwise
bool SetPage(const wxString& source);
bool LoadPage(const wxString& location);
// Load HTML page from given location. Location can be either // Load HTML page from given location. Location can be either
// a) /usr/wxGTK2/docs/html/wx.htm // a) /usr/wxGTK2/docs/html/wx.htm
// b) http://www.somewhere.uk/document.htm // b) http://www.somewhere.uk/document.htm
@@ -91,88 +90,88 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
// After the page is loaded, the method calls SetPage() to display it. // After the page is loaded, the method calls SetPage() to display it.
// Note : you can also use path relative to previously loaded page // Note : you can also use path relative to previously loaded page
// Return value : same as SetPage // Return value : same as SetPage
bool LoadPage(const wxString& location);
wxString GetOpenedPage() const {return m_OpenedPage;}
// Returns full location of opened page // Returns full location of opened page
wxString GetOpenedAnchor() const {return m_OpenedAnchor;} wxString GetOpenedPage() const {return m_OpenedPage;}
// Returns anchor within opened page // Returns anchor within opened page
wxString GetOpenedPageTitle() const {return m_OpenedPageTitle;} wxString GetOpenedAnchor() const {return m_OpenedAnchor;}
// Returns <TITLE> of opened page or empty string otherwise // Returns <TITLE> of opened page or empty string otherwise
wxString GetOpenedPageTitle() const {return m_OpenedPageTitle;}
void SetRelatedFrame(wxFrame* frame, const wxString& format); // Sets frame in which page title will be displayed. Format is format of
// sets frame in which page title will be displayed. Format is format of
// frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
void SetRelatedFrame(wxFrame* frame, const wxString& format);
wxFrame* GetRelatedFrame() const {return m_RelatedFrame;} wxFrame* GetRelatedFrame() const {return m_RelatedFrame;}
void SetRelatedStatusBar(int bar); // After(!) calling SetRelatedFrame, this sets statusbar slot where messages
// after(!) calling SetRelatedFrame, this sets statusbar slot where messages
// will be displayed. Default is -1 = no messages. // will be displayed. Default is -1 = no messages.
void SetRelatedStatusBar(int bar);
// Sets fonts to be used when displaying HTML page.
void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes); void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes);
// sets fonts to be used when displaying HTML page.
virtual void OnSetTitle(const wxString& title);
// Sets the title of the window // Sets the title of the window
// (depending on the information passed to SetRelatedFrame() method) // (depending on the information passed to SetRelatedFrame() method)
virtual void OnSetTitle(const wxString& title);
void SetBorders(int b) {m_Borders = b;}
// Sets space between text and window borders. // Sets space between text and window borders.
void SetBorders(int b) {m_Borders = b;}
virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); // Saves custom settings into cfg config. it will use the path 'path'
// saves custom settings into cfg config. it will use the path 'path'
// if given, otherwise it will save info into currently selected path. // if given, otherwise it will save info into currently selected path.
// saved values : things set by SetFonts, SetBorders. // saved values : things set by SetFonts, SetBorders.
virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
// ... // ...
virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
bool HistoryBack();
bool HistoryForward();
// Goes to previous/next page (in browsing history) // Goes to previous/next page (in browsing history)
// Returns TRUE if successful, FALSE otherwise // Returns TRUE if successful, FALSE otherwise
bool HistoryBack();
bool HistoryForward();
bool HistoryCanBack(); bool HistoryCanBack();
bool HistoryCanForward(); bool HistoryCanForward();
void HistoryClear();
// Resets history // Resets history
void HistoryClear();
wxHtmlContainerCell* GetInternalRepresentation() const {return m_Cell;}
// Returns pointer to conteiners/cells structure. // Returns pointer to conteiners/cells structure.
// It should be used ONLY when printing // It should be used ONLY when printing
wxHtmlContainerCell* GetInternalRepresentation() const {return m_Cell;}
static void AddFilter(wxHtmlFilter *filter);
// Adds input filter // Adds input filter
static void AddFilter(wxHtmlFilter *filter);
virtual void OnLinkClicked(const wxHtmlLinkInfo& link); // Called when users clicked on hypertext link. Default behavior is to
// called when users clicked on hypertext link. Default behavior is to
// call LoadPage(loc) // call LoadPage(loc)
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
// Returns a pointer to the parser.
wxHtmlWinParser *GetParser() const { return m_Parser; } wxHtmlWinParser *GetParser() const { return m_Parser; }
// return a pointer to the parser.
protected: protected:
bool ScrollToAnchor(const wxString& anchor);
// Scrolls to anchor of this name. (Anchor is #news // Scrolls to anchor of this name. (Anchor is #news
// or #features etc. it is part of address sometimes: // or #features etc. it is part of address sometimes:
// http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html#news) // http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html#news)
// Return value : TRUE if anchor exists, FALSE otherwise // Return value : TRUE if anchor exists, FALSE otherwise
bool ScrollToAnchor(const wxString& anchor);
// Prepares layout (= fill m_PosX, m_PosY for fragments) based on
// actual size of window. This method also setup scrollbars
void CreateLayout(); void CreateLayout();
// prepare layout (= fill m_PosX, m_PosY for fragments) based on actual size of
// window. This method also setup scrollbars
void OnDraw(wxDC& dc); void OnDraw(wxDC& dc);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
void OnIdle(wxIdleEvent& event); void OnIdle(wxIdleEvent& event);
// Returns new filter (will be stored into m_DefaultFilter variable)
virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;} virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;}
// returns new filter (will be stored into m_DefaultFilter variable)
static void CleanUpStatics(); static void CleanUpStatics();
// cleans static variables // cleans static variables
protected: protected:
wxHtmlContainerCell *m_Cell; wxHtmlContainerCell *m_Cell;
// This is pointer to the first cell in parsed data. // 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) // (Note: the first cell is usually top one = all other cells are sub-cells of this one)
@@ -201,7 +200,7 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
int m_Style; int m_Style;
private: private:
bool m_tmpMouseMoved; bool m_tmpMouseMoved;
// a flag indicated if mouse moved // a flag indicated if mouse moved
// (if TRUE we will try to change cursor in last call to OnIdle) // (if TRUE we will try to change cursor in last call to OnIdle)

View File

@@ -12,7 +12,7 @@
#define _WX_HTMPRINT_H_ #define _WX_HTMPRINT_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "htmprint.h"
#endif #endif
#include <wx/defs.h> #include <wx/defs.h>
@@ -33,25 +33,26 @@
class WXDLLEXPORT wxHtmlDCRenderer : public wxObject class WXDLLEXPORT wxHtmlDCRenderer : public wxObject
{ {
public: public:
wxHtmlDCRenderer(); wxHtmlDCRenderer();
~wxHtmlDCRenderer(); ~wxHtmlDCRenderer();
// Following 3 methods *must* be called before any call to Render: // Following 3 methods *must* be called before any call to Render:
// Asign DC to this render
void SetDC(wxDC *dc, double pixel_scale = 1.0); void SetDC(wxDC *dc, double pixel_scale = 1.0);
// asign DC to this render
void SetSize(int width, int height); // Sets size of output rectangle, in pixels. Note that you *can't* change
// sets size of output rectangle, in pixels. Note that you *can't* change
// width of the rectangle between calls to Render! (You can freely change height.) // width of the rectangle between calls to Render! (You can freely change height.)
void SetHtmlText(const wxString& html, const wxString& basepath = wxEmptyString, bool isdir = TRUE); void SetSize(int width, int height);
// sets the text to be displayed
// // Sets the text to be displayed.
// basepath is base directory (html string would be stored there if it was in // Basepath is base directory (html string would be stored there if it was in
// file). It is used to determine path for loading images, for example. // file). It is used to determine path for loading images, for example.
// isdir is FALSE if basepath is filename, TRUE if it is directory name // isdir is FALSE if basepath is filename, TRUE if it is directory name
// (see wxFileSystem for detailed explanation) // (see wxFileSystem for detailed explanation)
void SetHtmlText(const wxString& html, const wxString& basepath = wxEmptyString, bool isdir = TRUE);
int Render(int x, int y, int from = 0, int dont_render = FALSE);
// [x,y] is position of upper-left corner of printing rectangle (see SetSize) // [x,y] is position of upper-left corner of printing rectangle (see SetSize)
// from is y-coordinate of the very first visible cell // from is y-coordinate of the very first visible cell
// Returned value is y coordinate of first cell than didn't fit onto page. // Returned value is y coordinate of first cell than didn't fit onto page.
@@ -61,13 +62,13 @@ class WXDLLEXPORT wxHtmlDCRenderer : public wxObject
// pixels and return y coord of the next page // pixels and return y coord of the next page
// //
// CAUTION! Render() changes DC's user scale and does NOT restore it! // CAUTION! Render() changes DC's user scale and does NOT restore it!
int Render(int x, int y, int from = 0, int dont_render = FALSE);
int GetTotalHeight();
// returns total height of the html document // returns total height of the html document
// (compare Render's return value with this) // (compare Render's return value with this)
int GetTotalHeight();
private: private:
wxDC *m_DC; wxDC *m_DC;
wxHtmlWinParser *m_Parser; wxHtmlWinParser *m_Parser;
wxFileSystem *m_FS; wxFileSystem *m_FS;

View File

@@ -27,7 +27,7 @@ I STRONGLY recommend reading and understanding these macros!!
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "m_templ.h"
#pragma implementation #pragma implementation
#endif #endif

View File

@@ -12,7 +12,7 @@
#define _WX_WINPARS_H_ #define _WX_WINPARS_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface "winpars.h"
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
@@ -24,9 +24,9 @@
#include "wx/html/htmlcell.h" #include "wx/html/htmlcell.h"
#include "wx/encconv.h" #include "wx/encconv.h"
class wxHtmlWinParser; class WXDLLEXPORT wxHtmlWinParser;
class wxHtmlWinTagHandler; class WXDLLEXPORT wxHtmlWinTagHandler;
class wxHtmlTagsModule; class WXDLLEXPORT wxHtmlTagsModule;
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// wxHtmlWinParser // wxHtmlWinParser
@@ -39,7 +39,7 @@ class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser
{ {
friend class wxHtmlWindow; friend class wxHtmlWindow;
public: public:
wxHtmlWinParser(wxWindow *wnd = NULL); wxHtmlWinParser(wxWindow *wnd = NULL);
~wxHtmlWinParser(); ~wxHtmlWinParser();
@@ -47,41 +47,50 @@ class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser
virtual void DoneParser(); virtual void DoneParser();
virtual wxObject* GetProduct(); virtual wxObject* GetProduct();
virtual void SetDC(wxDC *dc, double pixel_scale = 1.0) {m_DC = dc; m_PixelScale = pixel_scale;}
// Set's the DC used for parsing. If SetDC() is not called, // Set's the DC used for parsing. If SetDC() is not called,
// parsing won't proceed // parsing won't proceed
virtual void SetDC(wxDC *dc, double pixel_scale = 1.0)
{ m_DC = dc; m_PixelScale = pixel_scale; }
wxDC *GetDC() {return m_DC;} wxDC *GetDC() {return m_DC;}
double GetPixelScale() {return m_PixelScale;} double GetPixelScale() {return m_PixelScale;}
int GetCharHeight() const {return m_CharHeight;} int GetCharHeight() const {return m_CharHeight;}
int GetCharWidth() const {return m_CharWidth;} int GetCharWidth() const {return m_CharWidth;}
// NOTE : these functions do _not_ return _actual_ // NOTE : these functions do _not_ return _actual_
// height/width. They return h/w of default font // height/width. They return h/w of default font
// for this DC. If you want actual values, call // for this DC. If you want actual values, call
// GetDC()->GetChar...() // GetDC()->GetChar...()
wxWindow *GetWindow() {return m_Window;}
// returns associated wxWindow // returns associated wxWindow
wxWindow *GetWindow() {return m_Window;}
void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes);
// sets fonts to be used when displaying HTML page. // sets fonts to be used when displaying HTML page.
void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes);
static void AddModule(wxHtmlTagsModule *module);
// Adds tags module. see wxHtmlTagsModule for details. // Adds tags module. see wxHtmlTagsModule for details.
static void AddModule(wxHtmlTagsModule *module);
static void RemoveModule(wxHtmlTagsModule *module); static void RemoveModule(wxHtmlTagsModule *module);
// parsing-related methods. These methods are called by tag handlers: // parsing-related methods. These methods are called by tag handlers:
wxHtmlContainerCell *GetContainer() const {return m_Container;}
// Returns pointer to actual container. Common use in tag handler is : // Returns pointer to actual container. Common use in tag handler is :
// m_WParser->GetContainer()->InsertCell(new ...); // m_WParser->GetContainer()->InsertCell(new ...);
wxHtmlContainerCell *OpenContainer(); wxHtmlContainerCell *GetContainer() const {return m_Container;}
// opens new container. This container is sub-container of opened // opens new container. This container is sub-container of opened
// container. Sets GetContainer to newly created container // container. Sets GetContainer to newly created container
// and returns it. // and returns it.
wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c); wxHtmlContainerCell *OpenContainer();
// works like OpenContainer except that new container is not created // works like OpenContainer except that new container is not created
// but c is used. You can use this to directly set actual container // but c is used. You can use this to directly set actual container
wxHtmlContainerCell *CloseContainer(); wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
// closes the container and sets actual Container to upper-level // closes the container and sets actual Container to upper-level
// container // container
wxHtmlContainerCell *CloseContainer();
int GetFontSize() const {return m_FontSize;} int GetFontSize() const {return m_FontSize;}
void SetFontSize(int s); void SetFontSize(int s);
@@ -110,13 +119,13 @@ class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser
wxFontEncoding GetOutputEncoding() const { return m_OutputEnc; } wxFontEncoding GetOutputEncoding() const { return m_OutputEnc; }
wxEncodingConverter *GetEncodingConverter() const { return m_EncConv; } wxEncodingConverter *GetEncodingConverter() const { return m_EncConv; }
virtual wxFont* CreateCurrentFont();
// creates font depending on m_Font* members. // creates font depending on m_Font* members.
virtual wxFont* CreateCurrentFont();
protected: protected:
virtual void AddText(const char *txt); virtual void AddText(const char *txt);
private: private:
bool m_tmpLastWasSpace; bool m_tmpLastWasSpace;
// temporary variable used by AddText // temporary variable used by AddText
wxWindow *m_Window; wxWindow *m_Window;
@@ -179,14 +188,13 @@ class WXDLLEXPORT wxHtmlWinTagHandler : public wxHtmlTagHandler
{ {
DECLARE_ABSTRACT_CLASS(wxHtmlWinTagHandler) DECLARE_ABSTRACT_CLASS(wxHtmlWinTagHandler)
public: public:
wxHtmlWinTagHandler() : wxHtmlTagHandler() {}; wxHtmlWinTagHandler() : wxHtmlTagHandler() {};
virtual void SetParser(wxHtmlParser *parser) {wxHtmlTagHandler::SetParser(parser); m_WParser = (wxHtmlWinParser*) parser;}; virtual void SetParser(wxHtmlParser *parser) {wxHtmlTagHandler::SetParser(parser); m_WParser = (wxHtmlWinParser*) parser;};
protected: protected:
wxHtmlWinParser *m_WParser; wxHtmlWinParser *m_WParser; // same as m_Parser, but overcasted
// same as m_Parser, but overcasted
}; };
@@ -206,17 +214,16 @@ class WXDLLEXPORT wxHtmlTagsModule : public wxModule
{ {
DECLARE_DYNAMIC_CLASS(wxHtmlTagsModule) DECLARE_DYNAMIC_CLASS(wxHtmlTagsModule)
public: public:
wxHtmlTagsModule() : wxModule() {}; wxHtmlTagsModule() : wxModule() {};
virtual bool OnInit(); virtual bool OnInit();
virtual void OnExit(); virtual void OnExit();
virtual void FillHandlersTable(wxHtmlWinParser * WXUNUSED(parser)) { }
// This is called by wxHtmlWinParser. // This is called by wxHtmlWinParser.
// The method must simply call parser->AddTagHandler(new <handler_class_name>); // The method must simply call parser->AddTagHandler(new <handler_class_name>);
// for each handler // for each handler
virtual void FillHandlersTable(wxHtmlWinParser * WXUNUSED(parser)) { }
}; };