X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4dcaf11a7b5189be78e52e1412febd7689a959f8..8e193f384f7b98daef459653ddb8485173fba8ba:/src/html/htmlcell.cpp diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index 1019e1367f..6ed7c1fa80 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -2,12 +2,13 @@ // Name: htmlcell.cpp // Purpose: wxHtmlCell - basic element of HTML output // Author: Vaclav Slavik +// RCS-ID: $Id$ // Copyright: (c) 1999 Vaclav Slavik // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "htmlcell.h" +#pragma implementation #endif #include "wx/wxprec.h" @@ -32,7 +33,10 @@ //----------------------------------------------------------------------------- -void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, bool left, bool middle, bool right) +void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, + bool WXUNUSED(left), + bool WXUNUSED(middle), + bool WXUNUSED(right)) { wxString lnk = GetLink(x, y); if (lnk != wxEmptyString) @@ -42,6 +46,25 @@ void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, bool left, bool mi +bool wxHtmlCell::AdjustPagebreak(int *pagebreak) +{ + + if ((!m_CanLiveOnPagebreak) && + m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak) { + *pagebreak = m_PosY; + if (m_Next != NULL) m_Next -> AdjustPagebreak(pagebreak); + return TRUE; + } + + else { + if (m_Next != NULL) return m_Next -> AdjustPagebreak(pagebreak); + else return FALSE; + } +} + + + + //----------------------------------------------------------------------------- // wxHtmlWordCell //----------------------------------------------------------------------------- @@ -55,6 +78,7 @@ wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell() m_Word.Replace(">", ">", TRUE); m_Word.Replace("&", "&", TRUE); dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent); + SetCanLiveOnPagebreak(FALSE); } @@ -125,6 +149,27 @@ int wxHtmlContainerCell::GetIndentUnits(int ind) const +bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) +{ + if (!m_CanLiveOnPagebreak) + return wxHtmlCell::AdjustPagebreak(pagebreak); + + else { + wxHtmlCell *c = GetFirstCell(); + bool rt = FALSE; + int pbrk = *pagebreak - m_PosY; + + while (c) { + if (c -> AdjustPagebreak(&pbrk)) rt = TRUE; + c = c -> GetNext(); + } + if (rt) *pagebreak = pbrk + m_PosY; + return rt; + } +} + + + void wxHtmlContainerCell::Layout(int w) { wxHtmlCell *cell = m_Cells, *line = m_Cells; @@ -134,9 +179,9 @@ void wxHtmlContainerCell::Layout(int w) int ysizeup = 0, ysizedown = 0; /* - + WIDTH ADJUSTING : - + */ if (m_WidthFloatUnits == HTML_UNITS_PERCENT) { @@ -157,7 +202,7 @@ void wxHtmlContainerCell::Layout(int w) /* LAYOUTING : - + */ // adjust indentation: @@ -165,7 +210,7 @@ void wxHtmlContainerCell::Layout(int w) s_width = m_Width - s_indent - ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight); m_MaxLineWidth = 0; - + // my own layouting: while (cell != NULL) { switch (m_AlignVer) { @@ -350,7 +395,7 @@ void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag) const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) const { const wxHtmlCell *r = NULL; - + if (m_Cells) { r = m_Cells -> Find(condition, param); if (r) return r; @@ -460,9 +505,7 @@ void wxHtmlWidgetCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) } ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty); - m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height); -// m_Wnd -> Refresh(); wxHtmlCell::Draw(dc, x, y, view_y1, view_y2); } @@ -479,9 +522,10 @@ void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y) absy += c -> GetPosY(); c = c -> GetParent(); } - ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty); + ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty); m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height); + wxHtmlCell::DrawInvisible(dc, x, y); }