Added more docs for the new events, derived from wxNotifyEvents.
[wxWidgets.git] / src / html / htmlwin.cpp
index b0077c8b1a9530b06607ba5f166ebf6c1330baf6..b98f5fed9a0bc78dca109d90a3f5e14eda8278ff 100644 (file)
@@ -170,8 +170,9 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
             wxString err;
 
             err.Printf(_("The browser is unable to open requested location :\n\n%s"), WXSTRINGCAST location);
-            wxMessageBox(err, "Error");
             m_tmpCanDraw = TRUE;
+            Refresh();
+            wxMessageBox(err, "Error");
             return FALSE;
         }
 
@@ -194,7 +195,10 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
                 }
                 node = node -> GetNext();
             }
-            if (src == wxEmptyString) src = m_DefaultFilter.ReadFile(*f);
+            if (src == wxEmptyString) {
+               if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
+               src = m_DefaultFilter -> ReadFile(*f);
+           }
 
             m_FS -> ChangePathTo(f -> GetLocation());
             rt_val = SetPage(src);
@@ -376,7 +380,15 @@ void wxHtmlWindow::HistoryClear()
 
 
 wxList wxHtmlWindow::m_Filters;
-wxHtmlFilterPlainText wxHtmlWindow::m_DefaultFilter;
+wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL;
+
+void wxHtmlWindow::CleanUpStatics()
+{
+    if (m_DefaultFilter) delete m_DefaultFilter;
+    m_DefaultFilter = NULL;
+}
+
+
 
 void wxHtmlWindow::AddFilter(wxHtmlFilter *filter)
 {
@@ -524,6 +536,21 @@ END_EVENT_TABLE()
 
 
 
+// A module to allow initialization/cleanup
+// without calling these functions from app.cpp or from
+// the user's application.
+
+class wxHtmlWinModule: public wxModule
+{
+DECLARE_DYNAMIC_CLASS(wxHtmlWinModule)
+public:
+    wxHtmlWinModule() : wxModule() {}
+    bool OnInit() { return TRUE; }
+    void OnExit() { wxHtmlWindow::CleanUpStatics(); }
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxHtmlWinModule, wxModule)
+
 
 
 
@@ -539,4 +566,4 @@ FORCE_LINK(mod_links)
 FORCE_LINK(mod_tables)
 
 
-#endif
\ No newline at end of file
+#endif