1. fixed (?) blitting bitmaps with mask
2. fixed wxWindowBase compilation (oops) 3. fixed kbd handling in wxScrolledWindow under MSW git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -748,7 +748,7 @@ bool wxWindowBase::TransferDataToWindow()
|
|||||||
|
|
||||||
if ( recurse )
|
if ( recurse )
|
||||||
{
|
{
|
||||||
if ( !child->TransferToWindow() )
|
if ( !child->TransferDataToWindow() )
|
||||||
{
|
{
|
||||||
// warning already given
|
// warning already given
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -780,7 +780,7 @@ bool wxWindowBase::TransferDataFromWindow()
|
|||||||
|
|
||||||
if ( recurse )
|
if ( recurse )
|
||||||
{
|
{
|
||||||
if ( !child->TransferFromWindow() )
|
if ( !child->TransferDataFromWindow() )
|
||||||
{
|
{
|
||||||
// warning already given
|
// warning already given
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@@ -109,7 +109,8 @@ bool wxScrolledWindow::Create(wxWindow *parent,
|
|||||||
|
|
||||||
m_targetWindow = this;
|
m_targetWindow = this;
|
||||||
|
|
||||||
return wxPanel::Create(parent, id, pos, size, style, name);
|
// we need wxWANTS_CHARS to process arrows ourselves
|
||||||
|
return wxPanel::Create(parent, id, pos, size, style | wxWANTS_CHARS, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxScrolledWindow::~wxScrolledWindow()
|
wxScrolledWindow::~wxScrolledWindow()
|
||||||
|
@@ -582,15 +582,15 @@ wxMask::~wxMask()
|
|||||||
// Create a mask from a mono bitmap (copies the bitmap).
|
// Create a mask from a mono bitmap (copies the bitmap).
|
||||||
bool wxMask::Create(const wxBitmap& bitmap)
|
bool wxMask::Create(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, FALSE,
|
||||||
|
_T("can't create mask from invalid or not monochrome bitmap") );
|
||||||
|
|
||||||
if ( m_maskBitmap )
|
if ( m_maskBitmap )
|
||||||
{
|
{
|
||||||
::DeleteObject((HBITMAP) m_maskBitmap);
|
::DeleteObject((HBITMAP) m_maskBitmap);
|
||||||
m_maskBitmap = 0;
|
m_maskBitmap = 0;
|
||||||
}
|
}
|
||||||
if (!bitmap.Ok() || bitmap.GetDepth() != 1)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
m_maskBitmap = (WXHBITMAP) CreateBitmap(
|
m_maskBitmap = (WXHBITMAP) CreateBitmap(
|
||||||
bitmap.GetWidth(),
|
bitmap.GetWidth(),
|
||||||
bitmap.GetHeight(),
|
bitmap.GetHeight(),
|
||||||
|
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
#include "wx/msw/private.h" // needs to be before #include <commdlg.h>
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
@@ -46,6 +45,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "wx/msw/private.h" // needs to be before #include <commdlg.h>
|
||||||
|
|
||||||
#if wxUSE_COMMON_DIALOGS
|
#if wxUSE_COMMON_DIALOGS
|
||||||
#if wxUSE_NORLANDER_HEADERS
|
#if wxUSE_NORLANDER_HEADERS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -57,7 +58,7 @@
|
|||||||
#include <print.h>
|
#include <print.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
@@ -1254,7 +1255,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
|
|||||||
const wxBitmap& bmp = source->m_selectedBitmap;
|
const wxBitmap& bmp = source->m_selectedBitmap;
|
||||||
mask = bmp.GetMask();
|
mask = bmp.GetMask();
|
||||||
|
|
||||||
wxCHECK_MSG( bmp.Ok() && mask, FALSE,
|
wxCHECK_MSG( bmp.Ok() && mask && mask->GetMaskBitmap(), FALSE,
|
||||||
_T("can't blit with mask without mask") );
|
_T("can't blit with mask without mask") );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1288,16 +1289,24 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
|
|||||||
if (useMask)
|
if (useMask)
|
||||||
{
|
{
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
if ( ::MaskBlt(GetHdc(), xdest, ydest,
|
HBITMAP hbmpMask = wxInvertMask((HBITMAP)mask->GetMaskBitmap());
|
||||||
(int)width, (int)height,
|
|
||||||
|
// we want the part of the image corresponding to the mask to be
|
||||||
|
// transparent, i.e. do PATCOPY there and apply dwRop elsewhere
|
||||||
|
const wxColour& colBg = m_backgroundBrush.GetColour();
|
||||||
|
HBRUSH hbrBg = (HBRUSH)::CreateSolidBrush(wxColourToRGB(colBg));
|
||||||
|
HBRUSH hbrOld = (HBRUSH)::SelectObject(GetHdc(), hbrBg);
|
||||||
|
|
||||||
|
success = ::MaskBlt(GetHdc(), xdest, ydest, width, height,
|
||||||
GetHdcOf(*source), xsrc, ysrc,
|
GetHdcOf(*source), xsrc, ysrc,
|
||||||
(HBITMAP) mask->GetMaskBitmap(),
|
hbmpMask, 0, 0,
|
||||||
0, 0, MAKEROP4(SRCCOPY, PATCOPY)) != 0 )
|
MAKEROP4(PATCOPY, dwRop)) != 0;
|
||||||
{
|
|
||||||
// Success
|
(void)::SelectObject(GetHdc(), hbrOld);
|
||||||
success = TRUE;
|
::DeleteObject(hbrOld);
|
||||||
}
|
::DeleteObject(hbmpMask);
|
||||||
else
|
|
||||||
|
if ( !success )
|
||||||
#endif // Win32
|
#endif // Win32
|
||||||
{
|
{
|
||||||
// Blit bitmap with mask
|
// Blit bitmap with mask
|
||||||
|
@@ -426,7 +426,6 @@ BOOL wxReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette)
|
|||||||
BITMAPFILEHEADER bf;
|
BITMAPFILEHEADER bf;
|
||||||
WORD nNumColors;
|
WORD nNumColors;
|
||||||
BOOL result = FALSE;
|
BOOL result = FALSE;
|
||||||
wxChar str[128];
|
|
||||||
WORD offBits;
|
WORD offBits;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
BOOL bCoreHead = FALSE;
|
BOOL bCoreHead = FALSE;
|
||||||
@@ -436,8 +435,7 @@ BOOL wxReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette)
|
|||||||
|
|
||||||
fh = OpenFile (wxFNCONV(lpFileName), &of, OF_READ);
|
fh = OpenFile (wxFNCONV(lpFileName), &of, OF_READ);
|
||||||
if (fh == -1) {
|
if (fh == -1) {
|
||||||
wsprintf(str,wxT("Can't open file '%s'"), lpFileName);
|
wxLogError(_("Can't open file '%s'"), lpFileName);
|
||||||
MessageBox(NULL, str, wxT("Error"), MB_ICONSTOP | MB_OK);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user