/////////////////////////////////////////////////////////////////////////////
-// Name: richtextstyles.h
+// Name: wx/richtext/richtextstyles.h
// Purpose: Style management for wxRichTextCtrl
// Author: Julian Smart
// Modified by:
* Includes
*/
-#include "wx/richtext/richtextbuffer.h"
+#include "wx/defs.h"
#if wxUSE_RICHTEXT
+#include "wx/richtext/richtextbuffer.h"
+
#if wxUSE_HTML
#include "wx/htmllbox.h"
#endif
// Constructors
- wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def) { Copy(def); }
+ wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def)
+ : wxObject()
+ {
+ Copy(def);
+ }
wxRichTextStyleDefinition(const wxString& name = wxEmptyString) { Init(); m_name = name; }
virtual ~wxRichTextStyleDefinition() {}
bool Eq(const wxRichTextStyleDefinition& def) const;
void operator =(const wxRichTextStyleDefinition& def) { Copy(def); }
bool operator ==(const wxRichTextStyleDefinition& def) const { return Eq(def); }
+ virtual wxRichTextStyleDefinition* Clone() const = 0;
/// The name of the style.
void SetName(const wxString& name) { m_name = name; }
wxRichTextStyleDefinition(name) {}
virtual ~wxRichTextCharacterStyleDefinition() {}
+ virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextCharacterStyleDefinition(*this); }
+
protected:
};
void operator =(const wxRichTextParagraphStyleDefinition& def) { Copy(def); }
bool operator ==(const wxRichTextParagraphStyleDefinition& def) const;
+ virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextParagraphStyleDefinition(*this); }
+
protected:
/// The next style to use when adding a paragraph after this style.
public:
/// Constructors
- wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet) { Copy(sheet); }
+ wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)
+ : wxObject()
+ {
+ Copy(sheet);
+ }
wxRichTextStyleSheet() { Init(); }
virtual ~wxRichTextStyleSheet() { DeleteStyles(); }
{
m_styleSheet = NULL;
m_richTextCtrl = NULL;
+ m_applyOnSelection = true;
}
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
/// Updates the list
void UpdateStyles();
- /// Do selection
- void DoSelection(int i);
+ /// Apply the style
+ void ApplyStyle(int i);
/// React to selection
void OnSelect(wxCommandEvent& event);
/// Need to override this if being used in a combobox popup
virtual bool CanAutoSetSelection() { return true; }
+ /// Set whether the style should be applied as soon as the item is selected (the default)
+ void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; }
+ bool GetApplyOnSelection() const { return m_applyOnSelection; }
+
protected:
/// Returns the HTML for this item
virtual wxString OnGetItem(size_t n) const;
wxRichTextStyleSheet* m_styleSheet;
wxRichTextCtrl* m_richTextCtrl;
+ bool m_applyOnSelection; // if true, applies style on selection
};
#if wxUSE_COMBOCTRL