]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/htmlstrt.tex
replaced my recent GSocket_SetReuseAddr() addition with GSocket_SetReusable() from...
[wxWidgets.git] / docs / latex / wx / htmlstrt.tex
CommitLineData
bd330a69 1\subsection{wxHTML quick start}\label{wxhtmlquickstart}
704a4b75
VS
2
3\wxheading{Displaying HMTL}
4
5First of all, you must include <wx/wxhtml.h>.
6
7Class \helpref{wxHtmlWindow}{wxhtmlwindow} (derived from wxScrolledWindow)
8is used to display HTML documents.
448af9a4 9It has two important methods: \helpref{LoadPage}{wxhtmlwindowloadpage}
704a4b75
VS
10and \helpref{SetPage}{wxhtmlwindowsetpage}.
11LoadPage loads and displays HTML file while SetPage displays directly the
12passed {\bf string}. See the example:
13
14\begin{verbatim}
15 mywin -> LoadPage("test.htm");
16 mywin -> SetPage("<html><body>"
17 "<h1>Error</h1>"
f6bcfd97 18 "Some error occurred :-H)"
704a4b75
VS
19 "</body></hmtl>");
20\end{verbatim}
21
22d6efa8 22I think the difference is quite clear.
704a4b75
VS
23
24\wxheading{Displaying Help}
25
26See \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller}.
27
28\wxheading{Setting up wxHtmlWindow}
29
30Because wxHtmlWindow is derived from wxScrolledWindow and not from
31wxFrame, it doesn't have visible frame. But the user usually want to see
32the title of HTML page displayed somewhere and frame's titlebar is
22d6efa8 33ideal place for it.
704a4b75 34
22d6efa8 35wxHtmlWindow provides 2 methods in order to handle this:
704a4b75
VS
36\helpref{SetRelatedFrame}{wxhtmlwindowsetrelatedframe} and
37\helpref{SetRelatedStatusBar}{wxhtmlwindowsetrelatedstatusbar}.
38See the example:
39
40\begin{verbatim}
41 html = new wxHtmlWindow(this);
42 html -> SetRelatedFrame(this, "HTML : %%s");
43 html -> SetRelatedStatusBar(0);
44\end{verbatim}
45
f6bcfd97 46The first command associates html object with it is parent frame
704a4b75
VS
47(this points to wxFrame object there) and sets format of title.
48Page title "Hello, world!" will be displayed as "HTML : Hello, world!"
49in this example.
50
51The second command sets which frame's status bar should be used to display
52browser's messages (such as "Loading..." or "Done" or hypertext links).
53
54\wxheading{Customizing wxHtmlWindow}
55
56You can customize wxHtmlWindow by setting font size, font face and
57borders (space between border of window and displayed HTML). Related functions:
58
448af9a4 59\begin{itemize}\itemsep=0pt
704a4b75
VS
60\item \helpref{SetFonts}{wxhtmlwindowsetfonts}
61\item \helpref{SetBorders}{wxhtmlwindowsetborders}
62\item \helpref{ReadCustomization}{wxhtmlwindowreadcustomization}
63\item \helpref{WriteCustomization}{wxhtmlwindowwritecustomization}
64\end{itemize}
65
66The last two functions are used to store user customization info wxConfig stuff
36edded9 67(for example in the registry under Windows, or in a dotfile under Unix).
704a4b75 68