X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fc7dfaf8ee3ad22cc42be647aa6217a8aed5b5ff..7e99520bd3fc092bbbcbc38bb699a0236618ea40:/src/html/htmlwin.cpp diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 6a8bfcfa58..9316bf7019 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -15,7 +15,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop @@ -41,7 +41,7 @@ WX_DEFINE_OBJARRAY(HtmlHistoryArray) wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name) : wxScrolledWindow(parent, id, pos, size, wxVSCROLL | wxHSCROLL, name) + long style, const wxString& name) : wxScrolledWindow(parent, id, pos, size, style | wxVSCROLL | wxHSCROLL, name) { m_tmpMouseMoved = FALSE; m_tmpLastLink = NULL; @@ -172,7 +172,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location) if (f == NULL) { wxString err; - wxLogError(_("Unable to open requested HTML document: %s"), location.mb_str()); + wxLogError(_("Unable to open requested HTML document: %s"), location.c_str()); m_tmpCanDrawLocks--; SetCursor(*wxSTANDARD_CURSOR); @@ -248,7 +248,7 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor) const wxHtmlCell *c = m_Cell -> Find(wxHTML_COND_ISANCHOR, &anchor); if (!c) { - wxLogWarning(_("HTML anchor %s does not exist."), anchor.mb_str()); + wxLogWarning(_("HTML anchor %s does not exist."), anchor.c_str()); return FALSE; } else { @@ -282,7 +282,7 @@ void wxHtmlWindow::CreateLayout() if (!m_Cell) return; - if (m_Style == wxHW_SCROLLBAR_NEVER) { + if (m_Style & wxHW_SCROLLBAR_NEVER) { SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, 0); // always off GetClientSize(&ClientWidth, &ClientHeight); m_Cell -> Layout(ClientWidth); @@ -365,6 +365,12 @@ bool wxHtmlWindow::HistoryBack() if (m_HistoryPos < 1) return FALSE; + // store scroll position into history item: + int x, y; + ViewStart(&x, &y); + m_History[m_HistoryPos].SetPos(y); + + // go to previous position: m_HistoryPos--; l = m_History[m_HistoryPos].GetPage(); @@ -381,6 +387,11 @@ bool wxHtmlWindow::HistoryBack() return TRUE; } +bool wxHtmlWindow::HistoryCanBack() +{ + if (m_HistoryPos < 1) return FALSE; + return TRUE ; +} bool wxHtmlWindow::HistoryForward() @@ -407,6 +418,12 @@ bool wxHtmlWindow::HistoryForward() return TRUE; } +bool wxHtmlWindow::HistoryCanForward() +{ + if (m_HistoryPos == -1) return FALSE; + if (m_HistoryPos >= (int)m_History.GetCount() - 1)return FALSE; + return TRUE ; +} void wxHtmlWindow::HistoryClear() @@ -419,6 +436,8 @@ void wxHtmlWindow::HistoryClear() wxList wxHtmlWindow::m_Filters; wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL; +wxCursor *wxHtmlWindow::s_cur_hand = NULL; +wxCursor *wxHtmlWindow::s_cur_arrow = NULL; void wxHtmlWindow::CleanUpStatics() { @@ -426,7 +445,8 @@ void wxHtmlWindow::CleanUpStatics() m_DefaultFilter = NULL; m_Filters.DeleteContents(TRUE); m_Filters.Clear(); - + if (s_cur_hand) delete s_cur_hand; + if (s_cur_arrow) delete s_cur_arrow; } @@ -480,6 +500,7 @@ void wxHtmlWindow::OnSize(wxSizeEvent& event) { wxScrolledWindow::OnSize(event); CreateLayout(); + Refresh(); } @@ -504,7 +525,11 @@ void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event) void wxHtmlWindow::OnIdle(wxIdleEvent& event) { - static wxCursor cur_hand(wxCURSOR_HAND), cur_arrow(wxCURSOR_ARROW); + if (s_cur_hand == NULL) + { + s_cur_hand = new wxCursor(wxCURSOR_HAND); + s_cur_arrow = new wxCursor(wxCURSOR_ARROW); + } if (m_tmpMouseMoved && (m_Cell != NULL)) { int sx, sy; @@ -518,11 +543,11 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& event) if (lnk != m_tmpLastLink) { if (lnk == NULL) { - SetCursor(cur_arrow); + SetCursor(*s_cur_arrow); if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(wxEmptyString, m_RelatedStatusBar); } else { - SetCursor(cur_hand); + SetCursor(*s_cur_hand); if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(lnk -> GetHref(), m_RelatedStatusBar); }