//-----------------------------------------------------------------------------
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
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);
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)
{
bool wxHtmlWindow::AppendToPage(const wxString& source)
{
- return SetPage(*(GetParser()->GetSource()) + source);
+ return DoSetPage(*(GetParser()->GetSource()) + source);
}
bool wxHtmlWindow::LoadPage(const wxString& location)
void wxHtmlWindow::OnKeyUp(wxKeyEvent& event)
{
- if ( IsSelectionEnabled() &&
- event.GetKeyCode() == 'C' && event.ControlDown() )
+ if ( IsSelectionEnabled() && event.GetKeyCode() == 'C' && event.CmdDown() )
{
(void) CopySelection();
}