]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/html/htmltag.h
Move code removing "-psn_xxx" command line arguments to common code.
[wxWidgets.git] / interface / wx / html / htmltag.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: html/htmltag.h
e54c96f1 3// Purpose: interface of wxHtmlTag
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxHtmlTag
7c913512
FM
10
11 This class represents a single HTML tag.
5bddd46d 12 It is used by @ref overview_html_handlers "tag handlers".
7c913512 13
23324ae1 14 @library{wxhtml}
551266a9 15 @category{html}
23324ae1 16*/
7c913512 17class wxHtmlTag
23324ae1 18{
551266a9 19protected:
23324ae1
FM
20 /**
21 Constructor. You will probably never have to construct a wxHtmlTag object
22 yourself. Feel free to ignore the constructor parameters.
5bddd46d 23 Have a look at @c src/html/htmlpars.cpp if you're interested in creating it.
23324ae1 24 */
8067ee11
FM
25 wxHtmlTag(wxHtmlTag* parent, const wxString* source,
26 const const_iterator& pos, const const_iterator& end_pos,
27 wxHtmlTagsCache* cache, wxHtmlEntitiesParser* entParser);
23324ae1 28
551266a9 29public:
23324ae1
FM
30 /**
31 Returns a string containing all parameters.
5bddd46d
FM
32 Example: tag contains \<FONT SIZE=+2 COLOR="#000000"\>.
33 Call to tag.GetAllParams() would return @c 'SIZE=+2 COLOR="#000000"'.
23324ae1 34 */
5267aefd 35 wxString GetAllParams() const;
23324ae1
FM
36
37 /**
38 Returns beginning position of the text @e between this tag and paired
5bddd46d
FM
39 ending tag. See explanation (returned position is marked with '|'):
40 @code
41 bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
42 |
43 @endcode
44
adaaa686 45 @deprecated @todo provide deprecation description
23324ae1 46 */
328f5751 47 int GetBeginPos() const;
23324ae1
FM
48
49 /**
50 Returns ending position of the text @e between this tag and paired
5bddd46d
FM
51 ending tag. See explanation (returned position is marked with '|'):
52 @code
53 bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
54 |
55 @endcode
56
18e8e19b 57 @deprecated @todo provide deprecation description
23324ae1 58 */
328f5751 59 int GetEndPos1() const;
23324ae1
FM
60
61 /**
62 Returns ending position 2 of the text @e between this tag and paired
5bddd46d
FM
63 ending tag. See explanation (returned position is marked with '|'):
64 @code
65 bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
66 |
67 @endcode
68
18e8e19b 69 @deprecated @todo provide deprecation description
23324ae1 70 */
328f5751 71 int GetEndPos2() const;
23324ae1
FM
72
73 /**
74 Returns tag's name. The name is always in uppercase and it doesn't contain
163bd4f7 75 &quot; or '/' characters. (So the name of \<FONT SIZE=+2\> tag is "FONT"
5bddd46d 76 and name of \</table\> is "TABLE").
23324ae1 77 */
328f5751 78 wxString GetName() const;
23324ae1
FM
79
80 /**
81 Returns the value of the parameter. You should check whether the
82 parameter exists or not (use wxHtmlTag::HasParam) first.
18e8e19b 83
7c913512 84 @param par
4cc4bfaf 85 The parameter's name.
7c913512 86 @param with_quotes
4cc4bfaf 87 @true if you want to get quotes as well. See example.
5bddd46d
FM
88
89 Example:
90 @code
91 ...
92 // you have wxHtmlTag variable tag which is equal to the
93 // HTML tag <FONT SIZE=+2 COLOR="#0000FF">
94 dummy = tag.GetParam("SIZE");
95 // dummy == "+2"
96 dummy = tag.GetParam("COLOR");
97 // dummy == "#0000FF"
98 dummy = tag.GetParam("COLOR", true);
99 // dummy == "\"#0000FF\"" -- see the difference!!
100 @endcode
23324ae1 101 */
328f5751 102 wxString GetParam(const wxString& par, bool with_quotes = false) const;
23324ae1
FM
103
104 /**
4cc4bfaf 105 Interprets tag parameter @a par as colour specification and saves its value
5bddd46d
FM
106 into wxColour variable pointed by @a clr.
107
4cc4bfaf 108 Returns @true on success and @false if @a par is not colour specification or
23324ae1 109 if the tag has no such parameter.
f68e16c5
VZ
110
111 @see ParseAsColour()
23324ae1 112 */
328f5751 113 bool GetParamAsColour(const wxString& par, wxColour* clr) const;
23324ae1
FM
114
115 /**
4cc4bfaf 116 Interprets tag parameter @a par as an integer and saves its value
5bddd46d
FM
117 into int variable pointed by @a value.
118
4cc4bfaf 119 Returns @true on success and @false if @a par is not an integer or
23324ae1
FM
120 if the tag has no such parameter.
121 */
328f5751 122 bool GetParamAsInt(const wxString& par, int* value) const;
23324ae1
FM
123
124 /**
125 Returns @true if this tag is paired with ending tag, @false otherwise.
23324ae1 126 See the example of HTML document:
5bddd46d
FM
127 @code
128 <html><body>
129 Hello<p>
130 How are you?
131 <p align=center>This is centered...</p>
132 Oops<br>Oooops!
133 </body></html>
134 @endcode
18e8e19b 135
7c913512 136 In this example tags HTML and BODY have ending tags, first P and BR
5bddd46d
FM
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.
23324ae1 139 */
328f5751 140 bool HasEnding() const;
23324ae1
FM
141
142 /**
7c913512 143 Returns @true if the tag has a parameter of the given name.
5bddd46d 144 Example: \<FONT SIZE=+2 COLOR="\#FF00FF"\> has two parameters named
23324ae1 145 "SIZE" and "COLOR".
18e8e19b 146
7c913512 147 @param par
4cc4bfaf 148 the parameter you're looking for.
23324ae1 149 */
328f5751 150 bool HasParam(const wxString& par) const;
23324ae1 151
f68e16c5
VZ
152 /**
153 Parses the given string as an HTML colour.
154
155 This function recognizes the standard named HTML 4 colours as well as
156 the usual RGB syntax.
157
158 @since 2.9.1
159
160 @see wxColour::Set()
161
162 @return @true if the string was successfully parsed and @a clr was
163 filled with the result or @false otherwise.
164 */
165 static bool ParseAsColour(const wxString& str, wxColour *clr);
166
a44f3b5a 167 //@{
23324ae1 168 /**
7c913512 169 This method scans the given parameter. Usage is exactly the same as sscanf's
23324ae1 170 usage except that you don't pass a string but a parameter name as the first
5bddd46d
FM
171 argument and you can only retrieve one value (i.e. you can use only one "%"
172 element in @a format).
18e8e19b 173
7c913512 174 @param par
4cc4bfaf 175 The name of the tag you want to query
7c913512 176 @param format
4cc4bfaf 177 scanf()-like format string.
7c913512 178 @param value
4cc4bfaf 179 pointer to a variable to store the value in
23324ae1 180 */
a44f3b5a
FM
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;
183 //@}
23324ae1 184};
e54c96f1 185