wxRuby Documentation Home

Wx::HtmlListBox

HtmlListBox is a subclass of VListBox which shows HTML content in the listbox rows. It is an abstract class, and in order to use it, you must inherit from it in your own Ruby class. The only method that must be defined in your subclass is on_get_item()(). This method should return the snippet of HTML that should be displayed for the given item. Optionally, on_get_item_markup can also be redefined in your subclass.

This control supports only the limited subset of HTML supported by Wx::HtmlWindow. In particular, CSS is not supported, although attributes of the tag may be used to customise the appearance of text.

Derived from

VListBox

VScrolledWindow

Panel

Window

EvtHandler

Object

Event handling

To process user interaction with an HtmlListBox, use these event handler methods to direct input to methods or blocks that take a HtmlCellEvent argument or a HtmlLinkEvent.

evt_html_cell_clicked(id) { | event | ... } A HtmlCell was clicked.
evt_html_cell_hover(id) { | event | ... } The mouse passed over a HtmlCell.
evt_html_link_clicked(id) { | event | ... } A HtmlCell which contains an hyperlink was clicked.

The class also responds to the selection and clicking event handlers offered by Wx::ListBox.

Methods

HtmlListBox.new

HtmlListBox.new(Window parent,  Integer id = ID_ANY, 
                Point pos = DEFAULT_POSITION, 
                Size size = DEFAULT_SIZE, 
                Integer style = 0, 
                String name = "HtmlListBox")

Standard constructor. There are no special styles defined for HtmlListBox; in particular the ListBox styles (with the exception of LB_MULTIPLE) can not be used here.

HtmlListBox#get_file_system

FileSystem get_file_system()
FileSystem get_file_system()

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

HtmlListBox#get_selected_text_bg_colour

Colour get_selected_text_bg_colour(Colour colBg)

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

HtmlListBox#on_get_item

String on_get_item(Integer n)

This method must be implemented in the derived class and should return the body (i.e. without <html> or <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.

HtmlListBox#on_get_item_markup

String on_get_item_markup(Integer n)

This method may be overridden to decorate HTML returned by on_get_item()().

[This page automatically generated from the Textile source at Wed Sep 09 02:21:12 +0100 2009]