]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/html/htmltag.h
14fb57af9d4b8d2032ef87a9546f9cb2a74bc814
[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 @deprecated @todo provide deprecation description
42 */
43 int GetBeginPos() const;
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 */
50 int GetEndPos1() const;
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 */
57 int GetEndPos2() const;
58
59 /**
60 Returns tag's name. The name is always in uppercase and it doesn't contain
61 " or '/' characters. (So the name of @c FONT SIZE=+2 tag is "FONT"
62 and name of @c /table is "TABLE")
63 */
64 wxString GetName() const;
65
66 /**
67 Returns the value of the parameter. You should check whether the
68 parameter exists or not (use wxHtmlTag::HasParam) first.
69
70 @param par
71 The parameter's name.
72 @param with_quotes
73 @true if you want to get quotes as well. See example.
74 */
75 wxString GetParam(const wxString& par, bool with_quotes = false) const;
76
77 /**
78 Interprets tag parameter @a par as colour specification and saves its value
79 into wxColour variable pointed by @e clr.
80 Returns @true on success and @false if @a par is not colour specification or
81 if the tag has no such parameter.
82 */
83 bool GetParamAsColour(const wxString& par, wxColour* clr) const;
84
85 /**
86 Interprets tag parameter @a par as an integer and saves its value
87 into int variable pointed by @e value.
88 Returns @true on success and @false if @a par is not an integer or
89 if the tag has no such parameter.
90 */
91 bool GetParamAsInt(const wxString& par, int* value) const;
92
93 /**
94 Returns @true if this tag is paired with ending tag, @false otherwise.
95 See the example of HTML document:
96
97 In this example tags HTML and BODY have ending tags, first P and BR
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 */
101 bool HasEnding() const;
102
103 /**
104 Returns @true if the tag has a parameter of the given name.
105 Example : @c FONT SIZE=+2 COLOR="\#FF00FF" has two parameters named
106 "SIZE" and "COLOR".
107
108 @param par
109 the parameter you're looking for.
110 */
111 bool HasParam(const wxString& par) const;
112
113 /**
114 This method scans the given parameter. Usage is exactly the same as sscanf's
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
120 @param par
121 The name of the tag you want to query
122 @param format
123 scanf()-like format string.
124 @param value
125 pointer to a variable to store the value in
126 */
127 wxString ScanParam(const wxString& par, const wxChar* format,
128 void* value) const;
129 };
130