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