respecting more of the toolbar positions (tb_right not yet working), and fixing SetSize in Realize, closes #10852
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -145,7 +145,7 @@ public:
|
|||||||
{
|
{
|
||||||
// separator size
|
// separator size
|
||||||
curSize = GetToolBar()->GetToolSize();
|
curSize = GetToolBar()->GetToolSize();
|
||||||
if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetToolBar()->GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
curSize.y /= 4;
|
curSize.y /= 4;
|
||||||
else
|
else
|
||||||
curSize.x /= 4;
|
curSize.x /= 4;
|
||||||
@@ -1085,7 +1085,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative)
|
|||||||
if (usesNative && (m_macToolbar == NULL))
|
if (usesNative && (m_macToolbar == NULL))
|
||||||
return bResult;
|
return bResult;
|
||||||
|
|
||||||
if (usesNative && ((GetWindowStyleFlag() & wxTB_VERTICAL) != 0))
|
if (usesNative && ((GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT|wxTB_BOTTOM)) != 0))
|
||||||
return bResult;
|
return bResult;
|
||||||
|
|
||||||
WindowRef tlw = MAC_WXHWND(MacGetTopLevelWindowRef());
|
WindowRef tlw = MAC_WXHWND(MacGetTopLevelWindowRef());
|
||||||
@@ -1222,7 +1222,7 @@ bool wxToolBar::Realize()
|
|||||||
if ( y + cursize.y > maxHeight )
|
if ( y + cursize.y > maxHeight )
|
||||||
maxHeight = y + cursize.y;
|
maxHeight = y + cursize.y;
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
{
|
{
|
||||||
int x1 = x + ( maxToolWidth - cursize.x ) / 2;
|
int x1 = x + ( maxToolWidth - cursize.x ) / 2;
|
||||||
tool->SetPosition( wxPoint(x1, y) );
|
tool->SetPosition( wxPoint(x1, y) );
|
||||||
@@ -1234,7 +1234,7 @@ bool wxToolBar::Realize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update the item positioning state
|
// update the item positioning state
|
||||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
y += cursize.y + kwxMacToolSpacing;
|
y += cursize.y + kwxMacToolSpacing;
|
||||||
else
|
else
|
||||||
x += cursize.x + kwxMacToolSpacing;
|
x += cursize.x + kwxMacToolSpacing;
|
||||||
@@ -1366,14 +1366,13 @@ bool wxToolBar::Realize()
|
|||||||
if (m_macUsesNativeToolbar)
|
if (m_macUsesNativeToolbar)
|
||||||
GetParent()->SetSize( tlw_sz );
|
GetParent()->SetSize( tlw_sz );
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
if ( GetWindowStyleFlag() & (wxTB_TOP|wxTB_BOTTOM) )
|
||||||
{
|
{
|
||||||
// if not set yet, only one row
|
// if not set yet, only one row
|
||||||
if ( m_maxRows <= 0 )
|
if ( m_maxRows <= 0 )
|
||||||
SetRows( 1 );
|
SetRows( 1 );
|
||||||
|
|
||||||
m_minWidth = maxWidth;
|
m_minWidth = maxWidth;
|
||||||
maxWidth = tw;
|
|
||||||
maxHeight += m_yMargin + kwxMacToolBarTopMargin;
|
maxHeight += m_yMargin + kwxMacToolBarTopMargin;
|
||||||
m_minHeight = m_maxHeight = maxHeight;
|
m_minHeight = m_maxHeight = maxHeight;
|
||||||
}
|
}
|
||||||
@@ -1384,7 +1383,6 @@ bool wxToolBar::Realize()
|
|||||||
SetRows( GetToolsCount() );
|
SetRows( GetToolsCount() );
|
||||||
|
|
||||||
m_minHeight = maxHeight;
|
m_minHeight = maxHeight;
|
||||||
maxHeight = th;
|
|
||||||
maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
|
maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
|
||||||
m_minWidth = m_maxWidth = maxWidth;
|
m_minWidth = m_maxWidth = maxWidth;
|
||||||
}
|
}
|
||||||
@@ -1395,7 +1393,7 @@ bool wxToolBar::Realize()
|
|||||||
bool wantNativeToolbar, ownToolbarInstalled;
|
bool wantNativeToolbar, ownToolbarInstalled;
|
||||||
|
|
||||||
// attempt to install the native toolbar
|
// attempt to install the native toolbar
|
||||||
wantNativeToolbar = ((GetWindowStyleFlag() & wxTB_VERTICAL) == 0);
|
wantNativeToolbar = ((GetWindowStyleFlag() & (wxTB_LEFT|wxTB_BOTTOM|wxTB_RIGHT)) == 0);
|
||||||
MacInstallNativeToolbar( wantNativeToolbar );
|
MacInstallNativeToolbar( wantNativeToolbar );
|
||||||
(void)MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
|
(void)MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
|
||||||
if (!ownToolbarInstalled)
|
if (!ownToolbarInstalled)
|
||||||
@@ -1557,7 +1555,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
|
|||||||
wxASSERT( tool->GetControlHandle() == NULL );
|
wxASSERT( tool->GetControlHandle() == NULL );
|
||||||
toolSize.x /= 4;
|
toolSize.x /= 4;
|
||||||
toolSize.y /= 4;
|
toolSize.y /= 4;
|
||||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
toolrect.bottom = toolSize.y;
|
toolrect.bottom = toolSize.y;
|
||||||
else
|
else
|
||||||
toolrect.right = toolSize.x;
|
toolrect.right = toolSize.x;
|
||||||
@@ -1754,7 +1752,7 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase)
|
|||||||
wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData();
|
wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData();
|
||||||
wxPoint pt = tool2->GetPosition();
|
wxPoint pt = tool2->GetPosition();
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
pt.y -= sz.y;
|
pt.y -= sz.y;
|
||||||
else
|
else
|
||||||
pt.x -= sz.x;
|
pt.x -= sz.x;
|
||||||
|
@@ -136,7 +136,7 @@ public:
|
|||||||
{
|
{
|
||||||
// separator size
|
// separator size
|
||||||
curSize = GetToolBar()->GetToolSize();
|
curSize = GetToolBar()->GetToolSize();
|
||||||
if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetToolBar()->GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
curSize.y /= 4;
|
curSize.y /= 4;
|
||||||
else
|
else
|
||||||
curSize.x /= 4;
|
curSize.x /= 4;
|
||||||
@@ -790,7 +790,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative)
|
|||||||
if (usesNative && (m_macToolbar == NULL))
|
if (usesNative && (m_macToolbar == NULL))
|
||||||
return bResult;
|
return bResult;
|
||||||
|
|
||||||
if (usesNative && ((GetWindowStyleFlag() & wxTB_VERTICAL) != 0))
|
if (usesNative && ((GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT|wxTB_BOTTOM)) != 0))
|
||||||
return bResult;
|
return bResult;
|
||||||
|
|
||||||
WXWindow tlw = MacGetTopLevelWindowRef();
|
WXWindow tlw = MacGetTopLevelWindowRef();
|
||||||
@@ -908,7 +908,7 @@ bool wxToolBar::Realize()
|
|||||||
if ( y + cursize.y > maxHeight )
|
if ( y + cursize.y > maxHeight )
|
||||||
maxHeight = y + cursize.y;
|
maxHeight = y + cursize.y;
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
{
|
{
|
||||||
int x1 = x + ( maxToolWidth - cursize.x ) / 2;
|
int x1 = x + ( maxToolWidth - cursize.x ) / 2;
|
||||||
tool->SetPosition( wxPoint(x1, y) );
|
tool->SetPosition( wxPoint(x1, y) );
|
||||||
@@ -920,7 +920,7 @@ bool wxToolBar::Realize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update the item positioning state
|
// update the item positioning state
|
||||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
y += cursize.y + kwxMacToolSpacing;
|
y += cursize.y + kwxMacToolSpacing;
|
||||||
else
|
else
|
||||||
x += cursize.x + kwxMacToolSpacing;
|
x += cursize.x + kwxMacToolSpacing;
|
||||||
@@ -1013,14 +1013,14 @@ bool wxToolBar::Realize()
|
|||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
if ( GetWindowStyleFlag() & (wxTB_TOP|wxTB_BOTTOM) )
|
||||||
{
|
{
|
||||||
// if not set yet, only one row
|
// if not set yet, only one row
|
||||||
if ( m_maxRows <= 0 )
|
if ( m_maxRows <= 0 )
|
||||||
SetRows( 1 );
|
SetRows( 1 );
|
||||||
|
|
||||||
m_minWidth = maxWidth;
|
m_minWidth = maxWidth;
|
||||||
maxWidth = tw;
|
// maxHeight = th;
|
||||||
maxHeight += m_yMargin + kwxMacToolBarTopMargin;
|
maxHeight += m_yMargin + kwxMacToolBarTopMargin;
|
||||||
m_minHeight = m_maxHeight = maxHeight;
|
m_minHeight = m_maxHeight = maxHeight;
|
||||||
}
|
}
|
||||||
@@ -1031,7 +1031,7 @@ bool wxToolBar::Realize()
|
|||||||
SetRows( GetToolsCount() );
|
SetRows( GetToolsCount() );
|
||||||
|
|
||||||
m_minHeight = maxHeight;
|
m_minHeight = maxHeight;
|
||||||
maxHeight = th;
|
// maxWidth = tw;
|
||||||
maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
|
maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
|
||||||
m_minWidth = m_maxWidth = maxWidth;
|
m_minWidth = m_maxWidth = maxWidth;
|
||||||
}
|
}
|
||||||
@@ -1042,7 +1042,7 @@ bool wxToolBar::Realize()
|
|||||||
bool wantNativeToolbar, ownToolbarInstalled;
|
bool wantNativeToolbar, ownToolbarInstalled;
|
||||||
|
|
||||||
// attempt to install the native toolbar
|
// attempt to install the native toolbar
|
||||||
wantNativeToolbar = ((GetWindowStyleFlag() & wxTB_VERTICAL) == 0);
|
wantNativeToolbar = ((GetWindowStyleFlag() & (wxTB_LEFT|wxTB_BOTTOM|wxTB_RIGHT)) == 0);
|
||||||
MacInstallNativeToolbar( wantNativeToolbar );
|
MacInstallNativeToolbar( wantNativeToolbar );
|
||||||
(void)MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
|
(void)MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
|
||||||
if (!ownToolbarInstalled)
|
if (!ownToolbarInstalled)
|
||||||
@@ -1205,7 +1205,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
|
|||||||
wxASSERT( tool->GetControlHandle() == NULL );
|
wxASSERT( tool->GetControlHandle() == NULL );
|
||||||
toolSize.x /= 4;
|
toolSize.x /= 4;
|
||||||
toolSize.y /= 4;
|
toolSize.y /= 4;
|
||||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
toolrect.size.height = toolSize.y;
|
toolrect.size.height = toolSize.y;
|
||||||
else
|
else
|
||||||
toolrect.size.width = toolSize.x;
|
toolrect.size.width = toolSize.x;
|
||||||
@@ -1352,7 +1352,7 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase)
|
|||||||
wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData();
|
wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData();
|
||||||
wxPoint pt = tool2->GetPosition();
|
wxPoint pt = tool2->GetPosition();
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) )
|
||||||
pt.y -= sz.y;
|
pt.y -= sz.y;
|
||||||
else
|
else
|
||||||
pt.x -= sz.x;
|
pt.x -= sz.x;
|
||||||
|
Reference in New Issue
Block a user