## wxRichTextStyleListBox

This is a listbox that can display the styles in a wxRichTextStyleSheet, and apply the selection to an associated wxRichTextCtrl.

See `samples/richtext` for an example of how to use it.

Derived from

wxHtmlListBox

Include files

<wx/richtext/richtextstyles.h>

See also

wxRichTextStyleComboCtrl, wxRichTextCtrl overview

Members

wxRichTextStyleListBox::wxRichTextStyleListBox
wxRichTextStyleListBox::~wxRichTextStyleListBox
wxRichTextStyleListBox::ApplyStyle
wxRichTextStyleListBox::ConvertTenthsMMToPixels
wxRichTextStyleListBox::CreateHTML
wxRichTextStyleListBox::GetApplyOnSelection
wxRichTextStyleListBox::GetRichTextCtrl
wxRichTextStyleListBox::GetStyle
wxRichTextStyleListBox::GetStyleSheet
wxRichTextStyleListBox::GetStyleType
wxRichTextStyleListBox::OnGetItem
wxRichTextStyleListBox::OnLeftDown
wxRichTextStyleListBox::OnSelect
wxRichTextStyleListBox::SetApplyOnSelection
wxRichTextStyleListBox::SetRichTextCtrl
wxRichTextStyleListBox::SetStyleSheet
wxRichTextStyleListBox::SetStyleType
wxRichTextStyleListBox::UpdateStyles

### wxRichTextStyleListBox::wxRichTextStyleListBox

wxRichTextStyleListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0)

Constructor.

### wxRichTextStyleListBox::~wxRichTextStyleListBox

~wxRichTextStyleListBox()

Destructor.

### wxRichTextStyleListBox::ApplyStyle

void ApplyStyle(int i)

Applies the ith style to the associated rich text control.

### wxRichTextStyleListBox::ConvertTenthsMMToPixels

int ConvertTenthsMMToPixels(wxDC& dc, int units) const

Converts units in tenths of a millimetre to device units.

### wxRichTextStyleListBox::CreateHTML

wxString CreateHTML(wxRichTextStyleDefinition* def) const

Creates a suitable HTML fragment for a definition.

### wxRichTextStyleListBox::GetApplyOnSelection

bool GetApplyOnSelection() const

If the return value is `true`, clicking on a style name in the list will immediately apply the style to the associated rich text control.

### wxRichTextStyleListBox::GetRichTextCtrl

wxRichTextCtrl* GetRichTextCtrl() const

Returns the wxRichTextCtrl associated with this listbox.

### wxRichTextStyleListBox::GetStyle

wxRichTextStyleDefinition* GetStyle(size_t i) const

Gets a style for a listbox index.

### wxRichTextStyleListBox::GetStyleSheet

wxRichTextStyleSheet* GetStyleSheet() const

Returns the style sheet associated with this listbox.

### wxRichTextStyleListBox::GetStyleType

wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const

Returns the type of style to show in the list box.

### wxRichTextStyleListBox::OnGetItem

wxString OnGetItem(size_t n) const

Returns the HTML for this item.

### wxRichTextStyleListBox::OnLeftDown

void OnLeftDown(wxMouseEvent& event)

Implements left click behaviour, applying the clicked style to the wxRichTextCtrl.

### wxRichTextStyleListBox::OnSelect

void OnSelect(wxCommandEvent& event)

Reacts to selection.

### wxRichTextStyleListBox::SetApplyOnSelection

void SetApplyOnSelection(bool applyOnSelection)

If applyOnSelection is `true`, clicking on a style name in the list will immediately apply the style to the associated rich text control.

### wxRichTextStyleListBox::SetRichTextCtrl

void SetRichTextCtrl(wxRichTextCtrl* ctrl)

Associates the listbox with a wxRichTextCtrl.

### wxRichTextStyleListBox::SetStyleSheet

void SetStyleSheet(wxRichTextStyleSheet* styleSheet)

Associates the control with a style sheet.

### wxRichTextStyleListBox::SetStyleType

void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType)

Sets the style type to display. One of wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL, wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH, wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER and wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST.

### wxRichTextStyleListBox::UpdateStyles

void UpdateStyles()

Updates the list from the associated style sheet.