// Purpose: interface of wxRichTextStyleListCtrl
// Author: wxWidgets team
// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
@class wxRichTextStyleListCtrl
- @headerfile richtextstyles.h wx/richtext/richtextstyles.h
- This class incorporates a wxRichTextStyleListBox and
- a choice control that allows the user to select the category of style to view.
+ This class incorporates a wxRichTextStyleListBox and a choice control that
+ allows the user to select the category of style to view.
+
It is demonstrated in the wxRichTextCtrl sample in @c samples/richtext.
To use wxRichTextStyleListCtrl, add the control to your window hierarchy and
- call wxRichTextStyleListCtrl::SetStyleType with
- one of wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL,
+ call wxRichTextStyleListCtrl::SetStyleType with one of
+ wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL,
wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH,
wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER and
wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST to set the current view.
+
Associate the control with a style sheet and rich text control with
- SetStyleSheet and SetRichTextCtrl,
- so that when a style is double-clicked, it is applied to the selection.
+ SetStyleSheet and SetRichTextCtrl, so that when a style is double-clicked,
+ it is applied to the selection.
@beginStyleTable
@style{wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR}
@endStyleTable
@library{wxrichtext}
- @category{FIXME}
+ @category{richtext}
*/
class wxRichTextStyleListCtrl : public wxControl
{
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
/**
- 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.
+ 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 SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
/**
@class wxRichTextStyleDefinition
- @headerfile richtextstyles.h wx/richtext/richtextstyles.h
This is a base class for paragraph and character styles.
@library{wxrichtext}
- @category{FIXME}
+ @category{richtext}
*/
class wxRichTextStyleDefinition : public wxObject
{
/**
Destructor.
*/
- ~wxRichTextStyleDefinition();
+ virtual ~wxRichTextStyleDefinition();
/**
Returns the style on which this style is based.
*/
- const wxString GetBaseStyle() const;
+ const wxString& GetBaseStyle() const;
/**
Returns the style's description.
*/
- const wxString GetDescription() const;
+ const wxString& GetDescription() const;
/**
Returns the style name.
*/
- const wxString GetName() const;
+ const wxString& GetName() const;
//@{
/**
Returns the attributes associated with this style.
*/
- wxTextAttr GetStyle() const;
- const wxTextAttr GetStyle() const;
+ wxRichTextAttr GetStyle() const;
+ const wxRichTextAttr GetStyle() const;
//@}
/**
Returns the style attributes combined with the attributes of the specified base
style, if any. This function works recursively.
*/
- wxTextAttr GetStyleMergedWithBase(wxRichTextStyleSheet* sheet) const;
+ virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const;
/**
Sets the name of the style that this style is based on.
/**
Sets the attributes for this style.
*/
- void SetStyle(const wxTextAttr& style);
+ void SetStyle(const wxRichTextAttr& style);
+
+ /**
+ Returns the definition's properties.
+ */
+ wxRichTextProperties& GetProperties();
+
+ /**
+ Returns the definition's properties.
+ */
+ const wxRichTextProperties& GetProperties() const;
+
+ /**
+ Sets the definition's properties.
+ */
+ void SetProperties(const wxRichTextProperties& props);
};
/**
@class wxRichTextParagraphStyleDefinition
- @headerfile richtextstyles.h wx/richtext/richtextstyles.h
This class represents a paragraph style definition, usually added to a
wxRichTextStyleSheet.
/**
Destructor.
*/
- ~wxRichTextParagraphStyleDefinition();
+ virtual ~wxRichTextParagraphStyleDefinition();
/**
Returns the style that should normally follow this style.
*/
- const wxString GetNextStyle() const;
+ const wxString& GetNextStyle() const;
/**
Sets the style that should normally follow this style.
/**
@class wxRichTextStyleListBox
- @headerfile richtextstyles.h wx/richtext/richtextstyles.h
This is a listbox that can display the styles in a wxRichTextStyleSheet,
and apply the selection to an associated wxRichTextCtrl.
@library{wxrichtext}
@category{richtext}
- @see wxRichTextStyleComboCtrl, @ref overview_wxrichtextctrloverview
- "wxRichTextCtrl overview"
+ @see wxRichTextStyleComboCtrl, @ref overview_richtextctrl
*/
class wxRichTextStyleListBox : public wxHtmlListBox
{
public:
+
+ /// Which type of style definition is currently showing?
+ enum wxRichTextStyleType
+ {
+ wxRICHTEXT_STYLE_ALL,
+ wxRICHTEXT_STYLE_PARAGRAPH,
+ wxRICHTEXT_STYLE_CHARACTER,
+ wxRICHTEXT_STYLE_LIST,
+ wxRICHTEXT_STYLE_BOX
+ };
+
/**
Constructor.
*/
/**
Destructor.
*/
- ~wxRichTextStyleListBox();
+ virtual ~wxRichTextStyleListBox();
/**
Applies the @e ith style to the associated rich text control.
/**
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.
+ immediately apply the style to the associated rich text control.
*/
bool GetApplyOnSelection() const;
*/
wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;
- /**
- Returns the HTML for this item.
- */
- wxString OnGetItem(size_t n) const;
-
/**
Implements left click behaviour, applying the clicked style to the
wxRichTextCtrl.
*/
void OnLeftDown(wxMouseEvent& event);
- /**
- Reacts to selection.
- */
- void OnSelect(wxCommandEvent& event);
-
/**
If @a applyOnSelection is @true, clicking on a style name in the list will
- immediately
- apply the style to the associated rich text control.
+ immediately apply the style to the associated rich text control.
*/
void SetApplyOnSelection(bool applyOnSelection);
/**
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::wxRICHTEXT_STYLE_ALL,
+ - wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH,
+ - wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER
+ - wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST.
*/
void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
Updates the list from the associated style sheet.
*/
void UpdateStyles();
+
+protected:
+
+ /**
+ Returns the HTML for this item.
+ */
+ virtual wxString OnGetItem(size_t n) const;
};
/**
@class wxRichTextStyleComboCtrl
- @headerfile richtextstyles.h wx/richtext/richtextstyles.h
This is a combo control that can display the styles in a wxRichTextStyleSheet,
and apply the selection to an associated wxRichTextCtrl.
@library{wxrichtext}
@category{richtext}
- @see wxRichTextStyleListBox, @ref overview_wxrichtextctrloverview
- "wxRichTextCtrl overview"
+ @see wxRichTextStyleListBox, @ref overview_richtextctrl
*/
class wxRichTextStyleComboCtrl : public wxComboCtrl
{
/**
Destructor.
*/
- ~wxRichTextStyleComboCtrl();
+ virtual ~wxRichTextStyleComboCtrl();
/**
Returns the wxRichTextCtrl associated with this control.
/**
@class wxRichTextCharacterStyleDefinition
- @headerfile richtextstyles.h wx/richtext/richtextstyles.h
This class represents a character style definition, usually added to a
wxRichTextStyleSheet.
/**
Destructor.
*/
- ~wxRichTextCharacterStyleDefinition();
+ virtual ~wxRichTextCharacterStyleDefinition();
};
/**
@class wxRichTextListStyleDefinition
- @headerfile richtextstyles.h wx/richtext/richtextstyles.h
This class represents a list style definition, usually added to a
wxRichTextStyleSheet.
- The class inherits paragraph attributes from
- wxRichTextStyleParagraphDefinition, and adds 10 further attribute objects, one for each level of a list.
+ The class inherits paragraph attributes from wxRichTextStyleParagraphDefinition,
+ and adds 10 further attribute objects, one for each level of a list.
When applying a list style to a paragraph, the list style's base and
- appropriate level attributes are merged with the
- paragraph's existing attributes.
-
- You can apply a list style to one or more paragraphs using
- wxRichTextCtrl::SetListStyle. You
- can also use the functions wxRichTextCtrl::NumberList,
- wxRichTextCtrl::PromoteList and
- wxRichTextCtrl::ClearListStyle. As usual, there are wxRichTextBuffer versions
- of these functions
+ appropriate level attributes are merged with the paragraph's existing attributes.
+
+ You can apply a list style to one or more paragraphs using wxRichTextCtrl::SetListStyle.
+ You can also use the functions wxRichTextCtrl::NumberList, wxRichTextCtrl::PromoteList and
+ wxRichTextCtrl::ClearListStyle.
+
+ As usual, there are wxRichTextBuffer versions of these functions
so that you can apply them directly to a buffer without requiring a control.
@library{wxrichtext}
/**
Destructor.
*/
- ~wxRichTextListStyleDefinition();
+ virtual ~wxRichTextListStyleDefinition();
/**
This function combines the given paragraph style with the list style's base
attributes and level style matching the given indent, returning the combined attributes.
+
If @a styleSheet is specified, the base style for this definition will also be
included in the result.
*/
- wxTextAttr CombineWithParagraphStyle(int indent,
- const wxTextAttr& paraStyle,
+ wxRichTextAttr CombineWithParagraphStyle(int indent,
+ const wxRichTextAttr& paraStyle,
wxRichTextStyleSheet* styleSheet = NULL);
/**
/**
This function combines the list style's base attributes and the level style
matching the given indent, returning the combined attributes.
+
If @a styleSheet is specified, the base style for this definition will also be
included in the result.
*/
- wxTextAttr GetCombinedStyle(int indent,
- wxRichTextStyleSheet* styleSheet = NULL) const;
+ wxRichTextAttr GetCombinedStyle(int indent,
+ wxRichTextStyleSheet* styleSheet = NULL);
/**
This function combines the list style's base attributes and the style for the
specified level, returning the combined attributes.
+
If @a styleSheet is specified, the base style for this definition will also be
included in the result.
*/
- wxTextAttr GetCombinedStyleLevel(int level,
- wxRichTextStyleSheet* styleSheet = NULL) const;
+
+ wxRichTextAttr GetCombinedStyleForLevel(int level,
+ wxRichTextStyleSheet* styleSheet = NULL);
/**
Returns the style for the given level. @a level is a number between 0 and 9.
*/
- const wxTextAttr* GetLevelAttributes(int level) const;
+ const wxRichTextAttr* GetLevelAttributes(int level) const;
/**
Returns the number of levels. This is hard-wired to 10.
/**
Returns @true if the given level has numbered list attributes.
*/
- int IsNumbered(int level) const;
+ bool IsNumbered(int level) const;
- //@{
/**
Sets the style for the given level. @a level is a number between 0 and 9.
The first and most flexible form uses a wxTextAttr object, while the second
form is for convenient setting of the most commonly-used attributes.
*/
- void SetLevelAttributes(int level, const wxTextAttr& attr);
- void SetLevelAttributes(int level, int leftIndent,
- int leftSubIndent,
- int bulletStyle,
- const wxString& bulletSymbol = wxEmptyString);
- //@}
+ void SetLevelAttributes(int level, const wxRichTextAttr& attr);
};
/**
@class wxRichTextStyleSheet
- @headerfile richtextstyles.h wx/richtext/richtextstyles.h
A style sheet contains named paragraph and character styles that make it
easy for a user to apply combinations of attributes to a wxRichTextCtrl.
- You can use a wxRichTextStyleListBox in your
- user interface to show available styles to the user, and allow application
- of styles to the control.
+ You can use a wxRichTextStyleListBox in your user interface to show available
+ styles to the user, and allow application of styles to the control.
@library{wxrichtext}
@category{richtext}
/**
Destructor.
*/
- ~wxRichTextStyleSheet();
+ virtual ~wxRichTextStyleSheet();
/**
Adds a definition to the character style list.
/**
Finds a character definition by name.
*/
- wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name) const;
+ wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name,
+ bool recurse = true) const;
/**
Finds a list definition by name.
*/
- wxRichTextListStyleDefinition* FindListStyle(const wxString& name) const;
+ wxRichTextListStyleDefinition* FindListStyle(const wxString& name,
+ bool recurse = true) const;
/**
Finds a paragraph definition by name.
*/
- wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name) const;
+ wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name,
+ bool recurse = true) const;
/**
Finds a style definition by name.
/**
Returns the style sheet's description.
*/
- const wxString GetDescription() const;
+ const wxString& GetDescription() const;
/**
Returns the @e nth list style.
/**
Returns the style sheet's name.
*/
- const wxString GetName() const;
+ const wxString& GetName() const;
/**
Returns the @e nth paragraph style.
Sets the style sheet's name.
*/
void SetName(const wxString& name);
+
+ /**
+ Returns the sheet's properties.
+ */
+ wxRichTextProperties& GetProperties();
+
+ /**
+ Returns the sheet's properties.
+ */
+ const wxRichTextProperties& GetProperties() const;
+
+ /**
+ Sets the sheet's properties.
+ */
+ void SetProperties(const wxRichTextProperties& props);
};