use BitmapText::CropToWidth instead
This commit is contained in:
@@ -34,8 +34,7 @@ void ModIcon::Load( RString sMetricsGroup )
|
|||||||
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_text, sMetricsGroup );
|
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_text, sMetricsGroup );
|
||||||
this->AddChild( &m_text );
|
this->AddChild( &m_text );
|
||||||
|
|
||||||
CROP_TEXT_TO_LENGTH.Load( sMetricsGroup, "CropTextToLength" );
|
CROP_TEXT_TO_WIDTH.Load( sMetricsGroup, "CropTextToWidth" );
|
||||||
CROP_IF_LONGER_THAN.Load( sMetricsGroup, "CropIfLongerThan" );
|
|
||||||
|
|
||||||
Set("");
|
Set("");
|
||||||
}
|
}
|
||||||
@@ -62,10 +61,8 @@ void ModIcon::Set( const RString &_sText )
|
|||||||
m_sprFilled->SetVisible( !bVacant );
|
m_sprFilled->SetVisible( !bVacant );
|
||||||
m_sprEmpty->SetVisible( bVacant );
|
m_sprEmpty->SetVisible( bVacant );
|
||||||
|
|
||||||
if( (int)sText.length() > CROP_IF_LONGER_THAN )
|
|
||||||
sText = sText.Left(CROP_TEXT_TO_LENGTH);
|
|
||||||
|
|
||||||
m_text.SetText( sText );
|
m_text.SetText( sText );
|
||||||
|
m_text.CropToWidth( CROP_TEXT_TO_WIDTH );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ protected:
|
|||||||
AutoActor m_sprFilled;
|
AutoActor m_sprFilled;
|
||||||
AutoActor m_sprEmpty;
|
AutoActor m_sprEmpty;
|
||||||
|
|
||||||
ThemeMetric<int> CROP_TEXT_TO_LENGTH;
|
ThemeMetric<int> CROP_TEXT_TO_WIDTH;
|
||||||
ThemeMetric<int> CROP_IF_LONGER_THAN;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user