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

View File

@@ -822,7 +822,7 @@ void wxAuiManager::UpdateHintWindowConfig()
wxWindow* w = m_frame; wxWindow* w = m_frame;
while (w) while (w)
{ {
if (w->IsKindOf(CLASSINFO(wxFrame))) if (wxDynamicCast(w, wxFrame))
{ {
wxFrame* f = static_cast<wxFrame*>(w); wxFrame* f = static_cast<wxFrame*>(w);
can_do_transparent = f->CanSetTransparent(); 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 // we need to add the MDI client window as the default
// center pane // center pane
if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame))) if (wxDynamicCast(m_frame, wxMDIParentFrame))
{ {
wxMDIParentFrame* mdi_frame = (wxMDIParentFrame*)m_frame; wxMDIParentFrame* mdi_frame = (wxMDIParentFrame*)m_frame;
wxWindow* client_window = mdi_frame->GetClientWindow(); wxWindow* client_window = mdi_frame->GetClientWindow();
@@ -924,7 +924,7 @@ void wxAuiManager::SetManagedWindow(wxWindow* wnd)
wxAuiPaneInfo().Name(wxT("mdiclient")). wxAuiPaneInfo().Name(wxT("mdiclient")).
CenterPane().PaneBorder(false)); CenterPane().PaneBorder(false));
} }
else if (m_frame->IsKindOf(CLASSINFO(wxAuiMDIParentFrame))) else if (wxDynamicCast(m_frame, wxAuiMDIParentFrame))
{ {
wxAuiMDIParentFrame* mdi_frame = (wxAuiMDIParentFrame*)m_frame; wxAuiMDIParentFrame* mdi_frame = (wxAuiMDIParentFrame*)m_frame;
wxAuiMDIClientWindow* client_window = mdi_frame->GetClientWindow(); wxAuiMDIClientWindow* client_window = mdi_frame->GetClientWindow();
@@ -1097,7 +1097,7 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& paneInfo)
if (pinfo.HasGripper()) if (pinfo.HasGripper())
{ {
if (pinfo.window->IsKindOf(CLASSINFO(wxAuiToolBar))) if (wxDynamicCast(pinfo.window, wxAuiToolBar))
{ {
// prevent duplicate gripper -- both wxAuiManager and wxAuiToolBar // prevent duplicate gripper -- both wxAuiManager and wxAuiToolBar
// have a gripper control. The toolbar's built-in gripper // 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(); pinfo.best_size = pinfo.window->GetClientSize();
#if wxUSE_TOOLBAR #if wxUSE_TOOLBAR
if (pinfo.window->IsKindOf(CLASSINFO(wxToolBar))) if (wxDynamicCast(pinfo.window, wxToolBar))
{ {
// GetClientSize() doesn't get the best size for // GetClientSize() doesn't get the best size for
// a toolbar under some newer versions of wxWidgets, // a toolbar under some newer versions of wxWidgets,
@@ -3313,7 +3313,7 @@ void wxAuiManager::ShowHint(const wxRect& rect)
m_hintFadeAmt = m_hintFadeMax; m_hintFadeAmt = m_hintFadeMax;
if ((m_flags & wxAUI_MGR_HINT_FADE) 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_flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE))
) )
m_hintFadeAmt = 0; m_hintFadeAmt = 0;
@@ -3959,7 +3959,7 @@ void wxAuiManager::OnSize(wxSizeEvent& event)
Repaint(); Repaint();
#if wxUSE_MDI #if wxUSE_MDI
if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame))) if (wxDynamicCast(m_frame, wxMDIParentFrame))
{ {
// for MDI parent frames, this event must not // for MDI parent frames, this event must not
// be "skipped". In other words, the parent frame // 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 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); wxAuiFloatingFrame* float_frame = static_cast<wxAuiFloatingFrame*>(window);
evt.SetManager(float_frame->GetOwnerManager()); evt.SetManager(float_frame->GetOwnerManager());
@@ -4126,7 +4126,7 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event)
if (part->pane && if (part->pane &&
part->pane->window && part->pane->window &&
managed_wnd && managed_wnd &&
managed_wnd->IsKindOf(CLASSINFO(wxAuiFloatingFrame))) wxDynamicCast(managed_wnd, wxAuiFloatingFrame))
{ {
wxAuiFloatingFrame* floating_frame = (wxAuiFloatingFrame*)managed_wnd; wxAuiFloatingFrame* floating_frame = (wxAuiFloatingFrame*)managed_wnd;
wxAuiManager* owner_mgr = floating_frame->GetOwnerManager(); wxAuiManager* owner_mgr = floating_frame->GetOwnerManager();
@@ -4211,7 +4211,7 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// if there's a status control, the available // if there's a status control, the available
// height decreases accordingly // height decreases accordingly
if (m_frame && m_frame->IsKindOf(CLASSINFO(wxFrame))) if (wxDynamicCast(m_frame, wxFrame))
{ {
wxFrame* frame = static_cast<wxFrame*>(m_frame); wxFrame* frame = static_cast<wxFrame*>(m_frame);
wxStatusBar* status = frame->GetStatusBar(); 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 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 // 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. // 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); wxAuiPaneInfo& pane = GetPane(m_actionWindow);
m_actionWindow = pane.frame; m_actionWindow = pane.frame;

View File

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

View File

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

View File

@@ -399,7 +399,7 @@ wxConnectionBase *wxTCPClient::MakeConnection(const wxString& host,
if (connection) if (connection)
{ {
if (connection->IsKindOf(CLASSINFO(wxTCPConnection))) if (wxDynamicCast(connection, wxTCPConnection))
{ {
connection->m_topic = topic; connection->m_topic = topic;
connection->m_sock = client; connection->m_sock = client;
@@ -898,7 +898,7 @@ void wxTCPEventHandler::Server_OnRequest(wxSocketEvent &event)
if (new_connection) if (new_connection)
{ {
if (new_connection->IsKindOf(CLASSINFO(wxTCPConnection))) if (wxDynamicCast(new_connection, wxTCPConnection))
{ {
// Acknowledge success // Acknowledge success
out.Write8(IPC_CONNECT); 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 // Hack for wxNotebook case: at least in wxGTK, all pages
// claim to be shown, so we must only deal with the selected one. // claim to be shown, so we must only deal with the selected one.
#if wxUSE_NOTEBOOK #if wxUSE_NOTEBOOK
if (win->IsKindOf(CLASSINFO(wxNotebook))) if (wxDynamicCast(win, wxNotebook))
{ {
wxNotebook* nb = (wxNotebook*) win; wxNotebook* nb = (wxNotebook*) win;
int sel = nb->GetSelection(); int sel = nb->GetSelection();

View File

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

View File

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

View File

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

View File

@@ -324,7 +324,7 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, wxW
wxSize sz = fullScreenRect->GetSize(); wxSize sz = fullScreenRect->GetSize();
if (fullScreenRect->GetParent() && !fullScreenRect->IsKindOf(CLASSINFO(wxFrame))) if (fullScreenRect->GetParent() && !wxDynamicCast(fullScreenRect, wxFrame))
fullScreenRect->GetParent()->ClientToScreen(& x, & y); fullScreenRect->GetParent()->ClientToScreen(& x, & y);
rect.x = x; rect.y = 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; int leftMargin = 0, rightMargin = 0, topMargin = 0, bottomMargin = 0;
#if wxUSE_SASH #if wxUSE_SASH
if (parent->IsKindOf(CLASSINFO(wxSashWindow))) if (wxDynamicCast(parent, wxSashWindow))
{ {
wxSashWindow* sashWindow = (wxSashWindow*) parent; 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 // find the top window and set it's status text if it has any
if ( pFrame == NULL ) { if ( pFrame == NULL ) {
wxWindow *pWin = wxTheApp->GetTopWindow(); wxWindow *pWin = wxTheApp->GetTopWindow();
if ( pWin != NULL && pWin->IsKindOf(CLASSINFO(wxFrame)) ) { if ( wxDynamicCast(pWin, wxFrame) ) {
pFrame = (wxFrame *)pWin; pFrame = (wxFrame *)pWin;
} }
} }

View File

@@ -163,7 +163,7 @@ wxCoord wxVListBoxComboPopup::OnMeasureItem(size_t n) const
{ {
wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo; 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") ); wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
wxCoord h = combo->OnMeasureItem(n); wxCoord h = combo->OnMeasureItem(n);
@@ -176,7 +176,7 @@ wxCoord wxVListBoxComboPopup::OnMeasureItemWidth(size_t n) const
{ {
wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo; 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") ); wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
return combo->OnMeasureItemWidth(n); return combo->OnMeasureItemWidth(n);
@@ -189,7 +189,7 @@ void wxVListBoxComboPopup::OnDrawBg( wxDC& dc,
{ {
wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo; 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") ); wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
if ( IsCurrent((size_t)item) && !(flags & wxODCB_PAINTING_CONTROL) ) 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; 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") ); wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
combo->OnDrawItem(dc,rect,item,flags); combo->OnDrawItem(dc,rect,item,flags);

View File

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

View File

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

View File

@@ -204,7 +204,7 @@ void wxHtmlHelpFrame::OnCloseWindow(wxCloseEvent& evt)
if (m_HtmlHelpWin->GetSplitterWindow() && m_HtmlHelpWin->GetCfgData().navig_on) if (m_HtmlHelpWin->GetSplitterWindow() && m_HtmlHelpWin->GetCfgData().navig_on)
m_HtmlHelpWin->GetCfgData().sashpos = m_HtmlHelpWin->GetSplitterWindow()->GetSashPosition(); 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); ((wxHtmlHelpController*) m_helpController)->OnCloseFrame(evt);
} }

View File

@@ -413,7 +413,7 @@ bool wxDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow*
wxSize sz = fullScreenRect->GetSize(); wxSize sz = fullScreenRect->GetSize();
if (fullScreenRect->GetParent() && !fullScreenRect->IsKindOf(CLASSINFO(wxFrame))) if (fullScreenRect->GetParent() && !wxDynamicCast(fullScreenRect, wxFrame))
fullScreenRect->GetParent()->ClientToScreen(& x, & y); fullScreenRect->GetParent()->ClientToScreen(& x, & y);
rect.x = x; rect.y = 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) 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" ); "control used for label editing must be a wxTextCtrl" );
// ListView_EditLabel requires that the list has focus. // 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) while (node)
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame))) if (wxDynamicCast(child, wxMDIChildFrame))
{ {
::RedrawWindow(GetHwndOf(child), ::RedrawWindow(GetHwndOf(child),
NULL, NULL,

View File

@@ -409,7 +409,7 @@ wxWindow *wxWindowMSW::FindItemByHWND(WXHWND hWnd, bool controlOnly) const
if ( !controlOnly if ( !controlOnly
#if wxUSE_CONTROLS #if wxUSE_CONTROLS
|| parent->IsKindOf(CLASSINFO(wxControl)) || wxDynamicCast(parent, wxControl)
#endif // wxUSE_CONTROLS #endif // wxUSE_CONTROLS
) )
{ {
@@ -7386,7 +7386,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxIdleWakeUpModule, wxModule)
#if wxUSE_STATBOX #if wxUSE_STATBOX
static void wxAdjustZOrder(wxWindow* parent) static void wxAdjustZOrder(wxWindow* parent)
{ {
if (parent->IsKindOf(CLASSINFO(wxStaticBox))) if (wxDynamicCast(parent, wxStaticBox))
{ {
// Set the z-order correctly // Set the z-order correctly
SetWindowPos((HWND) parent->GetHWND(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); 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 wxPoint& pos,
const wxSize& sz ) const const wxSize& sz ) const
{ {
wxCHECK_MSG( property->IsKindOf(CLASSINFO(wxDateProperty)), wxCHECK_MSG( wxDynamicCast(property, wxDateProperty),
NULL, NULL,
wxT("DatePickerCtrl editor can only be used with wxDateProperty or derivative.") ); wxT("DatePickerCtrl editor can only be used with wxDateProperty or derivative.") );
@@ -498,7 +498,7 @@ void wxPGDatePickerCtrlEditor::UpdateControl( wxPGProperty* property,
wxWindow* wnd ) const wxWindow* wnd ) const
{ {
wxDatePickerCtrl* ctrl = (wxDatePickerCtrl*) wnd; wxDatePickerCtrl* ctrl = (wxDatePickerCtrl*) wnd;
wxASSERT( ctrl && ctrl->IsKindOf(CLASSINFO(wxDatePickerCtrl)) ); wxASSERT( wxDynamicCast(ctrl, wxDatePickerCtrl) );
wxDateTime dateValue(wxInvalidDateTime); wxDateTime dateValue(wxInvalidDateTime);
wxVariant v(property->GetValue()); 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 bool wxPGDatePickerCtrlEditor::GetValueFromControl( wxVariant& variant, wxPGProperty* WXUNUSED(property), wxWindow* wnd ) const
{ {
wxDatePickerCtrl* ctrl = (wxDatePickerCtrl*) wnd; wxDatePickerCtrl* ctrl = (wxDatePickerCtrl*) wnd;
wxASSERT( ctrl && ctrl->IsKindOf(CLASSINFO(wxDatePickerCtrl)) ); wxASSERT( wxDynamicCast(ctrl, wxDatePickerCtrl) );
variant = ctrl->GetValue(); variant = ctrl->GetValue();
@@ -534,7 +534,7 @@ void wxPGDatePickerCtrlEditor::SetValueToUnspecified( wxPGProperty* property,
wxWindow* wnd ) const wxWindow* wnd ) const
{ {
wxDatePickerCtrl* ctrl = (wxDatePickerCtrl*) wnd; wxDatePickerCtrl* ctrl = (wxDatePickerCtrl*) wnd;
wxASSERT( ctrl && ctrl->IsKindOf(CLASSINFO(wxDatePickerCtrl)) ); wxASSERT( wxDynamicCast(ctrl, wxDatePickerCtrl) );
wxDateProperty* prop = wxDynamicCast(property, wxDateProperty); wxDateProperty* prop = wxDynamicCast(property, wxDateProperty);
@@ -1320,7 +1320,7 @@ public:
const wxPropertyGrid* propertyGrid, wxPGProperty* property, const wxPropertyGrid* propertyGrid, wxPGProperty* property,
int WXUNUSED(column), int item, int WXUNUSED(flags) ) const int WXUNUSED(column), int item, int WXUNUSED(flags) ) const
{ {
wxASSERT( property->IsKindOf(CLASSINFO(wxSystemColourProperty)) ); wxASSERT( wxDynamicCast(property, wxSystemColourProperty) );
wxSystemColourProperty* prop = wxStaticCast(property, wxSystemColourProperty); wxSystemColourProperty* prop = wxStaticCast(property, wxSystemColourProperty);
dc.SetPen(*wxBLACK_PEN); dc.SetPen(*wxBLACK_PEN);

View File

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

View File

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

View File

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

View File

@@ -1008,7 +1008,7 @@ void wxRichTextObject::Dump(wxTextOutputStream& stream)
wxRichTextBuffer* wxRichTextObject::GetBuffer() const wxRichTextBuffer* wxRichTextObject::GetBuffer() const
{ {
const wxRichTextObject* obj = this; const wxRichTextObject* obj = this;
while (obj && !obj->IsKindOf(CLASSINFO(wxRichTextBuffer))) while (obj && !wxDynamicCast(obj, wxRichTextBuffer))
obj = obj->GetParent(); obj = obj->GetParent();
return wxDynamicCast(obj, wxRichTextBuffer); return wxDynamicCast(obj, wxRichTextBuffer);
} }
@@ -3478,7 +3478,7 @@ bool wxRichTextParagraphLayoutBox::HasCharacterAttributes(const wxRichTextRange&
if (childRange.GetLength() == 0 && GetRange().GetLength() == 1) if (childRange.GetLength() == 0 && GetRange().GetLength() == 1)
childRange.SetEnd(childRange.GetEnd()+1); childRange.SetEnd(childRange.GetEnd()+1);
if (!childRange.IsOutside(range) && child->IsKindOf(CLASSINFO(wxRichTextPlainText))) if (!childRange.IsOutside(range) && wxDynamicCast(child, wxRichTextPlainText))
{ {
foundCount ++; foundCount ++;
wxRichTextAttr textAttr = para->GetCombinedAttributes(child->GetAttributes()); 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. // If floating, ignore. We already laid out floats.
// Also ignore if empty object, except if we haven't got any // Also ignore if empty object, except if we haven't got any
// size yet. // 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) if (child->GetCachedSize().x > minWidth)
minWidth = child->GetMinSize().x; 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; 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; flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY;
@@ -4154,7 +4154,7 @@ bool wxRichTextCtrl::ApplyStyle(wxRichTextStyleDefinition* def)
bool isPara = false; bool isPara = false;
// Make sure the attr has the style name // Make sure the attr has the style name
if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition))) if (wxDynamicCast(def, wxRichTextParagraphStyleDefinition))
{ {
isPara = true; isPara = true;
attr.SetParagraphStyleName(def->GetName()); attr.SetParagraphStyleName(def->GetName());
@@ -4164,12 +4164,12 @@ bool wxRichTextCtrl::ApplyStyle(wxRichTextStyleDefinition* def)
// to change its style independently. // to change its style independently.
flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY; flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY;
} }
else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition))) else if (wxDynamicCast(def, wxRichTextCharacterStyleDefinition))
attr.SetCharacterStyleName(def->GetName()); attr.SetCharacterStyleName(def->GetName());
else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition))) else if (wxDynamicCast(def, wxRichTextBoxStyleDefinition))
attr.GetTextBoxAttr().SetBoxStyleName(def->GetName()); attr.GetTextBoxAttr().SetBoxStyleName(def->GetName());
if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition))) if (wxDynamicCast(def, wxRichTextBoxStyleDefinition))
{ {
if (GetFocusObject() && (GetFocusObject() != & GetBuffer())) if (GetFocusObject() && (GetFocusObject() != & GetBuffer()))
{ {

View File

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

View File

@@ -711,19 +711,19 @@ void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event
int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR; int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR;
if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition))) if (wxDynamicCast(def, wxRichTextCharacterStyleDefinition))
{ {
pages |= wxRICHTEXT_FORMAT_FONT; 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; 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; 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; 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); m_stylesListBox->GetStyleListBox()->SetItemCount(0);
if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition))) if (wxDynamicCast(def, wxRichTextListStyleDefinition))
GetStyleSheet()->RemoveListStyle((wxRichTextListStyleDefinition*) def, true); GetStyleSheet()->RemoveListStyle((wxRichTextListStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition))) else if (wxDynamicCast(def, wxRichTextParagraphStyleDefinition))
GetStyleSheet()->RemoveParagraphStyle((wxRichTextParagraphStyleDefinition*) def, true); GetStyleSheet()->RemoveParagraphStyle((wxRichTextParagraphStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition))) else if (wxDynamicCast(def, wxRichTextCharacterStyleDefinition))
GetStyleSheet()->RemoveCharacterStyle((wxRichTextCharacterStyleDefinition*) def, true); GetStyleSheet()->RemoveCharacterStyle((wxRichTextCharacterStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition))) else if (wxDynamicCast(def, wxRichTextBoxStyleDefinition))
GetStyleSheet()->RemoveBoxStyle((wxRichTextBoxStyleDefinition*) def, true); GetStyleSheet()->RemoveBoxStyle((wxRichTextBoxStyleDefinition*) def, true);
m_stylesListBox->UpdateStyles(); m_stylesListBox->UpdateStyles();

View File

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