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

@@ -4134,7 +4134,7 @@ bool wxRichTextCtrl::ApplyStyle(wxRichTextStyleDefinition* def)
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_RESET;
if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
if (wxDynamicCast(def, wxRichTextListStyleDefinition))
{
flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY;
@@ -4154,7 +4154,7 @@ bool wxRichTextCtrl::ApplyStyle(wxRichTextStyleDefinition* def)
bool isPara = false;
// Make sure the attr has the style name
if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
if (wxDynamicCast(def, wxRichTextParagraphStyleDefinition))
{
isPara = true;
attr.SetParagraphStyleName(def->GetName());
@@ -4164,12 +4164,12 @@ bool wxRichTextCtrl::ApplyStyle(wxRichTextStyleDefinition* def)
// to change its style independently.
flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY;
}
else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
else if (wxDynamicCast(def, wxRichTextCharacterStyleDefinition))
attr.SetCharacterStyleName(def->GetName());
else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
else if (wxDynamicCast(def, wxRichTextBoxStyleDefinition))
attr.GetTextBoxAttr().SetBoxStyleName(def->GetName());
if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
if (wxDynamicCast(def, wxRichTextBoxStyleDefinition))
{
if (GetFocusObject() && (GetFocusObject() != & GetBuffer()))
{