added convenience accessors to wxHtmlTag and modified wxHTML code to use them; improved colours parsing

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10747 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-07-01 18:07:33 +00:00
parent fef8557d30
commit 8bd72d9065
8 changed files with 167 additions and 97 deletions

View File

@@ -174,43 +174,23 @@ TAG_HANDLER_BEGIN(BODY, "BODY")
TAG_HANDLER_PROC(tag)
{
unsigned long tmp;
wxColour clr;
if (tag.HasParam(wxT("TEXT")))
if (tag.GetParamAsColour(wxT("TEXT"), &clr))
{
if (tag.ScanParam(wxT("TEXT"), wxT("#%lX"), &tmp) == 1)
{
clr = wxColour((unsigned char)((tmp & 0xFF0000) >> 16),
(unsigned char)((tmp & 0x00FF00) >> 8),
(unsigned char)(tmp & 0x0000FF));
m_WParser->SetActualColor(clr);
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
}
}
if (tag.HasParam(wxT("LINK")))
{
if (tag.ScanParam(wxT("LINK"), wxT("#%lX"), &tmp) == 1)
{
clr = wxColour((unsigned char)((tmp & 0xFF0000) >> 16),
(unsigned char)((tmp & 0x00FF00) >> 8),
(unsigned char)(tmp & 0x0000FF));
m_WParser->SetLinkColor(clr);
}
m_WParser->SetActualColor(clr);
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
}
if (tag.HasParam(wxT("BGCOLOR")))
if (tag.GetParamAsColour(wxT("LINK"), &clr))
m_WParser->SetLinkColor(clr);
if (tag.GetParamAsColour(wxT("BGCOLOR"), &clr))
{
if (tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &tmp) == 1)
{
clr = wxColour((unsigned char)((tmp & 0xFF0000) >> 16),
(unsigned char)((tmp & 0x00FF00) >> 8),
(unsigned char)(tmp & 0x0000FF));
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
if (m_WParser->GetWindow() != NULL)
m_WParser->GetWindow()->SetBackgroundColour(clr);
}
m_WParser->GetContainer()->InsertCell(
new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
if (m_WParser->GetWindow() != NULL)
m_WParser->GetWindow()->SetBackgroundColour(clr);
}
return FALSE;
}