X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3625820490496633a180ee57035f11b86c181798..4521f6c88cbefa7f13e3733d344776b795f981e4:/src/html/htmltag.cpp diff --git a/src/html/htmltag.cpp b/src/html/htmltag.cpp index fdc71fe171..d507d5373a 100644 --- a/src/html/htmltag.cpp +++ b/src/html/htmltag.cpp @@ -2,7 +2,6 @@ // Name: src/html/htmltag.cpp // Purpose: wxHtmlTag class (represents single tag) // Author: Vaclav Slavik -// RCS-ID: $Id$ // Copyright: (c) 1999 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -464,6 +463,7 @@ wxHtmlTag::wxHtmlTag(wxHtmlTag *parent, { "width", "WIDTH" }, { "vertical-align", "VALIGN" }, { "background", "BGCOLOR" }, + { "background-color", "BGCOLOR" }, }; wxHtmlStyleParams styleParams(*this); @@ -511,6 +511,19 @@ wxString wxHtmlTag::GetParam(const wxString& par, bool with_quotes) const return m_ParamValues[index]; } +bool wxHtmlTag::GetParamAsString(const wxString& par, wxString *str) const +{ + wxCHECK_MSG( str, false, wxT("NULL output string argument") ); + + int index = m_ParamNames.Index(par, false); + if (index == wxNOT_FOUND) + return false; + + *str = m_ParamValues[index]; + + return true; +} + int wxHtmlTag::ScanParam(const wxString& par, const char *format, void *param) const @@ -586,6 +599,38 @@ bool wxHtmlTag::GetParamAsInt(const wxString& par, int *clr) const return true; } +bool +wxHtmlTag::GetParamAsIntOrPercent(const wxString& par, + int* value, + bool& isPercent) const +{ + const wxString param = GetParam(par); + if ( param.empty() ) + return false; + + wxString num; + if ( param.EndsWith("%", &num) ) + { + isPercent = true; + } + else + { + isPercent = false; + num = param; + } + + long lValue; + if ( !num.ToLong(&lValue) ) + return false; + + if ( lValue > INT_MAX || lValue < INT_MIN ) + return false; + + *value = static_cast(lValue); + + return true; +} + wxString wxHtmlTag::GetAllParams() const { // VS: this function is for backward compatibility only,