# wxRichTextStyleListBox Class Reference
[Rich Text]

`#include <wx/richtext/richtextstyles.h>`

Inheritance diagram for wxRichTextStyleListBox:
[legend]

## Detailed Description

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.

##

Library: wxRichText

Category: Rich Text

See also:
  wxRichTextStyleComboCtrl, wxRichTextCtrl Overview

## Public Member Functions
| wxRichTextStyleListBox (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
| Constructor.
virtual | ~wxRichTextStyleListBox ()
| Destructor.
void | ApplyStyle (int i)
| Applies the ith style to the associated rich text control.
int | ConvertTenthsMMToPixels (wxDC &dc, int units) const
| Converts units in tenths of a millimetre to device units.
wxString | CreateHTML (wxRichTextStyleDefinition *def) const
| Creates a suitable HTML fragment for a definition.
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.
wxRichTextCtrl * | GetRichTextCtrl () const
| Returns the wxRichTextCtrl associated with this listbox.
wxRichTextStyleDefinition * | GetStyle (size_t i) const
| Gets a style for a listbox index.
wxRichTextStyleSheet * | GetStyleSheet () const
| Returns the style sheet associated with this listbox.
wxRichTextStyleListBox::wxRichTextStyleType | GetStyleType () const
| Returns the type of style to show in the list box.
void | OnLeftDown (wxMouseEvent &event)
| Implements left click behaviour, applying the clicked style to the wxRichTextCtrl.
void | OnSelect (wxCommandEvent &event)
| Reacts to selection.
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.
void | SetRichTextCtrl (wxRichTextCtrl *ctrl)
| Associates the listbox with a wxRichTextCtrl.
void | SetStyleSheet (wxRichTextStyleSheet *styleSheet)
| Associates the control with a style sheet.
void | SetStyleType (wxRichTextStyleListBox::wxRichTextStyleType styleType)
| Sets the style type to display.
void | UpdateStyles ()
| Updates the list from the associated style sheet.
## Protected Member Functions
virtual wxString | OnGetItem (size_t n) const
| Returns the HTML for this item.

List of all members.

## Constructor & Destructor Documentation

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

Constructor.

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

Destructor.

## Member Function Documentation

void wxRichTextStyleListBox::ApplyStyle | ( | int | i | ) |

Applies the ith style to the associated rich text control.

int wxRichTextStyleListBox::ConvertTenthsMMToPixels | ( | wxDC & | dc,
|  | int | units |
| ) |  |  | const

Converts units in tenths of a millimetre to device units.

wxString wxRichTextStyleListBox::CreateHTML | ( | wxRichTextStyleDefinition * | def | ) | const

Creates a suitable HTML fragment for a definition.

bool wxRichTextStyleListBox::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.

wxRichTextCtrl* wxRichTextStyleListBox::GetRichTextCtrl | ( |  | ) | const

Returns the wxRichTextCtrl associated with this listbox.

wxRichTextStyleDefinition* wxRichTextStyleListBox::GetStyle | ( | size_t | i | ) | const

Gets a style for a listbox index.

wxRichTextStyleSheet* wxRichTextStyleListBox::GetStyleSheet | ( |  | ) | const

Returns the style sheet associated with this listbox.

wxRichTextStyleListBox::wxRichTextStyleType wxRichTextStyleListBox::GetStyleType | ( |  | ) | const

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

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

Returns the HTML for this item.

Implements wxHtmlListBox.

void wxRichTextStyleListBox::OnLeftDown | ( | wxMouseEvent & | event | ) |

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

void wxRichTextStyleListBox::OnSelect | ( | wxCommandEvent & | event | ) |

Reacts to selection.

void wxRichTextStyleListBox::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.

void wxRichTextStyleListBox::SetRichTextCtrl | ( | wxRichTextCtrl * | ctrl | ) |

Associates the listbox with a wxRichTextCtrl.

void wxRichTextStyleListBox::SetStyleSheet | ( | wxRichTextStyleSheet * | styleSheet | ) |

Associates the control with a style sheet.

void wxRichTextStyleListBox::SetStyleType | ( | wxRichTextStyleListBox::wxRichTextStyleType | styleType | ) |

Sets the style type to display.

One of

- wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL,
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH,
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST.

void wxRichTextStyleListBox::UpdateStyles | ( |  | ) |

Updates the list from the associated style sheet.

|  | [ top ]