X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d2d0adc7765dfe904f0f7e97d85a2638c934a7d6..87f351de6c8d4cf2af78e36b3ceccf21bc8ec937:/include/wx/richtext/richtextstyles.h diff --git a/include/wx/richtext/richtextstyles.h b/include/wx/richtext/richtextstyles.h index bce0f3399f..104e1a0bdb 100644 --- a/include/wx/richtext/richtextstyles.h +++ b/include/wx/richtext/richtextstyles.h @@ -85,18 +85,26 @@ public: 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; } - /// Sets the style + /// Sets and gets the style void SetStyle(const wxRichTextAttr& style) { m_style = style; } const wxRichTextAttr& GetStyle() const { return m_style; } wxRichTextAttr& GetStyle() { return m_style; } + /// Gets the style combined with the base style + virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const; + protected: wxString m_name; wxString m_baseStyle; + wxString m_description; wxRichTextAttr m_style; }; @@ -210,15 +218,15 @@ public: /// 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); + wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& 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); + wxRichTextAttr 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); + wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL); /// Gets the number of available levels int GetLevelCount() const { return 10; } @@ -245,6 +253,7 @@ public: wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet) : wxObject() { + Init(); Copy(sheet); } wxRichTextStyleSheet() { Init(); } @@ -271,6 +280,9 @@ public: /// 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); } @@ -280,6 +292,9 @@ public: /// 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); } @@ -289,6 +304,9 @@ public: /// 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(); } @@ -327,6 +345,14 @@ public: 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 @@ -340,12 +366,15 @@ public: 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 @@ -392,7 +421,7 @@ public: /// 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; } @@ -454,6 +483,7 @@ private: bool m_applyOnSelection; // if true, applies style on selection wxRichTextStyleType m_styleType; // style type to display bool m_autoSetSelection; + wxArrayString m_styleNames; }; /*! @@ -498,7 +528,7 @@ public: /// 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; @@ -622,7 +652,7 @@ public: /// 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(); }