Some WrappedType members just for radio buttons are no longer needed

This commit is contained in:
Paul Licameli 2019-04-01 11:30:38 -04:00
parent c8a8c6a3fa
commit 89f3369556
3 changed files with 8 additions and 63 deletions

View File

@ -1463,7 +1463,13 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedTy
mpWind = pRadioButton = safenew wxRadioButton(GetParent(), miId, Prompt,
wxDefaultPosition, wxDefaultSize,
(mRadioCount==1)?wxRB_GROUP:0);
pRadioButton->SetValue(WrappedRef.ValuesMatch( *mRadioValue ));
wxASSERT( WrappedRef.IsString() );
wxASSERT( mRadioValue->IsString() );
const bool value =
(WrappedRef.ReadAsString() == mRadioValue->ReadAsString() );
pRadioButton->SetValue( value );
pRadioButton->SetName(wxStripMenuCodes(Prompt));
UpdateSizers();
}
@ -1476,9 +1482,7 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedTy
pRadioButton = wxDynamicCast(pWnd, wxRadioButton);
wxASSERT( pRadioButton );
if( pRadioButton->GetValue() )
{
mRadioValue->WriteToAsWrappedType( WrappedRef );
}
mRadioValue->WriteToAsString( WrappedRef.ReadAsString() );
}
break;
default:

View File

@ -37,62 +37,6 @@ bool WrappedType::IsString()
return eWrappedType == eWrappedString;
}
/// @param W Wrapped type to compare
/// @return true iff types and values are the same.
bool WrappedType::ValuesMatch( const WrappedType & W )
{
if( W.eWrappedType != eWrappedType )
return false;
switch( eWrappedType )
{
case eWrappedString:
return *W.mpStr == *mpStr;
break;
case eWrappedInt:
return *W.mpInt == *mpInt;
break;
case eWrappedDouble:
return *W.mpDouble == *mpDouble;
break;
case eWrappedBool:
return *W.mpBool == *mpBool;
break;
case eWrappedEnum:
wxASSERT( false );
break;
default:
wxASSERT( false );
break;
}
return false;
}
void WrappedType::WriteToAsWrappedType( const WrappedType & W )
{
wxASSERT( W.eWrappedType == eWrappedType );
switch( eWrappedType )
{
case eWrappedString:
*mpStr = *W.mpStr;
break;
case eWrappedInt:
*mpInt = *W.mpInt;
break;
case eWrappedDouble:
*mpDouble = *W.mpDouble;
break;
case eWrappedBool:
*mpBool = *W.mpBool;
break;
case eWrappedEnum:
wxASSERT( false );
break;
default:
wxASSERT( false );
break;
}
}
wxString WrappedType::ReadAsString()

View File

@ -59,9 +59,6 @@ public:
void WriteToAsDouble( const double InDouble);
void WriteToAsBool( const bool InBool);
bool ValuesMatch( const WrappedType & W );
void WriteToAsWrappedType( const WrappedType & W );
public :
const teWrappedType eWrappedType;