X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e90c1d2a19361551eb07778280f22be3e759cf64..8e193f384f7b98daef459653ddb8485173fba8ba:/src/html/htmlcell.cpp diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index ea07bad616..6ed7c1fa80 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -46,6 +46,25 @@ void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, +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 //----------------------------------------------------------------------------- @@ -59,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); } @@ -129,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; @@ -138,9 +179,9 @@ void wxHtmlContainerCell::Layout(int w) int ysizeup = 0, ysizedown = 0; /* - + WIDTH ADJUSTING : - + */ if (m_WidthFloatUnits == HTML_UNITS_PERCENT) { @@ -161,7 +202,7 @@ void wxHtmlContainerCell::Layout(int w) /* LAYOUTING : - + */ // adjust indentation: @@ -169,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) { @@ -323,9 +364,9 @@ void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag) alg.MakeUpper(); if (alg == "CENTER") SetAlignHor(HTML_ALIGN_CENTER); - else if (alg == "LEFT(") + else if (alg == "LEFT") SetAlignHor(HTML_ALIGN_LEFT); - else if (alg == "RIGHT(") + else if (alg == "RIGHT") SetAlignHor(HTML_ALIGN_RIGHT); } } @@ -354,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; @@ -464,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); } @@ -483,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); }