* Forward declarations
*/
-class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl;
-class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer;
/*!
* wxRichTextStyleDefinition class declaration
void SetBaseStyle(const wxString& name) { m_baseStyle = name; }
const wxString& GetBaseStyle() const { return m_baseStyle; }
- /// Sets the style
- void SetStyle(const wxRichTextAttr& style) { m_style = style; }
- const wxRichTextAttr& GetStyle() const { return m_style; }
- wxRichTextAttr& GetStyle() { return m_style; }
+ /// Sets and gets the style
+ void SetStyle(const wxTextAttr& style) { m_style = style; }
+ const wxTextAttr& GetStyle() const { return m_style; }
+ wxTextAttr& GetStyle() { return m_style; }
+
+ /// Gets the style combined with the base style
+ virtual wxTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const;
protected:
wxString m_name;
wxString m_baseStyle;
wxString m_description;
- wxRichTextAttr m_style;
+ wxTextAttr m_style;
};
/*!
virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextListStyleDefinition(*this); }
/// Sets/gets the attributes for the given level
- void SetLevelAttributes(int i, const wxRichTextAttr& attr);
- wxRichTextAttr* GetLevelAttributes(int i);
- const wxRichTextAttr* GetLevelAttributes(int i) const;
+ void SetLevelAttributes(int i, const wxTextAttr& attr);
+ wxTextAttr* GetLevelAttributes(int i);
+ const wxTextAttr* GetLevelAttributes(int i) const;
/// Convenience function for setting the major attributes for a list level specification
void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString);
/// Combine the base and list style with a paragraph style, using the given indent (from which
/// an appropriate level is found)
- wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle);
+ wxTextAttr CombineWithParagraphStyle(int indent, const wxTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = NULL);
/// Combine the base and list style, using the given indent (from which
/// an appropriate level is found)
- wxRichTextAttr GetCombinedStyle(int indent);
+ wxTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = NULL);
/// Combine the base and list style, using the given level from which
/// an appropriate level is found)
- wxRichTextAttr GetCombinedStyleForLevel(int level);
+ wxTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL);
/// Gets the number of available levels
int GetLevelCount() const { return 10; }
protected:
/// The styles for each level (up to 10)
- wxRichTextAttr m_levelStyles[10];
+ wxTextAttr m_levelStyles[10];
};
/*!
wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)
: wxObject()
{
+ Init();
Copy(sheet);
}
wxRichTextStyleSheet() { Init(); }
/// Add a definition to the list style list
bool AddListStyle(wxRichTextListStyleDefinition* def);
+ /// Add a definition to the appropriate style list
+ bool AddStyle(wxRichTextStyleDefinition* def);
+
/// Remove a character style
bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_characterStyleDefinitions, def, deleteStyle); }
/// Remove a list style
bool RemoveListStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_listStyleDefinitions, def, deleteStyle); }
+ /// Remove a style
+ bool RemoveStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false);
+
/// Find a character definition by name
wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, bool recurse = true) const { return (wxRichTextCharacterStyleDefinition*) FindStyle(m_characterStyleDefinitions, name, recurse); }
/// Find a list definition by name
wxRichTextListStyleDefinition* FindListStyle(const wxString& name, bool recurse = true) const { return (wxRichTextListStyleDefinition*) FindStyle(m_listStyleDefinitions, name, recurse); }
+ /// Find any definition by name
+ wxRichTextStyleDefinition* FindStyle(const wxString& name, bool recurse = true) const;
+
/// Return the number of character styles
size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions.GetCount(); }
/// Creates a suitable HTML fragment for a definition
wxString CreateHTML(wxRichTextStyleDefinition* def) const;
- /// Associates the control with a style manager
+ /// Associates the control with a style sheet
void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; }
wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; }
bool m_applyOnSelection; // if true, applies style on selection
wxRichTextStyleType m_styleType; // style type to display
bool m_autoSetSelection;
+ wxArrayString m_styleNames;
};
/*!
/// Updates the style list box
void UpdateStyles();
- /// Associates the control with a style manager
+ /// Associates the control with a style sheet
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
wxRichTextStyleSheet* GetStyleSheet() const;
m_value = -1;
}
- virtual bool Create( wxWindow* parent )
- {
- return wxRichTextStyleListBox::Create(parent, wxID_ANY,
- wxPoint(0,0), wxDefaultSize,
- wxSIMPLE_BORDER);
- }
+ virtual bool Create( wxWindow* parent );
virtual wxWindow *GetControl() { return this; }
/// Updates the list
void UpdateStyles() { m_stylePopup->UpdateStyles(); }
- /// Associates the control with a style manager
+ /// Associates the control with a style sheet
void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_stylePopup->SetStyleSheet(styleSheet); }
wxRichTextStyleSheet* GetStyleSheet() const { return m_stylePopup->GetStyleSheet(); }