Use wxDynamicCast() instead of IsKindOf() checks.

wxDynamicCast() is less verbose (due to the absence of "CLASSINFO") and more
compatible with the standard dynamic_cast<>, so prefer to use it when possible.

See #14356.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-06-01 11:01:18 +00:00
parent 7e8a20edc8
commit 345c78ca5f
29 changed files with 134 additions and 134 deletions

View File

@@ -1008,7 +1008,7 @@ void wxRichTextObject::Dump(wxTextOutputStream& stream)
wxRichTextBuffer* wxRichTextObject::GetBuffer() const
{
const wxRichTextObject* obj = this;
while (obj && !obj->IsKindOf(CLASSINFO(wxRichTextBuffer)))
while (obj && !wxDynamicCast(obj, wxRichTextBuffer))
obj = obj->GetParent();
return wxDynamicCast(obj, wxRichTextBuffer);
}
@@ -3478,7 +3478,7 @@ bool wxRichTextParagraphLayoutBox::HasCharacterAttributes(const wxRichTextRange&
if (childRange.GetLength() == 0 && GetRange().GetLength() == 1)
childRange.SetEnd(childRange.GetEnd()+1);
if (!childRange.IsOutside(range) && child->IsKindOf(CLASSINFO(wxRichTextPlainText)))
if (!childRange.IsOutside(range) && wxDynamicCast(child, wxRichTextPlainText))
{
foundCount ++;
wxRichTextAttr textAttr = para->GetCombinedAttributes(child->GetAttributes());
@@ -4982,7 +4982,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
// If floating, ignore. We already laid out floats.
// Also ignore if empty object, except if we haven't got any
// size yet.
if (!child->IsFloating() && child->GetRange().GetLength() != 0 && !child->IsKindOf(CLASSINFO(wxRichTextPlainText)))
if (!child->IsFloating() && child->GetRange().GetLength() != 0 && !wxDynamicCast(child, wxRichTextPlainText))
{
if (child->GetCachedSize().x > minWidth)
minWidth = child->GetMinSize().x;