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
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(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0)
Constructor.
~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.
wxString OnGetItem(size_t n) const
Returns the HTML for this item.
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. One of wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL, wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH, wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER and wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST.
void UpdateStyles()
Updates the list from the associated style sheet.