wxHtmlWindow
generated from ../src/mod_gui/control/htmlwin.cppThe purpose of this class is to display HTML pages (either local file or downloaded via HTTP protocol) in a window. The width of the window is constant - given in the constructor - and virtual height is changed dynamically depending on page size.
Constants
styles
| Name | Description |
|---|---|
| SCROLLBAR_NEVER | Never display scrollbars, not even when the page is larger than the window. |
| SCROLLBAR_AUTO | Display scrollbars only if page's size exceeds window's size. |
| NO_SELECTION | Don't allow the user to select text. |
| DEFAULT_STYLE |
Constructor
wxHtmlWindow
wxHtmlWindow()
wxHtmlWindow(Parent,
Id,
Position = wxDefaultPosition,
Size = wxDefaultSize,
Style = wxHtmlWindow.DEFAULT_STYLE)
| Name | Type | Default | Description |
|---|---|---|---|
| Parent | wxWindow | The parent window | |
| Id | Integer | A windows identifier. Use -1 when you don't need it. | |
| Position | wxPoint | wxDefaultPosition | The position of the control on the given parent |
| Size | wxSize | wxDefaultSize | The size of the control |
| Style | Integer | wxHtmlWindow.DEFAULT_STYLE | The style of the control |
Constructs a new wxHtmlWindow object. See also create.
Properties
| Name | Type | Description |
|---|---|---|
historyCanBack ![]() |
String | Returns true if it is possible to go back in the history (i.e. historyBack won't fail). |
historyCanForward ![]() |
String | Returns true if it is possible to go forward in the history (i.e. historyForward won't fail). |
openedAnchor ![]() |
String | Returns anchor within currently opened page (see openedPage). If no page is opened or if the displayed page wasn't produced by call to loadPage, empty string is returned. |
openedPage ![]() |
String | Returns full location of the opened page. If no page is opened or if the displayed page wasn't produced by call to loadPage, empty string is returned. |
openedPageTitle ![]() |
String | Returns title of the opened page or wxEmptyString if current page does not contain <title> tag. |
| relatedFrame | wxFrame | Gets/Sets the frame in which page title will be displayed. |
| text | String | Returns content of currently displayed page as plain text. |
Methods
appendToPage
appendToPage(Source) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| Source | String | HTML fragment |
Appends HTML fragment to currently displayed text and refreshes the window. False is returned on failure.
create
create(Parent,
Id,
Position = wxDefaultPosition,
Size = wxDefaultSize,
Style = wxHtmlWindow.DEFAULT_STYLE) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| Parent | wxWindow | The parent window | |
| Id | Integer | A windows identifier. Use -1 when you don't need it. | |
| Position | wxPoint | wxDefaultPosition | The position of the control on the given parent |
| Size | wxSize | wxDefaultSize | The size of the control |
| Style | Integer | wxHtmlWindow.DEFAULT_STYLE | The style of the control |
Creates an HTML window.
historyBack
historyBack() : Boolean
Moves back to the previous page. (each page displayed using loadPage is stored in history list.)
historyClear
historyClear()
Clears the history.
historyForward
historyForward() : Boolean
Moves forward to the next page. (each page displayed using loadPage is stored in history list.)
loadFile
loadFile(filename) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| filename | wxFileName | The file to load |
loadFile(filename) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| filename | String | The file to load |
Loads HTML page from file and displays it. Returns false on failure.
loadPage
loadPage(Location) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| Location | String | The address of document |
Unlike setPage this function first loads HTML page from location and then displays it.
selectAll
selectAll()
Selects all text in the window.
selectLine
selectLine(Pos)
| Name | Type | Default | Description |
|---|---|---|---|
| Pos | wxPoint |
Selects the line of text that pos points at. Note that pos is relative to the top of displayed page, not to window's origin, use calcUnscrolledPosition to convert physical coordinate.
selectWord
selectWord(Pos)
| Name | Type | Default | Description |
|---|---|---|---|
| Pos | wxPoint |
Selects the word at position pos. Note that pos is relative to the top of displayed page, not to window's origin, use calcUnscrolledPosition to convert physical coordinate.
setBorders
setBorders(Border)
| Name | Type | Default | Description |
|---|---|---|---|
| Border | Integer |
This function sets the space between border of window and HTML contents.
setFonts
setFonts(NormalFace,
FixedFace,
Sizes = null)
| Name | Type | Default | Description |
|---|---|---|---|
| NormalFace | String | This is face name for normal (i.e. non-fixed) font. It can be either empty string (then the default face is chosen) or platform-specific face name. Examples are "helvetica" under Unix or "Times New Roman" under Windows. | |
| FixedFace | String | The same thing for fixed face | |
| Sizes | Array | null | This is an array of 7 items of Integer type. The values represent size of font with HTML size from -2 to +4 ( <FONT SIZE=-2> to <FONT SIZE=+4> ). Default sizes are used if sizes is null. |
This function sets font sizes and faces
setPage
setPage(Source) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| Source | String | The HTML source |
Sets HTML page and display it. This won't load the page!! It will display the source
setRelatedFrame
setRelatedFrame(Frame,
Format)
| Name | Type | Default | Description |
|---|---|---|---|
| Frame | wxFrame | ||
| Format | String |
Sets the frame in which page title will be displayed. format is format of frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s. This %s is substituted with HTML page title.
setRelatedStatusBar
setRelatedStatusBar(Bar = -1)
| Name | Type | Default | Description |
|---|---|---|---|
| Bar | Integer | -1 |
After calling setRelatedFrame, this sets statusbar slot where messages will be displayed. (Default is -1 = no messages.)
Events
| onLinkClicked | This event is triggered when a hyperlinck is clicked. The function receives a wxHtmlLinkEvent as argument. |

© 2002 - 2007 Franky Braem.