// Equality test bool wxTextAttr::operator== (const wxTextAttr& attr) const { return GetFlags() == attr.GetFlags() && (!HasTextColour() || (GetTextColour() == attr.GetTextColour())) && (!HasBackgroundColour() || (GetBackgroundColour() == attr.GetBackgroundColour())) && (!HasAlignment() || (GetAlignment() == attr.GetAlignment())) && (!HasLeftIndent() || (GetLeftIndent() == attr.GetLeftIndent() && GetLeftSubIndent() == attr.GetLeftSubIndent())) && (!HasRightIndent() || (GetRightIndent() == attr.GetRightIndent())) && (!HasTabs() || (TabsEq(GetTabs(), attr.GetTabs()))) && (!HasParagraphSpacingAfter() || (GetParagraphSpacingAfter() == attr.GetParagraphSpacingAfter())) && (!HasParagraphSpacingBefore() || (GetParagraphSpacingBefore() == attr.GetParagraphSpacingBefore())) && (!HasLineSpacing() || (GetLineSpacing() == attr.GetLineSpacing())) && (!HasCharacterStyleName() || (GetCharacterStyleName() == attr.GetCharacterStyleName())) && (!HasParagraphStyleName() || (GetParagraphStyleName() == attr.GetParagraphStyleName())) && (!HasListStyleName() || (GetListStyleName() == attr.GetListStyleName())) && (!HasBulletStyle() || (GetBulletStyle() == attr.GetBulletStyle())) && (!HasBulletText() || (GetBulletText() == attr.GetBulletText())) && (!HasBulletNumber() || (GetBulletNumber() == attr.GetBulletNumber())) && (GetBulletFont() == attr.GetBulletFont()) && (!HasBulletName() || (GetBulletName() == attr.GetBulletName())) && (!HasTextEffects() || (GetTextEffects() == attr.GetTextEffects() && GetTextEffectFlags() == attr.GetTextEffectFlags())) && (!HasOutlineLevel() || (GetOutlineLevel() == attr.GetOutlineLevel())) && (!HasFontSize() || (GetFontSize() == attr.GetFontSize())) && (!HasFontItalic() || (GetFontStyle() == attr.GetFontStyle())) && (!HasFontWeight() || (GetFontWeight() == attr.GetFontWeight())) && (!HasFontUnderlined() || (GetFontUnderlined() == attr.GetFontUnderlined())) && (!HasFontStrikethrough() || (GetFontStrikethrough() == attr.GetFontStrikethrough())) && (!HasFontFaceName() || (GetFontFaceName() == attr.GetFontFaceName())) && (!HasFontEncoding() || (GetFontEncoding() == attr.GetFontEncoding())) && (!HasFontFamily() || (GetFontFamily() == attr.GetFontFamily())) && (!HasURL() || (GetURL() == attr.GetURL())); }
// Partial equality test taking flags into account bool wxTextAttr::EqPartial(const wxTextAttr& attr, int flags) const { if ((flags & wxTEXT_ATTR_TEXT_COLOUR) && GetTextColour() != attr.GetTextColour()) return false; if ((flags & wxTEXT_ATTR_BACKGROUND_COLOUR) && GetBackgroundColour() != attr.GetBackgroundColour()) return false; if ((flags & wxTEXT_ATTR_FONT_FACE) && GetFontFaceName() != attr.GetFontFaceName()) return false; if ((flags & wxTEXT_ATTR_FONT_SIZE) && GetFontSize() != attr.GetFontSize()) return false; if ((flags & wxTEXT_ATTR_FONT_WEIGHT) && GetFontWeight() != attr.GetFontWeight()) return false; if ((flags & wxTEXT_ATTR_FONT_ITALIC) && GetFontStyle() != attr.GetFontStyle()) return false; if ((flags & wxTEXT_ATTR_FONT_UNDERLINE) && GetFontUnderlined() != attr.GetFontUnderlined()) return false; if ((flags & wxTEXT_ATTR_FONT_ENCODING) && GetFontEncoding() != attr.GetFontEncoding()) return false; if ((flags & wxTEXT_ATTR_FONT_FAMILY) && GetFontFamily() != attr.GetFontFamily()) return false; if ((flags & wxTEXT_ATTR_URL) && GetURL() != attr.GetURL()) return false; if ((flags & wxTEXT_ATTR_ALIGNMENT) && GetAlignment() != attr.GetAlignment()) return false; if ((flags & wxTEXT_ATTR_LEFT_INDENT) && ((GetLeftIndent() != attr.GetLeftIndent()) || (GetLeftSubIndent() != attr.GetLeftSubIndent()))) return false; if ((flags & wxTEXT_ATTR_RIGHT_INDENT) && (GetRightIndent() != attr.GetRightIndent())) return false; if ((flags & wxTEXT_ATTR_PARA_SPACING_AFTER) && (GetParagraphSpacingAfter() != attr.GetParagraphSpacingAfter())) return false; if ((flags & wxTEXT_ATTR_PARA_SPACING_BEFORE) && (GetParagraphSpacingBefore() != attr.GetParagraphSpacingBefore())) return false; if ((flags & wxTEXT_ATTR_LINE_SPACING) && (GetLineSpacing() != attr.GetLineSpacing())) return false; if ((flags & wxTEXT_ATTR_CHARACTER_STYLE_NAME) && (GetCharacterStyleName() != attr.GetCharacterStyleName())) return false; if ((flags & wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && (GetParagraphStyleName() != attr.GetParagraphStyleName())) return false; if ((flags & wxTEXT_ATTR_LIST_STYLE_NAME) && (GetListStyleName() != attr.GetListStyleName())) return false; if ((flags & wxTEXT_ATTR_BULLET_STYLE) && (GetBulletStyle() != attr.GetBulletStyle())) return false; if ((flags & wxTEXT_ATTR_BULLET_NUMBER) && (GetBulletNumber() != attr.GetBulletNumber())) return false; if ((flags & wxTEXT_ATTR_BULLET_TEXT) && (GetBulletText() != attr.GetBulletText()) && (GetBulletFont() != attr.GetBulletFont())) return false; if ((flags & wxTEXT_ATTR_BULLET_NAME) && (GetBulletName() != attr.GetBulletName())) return false; if ((flags & wxTEXT_ATTR_TABS) && !TabsEq(GetTabs(), attr.GetTabs())) return false; if ((flags & wxTEXT_ATTR_PAGE_BREAK) && (HasPageBreak() != attr.HasPageBreak())) return false; if (flags & wxTEXT_ATTR_EFFECTS) { if (HasTextEffects() != attr.HasTextEffects()) return false; if (!BitlistsEqPartial(GetTextEffects(), attr.GetTextEffects(), attr.GetTextEffectFlags())) return false; } if ((flags & wxTEXT_ATTR_OUTLINE_LEVEL) && (GetOutlineLevel() != attr.GetOutlineLevel())) return false; return true; }
void WoodenLabel::DrawElement(C4TargetFacet &cgo) { // draw wood DrawBar(cgo, ::GraphicsResource.barCaption); // draw symbol if (fctIcon.Surface) { C4Facet cgoSymbol(cgo.Surface, cgo.TargetX + rcBounds.x + 1, cgo.TargetY + rcBounds.y + 1, rcBounds.Hgt-2, rcBounds.Hgt-2); fctIcon.Draw(cgoSymbol); } // calculations for automatic scrolling int32_t iXOff = 0; if (iAlign == ALeft) iXOff += 5; if (iAutoScrollDelay) { C4TimeMilliseconds tNow = C4TimeMilliseconds::Now(); if (tNow >= tLastChangeTime + iAutoScrollDelay) { if (!iScrollDir) iScrollDir=1; int32_t iMaxScroll = std::max<int32_t>(pFont->GetTextWidth(sText.getData(), true) + (x0 - rcBounds.x) + iXOff + GetRightIndent() - rcBounds.Wdt, 0); if (iMaxScroll) { iScrollPos += iScrollDir; if (iScrollPos >= iMaxScroll || iScrollPos < 0) { iScrollDir = -iScrollDir; iScrollPos += iScrollDir; tLastChangeTime = tNow; } } } iXOff -= iScrollPos; } // print out text; clipped pDraw->StorePrimaryClipper(); pDraw->SetPrimaryClipper(rcBounds.x + GetLeftIndent() + cgo.TargetX, rcBounds.y + cgo.TargetY, rcBounds.x+rcBounds.Wdt - GetRightIndent() + cgo.TargetX, rcBounds.y+rcBounds.Hgt + cgo.TargetY); pDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX + iXOff, rcBounds.y + cgo.TargetY + (rcBounds.Hgt-pFont->GetLineHeight())/2-1, dwFgClr, iAlign); pDraw->RestorePrimaryClipper(); }
// Partial equality test. Only returns false if an attribute doesn't match. bool wxTextAttr::EqPartial(const wxTextAttr& attr, bool weakTest) const { int flags = attr.GetFlags(); if (!weakTest && ((!HasTextColour() && attr.HasTextColour()) || (!HasBackgroundColour() && attr.HasBackgroundColour()) || (!HasFontFaceName() && attr.HasFontFaceName()) || (!HasFontSize() && attr.HasFontSize()) || (!HasFontWeight() && attr.HasFontWeight()) || (!HasFontItalic() && attr.HasFontItalic()) || (!HasFontUnderlined() && attr.HasFontUnderlined()) || (!HasFontStrikethrough() && attr.HasFontStrikethrough()) || (!HasFontEncoding() && attr.HasFontEncoding()) || (!HasFontFamily() && attr.HasFontFamily()) || (!HasURL() && attr.HasURL()) || (!HasAlignment() && attr.HasAlignment()) || (!HasLeftIndent() && attr.HasLeftIndent()) || (!HasParagraphSpacingAfter() && attr.HasParagraphSpacingAfter()) || (!HasParagraphSpacingBefore() && attr.HasParagraphSpacingBefore()) || (!HasLineSpacing() && attr.HasLineSpacing()) || (!HasCharacterStyleName() && attr.HasCharacterStyleName()) || (!HasParagraphStyleName() && attr.HasParagraphStyleName()) || (!HasListStyleName() && attr.HasListStyleName()) || (!HasBulletStyle() && attr.HasBulletStyle()) || (!HasBulletNumber() && attr.HasBulletNumber()) || (!HasBulletText() && attr.HasBulletText()) || (!HasBulletName() && attr.HasBulletName()) || (!HasTabs() && attr.HasTabs()) || (!HasTextEffects() && attr.HasTextEffects()) || (!HasOutlineLevel() && attr.HasOutlineLevel()))) { return false; } if (HasTextColour() && attr.HasTextColour() && GetTextColour() != attr.GetTextColour()) return false; if (HasBackgroundColour() && attr.HasBackgroundColour() && GetBackgroundColour() != attr.GetBackgroundColour()) return false; if (HasFontFaceName() && attr.HasFontFaceName() && GetFontFaceName() != attr.GetFontFaceName()) return false; // This checks whether the two objects have the same font size dimension (px versus pt) if (HasFontSize() && attr.HasFontSize() && (flags & wxTEXT_ATTR_FONT) != (GetFlags() & wxTEXT_ATTR_FONT)) return false; if (HasFontPointSize() && attr.HasFontPointSize() && GetFontSize() != attr.GetFontSize()) return false; if (HasFontPixelSize() && attr.HasFontPixelSize() && GetFontSize() != attr.GetFontSize()) return false; if (HasFontWeight() && attr.HasFontWeight() && GetFontWeight() != attr.GetFontWeight()) return false; if (HasFontItalic() && attr.HasFontItalic() && GetFontStyle() != attr.GetFontStyle()) return false; if (HasFontUnderlined() && attr.HasFontUnderlined() && GetFontUnderlined() != attr.GetFontUnderlined()) return false; if (HasFontStrikethrough() && attr.HasFontStrikethrough() && GetFontStrikethrough() != attr.GetFontStrikethrough()) return false; if (HasFontEncoding() && attr.HasFontEncoding() && GetFontEncoding() != attr.GetFontEncoding()) return false; if (HasFontFamily() && attr.HasFontFamily() && GetFontFamily() != attr.GetFontFamily()) return false; if (HasURL() && attr.HasURL() && GetURL() != attr.GetURL()) return false; if (HasAlignment() && attr.HasAlignment() && GetAlignment() != attr.GetAlignment()) return false; if (HasLeftIndent() && attr.HasLeftIndent() && ((GetLeftIndent() != attr.GetLeftIndent()) || (GetLeftSubIndent() != attr.GetLeftSubIndent()))) return false; if (HasRightIndent() && attr.HasRightIndent() && (GetRightIndent() != attr.GetRightIndent())) return false; if (HasParagraphSpacingAfter() && attr.HasParagraphSpacingAfter() && (GetParagraphSpacingAfter() != attr.GetParagraphSpacingAfter())) return false; if (HasParagraphSpacingBefore() && attr.HasParagraphSpacingBefore() && (GetParagraphSpacingBefore() != attr.GetParagraphSpacingBefore())) return false; if (HasLineSpacing() && attr.HasLineSpacing() && (GetLineSpacing() != attr.GetLineSpacing())) return false; if (HasCharacterStyleName() && attr.HasCharacterStyleName() && (GetCharacterStyleName() != attr.GetCharacterStyleName())) return false; if (HasParagraphStyleName() && attr.HasParagraphStyleName() && (GetParagraphStyleName() != attr.GetParagraphStyleName())) return false; if (HasListStyleName() && attr.HasListStyleName() && (GetListStyleName() != attr.GetListStyleName())) return false; if (HasBulletStyle() && attr.HasBulletStyle() && (GetBulletStyle() != attr.GetBulletStyle())) return false; if (HasBulletNumber() && attr.HasBulletNumber() && (GetBulletNumber() != attr.GetBulletNumber())) return false; if (HasBulletText() && attr.HasBulletText() && (GetBulletText() != attr.GetBulletText()) && (GetBulletFont() != attr.GetBulletFont())) return false; if (HasBulletName() && attr.HasBulletName() && (GetBulletName() != attr.GetBulletName())) return false; if (HasTabs() && attr.HasTabs() && !TabsEq(GetTabs(), attr.GetTabs())) return false; if ((HasPageBreak() != attr.HasPageBreak())) return false; if (HasTextEffects() && attr.HasTextEffects()) { if (!BitlistsEqPartial(GetTextEffects(), attr.GetTextEffects(), attr.GetTextEffectFlags())) return false; } if (HasOutlineLevel() && attr.HasOutlineLevel() && (GetOutlineLevel() != attr.GetOutlineLevel())) return false; return true; }