corrected realization of vertical toolbars (were always horizontal)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12193 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Gilles Depeyrot 2001-10-28 21:51:24 +00:00
parent 5384bdbc77
commit 0b7a8cd392
2 changed files with 302 additions and 268 deletions

View File

@ -183,6 +183,7 @@ bool wxToolBar::Realize()
wxNode *node = m_tools.First();
int noButtons = 0;
int x = 0 ;
int y = 0 ;
wxSize toolSize = GetToolSize() ;
int tw, th;
GetSize(& tw, & th);
@ -197,7 +198,8 @@ bool wxToolBar::Realize()
if( !tool->IsSeparator() )
{
Rect toolrect = { toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin, toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
Rect toolrect = { toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin,
toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
toolrect.right = toolrect.left + toolSize.x ;
toolrect.bottom = toolrect.top + toolSize.y ;
@ -266,19 +268,34 @@ bool wxToolBar::Realize()
wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
::EmbedControl( m_macToolHandle , container ) ;
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
{
x += (int)toolSize.x;
}
else
{
y += (int)toolSize.y;
}
noButtons ++;
}
else
{
m_macToolHandles.Add( NULL ) ;
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
{
x += (int)toolSize.x / 4;
}
if ( toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin- m_x - localOrigin.h > maxWidth)
maxWidth = toolbarrect.left + x + kwxMacToolBarLeftMargin+ m_xMargin - m_x - localOrigin.h;
if (toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight)
maxHeight = toolbarrect.top + kwxMacToolBarTopMargin + m_yMargin - m_y - localOrigin.v ;
else
{
y += (int)toolSize.y / 4;
}
}
if ( toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin - m_x - localOrigin.h > maxWidth) {
maxWidth = toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin - m_x - localOrigin.h;
}
if (toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight) {
maxHeight = toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v ;
}
node = node->Next();
}

View File

@ -183,6 +183,7 @@ bool wxToolBar::Realize()
wxNode *node = m_tools.First();
int noButtons = 0;
int x = 0 ;
int y = 0 ;
wxSize toolSize = GetToolSize() ;
int tw, th;
GetSize(& tw, & th);
@ -197,7 +198,8 @@ bool wxToolBar::Realize()
if( !tool->IsSeparator() )
{
Rect toolrect = { toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin, toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
Rect toolrect = { toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin,
toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
toolrect.right = toolrect.left + toolSize.x ;
toolrect.bottom = toolrect.top + toolSize.y ;
@ -266,19 +268,34 @@ bool wxToolBar::Realize()
wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
::EmbedControl( m_macToolHandle , container ) ;
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
{
x += (int)toolSize.x;
}
else
{
y += (int)toolSize.y;
}
noButtons ++;
}
else
{
m_macToolHandles.Add( NULL ) ;
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
{
x += (int)toolSize.x / 4;
}
if ( toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin- m_x - localOrigin.h > maxWidth)
maxWidth = toolbarrect.left + x + kwxMacToolBarLeftMargin+ m_xMargin - m_x - localOrigin.h;
if (toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight)
maxHeight = toolbarrect.top + kwxMacToolBarTopMargin + m_yMargin - m_y - localOrigin.v ;
else
{
y += (int)toolSize.y / 4;
}
}
if ( toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin - m_x - localOrigin.h > maxWidth) {
maxWidth = toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin - m_x - localOrigin.h;
}
if (toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight) {
maxHeight = toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v ;
}
node = node->Next();
}