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 ( !child->TransferToWindow() )
|
||||
if ( !child->TransferDataToWindow() )
|
||||
{
|
||||
// warning already given
|
||||
return FALSE;
|
||||
@@ -780,7 +780,7 @@ bool wxWindowBase::TransferDataFromWindow()
|
||||
|
||||
if ( recurse )
|
||||
{
|
||||
if ( !child->TransferFromWindow() )
|
||||
if ( !child->TransferDataFromWindow() )
|
||||
{
|
||||
// warning already given
|
||||
return FALSE;
|
||||
|
@@ -109,7 +109,8 @@ bool wxScrolledWindow::Create(wxWindow *parent,
|
||||
|
||||
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()
|
||||
|
@@ -582,15 +582,15 @@ wxMask::~wxMask()
|
||||
// Create a mask from a mono bitmap (copies the 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 )
|
||||
{
|
||||
::DeleteObject((HBITMAP) m_maskBitmap);
|
||||
m_maskBitmap = 0;
|
||||
}
|
||||
if (!bitmap.Ok() || bitmap.GetDepth() != 1)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_maskBitmap = (WXHBITMAP) CreateBitmap(
|
||||
bitmap.GetWidth(),
|
||||
bitmap.GetHeight(),
|
||||
|
@@ -23,7 +23,6 @@
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
#include "wx/msw/private.h" // needs to be before #include <commdlg.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
@@ -46,6 +45,8 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "wx/msw/private.h" // needs to be before #include <commdlg.h>
|
||||
|
||||
#if wxUSE_COMMON_DIALOGS
|
||||
#if wxUSE_NORLANDER_HEADERS
|
||||
#include <windows.h>
|
||||
@@ -57,7 +58,7 @@
|
||||
#include <print.h>
|
||||
#endif
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// constants
|
||||
@@ -1254,7 +1255,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
|
||||
const wxBitmap& bmp = source->m_selectedBitmap;
|
||||
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") );
|
||||
}
|
||||
|
||||
@@ -1288,16 +1289,24 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
|
||||
if (useMask)
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
if ( ::MaskBlt(GetHdc(), xdest, ydest,
|
||||
(int)width, (int)height,
|
||||
HBITMAP hbmpMask = wxInvertMask((HBITMAP)mask->GetMaskBitmap());
|
||||
|
||||
// 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,
|
||||
(HBITMAP) mask->GetMaskBitmap(),
|
||||
0, 0, MAKEROP4(SRCCOPY, PATCOPY)) != 0 )
|
||||
{
|
||||
// Success
|
||||
success = TRUE;
|
||||
}
|
||||
else
|
||||
hbmpMask, 0, 0,
|
||||
MAKEROP4(PATCOPY, dwRop)) != 0;
|
||||
|
||||
(void)::SelectObject(GetHdc(), hbrOld);
|
||||
::DeleteObject(hbrOld);
|
||||
::DeleteObject(hbmpMask);
|
||||
|
||||
if ( !success )
|
||||
#endif // Win32
|
||||
{
|
||||
// Blit bitmap with mask
|
||||
|
@@ -426,7 +426,6 @@ BOOL wxReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette)
|
||||
BITMAPFILEHEADER bf;
|
||||
WORD nNumColors;
|
||||
BOOL result = FALSE;
|
||||
wxChar str[128];
|
||||
WORD offBits;
|
||||
HDC hDC;
|
||||
BOOL bCoreHead = FALSE;
|
||||
@@ -436,8 +435,7 @@ BOOL wxReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette)
|
||||
|
||||
fh = OpenFile (wxFNCONV(lpFileName), &of, OF_READ);
|
||||
if (fh == -1) {
|
||||
wsprintf(str,wxT("Can't open file '%s'"), lpFileName);
|
||||
MessageBox(NULL, str, wxT("Error"), MB_ICONSTOP | MB_OK);
|
||||
wxLogError(_("Can't open file '%s'"), lpFileName);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user