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

@ -925,7 +925,7 @@ bool wxAuiTabContainer::ButtonHitTest(int x, int y,
static void ShowWnd(wxWindow* wnd, bool show)
{
#if wxUSE_MDI
if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
if (wxDynamicCast(wnd, wxAuiMDIChildFrame))
{
wxAuiMDIChildFrame* cf = (wxAuiMDIChildFrame*)wnd;
cf->DoShow(show);
@ -1051,7 +1051,7 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt)
// even if the tab is already active, because they may
// have multiple tab controls
if ((new_selection != GetActivePage() ||
GetParent()->IsKindOf(CLASSINFO(wxAuiNotebook))) && !m_hoverButton)
wxDynamicCast(GetParent(), wxAuiNotebook)) && !m_hoverButton)
{
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId);
e.SetSelection(new_selection);
@ -1569,7 +1569,7 @@ public:
// TODO: else if (GetFlags() & wxAUI_NB_RIGHT){}
#if wxUSE_MDI
if (page.window->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
if (wxDynamicCast(page.window, wxAuiMDIChildFrame))
{
wxAuiMDIChildFrame* wnd = (wxAuiMDIChildFrame*)page.window;
wnd->ApplyMDIChildFrameRect();
@ -1988,7 +1988,7 @@ bool wxAuiNotebook::DeletePage(size_t page_idx)
#if wxUSE_MDI
// actually destroy the window now
if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
if (wxDynamicCast(wnd, wxAuiMDIChildFrame))
{
// delete the child frame with pending delete, as is
// customary with frame windows
@ -2561,11 +2561,11 @@ void wxAuiNotebook::OnTabDragMotion(wxAuiNotebookEvent& evt)
return;
// make sure we are not over the hint window
if (!tab_ctrl->IsKindOf(CLASSINFO(wxFrame)))
if (!wxDynamicCast(tab_ctrl, wxFrame))
{
while (tab_ctrl)
{
if (tab_ctrl->IsKindOf(CLASSINFO(wxAuiTabCtrl)))
if (wxDynamicCast(tab_ctrl, wxAuiTabCtrl))
break;
tab_ctrl = tab_ctrl->GetParent();
}
@ -2647,7 +2647,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt)
while (tab_ctrl)
{
if (tab_ctrl->IsKindOf(CLASSINFO(wxAuiTabCtrl)))
if (wxDynamicCast(tab_ctrl, wxAuiTabCtrl))
break;
tab_ctrl = tab_ctrl->GetParent();
}
@ -3097,7 +3097,7 @@ void wxAuiNotebook::OnTabButton(wxAuiNotebookEvent& evt)
#if wxUSE_MDI
if (close_wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
if (wxDynamicCast(close_wnd, wxAuiMDIChildFrame))
{
close_wnd->Close();
}

View File

@ -822,7 +822,7 @@ void wxAuiManager::UpdateHintWindowConfig()
wxWindow* w = m_frame;
while (w)
{
if (w->IsKindOf(CLASSINFO(wxFrame)))
if (wxDynamicCast(w, wxFrame))
{
wxFrame* f = static_cast<wxFrame*>(w);
can_do_transparent = f->CanSetTransparent();
@ -913,7 +913,7 @@ void wxAuiManager::SetManagedWindow(wxWindow* wnd)
// we need to add the MDI client window as the default
// center pane
if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame)))
if (wxDynamicCast(m_frame, wxMDIParentFrame))
{
wxMDIParentFrame* mdi_frame = (wxMDIParentFrame*)m_frame;
wxWindow* client_window = mdi_frame->GetClientWindow();
@ -924,7 +924,7 @@ void wxAuiManager::SetManagedWindow(wxWindow* wnd)
wxAuiPaneInfo().Name(wxT("mdiclient")).
CenterPane().PaneBorder(false));
}
else if (m_frame->IsKindOf(CLASSINFO(wxAuiMDIParentFrame)))
else if (wxDynamicCast(m_frame, wxAuiMDIParentFrame))
{
wxAuiMDIParentFrame* mdi_frame = (wxAuiMDIParentFrame*)m_frame;
wxAuiMDIClientWindow* client_window = mdi_frame->GetClientWindow();
@ -1097,7 +1097,7 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& paneInfo)
if (pinfo.HasGripper())
{
if (pinfo.window->IsKindOf(CLASSINFO(wxAuiToolBar)))
if (wxDynamicCast(pinfo.window, wxAuiToolBar))
{
// prevent duplicate gripper -- both wxAuiManager and wxAuiToolBar
// have a gripper control. The toolbar's built-in gripper
@ -1117,7 +1117,7 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& paneInfo)
pinfo.best_size = pinfo.window->GetClientSize();
#if wxUSE_TOOLBAR
if (pinfo.window->IsKindOf(CLASSINFO(wxToolBar)))
if (wxDynamicCast(pinfo.window, wxToolBar))
{
// GetClientSize() doesn't get the best size for
// a toolbar under some newer versions of wxWidgets,
@ -3313,7 +3313,7 @@ void wxAuiManager::ShowHint(const wxRect& rect)
m_hintFadeAmt = m_hintFadeMax;
if ((m_flags & wxAUI_MGR_HINT_FADE)
&& !((m_hintWnd->IsKindOf(CLASSINFO(wxPseudoTransparentFrame))) &&
&& !((wxDynamicCast(m_hintWnd, wxPseudoTransparentFrame)) &&
(m_flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE))
)
m_hintFadeAmt = 0;
@ -3959,7 +3959,7 @@ void wxAuiManager::OnSize(wxSizeEvent& event)
Repaint();
#if wxUSE_MDI
if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame)))
if (wxDynamicCast(m_frame, wxMDIParentFrame))
{
// for MDI parent frames, this event must not
// be "skipped". In other words, the parent frame
@ -3983,7 +3983,7 @@ void wxAuiManager::OnFindManager(wxAuiManagerEvent& evt)
}
// if we are managing a child frame, get the 'real' manager
if (window->IsKindOf(CLASSINFO(wxAuiFloatingFrame)))
if (wxDynamicCast(window, wxAuiFloatingFrame))
{
wxAuiFloatingFrame* float_frame = static_cast<wxAuiFloatingFrame*>(window);
evt.SetManager(float_frame->GetOwnerManager());
@ -4126,7 +4126,7 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event)
if (part->pane &&
part->pane->window &&
managed_wnd &&
managed_wnd->IsKindOf(CLASSINFO(wxAuiFloatingFrame)))
wxDynamicCast(managed_wnd, wxAuiFloatingFrame))
{
wxAuiFloatingFrame* floating_frame = (wxAuiFloatingFrame*)managed_wnd;
wxAuiManager* owner_mgr = floating_frame->GetOwnerManager();
@ -4211,7 +4211,7 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event)
#if wxUSE_STATUSBAR
// if there's a status control, the available
// height decreases accordingly
if (m_frame && m_frame->IsKindOf(CLASSINFO(wxFrame)))
if (wxDynamicCast(m_frame, wxFrame))
{
wxFrame* frame = static_cast<wxFrame*>(m_frame);
wxStatusBar* status = frame->GetStatusBar();
@ -4640,7 +4640,7 @@ void wxAuiManager::OnMotion(wxMouseEvent& event)
// We can't move the child window so we need to get the frame that
// we want to be really moving. This is probably not the best place
// to do this but at least it fixes the bug (#13177) for now.
if (!m_actionWindow->IsKindOf(CLASSINFO(wxAuiFloatingFrame)))
if (!wxDynamicCast(m_actionWindow, wxAuiFloatingFrame))
{
wxAuiPaneInfo& pane = GetPane(m_actionWindow);
m_actionWindow = pane.frame;

View File

@ -517,7 +517,7 @@ bool wxComboPopupWindow::ProcessLeftDown(wxMouseEvent& event)
void wxComboPopupWindow::OnDismiss()
{
wxComboCtrlBase* combo = (wxComboCtrlBase*) GetParent();
wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxComboCtrlBase)),
wxASSERT_MSG( wxDynamicCast(combo, wxComboCtrlBase),
wxT("parent might not be wxComboCtrl, but check IMPLEMENT_DYNAMIC_CLASS(2) macro for correctness") );
combo->OnPopupDismiss(true);

View File

@ -405,7 +405,7 @@ wxFSFile* wxArchiveFSHandler::OpenFile(
}
#if WXWIN_COMPATIBILITY_2_6 && wxUSE_ZIPSTREAM
if (factory->IsKindOf(CLASSINFO(wxZipClassFactory)))
if (wxDynamicCast(factory, wxZipClassFactory))
((wxZipInputStream*)s)->m_allowSeeking = true;
#endif // WXWIN_COMPATIBILITY_2_6

View File

@ -399,7 +399,7 @@ wxConnectionBase *wxTCPClient::MakeConnection(const wxString& host,
if (connection)
{
if (connection->IsKindOf(CLASSINFO(wxTCPConnection)))
if (wxDynamicCast(connection, wxTCPConnection))
{
connection->m_topic = topic;
connection->m_sock = client;
@ -898,7 +898,7 @@ void wxTCPEventHandler::Server_OnRequest(wxSocketEvent &event)
if (new_connection)
{
if (new_connection->IsKindOf(CLASSINFO(wxTCPConnection)))
if (wxDynamicCast(new_connection, wxTCPConnection))
{
// Acknowledge success
out.Write8(IPC_CONNECT);

View File

@ -1275,7 +1275,7 @@ wxWindow* wxFindWindowAtPoint(wxWindow* win, const wxPoint& pt)
// Hack for wxNotebook case: at least in wxGTK, all pages
// claim to be shown, so we must only deal with the selected one.
#if wxUSE_NOTEBOOK
if (win->IsKindOf(CLASSINFO(wxNotebook)))
if (wxDynamicCast(win, wxNotebook))
{
wxNotebook* nb = (wxNotebook*) win;
int sel = nb->GetSelection();

View File

@ -136,7 +136,7 @@ bool wxGenericValidator::TransferToWindow(void)
// bool controls
#if wxUSE_CHECKBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) )
if (wxDynamicCast(m_validatorWindow, wxCheckBox))
{
wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow;
if (m_pBool)
@ -147,7 +147,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_RADIOBTN
if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) )
if (wxDynamicCast(m_validatorWindow, wxRadioButton))
{
wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow;
if (m_pBool)
@ -159,7 +159,7 @@ bool wxGenericValidator::TransferToWindow(void)
#endif
#if wxUSE_TOGGLEBTN
if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) )
if (wxDynamicCast(m_validatorWindow, wxToggleButton))
{
wxToggleButton * pControl = (wxToggleButton *) m_validatorWindow;
if (m_pBool)
@ -169,7 +169,7 @@ bool wxGenericValidator::TransferToWindow(void)
}
} else
#if (defined(__WXMAC__) || defined(__WXMSW__) || defined(__WXGTK20__)) && !defined(__WXUNIVERSAL__)
if (m_validatorWindow->IsKindOf(CLASSINFO(wxBitmapToggleButton)) )
if (wxDynamicCast(m_validatorWindow, wxBitmapToggleButton))
{
wxBitmapToggleButton * pControl = (wxBitmapToggleButton *) m_validatorWindow;
if (m_pBool)
@ -183,7 +183,7 @@ bool wxGenericValidator::TransferToWindow(void)
// int controls
#if wxUSE_GAUGE
if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) )
if (wxDynamicCast(m_validatorWindow, wxGauge))
{
wxGauge* pControl = (wxGauge*) m_validatorWindow;
if (m_pInt)
@ -194,7 +194,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_RADIOBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) )
if (wxDynamicCast(m_validatorWindow, wxRadioBox))
{
wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow;
if (m_pInt)
@ -205,7 +205,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_SCROLLBAR
if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) )
if (wxDynamicCast(m_validatorWindow, wxScrollBar))
{
wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow;
if (m_pInt)
@ -216,7 +216,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_SPINCTRL && !defined(__WXMOTIF__)
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) )
if (wxDynamicCast(m_validatorWindow, wxSpinCtrl))
{
wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow;
if (m_pInt)
@ -227,7 +227,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_SPINBTN
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
if (wxDynamicCast(m_validatorWindow, wxSpinButton))
{
wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
if (m_pInt)
@ -238,7 +238,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_SLIDER
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
if (wxDynamicCast(m_validatorWindow, wxSlider))
{
wxSlider* pControl = (wxSlider*) m_validatorWindow;
if (m_pInt)
@ -251,7 +251,7 @@ bool wxGenericValidator::TransferToWindow(void)
// date time controls
#if 0 // wxUSE_DATEPICKCTRL -- temporary fix for shared build linking
if (m_validatorWindow->IsKindOf(CLASSINFO(wxDatePickerCtrl)) )
if (wxDynamicCast(m_validatorWindow, wxDatePickerCtrl))
{
wxDatePickerCtrl* pControl = (wxDatePickerCtrl*) m_validatorWindow;
if (m_pDateTime)
@ -264,7 +264,7 @@ bool wxGenericValidator::TransferToWindow(void)
// string controls
#if wxUSE_BUTTON
if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
if (wxDynamicCast(m_validatorWindow, wxButton))
{
wxButton* pControl = (wxButton*) m_validatorWindow;
if (m_pString)
@ -275,7 +275,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_COMBOBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
if (wxDynamicCast(m_validatorWindow, wxComboBox))
{
wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
if (m_pInt)
@ -298,7 +298,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_CHOICE
if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
if (wxDynamicCast(m_validatorWindow, wxChoice))
{
wxChoice* pControl = (wxChoice*) m_validatorWindow;
if (m_pInt)
@ -317,7 +317,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_STATTEXT
if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
if (wxDynamicCast(m_validatorWindow, wxStaticText))
{
wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
if (m_pString)
@ -328,7 +328,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_TEXTCTRL
if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
if (wxDynamicCast(m_validatorWindow, wxTextCtrl))
{
wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow;
if (m_pString)
@ -364,7 +364,7 @@ bool wxGenericValidator::TransferToWindow(void)
// array controls
#if wxUSE_CHECKLISTBOX
// NOTE: wxCheckListBox is a wxListBox, so wxCheckListBox MUST come first:
if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
if (wxDynamicCast(m_validatorWindow, wxCheckListBox))
{
wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
if (m_pArrayInt)
@ -387,7 +387,7 @@ bool wxGenericValidator::TransferToWindow(void)
} else
#endif
#if wxUSE_LISTBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
if (wxDynamicCast(m_validatorWindow, wxListBox))
{
wxListBox* pControl = (wxListBox*) m_validatorWindow;
if (m_pArrayInt)
@ -422,7 +422,7 @@ bool wxGenericValidator::TransferFromWindow(void)
// BOOL CONTROLS **************************************
#if wxUSE_CHECKBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) )
if (wxDynamicCast(m_validatorWindow, wxCheckBox))
{
wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow;
if (m_pBool)
@ -433,7 +433,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_RADIOBTN
if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) )
if (wxDynamicCast(m_validatorWindow, wxRadioButton))
{
wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow;
if (m_pBool)
@ -444,7 +444,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_TOGGLEBTN
if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) )
if (wxDynamicCast(m_validatorWindow, wxToggleButton))
{
wxToggleButton *pControl = (wxToggleButton *) m_validatorWindow;
if (m_pBool)
@ -454,7 +454,7 @@ bool wxGenericValidator::TransferFromWindow(void)
}
} else
#if (defined(__WXMAC__) || defined(__WXMSW__) || defined(__WXGTK20__)) && !defined(__WXUNIVERSAL__)
if (m_validatorWindow->IsKindOf(CLASSINFO(wxBitmapToggleButton)) )
if (wxDynamicCast(m_validatorWindow, wxBitmapToggleButton))
{
wxBitmapToggleButton *pControl = (wxBitmapToggleButton *) m_validatorWindow;
if (m_pBool)
@ -468,7 +468,7 @@ bool wxGenericValidator::TransferFromWindow(void)
// INT CONTROLS ***************************************
#if wxUSE_GAUGE
if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) )
if (wxDynamicCast(m_validatorWindow, wxGauge))
{
wxGauge* pControl = (wxGauge*) m_validatorWindow;
if (m_pInt)
@ -479,7 +479,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_RADIOBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) )
if (wxDynamicCast(m_validatorWindow, wxRadioBox))
{
wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow;
if (m_pInt)
@ -490,7 +490,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_SCROLLBAR
if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) )
if (wxDynamicCast(m_validatorWindow, wxScrollBar))
{
wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow;
if (m_pInt)
@ -501,7 +501,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_SPINCTRL && !defined(__WXMOTIF__)
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) )
if (wxDynamicCast(m_validatorWindow, wxSpinCtrl))
{
wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow;
if (m_pInt)
@ -512,7 +512,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_SPINBTN
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
if (wxDynamicCast(m_validatorWindow, wxSpinButton))
{
wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
if (m_pInt)
@ -523,7 +523,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_SLIDER
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
if (wxDynamicCast(m_validatorWindow, wxSlider))
{
wxSlider* pControl = (wxSlider*) m_validatorWindow;
if (m_pInt)
@ -536,7 +536,7 @@ bool wxGenericValidator::TransferFromWindow(void)
// DATE TIME CONTROLS ************************************
#if 0 // wxUSE_DATEPICKCTRL -- temporary fix for shared build linking
if (m_validatorWindow->IsKindOf(CLASSINFO(wxDatePickerCtrl)) )
if (wxDynamicCast(m_validatorWindow, wxDatePickerCtrl))
{
wxDatePickerCtrl* pControl = (wxDatePickerCtrl*) m_validatorWindow;
if (m_pDateTime)
@ -549,7 +549,7 @@ bool wxGenericValidator::TransferFromWindow(void)
// STRING CONTROLS ************************************
#if wxUSE_BUTTON
if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
if (wxDynamicCast(m_validatorWindow, wxButton))
{
wxButton* pControl = (wxButton*) m_validatorWindow;
if (m_pString)
@ -560,7 +560,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_COMBOBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
if (wxDynamicCast(m_validatorWindow, wxComboBox))
{
wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
if (m_pInt)
@ -579,7 +579,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_CHOICE
if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
if (wxDynamicCast(m_validatorWindow, wxChoice))
{
wxChoice* pControl = (wxChoice*) m_validatorWindow;
if (m_pInt)
@ -595,7 +595,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_STATTEXT
if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
if (wxDynamicCast(m_validatorWindow, wxStaticText))
{
wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
if (m_pString)
@ -606,7 +606,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_TEXTCTRL
if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
if (wxDynamicCast(m_validatorWindow, wxTextCtrl))
{
wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow;
if (m_pString)
@ -640,7 +640,7 @@ bool wxGenericValidator::TransferFromWindow(void)
// ARRAY CONTROLS *************************************
#if wxUSE_CHECKLISTBOX
// NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first:
if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
if (wxDynamicCast(m_validatorWindow, wxCheckListBox))
{
wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
if (m_pArrayInt)
@ -664,7 +664,7 @@ bool wxGenericValidator::TransferFromWindow(void)
} else
#endif
#if wxUSE_LISTBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
if (wxDynamicCast(m_validatorWindow, wxListBox))
{
wxListBox* pControl = (wxListBox*) m_validatorWindow;
if (m_pArrayInt)

View File

@ -114,21 +114,21 @@ bool wxTextValidator::Copy(const wxTextValidator& val)
wxTextEntry *wxTextValidator::GetTextEntry()
{
#if wxUSE_TEXTCTRL
if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
if (wxDynamicCast(m_validatorWindow, wxTextCtrl))
{
return (wxTextCtrl*)m_validatorWindow;
}
#endif
#if wxUSE_COMBOBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)))
if (wxDynamicCast(m_validatorWindow, wxComboBox))
{
return (wxComboBox*)m_validatorWindow;
}
#endif
#if wxUSE_COMBOCTRL
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboCtrl)))
if (wxDynamicCast(m_validatorWindow, wxComboCtrl))
{
return (wxComboCtrl*)m_validatorWindow;
}

View File

@ -649,7 +649,7 @@ static bool wxHasRealChildren(const wxWindowBase* win)
wxWindow *win = node->GetData();
if ( !win->IsTopLevel() && win->IsShown()
#if wxUSE_SCROLLBAR
&& !win->IsKindOf(CLASSINFO(wxScrollBar))
&& !wxDynamicCast(win, wxScrollBar)
#endif
)
realChildCount ++;
@ -3511,7 +3511,7 @@ wxAccStatus wxWindowAccessible::GetLocation(wxRect& rect, int elementId)
if (win)
{
rect = win->GetRect();
if (win->GetParent() && !win->IsKindOf(CLASSINFO(wxTopLevelWindow)))
if (win->GetParent() && !wxDynamicCast(win, wxTopLevelWindow))
rect.SetPosition(win->GetParent()->ClientToScreen(rect.GetPosition()));
return wxACC_OK;
}
@ -3630,7 +3630,7 @@ wxAccStatus wxWindowAccessible::GetName(int childId, wxString* name)
// accessible classes, one for each kind of wxWidgets
// control or window.
#if wxUSE_BUTTON
if (GetWindow()->IsKindOf(CLASSINFO(wxButton)))
if (wxDynamicCast(GetWindow(), wxButton))
title = ((wxButton*) GetWindow())->GetLabel();
else
#endif
@ -3789,14 +3789,14 @@ wxAccStatus wxWindowAccessible::GetRole(int childId, wxAccRole* role)
if (childId > 0)
return wxACC_NOT_IMPLEMENTED;
if (GetWindow()->IsKindOf(CLASSINFO(wxControl)))
if (wxDynamicCast(GetWindow(), wxControl))
return wxACC_NOT_IMPLEMENTED;
#if wxUSE_STATUSBAR
if (GetWindow()->IsKindOf(CLASSINFO(wxStatusBar)))
if (wxDynamicCast(GetWindow(), wxStatusBar))
return wxACC_NOT_IMPLEMENTED;
#endif
#if wxUSE_TOOLBAR
if (GetWindow()->IsKindOf(CLASSINFO(wxToolBar)))
if (wxDynamicCast(GetWindow(), wxToolBar))
return wxACC_NOT_IMPLEMENTED;
#endif
@ -3821,15 +3821,15 @@ wxAccStatus wxWindowAccessible::GetState(int childId, long* state)
if (childId > 0)
return wxACC_NOT_IMPLEMENTED;
if (GetWindow()->IsKindOf(CLASSINFO(wxControl)))
if (wxDynamicCast(GetWindow(), wxControl))
return wxACC_NOT_IMPLEMENTED;
#if wxUSE_STATUSBAR
if (GetWindow()->IsKindOf(CLASSINFO(wxStatusBar)))
if (wxDynamicCast(GetWindow(), wxStatusBar))
return wxACC_NOT_IMPLEMENTED;
#endif
#if wxUSE_TOOLBAR
if (GetWindow()->IsKindOf(CLASSINFO(wxToolBar)))
if (wxDynamicCast(GetWindow(), wxToolBar))
return wxACC_NOT_IMPLEMENTED;
#endif

View File

@ -324,7 +324,7 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, wxW
wxSize sz = fullScreenRect->GetSize();
if (fullScreenRect->GetParent() && !fullScreenRect->IsKindOf(CLASSINFO(wxFrame)))
if (fullScreenRect->GetParent() && !wxDynamicCast(fullScreenRect, wxFrame))
fullScreenRect->GetParent()->ClientToScreen(& x, & y);
rect.x = x; rect.y = y;

View File

@ -238,7 +238,7 @@ bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow)
int leftMargin = 0, rightMargin = 0, topMargin = 0, bottomMargin = 0;
#if wxUSE_SASH
if (parent->IsKindOf(CLASSINFO(wxSashWindow)))
if (wxDynamicCast(parent, wxSashWindow))
{
wxSashWindow* sashWindow = (wxSashWindow*) parent;

View File

@ -372,7 +372,7 @@ void wxLogGui::DoLogRecord(wxLogLevel level,
// find the top window and set it's status text if it has any
if ( pFrame == NULL ) {
wxWindow *pWin = wxTheApp->GetTopWindow();
if ( pWin != NULL && pWin->IsKindOf(CLASSINFO(wxFrame)) ) {
if ( wxDynamicCast(pWin, wxFrame) ) {
pFrame = (wxFrame *)pWin;
}
}

View File

@ -163,7 +163,7 @@ wxCoord wxVListBoxComboPopup::OnMeasureItem(size_t n) const
{
wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo;
wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)),
wxASSERT_MSG( wxDynamicCast(combo, wxOwnerDrawnComboBox),
wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
wxCoord h = combo->OnMeasureItem(n);
@ -176,7 +176,7 @@ wxCoord wxVListBoxComboPopup::OnMeasureItemWidth(size_t n) const
{
wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo;
wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)),
wxASSERT_MSG( wxDynamicCast(combo, wxOwnerDrawnComboBox),
wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
return combo->OnMeasureItemWidth(n);
@ -189,7 +189,7 @@ void wxVListBoxComboPopup::OnDrawBg( wxDC& dc,
{
wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo;
wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)),
wxASSERT_MSG( wxDynamicCast(combo, wxOwnerDrawnComboBox),
wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
if ( IsCurrent((size_t)item) && !(flags & wxODCB_PAINTING_CONTROL) )
@ -208,7 +208,7 @@ void wxVListBoxComboPopup::OnDrawItem( wxDC& dc, const wxRect& rect, int item, i
{
wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo;
wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)),
wxASSERT_MSG( wxDynamicCast(combo, wxOwnerDrawnComboBox),
wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
combo->OnDrawItem(dc,rect,item,flags);

View File

@ -115,8 +115,8 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
// the area to draw on.
wxWindow* parent = this;
while (parent && !parent->IsKindOf(CLASSINFO(wxDialog)) &&
!parent->IsKindOf(CLASSINFO(wxFrame)))
while (parent && !wxDynamicCast(parent, wxDialog) &&
!wxDynamicCast(parent, wxFrame))
parent = parent->GetParent();
wxScreenDC::StartDrawingOnTop(parent);

View File

@ -145,7 +145,7 @@ static GdkWindow* wxGetGdkWindowForDC(wxWindow* win, wxDC& dc)
GdkWindow* gdk_window = NULL;
#if wxUSE_GRAPHICS_CONTEXT
if ( dc.IsKindOf( CLASSINFO(wxGCDC) ) )
if ( wxDynamicCast(&dc, wxGCDC) )
gdk_window = win->GTKGetDrawingWindow();
else
#endif

View File

@ -204,7 +204,7 @@ void wxHtmlHelpFrame::OnCloseWindow(wxCloseEvent& evt)
if (m_HtmlHelpWin->GetSplitterWindow() && m_HtmlHelpWin->GetCfgData().navig_on)
m_HtmlHelpWin->GetCfgData().sashpos = m_HtmlHelpWin->GetSplitterWindow()->GetSashPosition();
if (m_helpController && m_helpController->IsKindOf(CLASSINFO(wxHtmlHelpController)))
if (m_helpController && wxDynamicCast(m_helpController, wxHtmlHelpController))
{
((wxHtmlHelpController*) m_helpController)->OnCloseFrame(evt);
}

View File

@ -413,7 +413,7 @@ bool wxDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow*
wxSize sz = fullScreenRect->GetSize();
if (fullScreenRect->GetParent() && !fullScreenRect->IsKindOf(CLASSINFO(wxFrame)))
if (fullScreenRect->GetParent() && !wxDynamicCast(fullScreenRect, wxFrame))
fullScreenRect->GetParent()->ClientToScreen(& x, & y);
rect.x = x; rect.y = y;

View File

@ -1475,7 +1475,7 @@ void wxListCtrl::InitEditControl(WXHWND hWnd)
wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass)
{
wxCHECK_MSG( textControlClass->IsKindOf(CLASSINFO(wxTextCtrl)), NULL,
wxCHECK_MSG( textControlClass->IsKindOf(wxCLASSINFO(wxTextCtrl)), NULL,
"control used for label editing must be a wxTextCtrl" );
// ListView_EditLabel requires that the list has focus.

View File

@ -1374,7 +1374,7 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF
while (node)
{
wxWindow *child = node->GetData();
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
if (wxDynamicCast(child, wxMDIChildFrame))
{
::RedrawWindow(GetHwndOf(child),
NULL,

View File

@ -409,7 +409,7 @@ wxWindow *wxWindowMSW::FindItemByHWND(WXHWND hWnd, bool controlOnly) const
if ( !controlOnly
#if wxUSE_CONTROLS
|| parent->IsKindOf(CLASSINFO(wxControl))
|| wxDynamicCast(parent, wxControl)
#endif // wxUSE_CONTROLS
)
{
@ -7386,7 +7386,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxIdleWakeUpModule, wxModule)
#if wxUSE_STATBOX
static void wxAdjustZOrder(wxWindow* parent)
{
if (parent->IsKindOf(CLASSINFO(wxStaticBox)))
if (wxDynamicCast(parent, wxStaticBox))
{
// Set the z-order correctly
SetWindowPos((HWND) parent->GetHWND(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);

View File

@ -457,7 +457,7 @@ wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgri
const wxPoint& pos,
const wxSize& sz ) const
{
wxCHECK_MSG( property->IsKindOf(CLASSINFO(wxDateProperty)),
wxCHECK_MSG( wxDynamicCast(property, wxDateProperty),
NULL,
wxT("DatePickerCtrl editor can only be used with wxDateProperty or derivative.") );
@ -498,7 +498,7 @@ void wxPGDatePickerCtrlEditor::UpdateControl( wxPGProperty* property,
wxWindow* wnd ) const
{
wxDatePickerCtrl* ctrl = (wxDatePickerCtrl*) wnd;
wxASSERT( ctrl && ctrl->IsKindOf(CLASSINFO(wxDatePickerCtrl)) );
wxASSERT( wxDynamicCast(ctrl, wxDatePickerCtrl) );
wxDateTime dateValue(wxInvalidDateTime);
wxVariant v(property->GetValue());
@ -523,7 +523,7 @@ bool wxPGDatePickerCtrlEditor::OnEvent( wxPropertyGrid* WXUNUSED(propgrid),
bool wxPGDatePickerCtrlEditor::GetValueFromControl( wxVariant& variant, wxPGProperty* WXUNUSED(property), wxWindow* wnd ) const
{
wxDatePickerCtrl* ctrl = (wxDatePickerCtrl*) wnd;
wxASSERT( ctrl && ctrl->IsKindOf(CLASSINFO(wxDatePickerCtrl)) );
wxASSERT( wxDynamicCast(ctrl, wxDatePickerCtrl) );
variant = ctrl->GetValue();
@ -534,7 +534,7 @@ void wxPGDatePickerCtrlEditor::SetValueToUnspecified( wxPGProperty* property,
wxWindow* wnd ) const
{
wxDatePickerCtrl* ctrl = (wxDatePickerCtrl*) wnd;
wxASSERT( ctrl && ctrl->IsKindOf(CLASSINFO(wxDatePickerCtrl)) );
wxASSERT( wxDynamicCast(ctrl, wxDatePickerCtrl) );
wxDateProperty* prop = wxDynamicCast(property, wxDateProperty);
@ -1320,7 +1320,7 @@ public:
const wxPropertyGrid* propertyGrid, wxPGProperty* property,
int WXUNUSED(column), int item, int WXUNUSED(flags) ) const
{
wxASSERT( property->IsKindOf(CLASSINFO(wxSystemColourProperty)) );
wxASSERT( wxDynamicCast(property, wxSystemColourProperty) );
wxSystemColourProperty* prop = wxStaticCast(property, wxSystemColourProperty);
dc.SetPen(*wxBLACK_PEN);

View File

@ -217,13 +217,13 @@ void wxPGEditor::SetControlAppearance( wxPropertyGrid* pg,
// Get old editor appearance
wxTextCtrl* tc = NULL;
wxComboCtrl* cb = NULL;
if ( ctrl->IsKindOf(CLASSINFO(wxTextCtrl)) )
if ( wxDynamicCast(ctrl, wxTextCtrl) )
{
tc = (wxTextCtrl*) ctrl;
}
else
{
if ( ctrl->IsKindOf(CLASSINFO(wxComboCtrl)) )
if ( wxDynamicCast(ctrl, wxComboCtrl) )
{
cb = (wxComboCtrl*) ctrl;
tc = cb->GetTextCtrl();
@ -343,7 +343,7 @@ wxPGWindowList wxPGTextCtrlEditor::CreateControls( wxPropertyGrid* propGrid,
int flags = 0;
if ( (property->GetFlags() & wxPG_PROP_PASSWORD) &&
property->IsKindOf(CLASSINFO(wxStringProperty)) )
wxDynamicCast(property, wxStringProperty) )
flags |= wxTE_PASSWORD;
wxWindow* wnd = propGrid->GenerateEditorTextCtrl(pos,sz,text,NULL,flags,
@ -547,7 +547,7 @@ protected:
int evtType = event.GetEventType();
if ( m_property->HasFlag(wxPG_PROP_USE_DCC) &&
m_property->IsKindOf(CLASSINFO(wxBoolProperty)) &&
wxDynamicCast(m_property, wxBoolProperty) &&
!m_combo->IsPopupShown() )
{
// Just check that it is in the text area
@ -1021,7 +1021,7 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
int odcbFlags = extraStyle | wxBORDER_NONE | wxTE_PROCESS_ENTER;
if ( (property->GetFlags() & wxPG_PROP_USE_DCC) &&
(property->IsKindOf(CLASSINFO(wxBoolProperty)) ) )
wxDynamicCast(property, wxBoolProperty) )
odcbFlags |= wxODCB_DCLICK_CYCLES;
//
@ -1092,7 +1092,7 @@ void wxPGChoiceEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) c
{
wxASSERT( ctrl );
wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl;
wxASSERT( cb->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)));
wxASSERT( wxDynamicCast(cb, wxOwnerDrawnComboBox));
int ind = property->GetChoiceSelection();
cb->SetSelection(ind);
}
@ -1108,7 +1108,7 @@ int wxPGChoiceEditor::InsertItem( wxWindow* ctrl, const wxString& label, int ind
{
wxASSERT( ctrl );
wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl;
wxASSERT( cb->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)));
wxASSERT( wxDynamicCast(cb, wxOwnerDrawnComboBox));
if (index < 0)
index = cb->GetCount();
@ -1121,7 +1121,7 @@ void wxPGChoiceEditor::DeleteItem( wxWindow* ctrl, int index ) const
{
wxASSERT( ctrl );
wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl;
wxASSERT( cb->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)));
wxASSERT( wxDynamicCast(cb, wxOwnerDrawnComboBox));
cb->Delete(index);
}
@ -1590,7 +1590,7 @@ void wxSimpleCheckBox::SetValue( int value )
wxCommandEvent evt(wxEVT_COMMAND_CHECKBOX_CLICKED,GetParent()->GetId());
wxPropertyGrid* propGrid = (wxPropertyGrid*) GetParent();
wxASSERT( propGrid->IsKindOf(CLASSINFO(wxPropertyGrid)) );
wxASSERT( wxDynamicCast(propGrid, wxPropertyGrid) );
propGrid->HandleCustomEditorEvent(evt);
}
@ -1763,7 +1763,7 @@ void wxPropertyGrid::CorrectEditorWidgetSizeX()
#ifdef __WXMAC__
if ( m_wndEditor )
#else
if ( m_wndEditor && m_wndEditor->IsKindOf(CLASSINFO(wxTextCtrl)) )
if ( wxDynamicCast(m_wndEditor, wxTextCtrl) )
#endif
secWid += wxPG_TEXTCTRL_AND_BUTTON_SPACING;
}
@ -2093,10 +2093,10 @@ wxTextCtrl* wxPropertyGrid::GetEditorTextCtrl() const
if ( !wnd )
return NULL;
if ( wnd->IsKindOf(CLASSINFO(wxTextCtrl)) )
if ( wxDynamicCast(wnd, wxTextCtrl) )
return wxStaticCast(wnd, wxTextCtrl);
if ( wnd->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)) )
if ( wxDynamicCast(wnd, wxOwnerDrawnComboBox) )
{
wxOwnerDrawnComboBox* cb = wxStaticCast(wnd, wxOwnerDrawnComboBox);
return cb->GetTextCtrl();

View File

@ -3058,7 +3058,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
if ( changedProperty == GetSelection() )
{
wxWindow* editor = GetEditorControl();
wxASSERT( editor->IsKindOf(CLASSINFO(wxTextCtrl)) );
wxASSERT( wxDynamicCast(editor, wxTextCtrl) );
evtChangingValue = wxStaticCast(editor, wxTextCtrl)->GetValue();
}
else
@ -3113,7 +3113,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
wxStatusBar* wxPropertyGrid::GetStatusBar()
{
wxWindow* topWnd = ::wxGetTopLevelParent(this);
if ( topWnd && topWnd->IsKindOf(CLASSINFO(wxFrame)) )
if ( wxDynamicCast(topWnd, wxFrame) )
{
wxFrame* pFrame = wxStaticCast(topWnd, wxFrame);
if ( pFrame )
@ -3196,7 +3196,7 @@ bool wxPropertyGrid::OnValidationFailure( wxPGProperty* property,
//
// For non-wxTextCtrl editors, we do need to revert the value
if ( !editor->IsKindOf(CLASSINFO(wxTextCtrl)) &&
if ( !wxDynamicCast(editor, wxTextCtrl) &&
property == GetSelection() )
{
property->GetEditorClass()->UpdateControl(property, editor);
@ -3562,7 +3562,7 @@ bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
// Filter out excess wxTextCtrl modified events
if ( event.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED && wnd )
{
if ( wnd->IsKindOf(CLASSINFO(wxTextCtrl)) )
if ( wxDynamicCast(wnd, wxTextCtrl) )
{
wxTextCtrl* tc = (wxTextCtrl*) wnd;
@ -3571,12 +3571,12 @@ bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
return true;
m_prevTcValue = newTcValue;
}
else if ( wnd->IsKindOf(CLASSINFO(wxComboCtrl)) )
else if ( wxDynamicCast(wnd, wxComboCtrl) )
{
// In some cases we might stumble unintentionally on
// wxComboCtrl's embedded wxTextCtrl's events. Let's
// avoid them.
if ( editorWnd->IsKindOf(CLASSINFO(wxTextCtrl)) )
if ( wxDynamicCast(editorWnd, wxTextCtrl) )
return false;
wxComboCtrl* cc = (wxComboCtrl*) wnd;
@ -5244,7 +5244,7 @@ bool wxPropertyGrid::OnMouseCommon( wxMouseEvent& event, int* px, int* py )
// Hide popup on clicks
if ( event.GetEventType() != wxEVT_MOTION )
if ( wnd && wnd->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)) )
if ( wxDynamicCast(wnd, wxOwnerDrawnComboBox) )
{
((wxOwnerDrawnComboBox*)wnd)->HidePopup();
}

View File

@ -203,7 +203,7 @@ bool wxNumericPropertyValidator::Validate(wxWindow* parent)
return false;
wxWindow* wnd = GetWindow();
if ( !wnd->IsKindOf(CLASSINFO(wxTextCtrl)) )
if ( !wxDynamicCast(wnd, wxTextCtrl) )
return true;
// Do not allow zero-length string
@ -1080,7 +1080,7 @@ bool wxEnumProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& WXUNUS
// unless property has string as preferred value type
// To reduce code size, use conversion here as well
if ( value.GetType() == wxPG_VARIANT_TYPE_STRING &&
!this->IsKindOf(CLASSINFO(wxEditEnumProperty)) )
!wxDynamicCastThis(wxEditEnumProperty) )
return ValueFromString_( value, value.GetString(), wxPG_PROPERTY_SPECIFIC );
return true;
@ -1683,7 +1683,7 @@ bool wxPGFileDialogAdapter::DoShowDialog( wxPropertyGrid* propGrid, wxPGProperty
wxString path;
int indFilter = -1;
if ( property->IsKindOf(CLASSINFO(wxFileProperty)) )
if ( wxDynamicCast(property, wxFileProperty) )
{
fileProp = ((wxFileProperty*)property);
wxFileName filename = fileProp->GetValue().GetString();

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;

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()))
{

View File

@ -553,7 +553,7 @@ void wxRichTextFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
wxRichTextFormattingDialog* wxRichTextFormattingDialog::GetDialog(wxWindow* win)
{
wxWindow* p = win->GetParent();
while (p && !p->IsKindOf(CLASSINFO(wxRichTextFormattingDialog)))
while (p && !wxDynamicCast(p, wxRichTextFormattingDialog))
p = p->GetParent();
wxRichTextFormattingDialog* dialog = wxDynamicCast(p, wxRichTextFormattingDialog);
return dialog;
@ -709,7 +709,7 @@ void wxRichTextColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event)
if (event.LeftDown())
{
wxWindow* parent = GetParent();
while (parent != NULL && !parent->IsKindOf(CLASSINFO(wxDialog)) && !parent->IsKindOf(CLASSINFO(wxFrame)))
while (parent != NULL && !wxDynamicCast(parent, wxDialog) && !wxDynamicCast(parent, wxFrame))
parent = parent->GetParent();
wxColourData data;

View File

@ -711,19 +711,19 @@ void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event
int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR;
if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
if (wxDynamicCast(def, wxRichTextCharacterStyleDefinition))
{
pages |= wxRICHTEXT_FORMAT_FONT;
}
else if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
else if (wxDynamicCast(def, wxRichTextListStyleDefinition))
{
pages |= wxRICHTEXT_FORMAT_LIST_STYLE|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING;
}
else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
else if (wxDynamicCast(def, wxRichTextParagraphStyleDefinition))
{
pages |= wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
}
else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
else if (wxDynamicCast(def, wxRichTextBoxStyleDefinition))
{
pages |= wxRICHTEXT_FORMAT_MARGINS|wxRICHTEXT_FORMAT_SIZE|wxRICHTEXT_FORMAT_BORDERS|wxRICHTEXT_FORMAT_BACKGROUND;
}
@ -788,13 +788,13 @@ void wxRichTextStyleOrganiserDialog::OnDeleteClick( wxCommandEvent& WXUNUSED(eve
{
m_stylesListBox->GetStyleListBox()->SetItemCount(0);
if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
if (wxDynamicCast(def, wxRichTextListStyleDefinition))
GetStyleSheet()->RemoveListStyle((wxRichTextListStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
else if (wxDynamicCast(def, wxRichTextParagraphStyleDefinition))
GetStyleSheet()->RemoveParagraphStyle((wxRichTextParagraphStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
else if (wxDynamicCast(def, wxRichTextCharacterStyleDefinition))
GetStyleSheet()->RemoveCharacterStyle((wxRichTextCharacterStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
else if (wxDynamicCast(def, wxRichTextBoxStyleDefinition))
GetStyleSheet()->RemoveBoxStyle((wxRichTextBoxStyleDefinition*) def, true);
m_stylesListBox->UpdateStyles();

View File

@ -310,7 +310,7 @@ wxIcon wxRichTextStylePage::GetIconResource( const wxString& name )
void wxRichTextStylePage::OnNextStyleUpdate( wxUpdateUIEvent& event )
{
wxRichTextStyleDefinition* def = wxRichTextFormattingDialog::GetDialogStyleDefinition(this);
event.Enable(def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)));
event.Enable(wxDynamicCast(def, wxRichTextParagraphStyleDefinition));
}
#endif // wxUSE_RICHTEXT