X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b1a3a964997a143de68f2e3c75fa8dd82a4e3361..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/html/htmltag.h diff --git a/include/wx/html/htmltag.h b/include/wx/html/htmltag.h index 56f042096a..99d15ee6ff 100644 --- a/include/wx/html/htmltag.h +++ b/include/wx/html/htmltag.h @@ -1,8 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: htmltag.h +// Name: wx/html/htmltag.h // Purpose: wxHtmlTag class (represents single tag) // Author: Vaclav Slavik -// RCS-ID: $Id$ // Copyright: (c) 1999 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -47,7 +46,7 @@ public: wxString::const_iterator *end2, bool *hasEnding); - DECLARE_NO_COPY_CLASS(wxHtmlTagsCache) + wxDECLARE_NO_COPY_CLASS(wxHtmlTagsCache); }; @@ -94,16 +93,22 @@ public: // enclosed with " // Example :

GetParam("ALIGN") returns (RIGHT) //

GetParam("SRC") returns (WhaT.jpg) - // (or ("WhaT.jpg") if with_commas == true) - wxString GetParam(const wxString& par, bool with_commas = false) const; + // (or ("WhaT.jpg") if with_quotes == true) + wxString GetParam(const wxString& par, bool with_quotes = false) const; + + // Return true if the string could be parsed as an HTML colour and false + // otherwise. + static bool ParseAsColour(const wxString& str, wxColour *clr); // Convenience functions: bool GetParamAsColour(const wxString& par, wxColour *clr) const; bool GetParamAsInt(const wxString& par, int *clr) const; + bool GetParamAsIntOrPercent(const wxString& param, + int* value, bool& isPercent) const; // Scans param like scanf() functions family does. // Example : ScanParam("COLOR", "\"#%X\"", &clr); - // This is always with with_commas=false + // This is always with with_quotes=false // Returns number of scanned values // (like sscanf() does) // NOTE: unlike scanf family, this function only accepts @@ -117,21 +122,23 @@ public: // return true if there is matching ending tag inline bool HasEnding() const {return m_hasEnding;} - // returns beginning position of _internal_ block of text + // returns beginning position of _internal_ block of text as iterator + // into parser's source string (see wxHtmlParser::GetSource()) // See explanation (returned value is marked with *): // bla bla bla * bla bla intenal text bla bla wxString::const_iterator GetBeginIter() const { return m_Begin; } - // returns ending position of _internal_ block of text. + // returns ending position of _internal_ block of text as iterator + // into parser's source string (see wxHtmlParser::GetSource()): // bla bla bla bla bla intenal text* bla bla - wxString::const_iterator GetEndIter1() const - { wxASSERT(m_hasEnding); return m_End1; } - // returns end position 2 : + wxString::const_iterator GetEndIter1() const { return m_End1; } + // returns end position 2 as iterator + // into parser's source string (see wxHtmlParser::GetSource()): // bla bla bla bla bla internal text* bla bla - wxString::const_iterator GetEndIter2() const - { wxASSERT(m_hasEnding); return m_End2; } + wxString::const_iterator GetEndIter2() const { return m_End2; } #if WXWIN_COMPATIBILITY_2_8 + // use GetBeginIter(), GetEndIter1() and GetEndIter2() instead wxDEPRECATED( inline int GetBeginPos() const ); wxDEPRECATED( inline int GetEndPos1() const ); wxDEPRECATED( inline int GetEndPos2() const ); @@ -152,14 +159,14 @@ private: wxHtmlTag *m_FirstChild, *m_LastChild; wxHtmlTag *m_Parent; - DECLARE_NO_COPY_CLASS(wxHtmlTag) + wxDECLARE_NO_COPY_CLASS(wxHtmlTag); }; #if WXWIN_COMPATIBILITY_2_8 -inline int wxHtmlTag::GetBeginPos() const { return m_Begin - m_sourceStart; } -inline int wxHtmlTag::GetEndPos1() const { return m_End1 - m_sourceStart; } -inline int wxHtmlTag::GetEndPos2() const { return m_End2 - m_sourceStart; } +inline int wxHtmlTag::GetBeginPos() const { return int(m_Begin - m_sourceStart); } +inline int wxHtmlTag::GetEndPos1() const { return int(m_End1 - m_sourceStart); } +inline int wxHtmlTag::GetEndPos2() const { return int(m_End2 - m_sourceStart); } #endif // WXWIN_COMPATIBILITY_2_8