X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/edbd0635f283adfe7aeb5c551e199493d05b6cf5..0413cec5271566470f4c852608a35800b49056cd:/src/html/htmlcell.cpp?ds=sidebyside diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index e8680be944..f9f50db98f 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -33,14 +33,29 @@ // wxHtmlCell //----------------------------------------------------------------------------- +wxHtmlCell::wxHtmlCell() : wxObject() +{ + m_Next = NULL; + m_Parent = NULL; + m_Width = m_Height = m_Descent = 0; + m_CanLiveOnPagebreak = TRUE; + m_Link = NULL; +} + +wxHtmlCell::~wxHtmlCell() +{ + if (m_Link) delete m_Link; + if (m_Next) delete m_Next; +} + 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) + wxHtmlLinkInfo *lnk = GetLink(x, y); + if (lnk != NULL) ((wxHtmlWindow*)parent) -> OnLinkClicked(lnk); // note : this overcasting is legal because parent is *always* wxHtmlWindow } @@ -49,7 +64,6 @@ 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; @@ -65,6 +79,13 @@ bool wxHtmlCell::AdjustPagebreak(int *pagebreak) +void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link) +{ + if (m_Link) delete m_Link; + m_Link = new wxHtmlLinkInfo(link); +} + + //----------------------------------------------------------------------------- // wxHtmlWordCell @@ -344,7 +365,7 @@ void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y) -wxString wxHtmlContainerCell::GetLink(int x, int y) const +wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const { wxHtmlCell *c = m_Cells; int cx, cy, cw, ch; @@ -356,7 +377,7 @@ wxString wxHtmlContainerCell::GetLink(int x, int y) const return c -> GetLink(x - cx, y - cy); c = c -> GetNext(); } - return wxEmptyString; + return NULL; } @@ -376,14 +397,14 @@ void wxHtmlContainerCell::InsertCell(wxHtmlCell *f) void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag) { - if (tag.HasParam("ALIGN")) { - wxString alg = tag.GetParam("ALIGN"); + if (tag.HasParam(wxT("ALIGN"))) { + wxString alg = tag.GetParam(wxT("ALIGN")); alg.MakeUpper(); - if (alg == "CENTER") + if (alg == wxT("CENTER")) SetAlignHor(wxHTML_ALIGN_CENTER); - else if (alg == "LEFT") + else if (alg == wxT("LEFT")) SetAlignHor(wxHTML_ALIGN_LEFT); - else if (alg == "RIGHT") + else if (alg == wxT("RIGHT")) SetAlignHor(wxHTML_ALIGN_RIGHT); } } @@ -392,11 +413,11 @@ void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag) void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale) { - if (tag.HasParam("WIDTH")) { + if (tag.HasParam(wxT("WIDTH"))) { int wdi; - wxString wd = tag.GetParam("WIDTH"); + wxString wd = tag.GetParam(wxT("WIDTH")); - if (wd[wd.Length()-1] == '%') { + if (wd[wd.Length()-1] == wxT('%')) { wxSscanf(wd.c_str(), wxT("%i%%"), &wdi); SetWidthFloat(wdi, wxHTML_UNITS_PERCENT); } @@ -479,13 +500,13 @@ void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y) void wxHtmlFontCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) { - dc.SetFont(*m_Font); + dc.SetFont(m_Font); wxHtmlCell::Draw(dc, x, y, view_y1, view_y2); } void wxHtmlFontCell::DrawInvisible(wxDC& dc, int x, int y) { - dc.SetFont(*m_Font); + dc.SetFont(m_Font); wxHtmlCell::DrawInvisible(dc, x, y); }