@ -145,9 +145,15 @@ void MessageBox::ApplySchemeSettings(IScheme *pScheme)
int wide , tall ;
int wide , tall ;
m_pMessageLabel - > GetContentSize ( wide , tall ) ;
m_pMessageLabel - > GetContentSize ( wide , tall ) ;
m_pMessageLabel - > SetSize ( wide , tall ) ;
m_pMessageLabel - > SetSize ( wide , tall ) ;
int indent = 100 ;
if ( IsProportional ( ) )
{
indent = scheme ( ) - > GetProportionalScaledValueEx ( GetScheme ( ) , 100 ) ;
}
wide + = 100 ;
wide + = indent ;
tall + = 100 ;
tall + = indent ;
SetSize ( wide , tall ) ;
SetSize ( wide , tall ) ;
if ( m_bShowMessageBoxOverCursor )
if ( m_bShowMessageBoxOverCursor )
@ -243,7 +249,7 @@ void MessageBox::ShowWindow(Frame *pFrameOver)
// Purpose: Put the text and OK buttons in correct place
// Purpose: Put the text and OK buttons in correct place
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void MessageBox : : PerformLayout ( )
void MessageBox : : PerformLayout ( )
{
{
int x , y , wide , tall ;
int x , y , wide , tall ;
GetClientArea ( x , y , wide , tall ) ;
GetClientArea ( x , y , wide , tall ) ;
wide + = x ;
wide + = x ;
@ -255,38 +261,51 @@ void MessageBox::PerformLayout()
int oldWide , oldTall ;
int oldWide , oldTall ;
m_pOkButton - > GetSize ( oldWide , oldTall ) ;
m_pOkButton - > GetSize ( oldWide , oldTall ) ;
// calc proportionality scale
float scale = 1 ;
if ( IsProportional ( ) )
{
int screenW , screenH ;
surface ( ) - > GetScreenSize ( screenW , screenH ) ;
int proW , proH ;
surface ( ) - > GetProportionalBase ( proW , proH ) ;
scale = ( ( float ) ( screenH ) / ( float ) ( proH ) ) ;
}
int btnWide , btnTall ;
int btnWide , btnTall ;
m_pOkButton - > GetContentSize ( btnWide , btnTall ) ;
m_pOkButton - > GetContentSize ( btnWide , btnTall ) ;
btnWide = max ( oldWide , btnWide + 10 ) ;
btnWide = max ( oldWide , btnWide + 10 * scale ) ;
btnTall = max ( oldTall , btnTall + 10 ) ;
btnTall = max ( oldTall , btnTall + 10 * scale ) ;
m_pOkButton - > SetSize ( btnWide , btnTall ) ;
m_pOkButton - > SetSize ( btnWide , btnTall ) ;
int btnWide2 = 0 , btnTall2 = 0 ;
int btnWide2 = 0 , btnTall2 = 0 ;
if ( m_pCancelButton - > IsVisible ( ) )
if ( m_pCancelButton - > IsVisible ( ) )
{
{
m_pCancelButton - > GetSize ( oldWide , oldTall ) ;
m_pCancelButton - > GetSize ( oldWide , oldTall ) ;
m_pCancelButton - > GetContentSize ( btnWide2 , btnTall2 ) ;
m_pCancelButton - > GetContentSize ( btnWide2 , btnTall2 ) ;
btnWide2 = max ( oldWide , btnWide2 + 10 ) ;
btnWide2 = max ( oldWide , btnWide2 + 10 * scale ) ;
btnTall2 = max ( oldTall , btnTall2 + 10 ) ;
btnTall2 = max ( oldTall , btnTall2 + 10 * scale ) ;
m_pCancelButton - > SetSize ( btnWide2 , btnTall2 ) ;
m_pCancelButton - > SetSize ( btnWide2 , boxTall ) ;
}
}
boxWidth = max ( boxWidth , m_pMessageLabel - > GetWide ( ) + 100 ) ;
boxWidth = max ( boxWidth , m_pMessageLabel - > GetWide ( ) + 100 * scale ) ;
boxWidth = max ( boxWidth , ( btnWide + btnWide2 ) * 2 + 30 ) ;
boxWidth = max ( boxWidth , ( btnWide + btnWide2 ) * 2 + 30 * scale ) ;
SetSize ( boxWidth , boxTall ) ;
SetSize ( boxWidth , boxTall ) ;
GetSize ( boxWidth , boxTall ) ;
GetSize ( boxWidth , boxTall ) ;
m_pMessageLabel - > SetPos ( ( wide / 2 ) - ( m_pMessageLabel - > GetWide ( ) / 2 ) + x , y + 5 ) ;
m_pMessageLabel - > SetPos ( ( wide / 2 ) - ( m_pMessageLabel - > GetWide ( ) / 2 ) + x , y + 5 * scale ) ;
if ( ! m_pCancelButton - > IsVisible ( ) )
if ( ! m_pCancelButton - > IsVisible ( ) )
{
{
m_pOkButton - > SetPos ( ( wide / 2 ) - ( m_pOkButton - > GetWide ( ) / 2 ) + x , tall - m_pOkButton - > GetTall ( ) - 15 ) ;
m_pOkButton - > SetPos ( ( wide / 2 ) - ( m_pOkButton - > GetWide ( ) / 2 ) + x , tall - m_pOkButton - > GetTall ( ) - 15 * scale ) ;
}
}
else
else
{
{
m_pOkButton - > SetPos ( ( wide / 4 ) - ( m_pOkButton - > GetWide ( ) / 2 ) + x , tall - m_pOkButton - > GetTall ( ) - 15 ) ;
m_pOkButton - > SetPos ( ( wide / 4 ) - ( m_pOkButton - > GetWide ( ) / 2 ) + x , tall - m_pOkButton - > GetTall ( ) - 15 * scale ) ;
m_pCancelButton - > SetPos ( ( 3 * wide / 4 ) - ( m_pOkButton - > GetWide ( ) / 2 ) + x , tall - m_pOkButton - > GetTall ( ) - 15 ) ;
m_pCancelButton - > SetPos ( ( 3 * wide / 4 ) - ( m_pOkButton - > GetWide ( ) / 2 ) + x , tall - m_pOkButton - > GetTall ( ) - 15 * scale ) ;
}
}
BaseClass : : PerformLayout ( ) ;
BaseClass : : PerformLayout ( ) ;