#include <wx/richtext/richtextstyles.h>
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.
Public Types | |
| enum | wxRichTextStyleType { wxRICHTEXT_STYLE_ALL , wxRICHTEXT_STYLE_PARAGRAPH , wxRICHTEXT_STYLE_CHARACTER , wxRICHTEXT_STYLE_LIST , wxRICHTEXT_STYLE_BOX } |
| Which type of style definition is currently showing? More... | |
Public Member Functions | |
| wxRichTextStyleListBox (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0) | |
| Constructor. | |
| wxRichTextStyleListBox () | |
| virtual | ~wxRichTextStyleListBox () |
| Destructor. | |
| bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0) |
| Creates the window. | |
| void | ApplyStyle (int i) |
| Applies the ith style to the associated rich text control. | |
| int | ConvertTenthsMMToPixels (wxReadOnlyDC &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 | 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. | |
| Public Member Functions inherited from wxHtmlListBox | |
| wxHtmlListBox (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxHtmlListBoxNameStr) | |
| Normal constructor which calls Create() internally. | |
| wxHtmlListBox () | |
| Default constructor, you must call Create() later. | |
| virtual | ~wxHtmlListBox () |
| Destructor cleans up whatever resources we use. | |
| bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxHtmlListBoxNameStr) |
| Creates the control and optionally sets the initial number of items in it (it may also be set or changed later with wxVListBox::SetItemCount). | |
| wxFileSystem & | GetFileSystem () const |
| Returns the wxFileSystem used by the HTML parser of this object. | |
| const wxFileSystem & | GetFileSystem () const |
| Returns the wxFileSystem used by the HTML parser of this object. | |
| Public Member Functions inherited from wxVListBox | |
| wxVListBox () | |
| Default constructor, you must call Create() later. | |
| wxVListBox (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxVListBoxNameStr) | |
| Normal constructor which calls Create() internally. | |
| virtual | ~wxVListBox () |
| Destructor. | |
| void | Clear () |
| Deletes all items from the control. | |
| bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxVListBoxNameStr) |
| Creates the control. | |
| bool | DeselectAll () |
| Deselects all the items in the listbox. | |
| int | GetFirstSelected (unsigned long &cookie) const |
Returns the index of the first selected item in the listbox or wxNOT_FOUND if no items are currently selected. | |
| size_t | GetItemCount () const |
| Get the number of items in the control. | |
| wxPoint | GetMargins () const |
| Returns the margins used by the control. | |
| wxRect | GetItemRect (size_t item) const |
| Returns the rectangle occupied by this item in physical coordinates. | |
| int | GetNextSelected (unsigned long &cookie) const |
Returns the index of the next selected item or wxNOT_FOUND if there are no more. | |
| size_t | GetSelectedCount () const |
| Returns the number of the items currently selected. | |
| int | GetSelection () const |
Get the currently selected item or wxNOT_FOUND if there is no selection. | |
| const wxColour & | GetSelectionBackground () const |
| Returns the background colour used for the selected cells. | |
| bool | HasMultipleSelection () const |
Returns true if the listbox was created with wxLB_MULTIPLE style and so supports multiple selection or false if it is a single selection listbox. | |
| bool | IsCurrent (size_t item) const |
| Returns true if this item is the current one, false otherwise. | |
| int | GetCurrent () const |
Get the current item or wxNOT_FOUND if there is no current item. | |
| void | SetCurrent (int current) |
| Set the specified item as the current item, if it is wxNOT_FOUND the current item is unset. | |
| bool | IsSelected (size_t item) const |
| Returns true if this item is selected, false otherwise. | |
| bool | Select (size_t item, bool select=true) |
Selects or deselects the specified item which must be valid (i.e. not equal to wxNOT_FOUND). | |
| bool | SelectAll () |
| Selects all the items in the listbox. | |
| bool | SelectRange (size_t from, size_t to) |
| Selects all items in the specified range which may be given in any order. | |
| virtual void | SetItemCount (size_t count) |
| Set the number of items to be shown in the control. | |
| void | SetSelection (int selection) |
| Set the selection to the specified item, if it is -1 the selection is unset. | |
| void | SetSelectionBackground (const wxColour &col) |
| Sets the colour to be used for the selected cells background. | |
| void | Toggle (size_t item) |
| Toggles the state of the specified item, i.e. selects it if it was unselected and deselects it if it was selected. | |
| void | SetMargins (const wxPoint &pt) |
| Set the margins: horizontal margin is the distance between the window border and the item contents while vertical margin is half of the distance between items. | |
| void | SetMargins (wxCoord x, wxCoord y) |
| Set the margins: horizontal margin is the distance between the window border and the item contents while vertical margin is half of the distance between items. | |
Protected Member Functions | |
| virtual wxString | OnGetItem (size_t n) const |
| Returns the HTML for this item. | |
| Protected Member Functions inherited from wxHtmlListBox | |
| virtual void | OnLinkClicked (size_t n, const wxHtmlLinkInfo &link) |
| Called when the user clicks on hypertext link. | |
| virtual wxColour | GetSelectedTextBgColour (const wxColour &colBg) const |
| This virtual function may be overridden to change the appearance of the background of the selected cells in the same way as GetSelectedTextColour(). | |
| virtual wxColour | GetSelectedTextColour (const wxColour &colFg) const |
| This virtual function may be overridden to customize the appearance of the selected cells. | |
| virtual wxString | OnGetItemMarkup (size_t n) const |
| This function may be overridden to decorate HTML returned by OnGetItem(). | |
| Protected Member Functions inherited from wxVListBox | |
| virtual void | OnDrawItem (wxDC &dc, const wxRect &rect, size_t n) const =0 |
| The derived class must implement this function to actually draw the item with the given index on the provided DC. | |
| virtual void | OnDrawBackground (wxDC &dc, const wxRect &rect, size_t n) const |
| This method is used to draw the item's background and, maybe, a border around it. | |
| virtual void | OnDrawSeparator (wxDC &dc, wxRect &rect, size_t n) const |
| This method may be used to draw separators between the lines. | |
| virtual wxCoord | OnMeasureItem (size_t n) const =0 |
| The derived class must implement this method to return the height of the specified item (in pixels). | |
| wxRichTextStyleListBox::wxRichTextStyleListBox | ( | wxWindow * | parent, |
| wxWindowID | id = wxID_ANY, | ||
| const wxPoint & | pos = wxDefaultPosition, | ||
| const wxSize & | size = wxDefaultSize, | ||
| long | style = 0 ) |
Constructor.
| wxRichTextStyleListBox::wxRichTextStyleListBox | ( | ) |
|
virtual |
Destructor.
| void wxRichTextStyleListBox::ApplyStyle | ( | int | i | ) |
Applies the ith style to the associated rich text control.
| int wxRichTextStyleListBox::ConvertTenthsMMToPixels | ( | wxReadOnlyDC & | dc, |
| int | units ) const |
Converts units in tenths of a millimetre to device units.
| bool wxRichTextStyleListBox::Create | ( | wxWindow * | parent, |
| wxWindowID | id = wxID_ANY, | ||
| const wxPoint & | pos = wxDefaultPosition, | ||
| const wxSize & | size = wxDefaultSize, | ||
| long | style = 0 ) |
Creates the window.
| 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.
|
protectedvirtual |
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::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 | ) |
| void wxRichTextStyleListBox::UpdateStyles | ( | ) |
Updates the list from the associated style sheet.