]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/html/htmltag.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html/htmltag.h
3 // Purpose: interface of wxHtmlTag
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 This class represents a single HTML tag.
12 It is used by @ref overview_html_handlers "tag handlers".
21 Constructor. You will probably never have to construct a wxHtmlTag object
22 yourself. Feel free to ignore the constructor parameters.
23 Have a look at @c src/html/htmlpars.cpp if you're interested in creating it.
25 wxHtmlTag(wxHtmlTag
* parent
, const wxString
* source
,
26 const const_iterator
& pos
, const const_iterator
& end_pos
,
27 wxHtmlTagsCache
* cache
, wxHtmlEntitiesParser
* entParser
);
31 Returns a string containing all parameters.
32 Example: tag contains \<FONT SIZE=+2 COLOR="#000000"\>.
33 Call to tag.GetAllParams() would return @c 'SIZE=+2 COLOR="#000000"'.
35 wxString
GetAllParams() const;
38 Returns beginning position of the text @e between this tag and paired
39 ending tag. See explanation (returned position is marked with '|'):
41 bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
45 @deprecated @todo provide deprecation description
47 int GetBeginPos() const;
50 Returns ending position of the text @e between this tag and paired
51 ending tag. See explanation (returned position is marked with '|'):
53 bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
57 @deprecated @todo provide deprecation description
59 int GetEndPos1() const;
62 Returns ending position 2 of the text @e between this tag and paired
63 ending tag. See explanation (returned position is marked with '|'):
65 bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
69 @deprecated @todo provide deprecation description
71 int GetEndPos2() const;
74 Returns tag's name. The name is always in uppercase and it doesn't contain
75 " or '/' characters. (So the name of \<FONT SIZE=+2\> tag is "FONT"
76 and name of \</table\> is "TABLE").
78 wxString
GetName() const;
81 Returns the value of the parameter. You should check whether the
82 parameter exists or not (use wxHtmlTag::HasParam) first.
87 @true if you want to get quotes as well. See example.
92 // you have wxHtmlTag variable tag which is equal to the
93 // HTML tag <FONT SIZE=+2 COLOR="#0000FF">
94 dummy = tag.GetParam("SIZE");
96 dummy = tag.GetParam("COLOR");
98 dummy = tag.GetParam("COLOR", true);
99 // dummy == "\"#0000FF\"" -- see the difference!!
102 wxString
GetParam(const wxString
& par
, bool with_quotes
= false) const;
105 Interprets tag parameter @a par as colour specification and saves its value
106 into wxColour variable pointed by @a clr.
108 Returns @true on success and @false if @a par is not colour specification or
109 if the tag has no such parameter.
113 bool GetParamAsColour(const wxString
& par
, wxColour
* clr
) const;
116 Interprets tag parameter @a par as an integer and saves its value
117 into int variable pointed by @a value.
119 Returns @true on success and @false if @a par is not an integer or
120 if the tag has no such parameter.
122 bool GetParamAsInt(const wxString
& par
, int* value
) const;
125 Returns @true if this tag is paired with ending tag, @false otherwise.
126 See the example of HTML document:
131 <p align=center>This is centered...</p>
136 In this example tags HTML and BODY have ending tags, first P and BR
137 doesn't have ending tag while the second P has.
138 The third P tag (which is ending itself) of course doesn't have ending tag.
140 bool HasEnding() const;
143 Returns @true if the tag has a parameter of the given name.
144 Example: \<FONT SIZE=+2 COLOR="\#FF00FF"\> has two parameters named
148 the parameter you're looking for.
150 bool HasParam(const wxString
& par
) const;
153 Parses the given string as an HTML colour.
155 This function recognizes the standard named HTML 4 colours as well as
156 the usual RGB syntax.
162 @return @true if the string was successfully parsed and @a clr was
163 filled with the result or @false otherwise.
165 static bool ParseAsColour(const wxString
& str
, wxColour
*clr
);
169 This method scans the given parameter. Usage is exactly the same as sscanf's
170 usage except that you don't pass a string but a parameter name as the first
171 argument and you can only retrieve one value (i.e. you can use only one "%"
172 element in @a format).
175 The name of the tag you want to query
177 scanf()-like format string.
179 pointer to a variable to store the value in
181 int ScanParam(const wxString
& par
, const wchar_t* format
, void* value
) const;
182 int ScanParam(const wxString
& par
, const char* format
, void* value
) const;