void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
{
if (m_Link) delete m_Link;
- m_Link = new wxHtmlLinkInfo(link);
+ m_Link = NULL;
+ if (link.GetHref() != wxEmptyString)
+ m_Link = new wxHtmlLinkInfo(link);
+}
+
+
+
+void wxHtmlCell::Layout(int w)
+{
+ SetPos(0, 0);
+ if (m_Next) m_Next -> Layout(w);
+}
+
+
+void wxHtmlCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ if (m_Next) m_Next -> Draw(dc, x, y, view_y1, view_y2);
+}
+
+
+
+void wxHtmlCell::DrawInvisible(wxDC& dc, int x, int y)
+{
+ if (m_Next) m_Next -> DrawInvisible(dc, x, y);
+}
+
+
+
+const wxHtmlCell* wxHtmlCell::Find(int condition, const void* param) const
+{
+ if (m_Next) return m_Next -> Find(condition, param);
+ else return NULL;
}
m_WidthFloat = 100; m_WidthFloatUnits = wxHTML_UNITS_PERCENT;
m_UseBkColour = FALSE;
m_UseBorder = FALSE;
- m_MinHeight = m_MaxLineWidth = 0;
+ m_MinHeight = 0;
m_MinHeightAlign = wxHTML_ALIGN_TOP;
m_LastLayout = -1;
}
+wxHtmlContainerCell::~wxHtmlContainerCell()
+{
+ if (m_Cells) delete m_Cells;
+}
+
void wxHtmlContainerCell::SetIndent(int i, int what, int units)
int xdelta = 0, ybasicpos = 0, ydiff;
int s_width, s_indent;
int ysizeup = 0, ysizedown = 0;
+ int MaxLineWidth = 0;
+ int xcnt = 0;
+
/*
s_indent = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
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) {
cell -> SetPos(xpos, ybasicpos + cell -> GetDescent());
xpos += cell -> GetWidth();
cell = cell -> GetNext();
+ xcnt++;
// force new line if occured:
if ((cell == NULL) || (xpos + cell -> GetWidth() > s_width)) {
- if (xpos > m_MaxLineWidth) m_MaxLineWidth = xpos;
+ if (xpos > MaxLineWidth) MaxLineWidth = xpos;
if (ysizeup < 0) ysizeup = 0;
if (ysizedown < 0) ysizedown = 0;
switch (m_AlignHor) {
- case wxHTML_ALIGN_LEFT : xdelta = 0; break;
- case wxHTML_ALIGN_RIGHT : xdelta = 0 + (s_width - xpos); break;
- case wxHTML_ALIGN_CENTER : xdelta = 0 + (s_width - xpos) / 2; break;
+ case wxHTML_ALIGN_LEFT :
+ case wxHTML_ALIGN_JUSTIFY :
+ xdelta = 0;
+ break;
+ case wxHTML_ALIGN_RIGHT :
+ xdelta = 0 + (s_width - xpos);
+ break;
+ case wxHTML_ALIGN_CENTER :
+ xdelta = 0 + (s_width - xpos) / 2;
+ break;
}
if (xdelta < 0) xdelta = 0;
xdelta += s_indent;
ypos += ysizeup;
- while (line != cell) {
- line -> SetPos(line -> GetPosX() + xdelta, ypos + line -> GetPosY());
- line = line -> GetNext();
+
+ if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == NULL)
+ while (line != cell) {
+ line -> SetPos(line -> GetPosX() + xdelta,
+ ypos + line -> GetPosY());
+ line = line -> GetNext();
+ }
+ else
+ {
+ int counter = 0;
+ int step = (s_width - xpos);
+ if (step < 0) step = 0;
+ xcnt--;
+ if (xcnt > 0) while (line != cell) {
+ line -> SetPos(line -> GetPosX() + s_indent +
+ (counter++ * step / xcnt),
+ ypos + line -> GetPosY());
+ line = line -> GetNext();
+ }
+ xcnt++;
}
ypos += ysizedown;
- xpos = 0;
+ xpos = xcnt = 0;
ysizeup = ysizedown = 0;
line = cell;
}
m_Height = m_MinHeight;
}
- m_MaxLineWidth += s_indent + ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
- if (m_Width < m_MaxLineWidth) m_Width = m_MaxLineWidth;
+ MaxLineWidth += s_indent + ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
+ if (m_Width < MaxLineWidth) m_Width = MaxLineWidth;
m_LastLayout = w;
SetAlignHor(wxHTML_ALIGN_CENTER);
else if (alg == wxT("LEFT"))
SetAlignHor(wxHTML_ALIGN_LEFT);
+ else if (alg == wxT("JUSTIFY"))
+ SetAlignHor(wxHTML_ALIGN_JUSTIFY);
else if (alg == wxT("RIGHT"))
SetAlignHor(wxHTML_ALIGN_RIGHT);
m_LastLayout = -1;