2002-01-23 17:10:02 -05:00
|
|
|
\subsection{wxHTML quick start}\label{wxhtmlquickstart}
|
1999-07-10 17:17:24 -04:00
|
|
|
|
|
|
|
\wxheading{Displaying HMTL}
|
|
|
|
|
|
|
|
First of all, you must include <wx/wxhtml.h>.
|
|
|
|
|
|
|
|
Class \helpref{wxHtmlWindow}{wxhtmlwindow} (derived from wxScrolledWindow)
|
|
|
|
is used to display HTML documents.
|
1999-10-25 09:46:48 -04:00
|
|
|
It has two important methods: \helpref{LoadPage}{wxhtmlwindowloadpage}
|
1999-07-10 17:17:24 -04:00
|
|
|
and \helpref{SetPage}{wxhtmlwindowsetpage}.
|
|
|
|
LoadPage loads and displays HTML file while SetPage displays directly the
|
|
|
|
passed {\bf string}. See the example:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
mywin -> LoadPage("test.htm");
|
|
|
|
mywin -> SetPage("<html><body>"
|
|
|
|
"<h1>Error</h1>"
|
2000-07-15 15:51:35 -04:00
|
|
|
"Some error occurred :-H)"
|
1999-07-10 17:17:24 -04:00
|
|
|
"</body></hmtl>");
|
|
|
|
\end{verbatim}
|
|
|
|
|
1999-08-05 18:05:15 -04:00
|
|
|
I think the difference is quite clear.
|
1999-07-10 17:17:24 -04:00
|
|
|
|
|
|
|
\wxheading{Displaying Help}
|
|
|
|
|
|
|
|
See \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller}.
|
|
|
|
|
|
|
|
\wxheading{Setting up wxHtmlWindow}
|
|
|
|
|
|
|
|
Because wxHtmlWindow is derived from wxScrolledWindow and not from
|
|
|
|
wxFrame, it doesn't have visible frame. But the user usually want to see
|
|
|
|
the title of HTML page displayed somewhere and frame's titlebar is
|
1999-08-05 18:05:15 -04:00
|
|
|
ideal place for it.
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-08-05 18:05:15 -04:00
|
|
|
wxHtmlWindow provides 2 methods in order to handle this:
|
1999-07-10 17:17:24 -04:00
|
|
|
\helpref{SetRelatedFrame}{wxhtmlwindowsetrelatedframe} and
|
|
|
|
\helpref{SetRelatedStatusBar}{wxhtmlwindowsetrelatedstatusbar}.
|
|
|
|
See the example:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
html = new wxHtmlWindow(this);
|
|
|
|
html -> SetRelatedFrame(this, "HTML : %%s");
|
|
|
|
html -> SetRelatedStatusBar(0);
|
|
|
|
\end{verbatim}
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
The first command associates html object with it is parent frame
|
1999-07-10 17:17:24 -04:00
|
|
|
(this points to wxFrame object there) and sets format of title.
|
|
|
|
Page title "Hello, world!" will be displayed as "HTML : Hello, world!"
|
|
|
|
in this example.
|
|
|
|
|
|
|
|
The second command sets which frame's status bar should be used to display
|
|
|
|
browser's messages (such as "Loading..." or "Done" or hypertext links).
|
|
|
|
|
|
|
|
\wxheading{Customizing wxHtmlWindow}
|
|
|
|
|
|
|
|
You can customize wxHtmlWindow by setting font size, font face and
|
|
|
|
borders (space between border of window and displayed HTML). Related functions:
|
|
|
|
|
1999-10-25 09:46:48 -04:00
|
|
|
\begin{itemize}\itemsep=0pt
|
1999-07-10 17:17:24 -04:00
|
|
|
\item \helpref{SetFonts}{wxhtmlwindowsetfonts}
|
|
|
|
\item \helpref{SetBorders}{wxhtmlwindowsetborders}
|
|
|
|
\item \helpref{ReadCustomization}{wxhtmlwindowreadcustomization}
|
|
|
|
\item \helpref{WriteCustomization}{wxhtmlwindowwritecustomization}
|
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
The last two functions are used to store user customization info wxConfig stuff
|
1999-11-01 15:36:43 -05:00
|
|
|
(for example in the registry under Windows, or in a dotfile under Unix).
|
1999-07-10 17:17:24 -04:00
|
|
|
|