Public Member Functions | Protected Member Functions

# wxHtmlListBox Class Reference
[Controls]

`#include <wx/htmllbox.h>`

Inheritance diagram for wxHtmlListBox:
[legend]

## Detailed Description

wxHtmlListBox is an implementation of wxVListBox which shows HTML content in the listbox rows.

This is still an abstract base class and you will need to derive your own class from it (see htlbox sample for the example) but you will only need to override a single wxHtmlListBox::OnGetItem function.

## Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxHtmlCellEvent& event) or void handlerFuncName(wxHtmlLinkEvent& event)

Event macros for events emitted by this class:

- EVT_HTML_CELL_CLICKED(id, func):
  A wxHtmlCell was clicked.
- EVT_HTML_CELL_HOVER(id, func):
  The mouse passed over a wxHtmlCell.
- EVT_HTML_LINK_CLICKED(id, func):
  A wxHtmlCell which contains an hyperlink was clicked.

##

Library: wxHTML
Category: Controls

See also:
  wxSimpleHtmlListBox

## Public Member Functions
| wxHtmlListBox (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxHtmlListBoxNameStr)
| Normal constructor which calls Create() internally.
| wxHtmlListBox ()
| Default constructor, you must call Create() later.
virtual | ~wxHtmlListBox ()
| Destructor cleans up whatever resources we use.
bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxHtmlListBoxNameStr)
| Creates the control and optionally sets the initial number of items in it (it may also be set or changed later with wxVListBox::SetItemCount).
wxFileSystem & | GetFileSystem () const
| Returns the wxFileSystem used by the HTML parser of this object.
const wxFileSystem & | GetFileSystem () const
| Returns the wxFileSystem used by the HTML parser of this object.
## Protected Member Functions
virtual void | OnLinkClicked (size_t n, const wxHtmlLinkInfo &link)
| Called when the user clicks on hypertext link.
virtual wxColour | GetSelectedTextBgColour (const wxColour &colBg) const
| This virtual function may be overridden to change the appearance of the background of the selected cells in the same way as GetSelectedTextColour().
virtual wxColour | GetSelectedTextColour (const wxColour &colFg) const
| This virtual function may be overridden to customize the appearance of the selected cells.
virtual wxString | OnGetItemMarkup (size_t n) const
| This function may be overridden to decorate HTML returned by OnGetItem().
virtual wxString | OnGetItem (size_t n) const =0
| This method must be implemented in the derived class and should return the body (i.e.

List of all members.

## Constructor & Destructor Documentation

wxHtmlListBox::wxHtmlListBox | ( | wxWindow * | parent,
|  | wxWindowID | id = `wxID_ANY`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `0`,
|  | const wxString & | name = `wxHtmlListBoxNameStr` |
| ) |  |  |

Normal constructor which calls Create() internally.

wxHtmlListBox::wxHtmlListBox | ( |  | ) |

Default constructor, you must call Create() later.

virtual wxHtmlListBox::~wxHtmlListBox | ( |  | ) | `[virtual]`

Destructor cleans up whatever resources we use.

## Member Function Documentation

bool wxHtmlListBox::Create | ( | wxWindow * | parent,
|  | wxWindowID | id = `wxID_ANY`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `0`,
|  | const wxString & | name = `wxHtmlListBoxNameStr` |
| ) |  |  |

Creates the control and optionally sets the initial number of items in it (it may also be set or changed later with wxVListBox::SetItemCount).

There are no special styles defined for wxHtmlListBox, in particular the wxListBox styles (with the exception of `wxLB_MULTIPLE`) cannot be used here.

Returns true on success or false if the control couldn't be created

Reimplemented from wxVListBox.

wxFileSystem& wxHtmlListBox::GetFileSystem | ( |  | ) | const

Returns the wxFileSystem used by the HTML parser of this object.

The file system object is used to resolve the paths in HTML fragments displayed in the control and you should use wxFileSystem::ChangePathTo if you use relative paths for the images or other resources embedded in your HTML.

const wxFileSystem& wxHtmlListBox::GetFileSystem | ( |  | ) | const

Returns the wxFileSystem used by the HTML parser of this object.

The file system object is used to resolve the paths in HTML fragments displayed in the control and you should use wxFileSystem::ChangePathTo if you use relative paths for the images or other resources embedded in your HTML.

virtual wxColour wxHtmlListBox::GetSelectedTextBgColour | ( | const wxColour & | colBg | ) | const`[protected, virtual]`

This virtual function may be overridden to change the appearance of the background of the selected cells in the same way as GetSelectedTextColour().

It should be rarely, if ever, used because wxVListBox::SetSelectionBackground allows to change the selection background for all cells at once and doing anything more fancy is probably going to look strangely.

See also:
  GetSelectedTextColour()

virtual wxColour wxHtmlListBox::GetSelectedTextColour | ( | const wxColour & | colFg | ) | const`[protected, virtual]`

This virtual function may be overridden to customize the appearance of the selected cells.

It is used to determine how the colour colFg is going to look inside selection. By default all original colours are completely ignored and the standard, system-dependent, selection colour is used but the program may wish to override this to achieve some custom appearance.

See also:
  GetSelectedTextBgColour(), wxVListBox::SetSelectionBackground, wxSystemSettings::GetColour

virtual wxString wxHtmlListBox::OnGetItem | ( | size_t | n | ) | const`[protected, pure virtual]`

This method must be implemented in the derived class and should return the body (i.e.

without `html` nor `body` tags) of the HTML fragment for the given item.

Note that this function should always return a text fragment for the n item which renders with the same height both when it is selected and when it's not: i.e. if you call, inside your OnGetItem() implementation, `IsSelected(n)` to make the items appear differently when they are selected, then you should make sure that the returned HTML fragment will render with the same height or else you'll see some artifacts when the user selects an item.

Implemented in wxRichTextStyleListBox.

virtual wxString wxHtmlListBox::OnGetItemMarkup | ( | size_t | n | ) | const`[protected, virtual]`

This function may be overridden to decorate HTML returned by OnGetItem().

virtual void wxHtmlListBox::OnLinkClicked | ( | size_t | n,
|  | const wxHtmlLinkInfo & | link |
| ) |  |  | `[protected, virtual]`

Called when the user clicks on hypertext link.

Does nothing by default. Overloading this method is deprecated; intercept the event instead.

Parameters:

  | n | Index of the item containing the link.
  | link | Description of the link.

See also:
  wxHtmlLinkInfo.

|  | [ top ]