]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/htmlcell.tex
More asserts and stuff
[wxWidgets.git] / docs / latex / wx / htmlcell.tex
CommitLineData
704a4b75
VS
1\subsection{Cells and Containers}\label{cells}
2
3This article describes mechanism used by
4\helpref{wxHtmlWinParser}{wxhtmlwinparser} and
5\helpref{wxHtmlWindow}{wxhtmlwindow}
6to parse and display HTML documents.
7
8\wxheading{Cells}
9
10You can divide any text (or HTML) into small fragments. Let's call these
11fragments {\bf cells}. Cell is for example one word, horizontal line, image
12or any other part of document. Each cell has width and height (except special
13"magic" cells with zero dimensions - e.g. color changers or font changers).
14
15See \helpref{wxHtmlCell}{wxhtmlcell}.
16
17\wxheading{Containers}
18
19Container is kind of cell that may contain sub-cells. Its size depends
20on number and sizes of its sub-cells (and also depends on width of window).
21
22See \helpref{wxHtmlContainerCell}{wxhtmlcontainercell},
23\helpref{wxHtmlCell::Layout}{wxhtmlcelllayout}.
24
25This image shows you cells\ &\ containers:
26
27\image{}{contbox.bmp}
28
29\wxheading{Using Containers in Tag Handler}
30
31\helpref{wxHtmlWinParser}{wxhtmlwinparser} provides user-friendly way
32of managing containers. It's based on idea of opening and closing containers.
33
34Use \helpref{OpenContainer}{wxhtmlwinparseropencontainer} to open new
35container {\it within actually opened container}. This new container is
36{\it sub-container} of the old one. (If you want to create new container with
37same depth level you can call {\tt CloseContainer(); OpenContainer();}.)
38
39Use \helpref{CloseContaier}{wxhtmlwinparserclosecontainer} to close the
40container. This doesn't create new container with same depth level but
41it returns "control" to the parent container.
42
43See explanation:
44
45\image{}{cont.bmp}
46
47It's clear there must be same number of calls to
48OpenContainer as to CloseContainer...
49
50\wxheading{Example}
51
52This code creates new paragraph (container at same depth level)
53with "Hello, world!" :
54
55\begin{verbatim}
56m_WParser -> CloseContainer();
57c = m_WParser -> OpenContainer();
58
59m_WParser -> AddWord("Hello, ");
60m_WParser -> AddWord("world!");
61
62m_WParser -> CloseContainer();
63m_WParser -> OpenContainer();
64\end{verbatim}
65
66and here is image of the situation:
67
68\image{}{hello.bmp}
69
70You can see that there was opened container before running the code. We closed
71it, created our own container, then closed our container and opened
72new container. The result was that we had {\it same depth level} after
73executing. This is general rule that should be followed by tag handlers :
74leave depth level of containers unmodified (in other words, number of
75OpenContainer and CloseContainer calls should be same within \helpref{HandleTag}{wxhtmltaghandlerhandletag}'s body).
76