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