// Author: Julian Smart
// Modified by:
// Created: 2005-09-30
-// RCS-ID:
+// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
void SetName(const wxString& name) { m_name = name; }
const wxString& GetName() const { return m_name; }
+ /// Sets and gets the style description
+ void SetDescription(const wxString& descr) { m_description = descr; }
+ const wxString& GetDescription() const { return m_description; }
+
/// Sets and gets the name of the style that this style is based on
void SetBaseStyle(const wxString& name) { m_baseStyle = name; }
const wxString& GetBaseStyle() const { return m_baseStyle; }
protected:
wxString m_name;
wxString m_baseStyle;
+ wxString m_description;
wxRichTextAttr m_style;
};
virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextListStyleDefinition(*this); }
/// Sets/gets the attributes for the given level
- void SetLevelAttributes(int i, const wxTextAttrEx& attr);
- wxTextAttrEx* GetLevelAttributes(int i);
- const wxTextAttrEx* GetLevelAttributes(int i) const;
+ void SetLevelAttributes(int i, const wxRichTextAttr& attr);
+ wxRichTextAttr* GetLevelAttributes(int i);
+ const wxRichTextAttr* 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)
- wxTextAttrEx CombineWithParagraphStyle(int indent, const wxTextAttrEx& paraStyle);
+ wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle);
/// Combine the base and list style, using the given indent (from which
/// an appropriate level is found)
- wxTextAttrEx GetCombinedStyle(int indent);
+ wxRichTextAttr GetCombinedStyle(int indent);
/// Combine the base and list style, using the given level from which
/// an appropriate level is found)
- wxTextAttrEx GetCombinedStyleForLevel(int level);
+ wxRichTextAttr GetCombinedStyleForLevel(int level);
/// Gets the number of available levels
int GetLevelCount() const { return 10; }
protected:
/// The styles for each level (up to 10)
- wxTextAttrEx m_levelStyles[10];
+ wxRichTextAttr m_levelStyles[10];
};
/*!
wxRichTextStyleSheet* GetPreviousSheet() const { return m_previousSheet; }
void SetPreviousSheet(wxRichTextStyleSheet* sheet) { m_previousSheet = sheet; }
+ /// Sets and gets the name of the style sheet
+ void SetName(const wxString& name) { m_name = name; }
+ const wxString& GetName() const { return m_name; }
+
+ /// Sets and gets the style description
+ void SetDescription(const wxString& descr) { m_description = descr; }
+ const wxString& GetDescription() const { return m_description; }
+
/// Implementation
/// Add a definition to one of the style lists
protected:
- wxList m_characterStyleDefinitions;
- wxList m_paragraphStyleDefinitions;
- wxList m_listStyleDefinitions;
+ wxString m_description;
+ wxString m_name;
+
+ wxList m_characterStyleDefinitions;
+ wxList m_paragraphStyleDefinitions;
+ wxList m_listStyleDefinitions;
- wxRichTextStyleSheet* m_previousSheet;
- wxRichTextStyleSheet* m_nextSheet;
+ wxRichTextStyleSheet* m_previousSheet;
+ wxRichTextStyleSheet* m_nextSheet;
};
#if wxUSE_HTML
m_richTextCtrl = NULL;
m_applyOnSelection = false;
m_styleType = wxRICHTEXT_STYLE_PARAGRAPH;
+ m_autoSetSelection = true;
}
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
/// 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; }
/// Apply the style
void ApplyStyle(int i);
- /// React to selection
- void OnSelect(wxCommandEvent& event);
-
/// Left click
void OnLeftDown(wxMouseEvent& event);
/// Can we set the selection based on the editor caret position?
/// Need to override this if being used in a combobox popup
- virtual bool CanAutoSetSelection() { return true; }
+ virtual bool CanAutoSetSelection() { return m_autoSetSelection; }
+ virtual void SetAutoSetSelection(bool autoSet) { m_autoSetSelection = autoSet; }
/// Set whether the style should be applied as soon as the item is selected (the default)
void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; }
wxRichTextCtrl* m_richTextCtrl;
bool m_applyOnSelection; // if true, applies style on selection
wxRichTextStyleType m_styleType; // style type to display
+ bool m_autoSetSelection;
};
/*!
* style types.
*/
+#define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
+
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl
{
DECLARE_CLASS(wxRichTextStyleListCtrl)
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
- /// Associates the control with a style manager
+ /// Updates the style list box
+ void UpdateStyles();
+
+ /// Associates the control with a style sheet
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
wxRichTextStyleSheet* GetStyleSheet() const;
void SetRichTextCtrl(wxRichTextCtrl* ctrl);
wxRichTextCtrl* GetRichTextCtrl() const;
- /// Updates the style list box
- void UpdateStyles();
-
/// Set/get the style type to display
void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;
/// 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(); }