#pragma implementation
#endif
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
+#include "wx/defs.h"
#if wxUSE_HTML
#ifdef __BORDLANDC__
#pragma hdrstop
#endif
#ifndef WXPRECOMP
-#include <wx/wx.h>
+#include "wx/wx.h"
#endif
wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& tag)
: wxHtmlContainerCell(parent)
{
- m_HasBorders = tag.HasParam("BORDER");
+ m_HasBorders = (tag.HasParam("BORDER") && tag.GetParam("BORDER") != "0");
m_ColsInfo = NULL;
m_NumCols = m_NumRows = 0;
m_CellInfo = NULL;
/* scan params: */
m_tBkg = m_rBkg = -1;
- if (tag.HasParam("BGCOLOR")) tag.ScanParam("BGCOLOR", "#%lX", &m_tBkg);
- if (tag.HasParam("VALIGN")) m_tValign = tag.GetParam("VALIGN"); else m_tValign = wxEmptyString;
- if (tag.HasParam("CELLSPACING") && tag.ScanParam("CELLSPACING", "%i", &m_Spacing) == 1) {} else m_Spacing = 2;
- if (tag.HasParam("CELLPADDING") && tag.ScanParam("CELLPADDING", "%i", &m_Padding) == 1) {} else m_Padding = 3;
+ if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &m_tBkg);
+ if (tag.HasParam(wxT("VALIGN"))) m_tValign = tag.GetParam(wxT("VALIGN")); else m_tValign = wxEmptyString;
+ if (tag.HasParam(wxT("CELLSPACING")) && tag.ScanParam(wxT("CELLSPACING"), wxT("%i"), &m_Spacing) == 1) {} else m_Spacing = 2;
+ if (tag.HasParam(wxT("CELLPADDING")) && tag.ScanParam(wxT("CELLPADDING"), wxT("%i"), &m_Padding) == 1) {} else m_Padding = 3;
if (m_HasBorders)
SetBorder(TABLE_BORDER_CLR_1, TABLE_BORDER_CLR_2);
m_ColsInfo = (colStruct*) realloc(m_ColsInfo, sizeof(colStruct) * cols);
for (j = m_NumCols; j < cols; j++) {
m_ColsInfo[j].width = 0;
- m_ColsInfo[j].units = HTML_UNITS_PERCENT;
+ m_ColsInfo[j].units = wxHTML_UNITS_PERCENT;
}
m_NumCols = cols;
/* scan params: */
m_rBkg = m_tBkg;
- if (tag.HasParam("BGCOLOR")) tag.ScanParam("BGCOLOR", "#%lX", &m_rBkg);
- if (tag.HasParam("VALIGN")) m_rValign = tag.GetParam("VALIGN"); else m_rValign = m_tValign;
+ if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &m_rBkg);
+ if (tag.HasParam(wxT("VALIGN"))) m_rValign = tag.GetParam(wxT("VALIGN")); else m_rValign = m_tValign;
}
m_CellInfo[r][c].rowspan = 1;
m_CellInfo[r][c].flag = cellUsed;
m_CellInfo[r][c].minheight = 0;
- m_CellInfo[r][c].valign = HTML_ALIGN_TOP;
+ m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP;
/* scan for parameters: */
wxString wd = tag.GetParam("WIDTH");
if (wd[wd.Length()-1] == '%') {
- sscanf(wd.c_str(), "%i%%", &m_ColsInfo[c].width);
- m_ColsInfo[c].units = HTML_UNITS_PERCENT;
+ wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width);
+ m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
}
else {
- sscanf(wd.c_str(), "%i", &m_ColsInfo[c].width);
- m_ColsInfo[c].units = HTML_UNITS_PIXELS;
+ wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width);
+ m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
}
}
}
// spanning:
{
- if (tag.HasParam("COLSPAN")) tag.ScanParam("COLSPAN", "%i", &m_CellInfo[r][c].colspan);
- if (tag.HasParam("ROWSPAN")) tag.ScanParam("ROWSPAN", "%i", &m_CellInfo[r][c].rowspan);
+ if (tag.HasParam(wxT("COLSPAN"))) tag.ScanParam(wxT("COLSPAN"), wxT("%i"), &m_CellInfo[r][c].colspan);
+ if (tag.HasParam(wxT("ROWSPAN"))) tag.ScanParam(wxT("ROWSPAN"), wxT("%i"), &m_CellInfo[r][c].rowspan);
if ((m_CellInfo[r][c].colspan != 1) || (m_CellInfo[r][c].rowspan != 1)) {
int i, j;
//background color:
{
int bk = m_rBkg;
- if (tag.HasParam("BGCOLOR")) tag.ScanParam("BGCOLOR", "#%lX", &bk);
+ if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &bk);
if (bk != -1) {
wxColour clr = wxColour((bk & 0xFF0000) >> 16 , (bk & 0x00FF00) >> 8, (bk & 0x0000FF));
cell -> SetBackgroundColour(clr);
wxString valign;
if (tag.HasParam("VALIGN")) valign = tag.GetParam("VALIGN"); else valign = m_tValign;
valign.MakeUpper();
- if (valign == "TOP") m_CellInfo[r][c].valign = HTML_ALIGN_TOP;
- else if (valign == "BOTTOM") m_CellInfo[r][c].valign = HTML_ALIGN_BOTTOM;
- else m_CellInfo[r][c].valign = HTML_ALIGN_CENTER;
+ if (valign == "TOP") m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP;
+ else if (valign == "BOTTOM") m_CellInfo[r][c].valign = wxHTML_ALIGN_BOTTOM;
+ else m_CellInfo[r][c].valign = wxHTML_ALIGN_CENTER;
}
- cell -> SetIndent(m_Padding, HTML_INDENT_ALL, HTML_UNITS_PIXELS);
+ cell -> SetIndent(m_Padding, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
}
*/
- if (m_WidthFloatUnits == HTML_UNITS_PERCENT) {
+ if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT) {
if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
else m_Width = m_WidthFloat * w / 100;
}
// 1a. setup fixed-width columns:
for (i = 0; i < m_NumCols; i++)
- if (m_ColsInfo[i].units == HTML_UNITS_PIXELS)
+ if (m_ColsInfo[i].units == wxHTML_UNITS_PIXELS)
wpix -= (m_ColsInfo[i].pixwidth = m_ColsInfo[i].width);
// 1b. setup floating-width columns:
for (i = 0; i < m_NumCols; i++)
- if ((m_ColsInfo[i].units == HTML_UNITS_PERCENT) && (m_ColsInfo[i].width != 0))
+ if ((m_ColsInfo[i].units == wxHTML_UNITS_PERCENT) && (m_ColsInfo[i].width != 0))
wtemp += (m_ColsInfo[i].pixwidth = m_ColsInfo[i].width * wpix / 100);
wpix -= wtemp;
TAG_HANDLER_CONSTR(TABLE)
{
m_Table = NULL;
- m_tAlign = m_rAlign = wxEmptyString;
- m_OldAlign = HTML_ALIGN_LEFT;
+ m_tAlign = m_rAlign = wxEmptyString;
+ m_OldAlign = wxHTML_ALIGN_LEFT;
}
m_WParser -> OpenContainer();
if (tag.GetName() == "TH") /*header style*/ {
- m_WParser -> SetAlign(HTML_ALIGN_CENTER);
+ m_WParser -> SetAlign(wxHTML_ALIGN_CENTER);
}
{
als = m_rAlign;
if (tag.HasParam("ALIGN")) als = tag.GetParam("ALIGN");
als.MakeUpper();
- if (als == "RIGHT") m_WParser -> SetAlign(HTML_ALIGN_RIGHT);
- else if (als == "CENTER") m_WParser -> SetAlign(HTML_ALIGN_CENTER);
+ if (als == "RIGHT") m_WParser -> SetAlign(wxHTML_ALIGN_RIGHT);
+ else if (als == "CENTER") m_WParser -> SetAlign(wxHTML_ALIGN_CENTER);
}
m_WParser -> OpenContainer();
}