#include "wx/msw/private.h" // needs to be before #include <commdlg.h>
-#if wxUSE_COMMON_DIALOGS
+#if wxUSE_COMMON_DIALOGS && !defined(__WXMICROWIN__)
#include <commdlg.h>
#endif
#if wxUSE_PALETTE
if (m_oldPalette)
{
- ::SelectPalette((HDC) dc, (HPALETTE) m_oldPalette, TRUE);
+ ::SelectPalette((HDC) dc, (HPALETTE) m_oldPalette, FALSE);
}
m_oldPalette = 0;
#endif // wxUSE_PALETTE
HBITMAP hbmpMask = 0;
+#if wxUSE_PALETTE
+ HPALETTE oldPal = 0;
+#endif // wxUSE_PALETTE
+
if ( useMask )
{
wxMask *mask = bmp.GetMask();
if (wxSystemOptions::GetOptionInt(wxT("no-maskblt")) == 0)
#endif
{
+ HDC cdc = GetHdc();
HDC hdcMem = ::CreateCompatibleDC(GetHdc());
::SelectObject(hdcMem, GetHbitmapOf(bmp));
- ok = ::MaskBlt(GetHdc(), x, y, width, height,
+#if wxUSE_PALETTE
+ wxPalette *pal = bmp.GetPalette();
+ if ( pal && ::GetDeviceCaps(cdc,BITSPIXEL) <= 8 )
+ {
+ oldPal = ::SelectPalette(hdcMem, GetHpaletteOf(pal), FALSE);
+ ::RealizePalette(hdcMem);
+ }
+#endif // wxUSE_PALETTE
+
+ ok = ::MaskBlt(cdc, x, y, width, height,
hdcMem, 0, 0,
hbmpMask, 0, 0,
MAKEROP4(SRCCOPY, DSTCOPY)) != 0;
+
+#if wxUSE_PALETTE
+ if (oldPal)
+ ::SelectPalette(hdcMem, oldPal, FALSE);
+#endif // wxUSE_PALETTE
+
::DeleteDC(hdcMem);
}
::SetBkColor(GetHdc(), m_textBackgroundColour.GetPixel() );
}
+#if wxUSE_PALETTE
+ wxPalette *pal = bmp.GetPalette();
+ if ( pal && ::GetDeviceCaps(cdc,BITSPIXEL) <= 8 )
+ {
+ oldPal = ::SelectPalette(memdc, GetHpaletteOf(pal), FALSE);
+ ::RealizePalette(memdc);
+ }
+#endif // wxUSE_PALETTE
+
::SelectObject( memdc, hbitmap );
::BitBlt( cdc, x, y, width, height, memdc, 0, 0, SRCCOPY);
+
+#if wxUSE_PALETTE
+ if (oldPal)
+ ::SelectPalette(memdc, oldPal, FALSE);
+#endif // wxUSE_PALETTE
+
::DeleteDC( memdc );
::SetTextColor(GetHdc(), old_textground);
// that's not yet selected out.
if (m_oldPalette)
{
- ::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, TRUE);
+ ::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, FALSE);
m_oldPalette = 0;
}
// the original colourmap
if (m_oldPalette)
{
- ::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, TRUE);
+ ::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, FALSE);
m_oldPalette = 0;
}
if (m_palette.Ok() && m_palette.GetHPALETTE())
{
- HPALETTE oldPal = ::SelectPalette(GetHdc(), (HPALETTE) m_palette.GetHPALETTE(), TRUE);
+ HPALETTE oldPal = ::SelectPalette(GetHdc(), (HPALETTE) m_palette.GetHPALETTE(), FALSE);
if (!m_oldPalette)
m_oldPalette = (WXHPALETTE) oldPal;