]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmltag.cpp
wxGTK1 : wx/private/eventloopsourcesmanager.h was missing in evtloop.cpp
[wxWidgets.git] / src / html / htmltag.cpp
index fdc71fe1710063e3212f899891ceaddb31a95973..574b01006e9151b64b092a2f7ba92c46b64fbf94 100644 (file)
@@ -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);
@@ -586,6 +586,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<int>(lValue);
+
+    return true;
+}
+
 wxString wxHtmlTag::GetAllParams() const
 {
     // VS: this function is for backward compatibility only,