]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: html/htmltag.h | |
e54c96f1 | 3 | // Purpose: interface of wxHtmlTag |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxHtmlTag | |
7c913512 FM |
11 | |
12 | This class represents a single HTML tag. | |
23324ae1 | 13 | It is used by @ref overview_handlers "tag handlers". |
7c913512 | 14 | |
23324ae1 FM |
15 | @library{wxhtml} |
16 | @category{FIXME} | |
17 | */ | |
7c913512 | 18 | class wxHtmlTag |
23324ae1 FM |
19 | { |
20 | public: | |
21 | /** | |
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 src/html/htmlpars.cpp if you're interested in creating it. | |
25 | */ | |
4cc4bfaf | 26 | wxHtmlTag(wxHtmlTag* parent, const wxString& source, int pos, |
23324ae1 | 27 | int end_pos, wxHtmlTagsCache* cache, |
4cc4bfaf | 28 | wxHtmlEntitiesParser* entParser); |
23324ae1 FM |
29 | |
30 | /** | |
31 | Returns a string containing all parameters. | |
23324ae1 FM |
32 | Example : tag contains @c FONT SIZE=+2 COLOR="#000000". Call to |
33 | tag.GetAllParams() would return @c SIZE=+2 COLOR="#000000". | |
34 | */ | |
328f5751 | 35 | const wxString GetAllParams() const; |
23324ae1 FM |
36 | |
37 | /** | |
38 | Returns beginning position of the text @e between this tag and paired | |
7c913512 | 39 | ending tag. |
23324ae1 | 40 | See explanation (returned position is marked with '|'): |
adaaa686 | 41 | @deprecated @todo provide deprecation description |
23324ae1 | 42 | */ |
328f5751 | 43 | int GetBeginPos() const; |
23324ae1 FM |
44 | |
45 | /** | |
46 | Returns ending position of the text @e between this tag and paired | |
47 | ending tag. | |
48 | See explanation (returned position is marked with '|'): | |
18e8e19b | 49 | @deprecated @todo provide deprecation description |
23324ae1 | 50 | */ |
328f5751 | 51 | int GetEndPos1() const; |
23324ae1 FM |
52 | |
53 | /** | |
54 | Returns ending position 2 of the text @e between this tag and paired | |
55 | ending tag. | |
56 | See explanation (returned position is marked with '|'): | |
18e8e19b | 57 | @deprecated @todo provide deprecation description |
23324ae1 | 58 | */ |
328f5751 | 59 | int GetEndPos2() const; |
23324ae1 FM |
60 | |
61 | /** | |
62 | Returns tag's name. The name is always in uppercase and it doesn't contain | |
cdbcf4c2 | 63 | " or '/' characters. (So the name of @c FONT SIZE=+2 tag is "FONT" |
23324ae1 FM |
64 | and name of @c /table is "TABLE") |
65 | */ | |
328f5751 | 66 | wxString GetName() const; |
23324ae1 FM |
67 | |
68 | /** | |
69 | Returns the value of the parameter. You should check whether the | |
70 | parameter exists or not (use wxHtmlTag::HasParam) first. | |
18e8e19b | 71 | |
7c913512 | 72 | @param par |
4cc4bfaf | 73 | The parameter's name. |
7c913512 | 74 | @param with_quotes |
4cc4bfaf | 75 | @true if you want to get quotes as well. See example. |
23324ae1 | 76 | */ |
328f5751 | 77 | wxString GetParam(const wxString& par, bool with_quotes = false) const; |
23324ae1 FM |
78 | |
79 | /** | |
4cc4bfaf | 80 | Interprets tag parameter @a par as colour specification and saves its value |
23324ae1 | 81 | into wxColour variable pointed by @e clr. |
4cc4bfaf | 82 | Returns @true on success and @false if @a par is not colour specification or |
23324ae1 FM |
83 | if the tag has no such parameter. |
84 | */ | |
328f5751 | 85 | bool GetParamAsColour(const wxString& par, wxColour* clr) const; |
23324ae1 FM |
86 | |
87 | /** | |
4cc4bfaf | 88 | Interprets tag parameter @a par as an integer and saves its value |
23324ae1 | 89 | into int variable pointed by @e value. |
4cc4bfaf | 90 | Returns @true on success and @false if @a par is not an integer or |
23324ae1 FM |
91 | if the tag has no such parameter. |
92 | */ | |
328f5751 | 93 | bool GetParamAsInt(const wxString& par, int* value) const; |
23324ae1 FM |
94 | |
95 | /** | |
96 | Returns @true if this tag is paired with ending tag, @false otherwise. | |
23324ae1 | 97 | See the example of HTML document: |
18e8e19b | 98 | |
7c913512 | 99 | In this example tags HTML and BODY have ending tags, first P and BR |
23324ae1 FM |
100 | doesn't have ending tag while the second P has. The third P tag (which |
101 | is ending itself) of course doesn't have ending tag. | |
102 | */ | |
328f5751 | 103 | bool HasEnding() const; |
23324ae1 FM |
104 | |
105 | /** | |
7c913512 | 106 | Returns @true if the tag has a parameter of the given name. |
3f5506cf | 107 | Example : @c FONT SIZE=+2 COLOR="\#FF00FF" has two parameters named |
23324ae1 | 108 | "SIZE" and "COLOR". |
18e8e19b | 109 | |
7c913512 | 110 | @param par |
4cc4bfaf | 111 | the parameter you're looking for. |
23324ae1 | 112 | */ |
328f5751 | 113 | bool HasParam(const wxString& par) const; |
23324ae1 FM |
114 | |
115 | /** | |
7c913512 | 116 | This method scans the given parameter. Usage is exactly the same as sscanf's |
23324ae1 FM |
117 | usage except that you don't pass a string but a parameter name as the first |
118 | argument | |
119 | and you can only retrieve one value (i.e. you can use only one "%" element | |
120 | in @e format). | |
18e8e19b | 121 | |
7c913512 | 122 | @param par |
4cc4bfaf | 123 | The name of the tag you want to query |
7c913512 | 124 | @param format |
4cc4bfaf | 125 | scanf()-like format string. |
7c913512 | 126 | @param value |
4cc4bfaf | 127 | pointer to a variable to store the value in |
23324ae1 | 128 | */ |
4cc4bfaf | 129 | wxString ScanParam(const wxString& par, const wxChar* format, |
328f5751 | 130 | void* value) const; |
23324ae1 | 131 | }; |
e54c96f1 | 132 |