]>
Commit | Line | Data |
---|---|---|
c40aba83 WS |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: htcell.tex | |
3 | %% Purpose: wxHtmlCell documentation | |
4 | %% Author: wxWidgets Team | |
5 | %% Modified by: | |
6 | %% Created: 21/Mar/99 22:45:23 | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) wxWidgets Team | |
9 | %% License: wxWindows license | |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
704a4b75 | 11 | |
704a4b75 VS |
12 | \section{\class{wxHtmlCell}}\label{wxhtmlcell} |
13 | ||
14 | Internal data structure. It represents fragments of parsed HTML | |
448af9a4 | 15 | page, the so-called {\bf cell} - a word, picture, table, horizontal line and so on. |
22d6efa8 | 16 | It is used by \helpref{wxHtmlWindow}{wxhtmlwindow} and |
704a4b75 VS |
17 | \helpref{wxHtmlWinParser}{wxhtmlwinparser} to represent HTML page in memory. |
18 | ||
19 | You can divide cells into two groups : {\it visible} cells with non-zero width and | |
20 | height and {\it helper} cells (usually with zero width and height) that | |
21 | perform special actions such as color or font change. | |
22 | ||
704a4b75 VS |
23 | \wxheading{Derived from} |
24 | ||
9704b250 VS |
25 | \helpref{wxObject}{wxobject} |
26 | ||
27 | \wxheading{Include files} | |
28 | ||
29 | <wx/html/htmlcell.h> | |
704a4b75 VS |
30 | |
31 | \wxheading{See Also} | |
32 | ||
33 | \helpref{Cells Overview}{cells}, | |
22d6efa8 | 34 | \helpref{wxHtmlContainerCell}{wxhtmlcontainercell} |
704a4b75 VS |
35 | |
36 | \latexignore{\rtfignore{\wxheading{Members}}} | |
37 | ||
704a4b75 VS |
38 | \membersection{wxHtmlCell::wxHtmlCell}\label{wxhtmlcellwxhtmlcell} |
39 | ||
40 | \func{}{wxHtmlCell}{\void} | |
41 | ||
42 | Constructor. | |
43 | ||
eb3a4aa9 VS |
44 | \membersection{wxHtmlCell::AdjustPagebreak}\label{wxhtmlcelladjustpagebreak} |
45 | ||
46 | \func{virtual bool}{AdjustPagebreak}{\param{int * }{pagebreak}} | |
47 | ||
48 | This method is used to adjust pagebreak position. The parameter is | |
49 | variable that contains y-coordinate of page break (= horizontal line that | |
50 | should not be crossed by words, images etc.). If this cell cannot be divided | |
51 | into two pieces (each one on another page) then it moves the pagebreak | |
52 | few pixels up. | |
53 | ||
cc81d32f | 54 | Returns true if pagebreak was modified, false otherwise |
eb3a4aa9 | 55 | |
448af9a4 | 56 | Usage: |
eb3a4aa9 VS |
57 | \begin{verbatim} |
58 | while (container->AdjustPagebreak(&p)) {} | |
59 | \end{verbatim} | |
60 | ||
559fe022 | 61 | \membersection{wxHtmlCell::Draw}\label{wxhtmlcelldraw} |
704a4b75 | 62 | |
559fe022 | 63 | \func{virtual void}{Draw}{\param{wxDC\& }{dc}, \param{int }{x}, \param{int }{y}, \param{int }{view\_y1}, \param{int }{view\_y2}} |
704a4b75 | 64 | |
559fe022 | 65 | Renders the cell. |
704a4b75 | 66 | |
559fe022 | 67 | \wxheading{Parameters} |
704a4b75 | 68 | |
559fe022 | 69 | \docparam{dc}{Device context to which the cell is to be drawn} |
704a4b75 | 70 | |
559fe022 VS |
71 | \docparam{x,y}{Coordinates of parent's upper left corner (origin). You must |
72 | add this to m\_PosX,m\_PosY when passing coordinates to dc's methods | |
73 | Example : {\tt dc -> DrawText("hello", x + m\_PosX, y + m\_PosY)}} | |
704a4b75 | 74 | |
605d715d | 75 | \docparam{view\_y1}{y-coord of the first line visible in window. This is |
559fe022 | 76 | used to optimize rendering speed} |
704a4b75 | 77 | |
605d715d | 78 | \docparam{view\_y2}{y-coord of the last line visible in window. This is |
559fe022 | 79 | used to optimize rendering speed} |
704a4b75 | 80 | |
559fe022 | 81 | \membersection{wxHtmlCell::DrawInvisible}\label{wxhtmlcelldrawinvisible} |
704a4b75 | 82 | |
559fe022 | 83 | \func{virtual void}{DrawInvisible}{\param{wxDC\& }{dc}, \param{int }{x}, \param{int }{y}} |
704a4b75 | 84 | |
559fe022 VS |
85 | This method is called instead of \helpref{Draw}{wxhtmlcelldraw} when the |
86 | cell is certainly out of the screen (and thus invisible). This is not | |
87 | nonsense - some tags (like \helpref{wxHtmlColourCell}{wxhtmlcolourcell} | |
88 | or font setter) must be drawn even if they are invisible! | |
704a4b75 | 89 | |
559fe022 | 90 | \wxheading{Parameters} |
704a4b75 | 91 | |
559fe022 | 92 | \docparam{dc}{Device context to which the cell is to be drawn} |
704a4b75 | 93 | |
559fe022 VS |
94 | \docparam{x,y}{Coordinates of parent's upper left corner. You must |
95 | add this to m\_PosX,m\_PosY when passing coordinates to dc's methods | |
96 | Example : {\tt dc -> DrawText("hello", x + m\_PosX, y + m\_PosY)}} | |
704a4b75 | 97 | |
559fe022 | 98 | \membersection{wxHtmlCell::Find}\label{wxhtmlcellfind} |
704a4b75 | 99 | |
559fe022 | 100 | \func{virtual const wxHtmlCell*}{Find}{\param{int }{condition}, \param{const void* }{param}} |
704a4b75 | 101 | |
559fe022 VS |
102 | Returns pointer to itself if this cell matches condition (or if any of the cells |
103 | following in the list matches), NULL otherwise. | |
104 | (In other words if you call top-level container's Find it will | |
105 | return pointer to the first cell that matches the condition) | |
704a4b75 | 106 | |
559fe022 VS |
107 | It is recommended way how to obtain pointer to particular cell or |
108 | to cell of some type (e.g. wxHtmlAnchorCell reacts on | |
459d4207 | 109 | wxHTML\_COND\_ISANCHOR condition) |
559fe022 VS |
110 | |
111 | \wxheading{Parameters} | |
112 | ||
113 | \docparam{condition}{Unique integer identifier of condition} | |
114 | ||
115 | \docparam{param}{Optional parameters} | |
116 | ||
117 | \wxheading{Defined conditions} | |
118 | ||
448af9a4 | 119 | \begin{twocollist}\itemsep=0pt |
459d4207 | 120 | \twocolitem{{\bf wxHTML\_COND\_ISANCHOR}}{Finds particular anchor. |
559fe022 | 121 | {\it param} is pointer to wxString with name of the anchor.} |
459d4207 | 122 | \twocolitem{{\bf wxHTML\_COND\_USER}}{User-defined conditions start |
448af9a4 | 123 | from this number.} |
559fe022 | 124 | \end{twocollist} |
704a4b75 VS |
125 | |
126 | \membersection{wxHtmlCell::GetDescent}\label{wxhtmlcellgetdescent} | |
127 | ||
128 | \constfunc{int}{GetDescent}{\void} | |
129 | ||
605d715d VS |
130 | Returns descent value of the cell (m\_Descent member). |
131 | \helponly{See explanation: | |
704a4b75 VS |
132 | |
133 | \image{}{descent.bmp} | |
605d715d | 134 | } |
704a4b75 | 135 | |
c40aba83 WS |
136 | \membersection{wxHtmlCell::GetFirstChild}\label{wxhtmlcellgetfirstchild} |
137 | ||
138 | \func{wxHtmlCell*}{GetFirstChild}{\void} | |
139 | ||
140 | Returns pointer to the first cell in the list. | |
141 | You can then use child's \helpref{GetNext}{wxhtmlcellgetnext} | |
142 | method to obtain pointer to the next cell in list. | |
143 | ||
144 | {\bf Note:} This shouldn't be used by the end user. If you need some way of | |
145 | finding particular cell in the list, try \helpref{Find}{wxhtmlcellfind} method | |
146 | instead. | |
147 | ||
559fe022 VS |
148 | \membersection{wxHtmlCell::GetHeight}\label{wxhtmlcellgetheight} |
149 | ||
150 | \constfunc{int}{GetHeight}{\void} | |
151 | ||
605d715d | 152 | Returns height of the cell (m\_Height member). |
559fe022 | 153 | |
f3d6a602 VS |
154 | \membersection{wxHtmlCell::GetId}\label{wxhtmlcellgetid} |
155 | ||
156 | \constfunc{virtual wxString}{GetId}{\void} | |
157 | ||
158 | Returns unique cell identifier if there is any, empty string otherwise. | |
159 | ||
704a4b75 VS |
160 | \membersection{wxHtmlCell::GetLink}\label{wxhtmlcellgetlink} |
161 | ||
846914d1 | 162 | \constfunc{virtual wxHtmlLinkInfo*}{GetLink}{\param{int }{x = 0}, \param{int }{y = 0}} |
704a4b75 | 163 | |
846914d1 VS |
164 | Returns hypertext link if associated with this cell or NULL otherwise. |
165 | See \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}. | |
448af9a4 | 166 | (Note: this makes sense only for visible tags). |
704a4b75 VS |
167 | |
168 | \wxheading{Parameters} | |
169 | ||
170 | \docparam{x,y}{Coordinates of position where the user pressed mouse button. | |
171 | These coordinates are used e.g. by COLORMAP. Values are relative to the | |
605d715d | 172 | upper left corner of THIS cell (i.e. from 0 to m\_Width or m\_Height)} |
704a4b75 VS |
173 | |
174 | \membersection{wxHtmlCell::GetNext}\label{wxhtmlcellgetnext} | |
175 | ||
176 | \constfunc{wxHtmlCell*}{GetNext}{\void} | |
177 | ||
178 | Returns pointer to the next cell in list (see htmlcell.h if you're | |
179 | interested in details). | |
180 | ||
559fe022 | 181 | \membersection{wxHtmlCell::GetParent}\label{wxhtmlcellgetparent} |
704a4b75 | 182 | |
559fe022 | 183 | \constfunc{wxHtmlContainerCell*}{GetParent}{\void} |
704a4b75 | 184 | |
559fe022 | 185 | Returns pointer to parent container. |
704a4b75 | 186 | |
559fe022 | 187 | \membersection{wxHtmlCell::GetPosX}\label{wxhtmlcellgetposx} |
704a4b75 | 188 | |
559fe022 | 189 | \constfunc{int}{GetPosX}{\void} |
704a4b75 | 190 | |
559fe022 VS |
191 | Returns X position within parent (the value is relative to parent's |
192 | upper left corner). The returned value is meaningful only if | |
193 | parent's \helpref{Layout}{wxhtmlcelllayout} was called before! | |
704a4b75 | 194 | |
559fe022 | 195 | \membersection{wxHtmlCell::GetPosY}\label{wxhtmlcellgetposy} |
704a4b75 | 196 | |
559fe022 | 197 | \constfunc{int}{GetPosY}{\void} |
704a4b75 | 198 | |
559fe022 VS |
199 | Returns Y position within parent (the value is relative to parent's |
200 | upper left corner). The returned value is meaningful only if | |
201 | parent's \helpref{Layout}{wxhtmlcelllayout} was called before! | |
202 | ||
203 | \membersection{wxHtmlCell::GetWidth}\label{wxhtmlcellgetwidth} | |
204 | ||
205 | \constfunc{int}{GetWidth}{\void} | |
206 | ||
605d715d | 207 | Returns width of the cell (m\_Width member). |
704a4b75 VS |
208 | |
209 | \membersection{wxHtmlCell::Layout}\label{wxhtmlcelllayout} | |
210 | ||
211 | \func{virtual void}{Layout}{\param{int }{w}} | |
212 | ||
fa482912 | 213 | This method performs two actions: |
704a4b75 | 214 | |
448af9a4 | 215 | \begin{enumerate}\itemsep=0pt |
fa482912 | 216 | \item adjusts the cell's width according to the fact that maximal possible width is {\it w}. |
704a4b75 VS |
217 | (this has sense when working with horizontal lines, tables etc.) |
218 | \item prepares layout (=fill-in m\_PosX, m\_PosY (and sometimes m\_Height) members) | |
219 | based on actual width {\it w} | |
220 | \end{enumerate} | |
221 | ||
3660fc40 RD |
222 | It must be called before displaying cells structure because |
223 | m\_PosX and m\_PosY are undefined (or invalid) | |
224 | before calling Layout. | |
704a4b75 | 225 | |
bc55e31b | 226 | \membersection{wxHtmlCell::ProcessMouseClick}\label{wxhtmlcellprocessmouseclick} |
704a4b75 | 227 | |
bc55e31b | 228 | \func{virtual bool}{ProcessMouseClick}{\param{wxHtmlWindowInterface* }{window}, \param{const wxPoint\& }{pos}, \param{const wxMouseEvent\& }{event}} |
704a4b75 | 229 | |
bc55e31b VS |
230 | This function is simple event handler. Each time the user clicks mouse button |
231 | over a cell within \helpref{wxHtmlWindow}{wxhtmlwindow} this method of that | |
232 | cell is called. Default behavior is to call | |
233 | \helpref{wxHtmlWindow::LoadPage}{wxhtmlwindowloadpage}. | |
704a4b75 VS |
234 | |
235 | \wxheading{Note} | |
236 | ||
0b2dadd3 VS |
237 | If you need more "advanced" event handling |
238 | you should use wxHtmlBinderCell instead. | |
704a4b75 VS |
239 | |
240 | \wxheading{Parameters} | |
241 | ||
bc55e31b | 242 | \docparam{window}{interface to the parent HTML window} |
704a4b75 | 243 | |
bc55e31b | 244 | \docparam{pos}{coordinates of mouse click (this is relative to cell's origin} |
704a4b75 | 245 | |
bc55e31b VS |
246 | \docparam{event}{mouse event that triggered the call} |
247 | ||
248 | \wxheading{Return value} | |
249 | ||
250 | \true if a link was clicked, \false otherwise. | |
704a4b75 | 251 | |
f3d6a602 VS |
252 | \membersection{wxHtmlCell::SetId}\label{wxhtmlcellsetid} |
253 | ||
254 | \func{void}{SetId}{\param{const wxString\& }{id}} | |
255 | ||
256 | Sets unique cell identifier. Default value is no identifier, i.e. empty string. | |
257 | ||
559fe022 VS |
258 | \membersection{wxHtmlCell::SetLink}\label{wxhtmlcellsetlink} |
259 | ||
846914d1 | 260 | \func{void}{SetLink}{\param{const wxHtmlLinkInfo\& }{link}} |
559fe022 | 261 | |
2edb0bde | 262 | Sets the hypertext link associated with this cell. (Default value |
846914d1 | 263 | is \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}("", "") (no link)) |
559fe022 VS |
264 | |
265 | \membersection{wxHtmlCell::SetNext}\label{wxhtmlcellsetnext} | |
266 | ||
267 | \func{void}{SetNext}{\param{wxHtmlCell }{*cell}} | |
268 | ||
269 | Sets the next cell in the list. This shouldn't be called by user - it is | |
fa482912 | 270 | to be used only by \helpref{wxHtmlContainerCell::InsertCell}{wxhtmlcontainercellinsertcell}. |
559fe022 VS |
271 | |
272 | \membersection{wxHtmlCell::SetParent}\label{wxhtmlcellsetparent} | |
273 | ||
274 | \func{void}{SetParent}{\param{wxHtmlContainerCell }{*p}} | |
275 | ||
276 | Sets parent container of this cell. This is called from | |
277 | \helpref{wxHtmlContainerCell::InsertCell}{wxhtmlcontainercellinsertcell}. | |
278 | ||
279 | \membersection{wxHtmlCell::SetPos}\label{wxhtmlcellsetpos} | |
280 | ||
281 | \func{void}{SetPos}{\param{int }{x}, \param{int }{y}} | |
282 | ||
448af9a4 | 283 | Sets the cell's position within parent container. |
559fe022 | 284 |