phoenix_title wx.html.HtmlListBox

wx.html.HtmlListBox is an implementation of wx.VListBox 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 wx.html.HtmlListBox.OnGetItem function.

^^

events Events Emitted by this Class

Handlers bound for the following event types will receive one of the wx.html.HtmlCellEvent wx.html.HtmlLinkEvent parameters.


class_hierarchy Class Hierarchy

Inheritance diagram for class HtmlListBox:

method_summary Methods Summary

__init__

Normal constructor which calls Create internally.

Create

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

GetClassDefaultAttributes

GetFileSystem

Returns the wx.FileSystem used by the HTML parser of this object.

GetSelectedTextBgColour

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

GetSelectedTextColour

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

OnGetItem

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.

OnGetItemMarkup

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

OnLinkClicked

Called when the user clicks on hypertext link.


property_summary Properties Summary

FileSystem

See GetFileSystem


api Class API

class wx.html.HtmlListBox(VListBox)

Possible constructors:

HtmlListBox(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
            style=0, name=HtmlListBoxNameStr)

HtmlListBox()

HtmlListBox is an implementation of VListBox which shows HTML content in the listbox rows.


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0, name=HtmlListBoxNameStr)

Normal constructor which calls Create internally.

Parameters



__init__ (self)

Default constructor, you must call Create later.





Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0, name=HtmlListBoxNameStr)

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

There are no special styles defined for wx.html.HtmlListBox, in particular the wx.ListBox styles (with the exception of LB_MULTIPLE ) cannot be used here.

Returns True on success or False if the control couldn’t be created

Parameters
Return type

bool



static GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)
Parameters

variant (WindowVariant) –

Return type

VisualAttributes



GetFileSystem(self)

Returns the wx.FileSystem 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 wx.FileSystem.ChangePathTo if you use relative paths for the images or other resources embedded in your HTML.

Return type

FileSystem



GetSelectedTextBgColour(self, colBg)

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 wx.VListBox.SetSelectionBackground allows changing the selection background for all cells at once and doing anything more fancy is probably going to look strangely.

Parameters

colBg (wx.Colour) –

Return type

Colour



GetSelectedTextColour(self, colFg)

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.

Parameters

colFg (wx.Colour) –

Return type

Colour



OnGetItem(self, n)

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.

Parameters

n (int) –

Return type

string



OnGetItemMarkup(self, n)

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

Parameters

n (int) –

Return type

string



OnLinkClicked(self, n, link)

Called when the user clicks on hypertext link.

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

Parameters
  • n (int) – Index of the item containing the link.

  • link (wx.html.HtmlLinkInfo) – Description of the link.


Properties

FileSystem

See GetFileSystem