From d5db80c26999bab5ad0ee610aeaa59ffb0e9c1c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 28 Nov 1999 18:24:57 +0000 Subject: [PATCH] SetTitle method (internal use only) changed to virtual OnSetTitle, added GetOpenedPageTitle git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/htwindow.tex | 15 +++++++++++++++ include/wx/html/htmlwin.h | 9 +++++++-- src/html/htmlwin.cpp | 26 +++++++++++++++++--------- src/html/m_layout.cpp | 2 +- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/docs/latex/wx/htwindow.tex b/docs/latex/wx/htwindow.tex index 755971ed4a..0c47bc0c07 100644 --- a/docs/latex/wx/htwindow.tex +++ b/docs/latex/wx/htwindow.tex @@ -69,6 +69,12 @@ See also: \helpref{Cells Overview}{cells}, Returns full location of the opened page. If no page is opened or if the displayed page wasn't produced by call to LoadPage, empty string is returned. +\membersection{wxHtmlWindow::GetOpenedPageTitle}\label{wxhtmlwindowgetopenedpagetitle} + +\func{wxString}{GetOpenedPageTitle}{\void} + +Returns title of the opened page or wxEmptyString if current page does not contain {\tt } tag. + \membersection{wxHtmlWindow::GetRelatedFrame}\label{wxhtmlwindowgetrelatedframe} \constfunc{wxFrame*}{GetRelatedFrame}{\void} @@ -120,6 +126,14 @@ FALSE if an error occured, TRUE otherwise Called when user clicks on hypertext link. Default behaviour is to call \helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else. + +\membersection{wxHtmlWindow::OnSetTitle}\label{wxhtmlwindowonsettitle} + +\func{virtual void}{OnSetTitle}{\param{const wxString\& }{title}} + +Called on parsing {\tt <TITLE>} tag. + + \membersection{wxHtmlWindow::ReadCustomization}\label{wxhtmlwindowreadcustomization} \func{virtual void}{ReadCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}} @@ -234,6 +248,7 @@ this sets statusbar slot where messages will be displayed. \docparam{bar}{statusbar slot number (0..n)} + \membersection{wxHtmlWindow::WriteCustomization}\label{wxhtmlwindowwritecustomization} \func{virtual void}{WriteCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}} diff --git a/include/wx/html/htmlwin.h b/include/wx/html/htmlwin.h index 027064aefb..569ae110e9 100644 --- a/include/wx/html/htmlwin.h +++ b/include/wx/html/htmlwin.h @@ -68,7 +68,7 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow wxHtmlWindow() : wxScrolledWindow() {}; wxHtmlWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxHW_SCROLLBAR_AUTO, + long style = wxHW_SCROLLBAR_AUTO, const wxString& name = "htmlWindow"); ~wxHtmlWindow(); @@ -92,6 +92,9 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow wxString GetOpenedPage() const {return m_OpenedPage;} // Returns full location of opened page + wxString GetOpenedPageTitle() const {return m_OpenedPageTitle;} + // Returns <TITLE> of opened page or empty string otherwise + void SetRelatedFrame(wxFrame* frame, const wxString& format); // 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 @@ -105,7 +108,7 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow // sets fonts to be used when displaying HTML page. // *_italic_mode can be either wxSLANT or wxITALIC - void SetTitle(const wxString& title); + virtual void OnSetTitle(const wxString& title); // Sets the title of the window // (depending on the information passed to SetRelatedFrame() method) @@ -176,6 +179,8 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow // contains name of actualy opened page or empty string if no page opened wxString m_OpenedAnchor; // contains name of current anchor within m_OpenedPage + wxString m_OpenedPageTitle; + // contains title of actualy opened page or empty string if no <TITLE> tag wxFileSystem* m_FS; // class for opening files (file system) diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index ab653caf7b..86885419ac 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -51,7 +51,7 @@ wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, m_RelatedStatusBar = -1; m_RelatedFrame = NULL; m_TitleFormat = "%s"; - m_OpenedPage = m_OpenedAnchor = wxEmptyString; + m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString; m_Cell = NULL; m_Parser = new wxHtmlWinParser(this); m_Parser -> SetFS(m_FS); @@ -96,8 +96,11 @@ void wxHtmlWindow::SetRelatedStatusBar(int bar) void wxHtmlWindow::SetFonts(wxString normal_face, int normal_italic_mode, wxString fixed_face, int fixed_italic_mode, const int *sizes) { + wxString op = m_OpenedPage; + m_Parser -> SetFonts(normal_face, normal_italic_mode, fixed_face, fixed_italic_mode, sizes); - if (!m_OpenedPage.IsEmpty()) LoadPage(m_OpenedPage); + SetPage(wxT("")); // fonts changed => contents invalid + if (!op.IsEmpty()) LoadPage(op); } @@ -108,7 +111,7 @@ bool wxHtmlWindow::SetPage(const wxString& source) dc -> SetMapMode(wxMM_TEXT); SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF)); - m_OpenedPage = m_OpenedAnchor = wxEmptyString; + m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString; m_Parser -> SetDC(dc); if (m_Cell) { delete m_Cell; @@ -237,13 +240,14 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor) } -void wxHtmlWindow::SetTitle(const wxString& title) +void wxHtmlWindow::OnSetTitle(const wxString& title) { if (m_RelatedFrame) { wxString tit; tit.Printf(m_TitleFormat, title.c_str()); m_RelatedFrame -> SetTitle(tit); } + m_OpenedPageTitle = title; } @@ -290,6 +294,9 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path) { wxString oldpath; wxString tmp; + int p_fontsizes[7]; + wxString p_fff, p_ffn; + int p_imf, p_imn; if (path != wxEmptyString) { oldpath = cfg -> GetPath(); @@ -297,14 +304,15 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path) } m_Borders = cfg -> Read("wxHtmlWindow/Borders", m_Borders); - m_Parser -> m_FontFaceFixed = cfg -> Read("wxHtmlWindow/FontFaceFixed", m_Parser -> m_FontFaceFixed); - m_Parser -> m_FontFaceNormal = cfg -> Read("wxHtmlWindow/FontFaceNormal", m_Parser -> m_FontFaceNormal); - m_Parser -> m_ItalicModeFixed = cfg -> Read("wxHtmlWindow/ItalicModeFixed", m_Parser -> m_ItalicModeFixed); - m_Parser -> m_ItalicModeNormal = cfg -> Read("wxHtmlWindow/ItalicModeNormal", m_Parser -> m_ItalicModeNormal); + p_fff = cfg -> Read("wxHtmlWindow/FontFaceFixed", m_Parser -> m_FontFaceFixed); + p_ffn = cfg -> Read("wxHtmlWindow/FontFaceNormal", m_Parser -> m_FontFaceNormal); + p_imf = cfg -> Read("wxHtmlWindow/ItalicModeFixed", m_Parser -> m_ItalicModeFixed); + p_imn = cfg -> Read("wxHtmlWindow/ItalicModeNormal", m_Parser -> m_ItalicModeNormal); for (int i = 0; i < 7; i++) { tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i); - m_Parser -> m_FontsSizes[i] = cfg -> Read(tmp, m_Parser -> m_FontsSizes[i]); + p_fontsizes[i] = cfg -> Read(tmp, m_Parser -> m_FontsSizes[i]); } + m_Parser -> SetFonts(p_ffn, p_imn, p_fff, p_imf, p_fontsizes); if (path != wxEmptyString) cfg -> SetPath(oldpath); diff --git a/src/html/m_layout.cpp b/src/html/m_layout.cpp index af040afe95..ccd8b2f8ac 100644 --- a/src/html/m_layout.cpp +++ b/src/html/m_layout.cpp @@ -150,7 +150,7 @@ TAG_HANDLER_BEGIN(TITLE, "TITLE") wxString *src = m_WParser -> GetSource(); for (int i = tag.GetBeginPos(); i < tag.GetEndPos1(); i++) title += (*src)[(unsigned int) i]; - wfr -> SetTitle(title); + wfr -> OnSetTitle(title); } } return TRUE; -- 2.45.2