]> git.saurik.com Git - wxWidgets.git/commitdiff
SetTitle method (internal use only) changed to virtual OnSetTitle, added GetOpenedPag...
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 28 Nov 1999 18:24:57 +0000 (18:24 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 28 Nov 1999 18:24:57 +0000 (18:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/htwindow.tex
include/wx/html/htmlwin.h
src/html/htmlwin.cpp
src/html/m_layout.cpp

index 755971ed4a675f94bc4e720e4a6d81e68ef13be5..0c47bc0c07c15e7a8b4f90bae06837723a9f1659 100644 (file)
@@ -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.
 
 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 <TITLE>} tag.
+
 \membersection{wxHtmlWindow::GetRelatedFrame}\label{wxhtmlwindowgetrelatedframe}
 
 \constfunc{wxFrame*}{GetRelatedFrame}{\void}
 \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.
 
 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}}
 \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)}
 
 
 \docparam{bar}{statusbar slot number (0..n)}
 
+
 \membersection{wxHtmlWindow::WriteCustomization}\label{wxhtmlwindowwritecustomization}
 
 \func{virtual void}{WriteCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
 \membersection{wxHtmlWindow::WriteCustomization}\label{wxhtmlwindowwritecustomization}
 
 \func{virtual void}{WriteCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
index 027064aefb511634fe514d2887901a39878287dd..569ae110e9d893cb7b51721bffacb9a73c5d5f3a 100644 (file)
@@ -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,
         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();
 
                      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 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
         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
 
                 // 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)
 
                 // 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
                 // 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)
 
         wxFileSystem* m_FS;
                 // class for opening files (file system)
 
index ab653caf7b9ae4ca1b6558b5f3e5f4ca169464fe..86885419ac69e510ce647c3d3a74525793364c57 100644 (file)
@@ -51,7 +51,7 @@ wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
     m_RelatedStatusBar = -1;
     m_RelatedFrame = NULL;
     m_TitleFormat = "%s";
     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);
     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)
 {
 
 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);
     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));
 
     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;
     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);
     }
 {
     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;
 {
     wxString oldpath;
     wxString tmp;
+    int p_fontsizes[7];
+    wxString p_fff, p_ffn;
+    int p_imf, p_imn;
 
     if (path != wxEmptyString) {
         oldpath = cfg -> GetPath();
 
     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_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);
     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);
 
     if (path != wxEmptyString)
         cfg -> SetPath(oldpath);
index af040afe9514901e20b478479533e23a0bfd91d2..ccd8b2f8acf9112450c37821eeb2e73db6994c0e 100644 (file)
@@ -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];
                 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;
             }
         }
         return TRUE;