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