From 345c78ca5fa57ea6c7dc7e6a05496a8e82aa2b50 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 1 Jun 2012 11:01:18 +0000 Subject: [PATCH] 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 --- src/aui/auibook.cpp | 16 +++---- src/aui/framemanager.cpp | 22 ++++----- src/common/combocmn.cpp | 2 +- src/common/fs_arc.cpp | 2 +- src/common/sckipc.cpp | 4 +- src/common/utilscmn.cpp | 2 +- src/common/valgen.cpp | 72 +++++++++++++++--------------- src/common/valtext.cpp | 6 +-- src/common/wincmn.cpp | 18 ++++---- src/generic/dragimgg.cpp | 2 +- src/generic/laywin.cpp | 2 +- src/generic/logg.cpp | 2 +- src/generic/odcombo.cpp | 8 ++-- src/generic/sashwin.cpp | 4 +- src/gtk/renderer.cpp | 2 +- src/html/helpfrm.cpp | 2 +- src/msw/dragimag.cpp | 2 +- src/msw/listctrl.cpp | 2 +- src/msw/mdi.cpp | 2 +- src/msw/window.cpp | 4 +- src/propgrid/advprops.cpp | 10 ++--- src/propgrid/editors.cpp | 24 +++++----- src/propgrid/propgrid.cpp | 14 +++--- src/propgrid/props.cpp | 6 +-- src/richtext/richtextbuffer.cpp | 6 +-- src/richtext/richtextctrl.cpp | 10 ++--- src/richtext/richtextformatdlg.cpp | 4 +- src/richtext/richtextstyledlg.cpp | 16 +++---- src/richtext/richtextstylepage.cpp | 2 +- 29 files changed, 134 insertions(+), 134 deletions(-) diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 181defdb76..9288685eca 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -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(); } diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 3da7db209e..7526cf6938 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -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(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(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(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; diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 7679787977..8bd7e4cd71 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -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); diff --git a/src/common/fs_arc.cpp b/src/common/fs_arc.cpp index bd6c244f4b..4b4c382cac 100644 --- a/src/common/fs_arc.cpp +++ b/src/common/fs_arc.cpp @@ -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 diff --git a/src/common/sckipc.cpp b/src/common/sckipc.cpp index 31d1273191..0b5b834536 100644 --- a/src/common/sckipc.cpp +++ b/src/common/sckipc.cpp @@ -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); diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index d9ce6b56ff..535c455a66 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -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(); diff --git a/src/common/valgen.cpp b/src/common/valgen.cpp index 315d53a48c..58f633f499 100644 --- a/src/common/valgen.cpp +++ b/src/common/valgen.cpp @@ -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) diff --git a/src/common/valtext.cpp b/src/common/valtext.cpp index 43c87eb446..dced8ecb83 100644 --- a/src/common/valtext.cpp +++ b/src/common/valtext.cpp @@ -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; } diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index a2b359156c..d7d6453103 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -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 diff --git a/src/generic/dragimgg.cpp b/src/generic/dragimgg.cpp index 99286fbd28..d861987d17 100644 --- a/src/generic/dragimgg.cpp +++ b/src/generic/dragimgg.cpp @@ -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; diff --git a/src/generic/laywin.cpp b/src/generic/laywin.cpp index c532a2c0d2..51b6620189 100644 --- a/src/generic/laywin.cpp +++ b/src/generic/laywin.cpp @@ -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; diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index 8d7e4985f8..5c30264a17 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -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; } } diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp index 8d664eb25f..353790fe19 100644 --- a/src/generic/odcombo.cpp +++ b/src/generic/odcombo.cpp @@ -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); diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index aab0b33b90..0b8a17a8e4 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -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); diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index 248c9f7c47..5f74edc88b 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -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 diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index 8673493025..12d914ba2a 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -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); } diff --git a/src/msw/dragimag.cpp b/src/msw/dragimag.cpp index 17cad733bb..067d67608d 100644 --- a/src/msw/dragimag.cpp +++ b/src/msw/dragimag.cpp @@ -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; diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 1b0a6c74ac..ee3d370fb7 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -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. diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index dd19650db6..101e33ea65 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -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, diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 44af1d50be..c6f86a72b7 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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); diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index d0187762de..7c26ec6d07 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -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); diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index beb3e805aa..ca996be935 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -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(); diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 67959fbb7a..a4ceec111f 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -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(); } diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index 8bb315c708..12075f88db 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -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(); diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 4b99563db9..6567878d42 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -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; diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index 939c03de7e..9f90f65488 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -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())) { diff --git a/src/richtext/richtextformatdlg.cpp b/src/richtext/richtextformatdlg.cpp index 62e92b9ff3..2ec7304c44 100644 --- a/src/richtext/richtextformatdlg.cpp +++ b/src/richtext/richtextformatdlg.cpp @@ -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; diff --git a/src/richtext/richtextstyledlg.cpp b/src/richtext/richtextstyledlg.cpp index f190e700e8..40705cff21 100644 --- a/src/richtext/richtextstyledlg.cpp +++ b/src/richtext/richtextstyledlg.cpp @@ -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(); diff --git a/src/richtext/richtextstylepage.cpp b/src/richtext/richtextstylepage.cpp index 7dedcd1783..bb646168a3 100644 --- a/src/richtext/richtextstylepage.cpp +++ b/src/richtext/richtextstylepage.cpp @@ -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 -- 2.45.2