save the Handler in OptionRow so a row can refresh itself without needing the Screen to Import/Export

This commit is contained in:
Chris Danford
2005-02-24 13:48:14 +00:00
parent ab22e629d4
commit fb4ab8886c
8 changed files with 34 additions and 19 deletions
+6 -4
View File
@@ -150,22 +150,24 @@ void ScreenOptions::LoadOptionIcon( PlayerNumber pn, int iRow, CString sText )
m_Rows[iRow]->LoadOptionIcon( pn, sText );
}
void ScreenOptions::InitMenu( InputMode im, OptionRowDefinition defs[], int iNumOptionLines, bool bShowUnderlines )
void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &vDefs, const vector<OptionRowHandler*> &vHands, bool bShowUnderlines )
{
LOG->Trace( "ScreenOptions::Set()" );
ASSERT( vDefs.size() == vHands.size() );
m_InputMode = im;
m_bShowUnderlines = bShowUnderlines;
Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") );
for( int r=0; r<iNumOptionLines; r++ ) // foreach row
for( unsigned r=0; r<vDefs.size(); r++ ) // foreach row
{
m_Rows.push_back( new OptionRow() );
OptionRow &row = *m_Rows.back();
row.LoadNormal( defs[r] );
row.LoadNormal( vDefs[r], vHands[r] );
this->ImportOptions( r );
@@ -1150,7 +1152,7 @@ void ScreenOptions::RefreshRowChoices( int r, const OptionRowDefinition &newdef
{
Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") );
row.Clear();
row.LoadNormal( newdef );
row.LoadNormal( newdef, row.GetHandler() );
row.AfterImportOptions(
pFont,
ITEMS_START_X,