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