1. wxIcon/wxCursor change, wxGDIImage class added

2. wxCriticalSection doesn't alloc memory any more
3. many minor fixes in bitmap/icon code


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-11-24 12:55:02 +00:00
parent 6d167489bd
commit 0d0512bd8f
21 changed files with 1021 additions and 399 deletions

View File

@@ -18,26 +18,27 @@
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "dataobj.h"
#pragma implementation "dataobj.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if defined(__BORLANDC__)
#pragma hdrstop
#pragma hdrstop
#endif
#if defined(__WIN32__) && !defined(__GNUWIN32_OLD__)
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/intl.h"
#include "wx/log.h"
#endif
#include "wx/defs.h"
#if defined(__WIN32__) && !defined(__GNUWIN32__) || defined(wxUSE_NORLANDER_HEADERS)
#include "wx/log.h"
#include "wx/dataobj.h"
#include <windows.h>
#include "wx/msw/private.h" // includes <windows.h>
#ifdef wxUSE_NORLANDER_HEADERS
#include <ole2.h>
#endif
@@ -50,7 +51,9 @@
#include <shlobj.h>
#include "wx/msw/ole/oleutils.h"
#include "wx/msw/ole/oleutils.h"
#include "wx/msw/dib.h"
// ----------------------------------------------------------------------------
// functions
@@ -62,10 +65,6 @@
#define GetTymedName(tymed) ""
#endif // Debug/!Debug
// to be moved into wx/msw/bitmap.h
extern size_t wxConvertBitmapToDIB(BITMAPINFO *pbi, const wxBitmap& bitmap);
extern wxBitmap wxConvertDIBToBitmap(const BITMAPINFO *bmi);
// ----------------------------------------------------------------------------
// wxIEnumFORMATETC interface implementation
// ----------------------------------------------------------------------------
@@ -124,22 +123,6 @@ private:
bool m_mustDelete;
};
// ----------------------------------------------------------------------------
// small helper class for getting screen DC (we're working with bitmaps and
// DIBs here)
// ----------------------------------------------------------------------------
class ScreenHDC
{
public:
ScreenHDC() { m_hdc = GetDC(NULL); }
~ScreenHDC() { ReleaseDC(NULL, m_hdc); }
operator HDC() const { return m_hdc; }
private:
HDC m_hdc;
};
// ============================================================================
// implementation
// ============================================================================
@@ -736,12 +719,12 @@ size_t wxBitmapDataObject::GetDataSize() const
bool wxBitmapDataObject::GetDataHere(void *buf) const
{
return wxConvertBitmapToDIB((BITMAPINFO *)buf, GetBitmap()) != 0;
return wxConvertBitmapToDIB((LPBITMAPINFO)buf, GetBitmap()) != 0;
}
bool wxBitmapDataObject::SetData(size_t len, const void *buf)
{
wxBitmap bitmap(wxConvertDIBToBitmap((const BITMAPINFO *)buf));
wxBitmap bitmap(wxConvertDIBToBitmap((const LPBITMAPINFO)buf));
if ( !bitmap.Ok() ) {
wxFAIL_MSG(wxT("pasting/dropping invalid bitmap"));
@@ -1065,7 +1048,7 @@ static size_t wxGetNumOfBitmapColors(size_t bitsPerPixel)
}
}
size_t wxConvertBitmapToDIB(BITMAPINFO *pbi, const wxBitmap& bitmap)
size_t wxConvertBitmapToDIB(LPBITMAPINFO pbi, const wxBitmap& bitmap)
{
wxASSERT_MSG( bitmap.Ok(), wxT("invalid bmp can't be converted to DIB") );
@@ -1139,7 +1122,7 @@ size_t wxConvertBitmapToDIB(BITMAPINFO *pbi, const wxBitmap& bitmap)
return dwLen + bi.biSizeImage;
}
wxBitmap wxConvertDIBToBitmap(const BITMAPINFO *pbmi)
wxBitmap wxConvertDIBToBitmap(const LPBITMAPINFO pbmi)
{
// here we get BITMAPINFO struct followed by the actual bitmap bits and
// BITMAPINFO starts with BITMAPINFOHEADER followed by colour info