]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmlwin.cpp
added wxListBox::HitTest() from Ryan (patch 1446207)
[wxWidgets.git] / src / html / htmlwin.cpp
index 2ec463d64184b44955346c5ac209e5217763abac..fc42f4cb5ae77528d3595dee823fa3340cb2beab 100644 (file)
@@ -7,12 +7,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "htmlwin.h"
-#pragma implementation "htmlproc.h"
-#endif
-
 #include "wx/wxprec.h"
 
 #include "wx/defs.h"
@@ -141,10 +135,10 @@ private:
 //-----------------------------------------------------------------------------
 
 WX_DECLARE_OBJARRAY(wxHtmlHistoryItem, wxHtmlHistoryArray);
-WX_DEFINE_OBJARRAY(wxHtmlHistoryArray);
+WX_DEFINE_OBJARRAY(wxHtmlHistoryArray)
 
 WX_DECLARE_LIST(wxHtmlProcessor, wxHtmlProcessorList);
-WX_DEFINE_LIST(wxHtmlProcessorList);
+WX_DEFINE_LIST(wxHtmlProcessorList)
 
 //-----------------------------------------------------------------------------
 // wxHtmlWindow
@@ -241,32 +235,31 @@ void wxHtmlWindow::SetRelatedStatusBar(int bar)
 
 
 
-void wxHtmlWindow::SetFonts(wxString normal_face, wxString fixed_face, const int *sizes)
+void wxHtmlWindow::SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes)
 {
-    wxString op = m_OpenedPage;
-
     m_Parser->SetFonts(normal_face, fixed_face, sizes);
-    // fonts changed => contents invalid, so reload the page:
-    SetPage(wxT("<html><body></body></html>"));
-    if (!op.empty())
-        LoadPage(op);
+
+    // re-layout the page after changing fonts:
+    DoSetPage(*(m_Parser->GetSource()));
 }
 
 void wxHtmlWindow::SetStandardFonts(int size,
                                     const wxString& normal_face,
                                     const wxString& fixed_face)
 {
-    wxString op = m_OpenedPage;
-
     m_Parser->SetStandardFonts(size, normal_face, fixed_face);
-    // fonts changed => contents invalid, so reload the page:
-    SetPage(wxT("<html><body></body></html>"));
-    if (!op.empty())
-        LoadPage(op);
-}
 
+    // re-layout the page after changing fonts:
+    DoSetPage(*(m_Parser->GetSource()));
+}
 
 bool wxHtmlWindow::SetPage(const wxString& source)
+{
+    m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
+    return DoSetPage(source);
+}
+
+bool wxHtmlWindow::DoSetPage(const wxString& source)
 {
     wxString newsrc(source);
 
@@ -313,7 +306,7 @@ bool wxHtmlWindow::SetPage(const wxString& source)
     dc->SetMapMode(wxMM_TEXT);
     SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
     SetBackgroundImage(wxNullBitmap);
-    m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
+
     m_Parser->SetDC(dc);
     if (m_Cell)
     {
@@ -332,7 +325,7 @@ bool wxHtmlWindow::SetPage(const wxString& source)
 
 bool wxHtmlWindow::AppendToPage(const wxString& source)
 {
-    return SetPage(*(GetParser()->GetSource()) + source);
+    return DoSetPage(*(GetParser()->GetSource()) + source);
 }
 
 bool wxHtmlWindow::LoadPage(const wxString& location)
@@ -826,6 +819,8 @@ bool wxHtmlWindow::CopySelection(ClipboardType t)
             return true;
         }
     }
+#else
+    wxUnusedVar(t);
 #endif // wxUSE_CLIPBOARD
 
     return false;
@@ -1027,6 +1022,8 @@ void wxHtmlWindow::OnMouseDown(wxMouseEvent& event)
             CaptureMouse();
         }
     }
+#else
+    wxUnusedVar(event);
 #endif // wxUSE_CLIPBOARD
 }
 
@@ -1308,8 +1305,7 @@ void wxHtmlWindow::OnMouseLeave(wxMouseEvent& event)
 
 void wxHtmlWindow::OnKeyUp(wxKeyEvent& event)
 {
-    if ( IsSelectionEnabled() &&
-         event.GetKeyCode() == 'C' && event.ControlDown() )
+    if ( IsSelectionEnabled() && event.GetKeyCode() == 'C' && event.CmdDown() )
     {
         (void) CopySelection();
     }