]>
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
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
12 This class represents a single HTML tag.
13 It is used by @ref overview_html_handlers "tag handlers".
22 Constructor. You will probably never have to construct a wxHtmlTag object
23 yourself. Feel free to ignore the constructor parameters.
24 Have a look at @c src/html/htmlpars.cpp if you're interested in creating it.
26 wxHtmlTag(wxHtmlTag
* parent
, const wxString
* source
,
27 const const_iterator
& pos
, const const_iterator
& end_pos
,
28 wxHtmlTagsCache
* cache
, wxHtmlEntitiesParser
* entParser
);
32 Returns a string containing all parameters.
33 Example: tag contains \<FONT SIZE=+2 COLOR="#000000"\>.
34 Call to tag.GetAllParams() would return @c 'SIZE=+2 COLOR="#000000"'.
36 wxString
GetAllParams() const;
39 Returns beginning position of the text @e between this tag and paired
40 ending tag. See explanation (returned position is marked with '|'):
42 bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
46 @deprecated @todo provide deprecation description
48 int GetBeginPos() const;
51 Returns ending position of the text @e between this tag and paired
52 ending tag. See explanation (returned position is marked with '|'):
54 bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
58 @deprecated @todo provide deprecation description
60 int GetEndPos1() const;
63 Returns ending position 2 of the text @e between this tag and paired
64 ending tag. See explanation (returned position is marked with '|'):
66 bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
70 @deprecated @todo provide deprecation description
72 int GetEndPos2() const;
75 Returns tag's name. The name is always in uppercase and it doesn't contain
76 " or '/' characters. (So the name of \<FONT SIZE=+2\> tag is "FONT"
77 and name of \</table\> is "TABLE").
79 wxString
GetName() const;
82 Returns the value of the parameter. You should check whether the
83 parameter exists or not (use wxHtmlTag::HasParam) first.
88 @true if you want to get quotes as well. See example.
93 // you have wxHtmlTag variable tag which is equal to the
94 // HTML tag <FONT SIZE=+2 COLOR="#0000FF">
95 dummy = tag.GetParam("SIZE");
97 dummy = tag.GetParam("COLOR");
99 dummy = tag.GetParam("COLOR", true);
100 // dummy == "\"#0000FF\"" -- see the difference!!
103 wxString
GetParam(const wxString
& par
, bool with_quotes
= false) const;
106 Interprets tag parameter @a par as colour specification and saves its value
107 into wxColour variable pointed by @a clr.
109 Returns @true on success and @false if @a par is not colour specification or
110 if the tag has no such parameter.
114 bool GetParamAsColour(const wxString
& par
, wxColour
* clr
) const;
117 Interprets tag parameter @a par as an integer and saves its value
118 into int variable pointed by @a value.
120 Returns @true on success and @false if @a par is not an integer or
121 if the tag has no such parameter.
123 bool GetParamAsInt(const wxString
& par
, int* value
) const;
126 Returns @true if this tag is paired with ending tag, @false otherwise.
127 See the example of HTML document:
132 <p align=center>This is centered...</p>
137 In this example tags HTML and BODY have ending tags, first P and BR
138 doesn't have ending tag while the second P has.
139 The third P tag (which is ending itself) of course doesn't have ending tag.
141 bool HasEnding() const;
144 Returns @true if the tag has a parameter of the given name.
145 Example: \<FONT SIZE=+2 COLOR="\#FF00FF"\> has two parameters named
149 the parameter you're looking for.
151 bool HasParam(const wxString
& par
) const;
154 Parses the given string as an HTML colour.
156 This function recognizes the standard named HTML 4 colours as well as
157 the usual RGB syntax.
163 @return @true if the string was successfully parsed and @a clr was
164 filled with the result or @false otherwise.
166 static bool ParseAsColour(const wxString
& str
, wxColour
*clr
);
170 This method scans the given parameter. Usage is exactly the same as sscanf's
171 usage except that you don't pass a string but a parameter name as the first
172 argument and you can only retrieve one value (i.e. you can use only one "%"
173 element in @a format).
176 The name of the tag you want to query
178 scanf()-like format string.
180 pointer to a variable to store the value in
182 int ScanParam(const wxString
& par
, const wchar_t* format
, void* value
) const;
183 int ScanParam(const wxString
& par
, const char* format
, void* value
) const;