Implemented wxTextAttrEx::CombineEx and wxRichTextAttr::Combine

Setting the default style now combines the default with the
new style, instead of just overriding it, so it is possible to
select e.g. bold and italic simultaneously in the sample


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-07-02 13:43:42 +00:00
parent f2a59080e9
commit 05b4fddf49
2 changed files with 255 additions and 1 deletions

View File

@@ -293,6 +293,12 @@ public:
int GetBulletNumber() const { return m_bulletNumber; }
wxChar GetBulletSymbol() const { return m_bulletSymbol; }
bool HasWeight() const { return (GetFlags() & wxTEXT_ATTR_FONT_WEIGHT) != 0; }
bool HasSize() const { return (GetFlags() & wxTEXT_ATTR_FONT_SIZE) != 0; }
bool HasItalic() const { return (GetFlags() & wxTEXT_ATTR_FONT_ITALIC) != 0; }
bool HasUnderlined() const { return (GetFlags() & wxTEXT_ATTR_FONT_UNDERLINE) != 0; }
bool HasFaceName() const { return (GetFlags() & wxTEXT_ATTR_FONT_FACE) != 0; }
bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); }
bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); }
bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); }
@@ -316,6 +322,14 @@ public:
!HasParagraphSpacingAfter() && !HasParagraphSpacingBefore() && !HasLineSpacing() &&
!HasCharacterStyleName() && !HasParagraphStyleName() && !HasBulletNumber() && !HasBulletStyle() && !HasBulletSymbol();
}
// return the attribute having the valid font and colours: it uses the
// attributes set in attr and falls back first to attrDefault and then to
// the text control font/colours for those attributes which are not set
static wxTextAttrEx CombineEx(const wxTextAttrEx& attr,
const wxTextAttrEx& attrDef,
const wxTextCtrlBase *text);
private:
// Paragraph styles
int m_paragraphSpacingAfter;
@@ -457,6 +471,12 @@ public:
!HasCharacterStyleName() && !HasParagraphStyleName() && !HasBulletNumber() && !HasBulletStyle() && !HasBulletSymbol();
}
// return the attribute having the valid font and colours: it uses the
// attributes set in attr and falls back first to attrDefault and then to
// the text control font/colours for those attributes which are not set
static wxRichTextAttr Combine(const wxRichTextAttr& attr,
const wxRichTextAttr& attrDef,
const wxTextCtrlBase *text);
private:
long m_flags;