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