adjust the toolbar tools bitmap size to fit the biggest bitmap used under wxOSX too, not only under MSW (and moved the code doing it to the common base class to avoid duplicating it)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61174 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-06-23 10:21:18 +00:00
parent 12a124ddc9
commit bb2212e6c4
5 changed files with 56 additions and 44 deletions

View File

@@ -286,7 +286,7 @@ void wxToolBar::Init()
// 32*32) size for their bitmaps, the native control itself still uses the
// old 16*15 default size (see TB_SETBITMAPSIZE documentation in MSDN), so
// default to it so that we don't call SetToolBitmapSize() unnecessarily in
// AdjustToolBitmapSize()
// wxToolBarBase::AdjustToolBitmapSize()
m_defaultWidth = 16;
m_defaultHeight = 15;
@@ -634,34 +634,12 @@ void wxToolBar::CreateDisabledImageList()
}
}
void wxToolBar::AdjustToolBitmapSize()
{
const wxSize sizeOrig(m_defaultWidth, m_defaultHeight);
wxSize sizeActual(sizeOrig);
for ( wxToolBarToolsList::const_iterator i = m_tools.begin();
i != m_tools.end();
++i )
{
const wxBitmap& bmp = (*i)->GetNormalBitmap();
sizeActual.IncTo(bmp.GetSize());
}
if ( sizeActual != sizeOrig )
SetToolBitmapSize(sizeActual);
}
bool wxToolBar::Realize()
{
const size_t nTools = GetToolsCount();
if ( nTools == 0 )
// nothing to do
return true;
if ( !wxToolBarBase::Realize() )
return false;
// make sure tool size is larger enough for all all bitmaps to fit in
// (this is consistent with what other ports do):
AdjustToolBitmapSize();
const size_t nTools = GetToolsCount();
#ifdef wxREMAP_BUTTON_COLOURS
// don't change the values of these constants, they can be set from the