* Use dynamic_cast<T*> instead of a C-style (T*) cast (dynamic_cast is safer since it walks the inheritance tree to check whether the pointer is actually of type T)

* Also dynamic_cast<T*> (which is compiler supported) should not be slower (if not faster) than wxWidgets' own RTTI implementation (t*)->IsKindOf(CLASSINFO(T))

This _does_ require RTTI to be enabled in wxWidgets' compilation; just enabling RTTI (as a compiler option) will only increase binary size, it should not add runtime overhead

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2264 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-07-29 16:45:40 +00:00
parent bab9bd3316
commit 0a310fdd5c
2 changed files with 13 additions and 13 deletions

View File

@ -65,15 +65,15 @@ AutoFlagDialog::AutoFlagDialog(wxWindow* parent,
{ {
//(*Initialize(AutoFlagDialog) //(*Initialize(AutoFlagDialog)
wxXmlResource::Get()->LoadObject(this,parent,_T("AutoFlagDialog"),_T("wxDialog")); wxXmlResource::Get()->LoadObject(this,parent,_T("AutoFlagDialog"),_T("wxDialog"));
Degree0_RadioButton = (wxRadioButton*)FindWindow(XRCID("ID_RADIO_0DEGREE")); Degree0_RadioButton = dynamic_cast<wxRadioButton*>(FindWindow(XRCID("ID_RADIO_0DEGREE")));
Degree90_RadioButton = (wxRadioButton*)FindWindow(XRCID("ID_RADIO_90DEGREE")); Degree90_RadioButton = dynamic_cast<wxRadioButton*>(FindWindow(XRCID("ID_RADIO_90DEGREE")));
Degree180_RadioButton = (wxRadioButton*)FindWindow(XRCID("ID_RADIO_180DEGREE")); Degree180_RadioButton = dynamic_cast<wxRadioButton*>(FindWindow(XRCID("ID_RADIO_180DEGREE")));
Degree270_RadioButton = (wxRadioButton*)FindWindow(XRCID("ID_RADIO_270DEGREE")); Degree270_RadioButton = dynamic_cast<wxRadioButton*>(FindWindow(XRCID("ID_RADIO_270DEGREE")));
XFlip_CheckBox = (wxCheckBox*)FindWindow(XRCID("ID_CHK_XFLIP")); XFlip_CheckBox = dynamic_cast<wxCheckBox*>(FindWindow(XRCID("ID_CHK_XFLIP")));
YFlip_CheckBox = (wxCheckBox*)FindWindow(XRCID("ID_CHK_YFLIP")); YFlip_CheckBox = dynamic_cast<wxCheckBox*>(FindWindow(XRCID("ID_CHK_YFLIP")));
RandRotate_CheckBox = (wxCheckBox*)FindWindow(XRCID("ID_CHK_RANDROTATE")); RandRotate_CheckBox = dynamic_cast<wxCheckBox*>(FindWindow(XRCID("ID_CHK_RANDROTATE")));
RandXFlip_CheckBox = (wxCheckBox*)FindWindow(XRCID("ID_CHK_RANDXFLIP")); RandXFlip_CheckBox = dynamic_cast<wxCheckBox*>(FindWindow(XRCID("ID_CHK_RANDXFLIP")));
RandYFlip_CheckBox = (wxCheckBox*)FindWindow(XRCID("ID_CHK_RANDYFLIP")); RandYFlip_CheckBox = dynamic_cast<wxCheckBox*>(FindWindow(XRCID("ID_CHK_RANDYFLIP")));
Connect(XRCID("ID_RADIO_0DEGREE"),wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&AutoFlagDialog::OnRotate); Connect(XRCID("ID_RADIO_0DEGREE"),wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&AutoFlagDialog::OnRotate);
Connect(XRCID("ID_RADIO_90DEGREE"),wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&AutoFlagDialog::OnRotate); Connect(XRCID("ID_RADIO_90DEGREE"),wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&AutoFlagDialog::OnRotate);
Connect(XRCID("ID_RADIO_180DEGREE"),wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&AutoFlagDialog::OnRotate); Connect(XRCID("ID_RADIO_180DEGREE"),wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&AutoFlagDialog::OnRotate);

View File

@ -61,10 +61,10 @@ SaveSegmentDialog::SaveSegmentDialog(wxWindow* parent,
{ {
//(*Initialize(SaveSegmentDialog) //(*Initialize(SaveSegmentDialog)
wxXmlResource::Get()->LoadObject(this,parent,_T("SaveSegmentDialog"),_T("wxDialog")); wxXmlResource::Get()->LoadObject(this,parent,_T("SaveSegmentDialog"),_T("wxDialog"));
StartX_TextCtrl = (wxTextCtrl*)FindWindow(XRCID("ID_TEXT_STARTX")); StartX_TextCtrl = dynamic_cast<wxTextCtrl*>(FindWindow(XRCID("ID_TEXT_STARTX")));
StartY_TextCtrl = (wxTextCtrl*)FindWindow(XRCID("ID_TEXT_STARTY")); StartY_TextCtrl = dynamic_cast<wxTextCtrl*>(FindWindow(XRCID("ID_TEXT_STARTY")));
Width_TextCtrl = (wxTextCtrl*)FindWindow(XRCID("ID_TEXT_WIDTH")); Width_TextCtrl = dynamic_cast<wxTextCtrl*>(FindWindow(XRCID("ID_TEXT_WIDTH")));
Height_TextCtrl = (wxTextCtrl*)FindWindow(XRCID("ID_TEXT_HEIGHT")); Height_TextCtrl = dynamic_cast<wxTextCtrl*>(FindWindow(XRCID("ID_TEXT_HEIGHT")));
//*) //*)
// Make sure all characters entered into these text controls // Make sure all characters entered into these text controls