// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "tbar95.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
void wxToolBar::CreateDisabledImageList()
{
+ if (m_disabledImgList != NULL)
+ {
+ delete m_disabledImgList;
+ m_disabledImgList = NULL;
+ }
+
// as we can't use disabled image list with older versions of comctl32.dll,
// don't even bother creating it
if ( wxTheApp->GetComCtl32Version() >= 470 )
bmpDisabled.GetMask() != NULL,
GetToolsCount()
);
- return;
+ break;
}
}
// we don't have any disabled bitmaps
}
-
- m_disabledImgList = NULL;
}
bool wxToolBar::Realize()
const bool isVertical = HasFlag(wxTB_VERTICAL);
bool doRemap, doRemapBg, doTransparent;
-#ifdef __WXWINCE__
- doRemapBg = false;
- doRemap = false;
- doTransparent = false;
-#else
- if (wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 2)
+ doRemapBg = doRemap = doTransparent = false;
+
+#ifndef __WXWINCE__
+ int remapValue = (-1);
+ if (wxSystemOptions::HasOption(wxT("msw.remap")))
+ remapValue = wxSystemOptions::GetOptionInt(wxT("msw.remap"));
+
+ doTransparent = (remapValue == 2);
+ if (!doTransparent)
{
- doRemapBg = doRemap = false;
- doTransparent = true;
- }
- else
- { doRemap = !wxSystemOptions::HasOption(wxT("msw.remap"))
- || wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 1;
+ doRemap = (remapValue != 0);
doRemapBg = !doRemap;
- doTransparent = false;
}
#endif
sizeBmp.x = m_defaultWidth;
sizeBmp.y = m_defaultHeight;
- const wxCoord totalBitmapWidth = m_defaultWidth * nTools,
+ const wxCoord totalBitmapWidth = m_defaultWidth *
+ wx_truncate_cast(wxCoord, nTools),
totalBitmapHeight = m_defaultHeight;
// Create a bitmap and copy all the tool bitmaps to it
wxMemoryDC dcAllButtons;
wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight);
dcAllButtons.SelectObject(bitmap);
+
#ifdef __WXWINCE__
dcAllButtons.SetBackground(wxBrush(wxColour(192,192,192)));
#else
totalBitmapWidth, totalBitmapHeight);
dcAllButtons.SelectObject(bitmap);
-
-
}
#endif // !__WXWINCE__
wxImage imgGreyed;
wxCreateGreyedImage(bmp.ConvertToImage(), imgGreyed);
- // we need to have light grey background colour for
- // MapBitmap() to work correctly
- for ( int y = 0; y < h; y++ )
+ if (doRemap)
{
- for ( int x = 0; x < w; x++ )
+ // we need to have light grey background colour for
+ // MapBitmap() to work correctly
+ for ( int y = 0; y < h; y++ )
{
- if ( imgGreyed.IsTransparent(x, y) )
- imgGreyed.SetRGB(x, y,
- wxLIGHT_GREY->Red(),
- wxLIGHT_GREY->Green(),
- wxLIGHT_GREY->Blue());
+ for ( int x = 0; x < w; x++ )
+ {
+ if ( imgGreyed.IsTransparent(x, y) )
+ imgGreyed.SetRGB(x, y,
+ wxLIGHT_GREY->Red(),
+ wxLIGHT_GREY->Green(),
+ wxLIGHT_GREY->Blue());
+ }
}
}
}
#endif // wxUSE_IMAGE
- MapBitmap(bmpDisabled.GetHBITMAP(), w, h);
+ if (doRemap)
+ {
+ MapBitmap(bmpDisabled.GetHBITMAP(), w, h);
+ }
m_disabledImgList->Add(bmpDisabled);
}
// Map to system colours
hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap,
totalBitmapWidth, totalBitmapHeight);
-
-
}
bool addBitmap = true;
continue;
}
-
TBBUTTON& button = buttons[i];
wxZeroMemory(button);