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@4673 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-11-24 12:30:56 +00:00
parent 162999bfb7
commit 6d167489bd
19 changed files with 906 additions and 900 deletions

View File

@@ -50,7 +50,8 @@ class WXDLLEXPORT wxString;
// Bitmap flags
enum
{
wxBITMAP_TYPE_BMP = 1,
wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility!
wxBITMAP_TYPE_BMP,
wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_ICO,
@@ -73,12 +74,12 @@ enum
wxBITMAP_TYPE_PNM_RESOURCE,
wxBITMAP_TYPE_PCX,
wxBITMAP_TYPE_PCX_RESOURCE,
wxBITMAP_TYPE_PICT,
wxBITMAP_TYPE_PICT_RESOURCE,
wxBITMAP_TYPE_ICON,
wxBITMAP_TYPE_ICON_RESOURCE,
wxBITMAP_TYPE_MACCURSOR ,
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
wxBITMAP_TYPE_PICT,
wxBITMAP_TYPE_PICT_RESOURCE,
wxBITMAP_TYPE_ICON,
wxBITMAP_TYPE_ICON_RESOURCE,
wxBITMAP_TYPE_MACCURSOR,
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
wxBITMAP_TYPE_ANY = 50
};

View File

@@ -45,12 +45,7 @@ class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxMenuItemBase : public wxObject
{
public:
// some compilers need a default constructor here, do not use
wxMenuItemBase() {}
/* This makes no sense (lots of asserts on MSW) so commenting out -- JACS
{ wxFAIL_MSG( wxT("illegal call") ); }
*/
wxMenuItemBase() { }
// creation
static wxMenuItem *New(wxMenu *parentMenu = (wxMenu *)NULL,

View File

@@ -83,7 +83,16 @@ public:
virtual bool ProcessMessage(WXMSG* pMsg);
void DeletePendingObjects();
bool ProcessIdle();
int GetComCtl32Version() const;
#if wxUSE_RICHEDIT
// initialize the richedit DLL of (at least) given version, return TRUE if
// ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3)
static bool InitRichEdit(int version = 2);
#endif // wxUSE_RICHEDIT
// returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
// wasn't found at all
static int GetComCtl32Version();
public:
int m_nCmdShow;

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bitmap.h
// Name: wx/msw/bitmap.h
// Purpose: wxBitmap class
// Author: Julian Smart
// Modified by:
@@ -16,109 +16,57 @@
#pragma interface "bitmap.h"
#endif
#include "wx/gdiobj.h"
#include "wx/msw/gdiimage.h"
#include "wx/gdicmn.h"
#include "wx/palette.h"
// Bitmap
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxControl;
class WXDLLEXPORT wxBitmap;
class WXDLLEXPORT wxBitmapHandler;
class WXDLLEXPORT wxIcon;
class WXDLLEXPORT wxMask;
class WXDLLEXPORT wxCursor;
class WXDLLEXPORT wxControl;
// A mask is a mono bitmap used for drawing bitmaps
// transparently.
class WXDLLEXPORT wxMask: public wxObject
// ----------------------------------------------------------------------------
// Bitmap data
//
// NB: this class is private, but declared here to make it possible inline
// wxBitmap functions accessing it
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapRefData : public wxGDIImageRefData
{
DECLARE_DYNAMIC_CLASS(wxMask)
public:
wxMask();
// Construct a mask from a bitmap and a colour indicating
// the transparent area
wxMask(const wxBitmap& bitmap, const wxColour& colour);
// Construct a mask from a bitmap and a palette index indicating
// the transparent area
wxMask(const wxBitmap& bitmap, int paletteIndex);
// Construct a mask from a mono bitmap (copies the bitmap).
wxMask(const wxBitmap& bitmap);
~wxMask();
bool Create(const wxBitmap& bitmap, const wxColour& colour);
bool Create(const wxBitmap& bitmap, int paletteIndex);
bool Create(const wxBitmap& bitmap);
// Implementation
WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; }
void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; }
protected:
WXHBITMAP m_maskBitmap;
};
class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
{
friend class WXDLLEXPORT wxBitmap;
friend class WXDLLEXPORT wxIcon;
friend class WXDLLEXPORT wxCursor;
public:
wxBitmapRefData();
~wxBitmapRefData();
virtual ~wxBitmapRefData() { Free(); }
virtual void Free();
public:
int m_width;
int m_height;
int m_depth;
bool m_ok;
int m_numColors;
wxPalette m_bitmapPalette;
int m_quality;
int m_numColors;
wxPalette m_bitmapPalette;
int m_quality;
#ifdef __WXMSW__
WXHBITMAP m_hBitmap;
wxDC * m_selectedInto; // So bitmap knows whether it's been selected into
// a device context (for error checking)
wxMask * m_bitmapMask; // Option mask
#endif
// MSW-specific
// ------------
// this field is solely for error checking: we detect selecting a bitmap
// into more than one DC at once or deleting a bitmap still selected into a
// DC (both are serious programming errors under Windows)
wxDC *m_selectedInto;
// optional mask for transparent drawing
wxMask *m_bitmapMask;
};
#define M_BITMAPDATA ((wxBitmapRefData *)m_refData)
// ----------------------------------------------------------------------------
// wxBitmap: a mono or colour bitmap
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapHandler: public wxObject
class WXDLLEXPORT wxBitmap : public wxGDIImage
{
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
public:
wxBitmapHandler() { m_name = ""; m_extension = ""; m_type = 0; };
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
void SetName(const wxString& name) { m_name = name; }
void SetExtension(const wxString& ext) { m_extension = ext; }
void SetType(long type) { m_type = type; }
wxString GetName() const { return m_name; }
wxString GetExtension() const { return m_extension; }
long GetType() const { return m_type; }
protected:
wxString m_name;
wxString m_extension;
long m_type;
};
#define M_BITMAPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData())
class WXDLLEXPORT wxBitmap: public wxGDIObject
{
friend class WXDLLEXPORT wxBitmapHandler;
public:
// default ctor creates an invalid bitmap, you must Create() it later
wxBitmap() { Init(); }
@@ -159,82 +107,169 @@ public:
return *this;
}
wxBitmap& operator=(const wxCursor& cursor)
{
(void)CopyFromCursor(cursor);
return *this;
}
virtual ~wxBitmap();
// copies the contents and mask of the given (colour) icon to the bitmap
bool CopyFromIcon(const wxIcon& icon);
// copies the contents and mask of the given cursor to the bitmap
bool CopyFromCursor(const wxCursor& cursor);
virtual bool Create(int width, int height, int depth = -1);
virtual bool Create(void *data, long type, int width, int height, int depth = 1);
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE);
virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); }
int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); }
int GetHeight() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_height : 0); }
int GetDepth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_depth : 0); }
int GetQuality() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_quality : 0); }
void SetWidth(int w);
void SetHeight(int h);
void SetDepth(int d);
wxBitmapRefData *GetBitmapData() const { return (wxBitmapRefData *)m_refData; }
int GetQuality() const { return (GetBitmapData() ? GetBitmapData()->m_quality : 0); }
void SetQuality(int q);
void SetOk(bool isOk);
#if WXWIN_COMPATIBILITY
wxPalette *GetColourMap() const { return GetPalette(); }
void SetColourMap(wxPalette *cmap) { SetPalette(*cmap); };
#endif
wxPalette* GetPalette() const { return (M_BITMAPDATA ? (& M_BITMAPDATA->m_bitmapPalette) : (wxPalette*) NULL); }
wxPalette* GetPalette() const { return (GetBitmapData() ? (& GetBitmapData()->m_bitmapPalette) : (wxPalette*) NULL); }
void SetPalette(const wxPalette& palette);
wxMask *GetMask() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_bitmapMask : (wxMask*) NULL); }
wxMask *GetMask() const { return (GetBitmapData() ? GetBitmapData()->m_bitmapMask : (wxMask*) NULL); }
void SetMask(wxMask *mask) ;
bool operator==(const wxBitmap& bitmap) { return m_refData == bitmap.m_refData; }
bool operator!=(const wxBitmap& bitmap) { return m_refData != bitmap.m_refData; }
// Format handling
static wxList& GetHandlers() { return sm_handlers; }
static void AddHandler(wxBitmapHandler *handler);
static void InsertHandler(wxBitmapHandler *handler);
static bool RemoveHandler(const wxString& name);
static wxBitmapHandler *FindHandler(const wxString& name);
static wxBitmapHandler *FindHandler(const wxString& extension, long bitmapType);
static wxBitmapHandler *FindHandler(long bitmapType);
#if WXWIN_COMPATIBILITY_2
void SetOk(bool isOk);
#endif // WXWIN_COMPATIBILITY_2
static void InitStandardHandlers();
static void CleanUpHandlers();
protected:
static wxList sm_handlers;
#if WXWIN_COMPATIBILITY
wxPalette *GetColourMap() const { return GetPalette(); }
void SetColourMap(wxPalette *cmap) { SetPalette(*cmap); };
#endif // WXWIN_COMPATIBILITY
// Implementation
public:
void SetHBITMAP(WXHBITMAP bmp);
WXHBITMAP GetHBITMAP() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hBitmap : 0); }
void SetSelectedInto(wxDC *dc) { if (M_BITMAPDATA) M_BITMAPDATA->m_selectedInto = dc; }
wxDC *GetSelectedInto() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_selectedInto : (wxDC*) NULL); }
bool FreeResource(bool force = FALSE);
void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); }
WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); }
// Creates a bitmap that matches the device context's depth, from
// an arbitray bitmap. At present, the original bitmap must have an
// associated palette. (TODO: use a default palette if no palette exists.)
// This function is necessary for you to Blit an arbitrary bitmap (which may have
// the wrong depth). wxDC::SelectObject will compare the depth of the bitmap
// with the DC's depth, and create a new bitmap if the depths differ.
// Eventually we should perhaps make this a public API function so that
// an app can efficiently produce bitmaps of the correct depth.
// The Windows solution is to use SetDibBits to blit an arbotrary DIB directly to a DC, but
// this is too Windows-specific, hence this solution of quietly converting the wxBitmap.
// Contributed by Frederic Villeneuve <frederic.villeneuve@natinst.com>
void SetSelectedInto(wxDC *dc) { if (GetBitmapData()) GetBitmapData()->m_selectedInto = dc; }
wxDC *GetSelectedInto() const { return (GetBitmapData() ? GetBitmapData()->m_selectedInto : (wxDC*) NULL); }
// Creates a bitmap that matches the device context's depth, from an
// arbitray bitmap. At present, the original bitmap must have an associated
// palette. (TODO: use a default palette if no palette exists.) This
// function is necessary for you to Blit an arbitrary bitmap (which may
// have the wrong depth). wxDC::SelectObject will compare the depth of the
// bitmap with the DC's depth, and create a new bitmap if the depths
// differ. Eventually we should perhaps make this a public API function so
// that an app can efficiently produce bitmaps of the correct depth. The
// Windows solution is to use SetDibBits to blit an arbotrary DIB directly
// to a DC, but this is too Windows-specific, hence this solution of
// quietly converting the wxBitmap. Contributed by Frederic Villeneuve
// <frederic.villeneuve@natinst.com>
wxBitmap GetBitmapForDC(wxDC& dc) const;
protected:
// common part of all ctors
void Init();
virtual wxGDIImageRefData *CreateData() const
{ return new wxBitmapRefData; }
private:
#ifdef __WIN32__
// common part of CopyFromIcon/CopyFromCursor for Win32
bool CopyFromIconOrCursor(const wxGDIImage& icon);
#endif // __WIN32__
DECLARE_DYNAMIC_CLASS(wxBitmap)
};
// ----------------------------------------------------------------------------
// wxMask: a mono bitmap used for drawing bitmaps transparently.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMask : public wxObject
{
public:
wxMask();
// Construct a mask from a bitmap and a colour indicating the transparent
// area
wxMask(const wxBitmap& bitmap, const wxColour& colour);
// Construct a mask from a bitmap and a palette index indicating the
// transparent area
wxMask(const wxBitmap& bitmap, int paletteIndex);
// Construct a mask from a mono bitmap (copies the bitmap).
wxMask(const wxBitmap& bitmap);
// construct a mask from the givne bitmap handle
wxMask(WXHBITMAP hbmp) { m_maskBitmap = hbmp; }
virtual ~wxMask();
bool Create(const wxBitmap& bitmap, const wxColour& colour);
bool Create(const wxBitmap& bitmap, int paletteIndex);
bool Create(const wxBitmap& bitmap);
// Implementation
WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; }
void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; }
protected:
WXHBITMAP m_maskBitmap;
DECLARE_DYNAMIC_CLASS(wxMask)
};
// ----------------------------------------------------------------------------
// wxBitmapHandler is a class which knows how to load/save bitmaps to/from file
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapHandler : public wxGDIImageHandler
{
public:
wxBitmapHandler() { m_type = wxBITMAP_TYPE_INVALID; }
wxBitmapHandler(const wxString& name, const wxString& ext, long type)
: wxGDIImageHandler(name, ext, type)
{
}
// keep wxBitmapHandler derived from wxGDIImageHandler compatible with the
// old class which worked only with bitmaps
virtual bool Create(wxBitmap *bitmap,
void *data,
long flags,
int width, int height, int depth = 1);
virtual bool LoadFile(wxBitmap *bitmap,
const wxString& name,
long flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(wxBitmap *bitmap,
const wxString& name,
int type,
const wxPalette *palette = NULL);
virtual bool Create(wxGDIImage *image,
void *data,
long flags,
int width, int height, int depth = 1);
virtual bool Load(wxGDIImage *image,
const wxString& name,
long flags,
int desiredWidth, int desiredHeight);
virtual bool Save(wxGDIImage *image,
const wxString& name,
int type);
private:
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
};
#endif
// _WX_BITMAP_H_

View File

@@ -1,67 +1,82 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cursor.h
// Name: wx/msw/cursor.h
// Purpose: wxCursor class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CURSOR_H_
#define _WX_CURSOR_H_
#ifdef __GNUG__
#pragma interface "cursor.h"
#pragma interface "cursor.h"
#endif
#include "wx/bitmap.h"
// compatible (even if incorrect) behaviour by default: derive wxCursor from
// wxBitmap
#ifndef wxICON_IS_BITMAP
#define wxICON_IS_BITMAP 1
#endif
class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
#if wxICON_IS_BITMAP
#include "wx/bitmap.h"
#define wxCursorRefDataBase wxBitmapRefData
#define wxCursorBase wxBitmap
#else
#include "wx/msw/gdiimage.h"
#define wxCursorRefDataBase wxGDIImageRefData
#define wxCursorBase wxGDIImage
#endif
class WXDLLEXPORT wxCursorRefData : public wxCursorRefDataBase
{
friend class WXDLLEXPORT wxBitmap;
friend class WXDLLEXPORT wxCursor;
public:
wxCursorRefData(void);
~wxCursorRefData(void);
wxCursorRefData();
virtual ~wxCursorRefData() { Free(); }
protected:
WXHCURSOR m_hCursor;
bool m_destroyCursor;
virtual void Free();
// for compatibility
public:
bool m_destroyCursor;
};
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
#define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
// Cursor
class WXDLLEXPORT wxCursor: public wxBitmap
class WXDLLEXPORT wxCursor : public wxCursorBase
{
DECLARE_DYNAMIC_CLASS(wxCursor)
public:
wxCursor(void);
wxCursor();
// Copy constructors
inline wxCursor(const wxCursor& cursor) { Ref(cursor); }
// Copy constructors
wxCursor(const wxCursor& cursor) { Ref(cursor); }
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_CUR_RESOURCE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(int cursor_type);
~wxCursor(void);
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
wxCursor(const wxString& name,
long flags = wxBITMAP_TYPE_CUR_RESOURCE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(int cursor_type);
virtual ~wxCursor();
virtual bool Ok(void) const { return (m_refData != NULL && M_CURSORDATA->m_hCursor) ; }
wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; }
wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; }
void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); }
WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); }
void SetHCURSOR(WXHCURSOR cursor);
inline WXHCURSOR GetHCURSOR(void) const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
protected:
virtual wxGDIImageRefData *CreateData() const { return new wxCursorRefData; }
bool FreeResource(bool force = FALSE);
private:
DECLARE_DYNAMIC_CLASS(wxCursor)
};
#endif

View File

@@ -1,22 +1,41 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dib.h
// Name: wx/msw/dib.h
// Purpose: Routines for loading and saving DIBs
// Author: Various
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DIB_H_
#define _WX_DIB_H_
class WXDLLEXPORT wxBitmap;
class WXDLLEXPORT wxColourMap;
class WXDLLEXPORT wxPalette;
// ----------------------------------------------------------------------------
// Functions for working with DIBs
// ----------------------------------------------------------------------------
// VZ: we have 3 different sets of functions: from bitmap.cpp (wxCreateDIB and
// wxFreeDIB), from dib.cpp and from dataobj.cpp - surely there is some
// redundancy between them? (FIXME)
// defined in bitmap.cpp
extern bool wxCreateDIB(long xSize, long ySize, long bitsPerPixel,
HPALETTE hPal, LPBITMAPINFO* lpDIBHeader);
extern void wxFreeDIB(LPBITMAPINFO lpDIBHeader);
// defined in ole/dataobj.cpp
extern size_t wxConvertBitmapToDIB(LPBITMAPINFO pbi, const wxBitmap& bitmap);
extern wxBitmap wxConvertDIBToBitmap(const LPBITMAPINFO pbi);
// the rest is defined in dib.cpp
// Save (device dependent) wxBitmap as a DIB
bool wxSaveBitmap(wxChar *filename, wxBitmap *bitmap, wxColourMap *colourmap = NULL);
bool wxSaveBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette *colourmap = NULL);
// Load device independent bitmap into device dependent bitmap
wxBitmap *wxLoadBitmap(wxChar *filename, wxColourMap **colourmap = NULL);
@@ -30,5 +49,5 @@ HANDLE wxReadDIB2(LPTSTR lpFileName);
LPSTR wxFindDIBBits (LPSTR lpbi);
HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo);
#endif
#endif // _WX_DIB_H_

View File

@@ -1,66 +1,64 @@
/////////////////////////////////////////////////////////////////////////////
// Name: gdiobj.h
// Name: wx/msw/gdiobj.h
// Purpose: wxGDIObject class: base class for other GDI classes
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GDIOBJ_H_
#define _WX_GDIOBJ_H_
#include "wx/object.h"
#ifdef __GNUG__
#pragma interface "gdiobj.h"
#pragma interface "gdiobj.h"
#endif
// wxGDIRefData is the reference-counted data part of a GDI object.
// It contains another counter, m_usageCount, which counts the number
// of times this object has been used; e.g. in SetFont, the count
// is incremented. This is different from reference counting,
// where only the constructors, destructors and (un)clone operations
// affect the reference count.
// THIS IS NOW BEING REMOVED AS REDUNDANT AND ERROR-PRONE
#include "wx/object.h" // base class
class WXDLLEXPORT wxGDIRefData: public wxObjectRefData {
public:
inline wxGDIRefData(void)
{
}
// ----------------------------------------------------------------------------
// wxGDIRefData is the base class for wxXXXData structures which contain the
// real data for the GDI object and are shared among all wxWin objects sharing
// the same native GDI object
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxGDIRefData : public wxObjectRefData
{
// this class is intentionally left blank
};
#define M_GDIDATA ((wxGDIRefData *)m_refData)
// ----------------------------------------------------------------------------
// wxGDIObject
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxGDIObject: public wxObject
class WXDLLEXPORT wxGDIObject : public wxObject
{
DECLARE_DYNAMIC_CLASS(wxGDIObject)
public:
inline wxGDIObject(void) { m_visible = FALSE; };
inline ~wxGDIObject(void) {};
public:
wxGDIObject() { m_visible = FALSE; };
// Creates the resource
virtual bool RealizeResource(void) { return FALSE; };
// Creates the resource
virtual bool RealizeResource() { return FALSE; };
// Frees the resource
virtual bool FreeResource(bool WXUNUSED(force) = FALSE) { return FALSE; };
// Frees the resource
virtual bool FreeResource(bool WXUNUSED(force) = FALSE) { return FALSE; }
virtual bool IsFree(void) const { return FALSE; };
virtual bool IsFree() const { return FALSE; }
inline bool IsNull(void) const { return (m_refData == 0); }
bool IsNull() const { return (m_refData == 0); }
// Returns handle.
virtual WXHANDLE GetResourceHandle(void) { return 0; }
// Returns handle.
virtual WXHANDLE GetResourceHandle() { return 0; }
virtual bool GetVisible(void) { return m_visible; }
virtual void SetVisible(bool v) { m_visible = v; }
virtual bool GetVisible() { return m_visible; }
virtual void SetVisible(bool v) { m_visible = v; }
protected:
bool m_visible; // Can a pointer to this object be safely taken?
// - only if created within FindOrCreate...
bool m_visible; // TRUE only if we should delete this object ourselves
private:
DECLARE_DYNAMIC_CLASS(wxGDIObject)
};
#endif

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: icon.h
// Name: wx/msw/icon.h
// Purpose: wxIcon class
// Author: Julian Smart
// Modified by:
@@ -16,34 +16,49 @@
#pragma interface "icon.h"
#endif
#include "wx/bitmap.h"
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// compatible (even if incorrect) behaviour by default: derive wxIcon from
// wxBitmap
#ifndef wxICON_IS_BITMAP
#define wxICON_IS_BITMAP 1
#endif
#if wxICON_IS_BITMAP
#include "wx/bitmap.h"
#define wxIconRefDataBase wxBitmapRefData
#define wxIconBase wxBitmap
#else
#include "wx/msw/gdiimage.h"
#define wxIconRefDataBase wxGDIImageRefData
#define wxIconBase wxGDIImage
#endif
// ---------------------------------------------------------------------------
// icon data
// ---------------------------------------------------------------------------
class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
// notice that although wxIconRefData inherits from wxBitmapRefData, it is not
// a valid wxBitmapRefData
class WXDLLEXPORT wxIconRefData : public wxIconRefDataBase
{
friend class WXDLLEXPORT wxBitmap;
friend class WXDLLEXPORT wxIcon;
public:
wxIconRefData();
~wxIconRefData();
wxIconRefData() { }
virtual ~wxIconRefData() { Free(); }
public:
WXHICON m_hIcon;
virtual void Free();
};
#define M_ICONDATA ((wxIconRefData *)m_refData)
#define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
// ---------------------------------------------------------------------------
// Icon
// ---------------------------------------------------------------------------
class WXDLLEXPORT wxIcon : public wxBitmap
{
DECLARE_DYNAMIC_CLASS(wxIcon)
class WXDLLEXPORT wxIcon : public wxIconBase
{
public:
wxIcon();
@@ -51,61 +66,35 @@ public:
wxIcon(const wxIcon& icon) { Ref(icon); }
wxIcon(const char bits[], int width, int height);
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
wxIcon(const wxString& name,
long type = wxBITMAP_TYPE_ICO_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
~wxIcon();
virtual ~wxIcon();
bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
virtual bool LoadFile(const wxString& name,
long type = wxBITMAP_TYPE_ICO_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
wxIcon& operator = (const wxIcon& icon)
{ if (*this == icon) return (*this); Ref(icon); return *this; }
{ if ( *this != icon ) Ref(icon); return *this; }
bool operator == (const wxIcon& icon) const
{ return m_refData == icon.m_refData; }
bool operator != (const wxIcon& icon) const
{ return m_refData != icon.m_refData; }
void SetHICON(WXHICON ico);
WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
bool Ok() const { return (m_refData != NULL && M_ICONDATA->m_hIcon != 0) ; }
void SetHICON(WXHICON icon) { SetHandle((WXHANDLE)icon); }
WXHICON GetHICON() const { return (WXHICON)GetHandle(); }
bool FreeResource(bool force = FALSE);
};
// TODO: Put these in separate, private header
class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
public:
wxICOFileHandler()
protected:
virtual wxGDIImageRefData *CreateData() const
{
m_name = "ICO icon file";
m_extension = "ico";
m_type = wxBITMAP_TYPE_ICO;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1);
};
class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
public:
wxICOResourceHandler()
{
m_name = "ICO resource";
m_extension = "ico";
m_type = wxBITMAP_TYPE_ICO_RESOURCE;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1);
return new wxIconRefData;
}
private:
DECLARE_DYNAMIC_CLASS(wxIcon)
};
#endif

View File

@@ -220,6 +220,23 @@ inline void wxRGBToColour(wxColour& c, COLORREF rgb)
c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
}
// ---------------------------------------------------------------------------
// small helper classes
// ---------------------------------------------------------------------------
// create an instance of this class and use it as the HDC for screen, will
// automatically release the DC going out of scope
class ScreenHDC
{
public:
ScreenHDC() { m_hdc = GetDC(NULL); }
~ScreenHDC() { ReleaseDC(NULL, m_hdc); }
operator HDC() const { return m_hdc; }
private:
HDC m_hdc;
};
// ---------------------------------------------------------------------------
// macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
// returns Foo cast to the Windows type for oruselves, while GetFooOf() takes

View File

@@ -19,6 +19,10 @@
// define this to 0 when building wxBase library
#define wxUSE_GUI 1
// ----------------------------------------------------------------------------
// compatibility settings
// ----------------------------------------------------------------------------
#define WXWIN_COMPATIBILITY 0
// Compatibility with 1.68 API.
// Level 0: no backward compatibility, all new features
@@ -26,6 +30,19 @@
// the compatibility code is now very minimal so there
// is little advantage to setting it to 1.
// in wxMSW version 2.1.11 and earlier, wxIcon always derives from wxBitmap,
// but this is very dangerous because you can mistakenly pass an icon instead
// of a bitmap to a function taking "const wxBitmap&" - which will *not* work
// because an icon is not a valid bitmap
//
// Starting from 2.1.12, you have the choice under this backwards compatible
// behaviour (your code will still compile, but probably won't behave as
// expected!) and not deriving wxIcon class from wxBitmap, but providing a
// conversion ctor wxBitmap(const wxIcon&) instead.
//
// Recommended setting: 0
#define wxICON_IS_BITMAP 0
// ----------------------------------------------------------------------------
// General features
// ----------------------------------------------------------------------------
@@ -300,6 +317,13 @@
// See note above about using FAFA and CTL3D.
#endif
// can we use RICHEDIT control?
#if defined(__WIN95__) && !defined(__TWIN32__) && !defined(__GNUWIN32_OLD__)
#define wxUSE_RICHEDIT 1
#else
#define wxUSE_RICHEDIT 0
#endif
#define wxUSE_COMMON_DIALOGS 1
// On rare occasions (e.g. using DJGPP) may want
// to omit common dialogs

View File

@@ -31,7 +31,7 @@ public:
wxStaticBitmap(wxWindow *parent,
wxWindowID id,
const wxBitmap& label,
const wxGDIImage& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
@@ -42,7 +42,7 @@ public:
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmap& label,
const wxGDIImage& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
@@ -50,15 +50,15 @@ public:
virtual ~wxStaticBitmap() { Free(); }
virtual void SetIcon(const wxIcon& icon) { SetBitmap(icon); }
virtual void SetBitmap(const wxBitmap& bitmap);
void SetIcon(const wxIcon& icon) { SetImage(icon); }
void SetBitmap(const wxBitmap& bitmap) { SetImage(bitmap); }
// assert failure is provoked by an attempt to get an icon from bitmap or
// vice versa
const wxIcon& GetIcon() const
{ wxASSERT( m_isIcon ); return *m_image.icon; }
{ wxASSERT( m_isIcon ); return *(wxIcon *)m_image; }
const wxBitmap& GetBitmap() const
{ wxASSERT( !m_isIcon ); return *m_image.bitmap; }
{ wxASSERT( !m_isIcon ); return *(wxBitmap *)m_image; }
// overriden base class virtuals
virtual bool AcceptsFocus() const { return FALSE; }
@@ -70,21 +70,19 @@ public:
#endif // __WIN16__
protected:
void Init() { m_isIcon = TRUE; m_image.icon = NULL; }
virtual wxSize DoGetBestSize() const;
void Init() { m_isIcon = TRUE; m_image = NULL; }
void Free();
// TRUE if icon/bitmap is valid
bool ImageIsOk() const;
void SetImage(const wxGDIImage& image);
// we can have either an icon or a bitmap
bool m_isIcon;
union
{
wxIcon *icon;
wxBitmap *bitmap;
} m_image;
virtual wxSize DoGetBestSize() const;
wxGDIImage *m_image;
};
#endif

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: tbarbase.h
// Name: wx/tbarbase.h
// Purpose: Base class for toolbar classes
// Author: Julian Smart
// Modified by:

View File

@@ -21,7 +21,8 @@
#include "wx/setup.h"
#if wxUSE_THREADS
/* otherwise we get undefined references for non-thread case (KB)*/
// only for wxUSE_THREADS - otherwise we'd get undefined symbols
#ifdef __GNUG__
#pragma interface "thread.h"
#endif
@@ -37,28 +38,31 @@
// constants
// ----------------------------------------------------------------------------
typedef enum
enum wxMutexError
{
wxMUTEX_NO_ERROR = 0,
wxMUTEX_DEAD_LOCK, // Mutex has been already locked by THE CALLING thread
wxMUTEX_BUSY, // Mutex has been already locked by ONE thread
wxMUTEX_UNLOCKED,
wxMUTEX_MISC_ERROR
} wxMutexError;
};
typedef enum
enum wxThreadError
{
wxTHREAD_NO_ERROR = 0, // No error
wxTHREAD_NO_RESOURCE, // No resource left to create a new thread
wxTHREAD_RUNNING, // The thread is already running
wxTHREAD_NOT_RUNNING, // The thread isn't running
wxTHREAD_MISC_ERROR // Some other error
} wxThreadError;
};
// defines the interval of priority
#define WXTHREAD_MIN_PRIORITY 0u
#define WXTHREAD_DEFAULT_PRIORITY 50u
#define WXTHREAD_MAX_PRIORITY 100u
enum
{
WXTHREAD_MIN_PRIORITY = 0u,
WXTHREAD_DEFAULT_PRIORITY = 50u,
WXTHREAD_MAX_PRIORITY = 100u
};
// ----------------------------------------------------------------------------
// A mutex object is a synchronization object whose state is set to signaled
@@ -129,21 +133,24 @@ private:
// Critical section: this is the same as mutex but is only visible to the
// threads of the same process. For the platforms which don't have native
// support for critical sections, they're implemented entirely in terms of
// mutexes
// mutexes.
//
// NB: wxCriticalSection object does not allocate any memory in its ctor
// which makes it possible to have static globals of this class
// ----------------------------------------------------------------------------
// in order to avoid any overhead under !MSW make all wxCriticalSection class
// functions inline - but this can't be done under MSW
#if defined(__WXMSW__)
class WXDLLEXPORT wxCriticalSectionInternal;
#define WXCRITICAL_INLINE
#elif defined(__WXMAC__)
class WXDLLEXPORT wxCriticalSectionInternal;
#define WXCRITICAL_INLINE
#elif defined(__WXPM__)
#define WXCRITICAL_INLINE
#else // !MSW && !PM
class WXDLLEXPORT wxCriticalSectionInternal;
// in order to avoid any overhead under platforms where critical sections are
// just mutexes make all wxCriticalSection class functions inline
#if !defined(__WXMSW__) && !defined(__WXPM__) && !defined(__WXMAC__)
#define WXCRITICAL_INLINE inline
#define wxCRITSECT_IS_MUTEX 1
#else // MSW || Mac || OS2
#define WXCRITICAL_INLINE
#define wxCRITSECT_IS_MUTEX 0
#endif // MSW/!MSW
// you should consider wxCriticalSectionLocker whenever possible instead of
@@ -165,11 +172,18 @@ private:
wxCriticalSection(const wxCriticalSection&);
wxCriticalSection& operator=(const wxCriticalSection&);
#if defined(__WXMSW__) || defined(__WXMAC__)
wxCriticalSectionInternal *m_critsect;
#else // !MSW
#if wxCRITSECT_IS_MUTEX
wxMutex m_mutex;
#endif // MSW/!MSW
#elif defined(__WXMSW__)
// we can't allocate any memory in the ctor, so use placement new -
// unfortunately, we have to hardcode the sizeof() here because we can't
// include windows.h from this public header
char m_buffer[24];
#elif !defined(__WXPM__)
wxCriticalSectionInternal *m_critsect;
#else
// nothing for OS/2
#endif // !Unix/Unix
};
// keep your preprocessor name space clean

View File

@@ -1,5 +1,24 @@
#ifndef _TOOLBAR_H_BASE_
#define _TOOLBAR_H_BASE_
/////////////////////////////////////////////////////////////////////////////
// Name: wx/toolbar.h
// Purpose: wxToolBar interface declaration
// Author: Vadim Zeitlin
// Modified by:
// Created: 20.11.99
// RCS-ID: $Id$
// Copyright: (c) wxWindows team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TOOLBAR_H_BASE_
#define _WX_TOOLBAR_H_BASE_
#include "wx/tbarbase.h" // the base class for all toolbars
#if 0
class WXDLLEXPORT wxToolBar : public wxControl
{
};
#endif // 0
#if defined(__WXMSW__) && defined(__WIN95__)
# include "wx/msw/tbar95.h"
@@ -20,4 +39,4 @@
#endif
#endif
// _TOOLBAR_H_BASE_
// _WX_TOOLBAR_H_BASE_

View File

@@ -499,7 +499,8 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
for (wxNode * node = First (); node; node = node->Next ())
{
wxPen *each_pen = (wxPen *) node->Data ();
if (each_pen && each_pen->GetVisible() &&
if (each_pen &&
each_pen->GetVisible() &&
each_pen->GetWidth () == width &&
each_pen->GetStyle () == style &&
each_pen->GetColour ().Red () == colour.Red () &&
@@ -514,6 +515,7 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
// returning a pointer to an automatic variable and hanging on to it
// (dangling pointer).
pen->SetVisible(TRUE);
return pen;
}
@@ -542,19 +544,23 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
for (wxNode * node = First (); node; node = node->Next ())
{
wxBrush *each_brush = (wxBrush *) node->Data ();
if (each_brush && each_brush->GetVisible() &&
if (each_brush &&
each_brush->GetVisible() &&
each_brush->GetStyle () == style &&
each_brush->GetColour ().Red () == colour.Red () &&
each_brush->GetColour ().Green () == colour.Green () &&
each_brush->GetColour ().Blue () == colour.Blue ())
return each_brush;
}
// Yes, we can return a pointer to this in a later FindOrCreateBrush call,
// because we created it within FindOrCreateBrush. Safeguards against
// returning a pointer to an automatic variable and hanging on to it
// (dangling pointer).
wxBrush *brush = new wxBrush (colour, style);
brush->SetVisible(TRUE);
return brush;
}
@@ -565,19 +571,19 @@ void wxBrushList::RemoveBrush (wxBrush * brush)
wxFontList::~wxFontList ()
{
wxNode *node = First ();
while (node)
wxNode *node = First ();
while (node)
{
// Only delete objects that are 'visible', i.e.
// that have been created using FindOrCreate...,
// where the pointers are expected to be shared
// (and therefore not deleted by any one part of an app).
wxFont *font = (wxFont *) node->Data ();
wxNode *next = node->Next ();
if (font->GetVisible())
delete font;
node = next;
}
// Only delete objects that are 'visible', i.e.
// that have been created using FindOrCreate...,
// where the pointers are expected to be shared
// (and therefore not deleted by any one part of an app).
wxFont *font = (wxFont *) node->Data ();
wxNode *next = node->Next ();
if (font->GetVisible())
delete font;
node = next;
}
}
void wxFontList::AddFont (wxFont * font)
@@ -596,27 +602,27 @@ wxFont *wxFontList::
for (wxNode * node = First (); node; node = node->Next ())
{
wxFont *each_font = (wxFont *) node->Data ();
if (each_font && each_font->GetVisible() && each_font->Ok() &&
if (each_font &&
each_font->GetVisible() &&
each_font->Ok() &&
each_font->GetPointSize () == PointSize &&
each_font->GetStyle () == Style &&
each_font->GetWeight () == Weight &&
each_font->GetUnderlined () == underline &&
//#if defined(__X__)
// each_font->GetFontId () == FamilyOrFontId) /* New font system */
//#else
#if defined(__WXGTK__)
(each_font->GetFamily() == FamilyOrFontId ||
(each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) &&
(each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) &&
#else
each_font->GetFamily() == FamilyOrFontId &&
#endif
((each_font->GetFaceName() == wxT("")) || each_font->GetFaceName() == Face) &&
(encoding == wxFONTENCODING_DEFAULT || each_font->GetEncoding() == encoding))
//#endif
return each_font;
}
wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face, encoding);
font->SetVisible(TRUE);
return font;
}

View File

@@ -894,11 +894,10 @@ wxBitmap wxImage::ConvertToBitmap() const
free(lpDIBh);
free(lpBits);
#if WXWIN_COMPATIBILITY_2
// check the wxBitmap object
if( bitmap.GetHBITMAP() )
bitmap.SetOk( TRUE );
else
bitmap.SetOk( FALSE );
bitmap.GetBitmapData()->SetOk();
#endif // WXWIN_COMPATIBILITY_2
return bitmap;
}

View File

@@ -129,14 +129,10 @@ HBRUSH wxDisableButtonBrush = (HBRUSH) 0;
LRESULT WXDLLEXPORT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM);
#if defined(__WIN95__) && !defined(__TWIN32__)
#define wxUSE_RICHEDIT 1
#else
#define wxUSE_RICHEDIT 0
#endif
#if wxUSE_RICHEDIT
static HINSTANCE gs_hRichEdit = (HINSTANCE) NULL;
// the handle to richedit DLL and the version of the DLL loaded
static HINSTANCE gs_hRichEdit = (HINSTANCE)NULL;
static int gs_verRichEdit = -1;
#endif
// ===========================================================================
@@ -193,15 +189,6 @@ bool wxApp::Initialize()
#if defined(__WIN95__)
InitCommonControls();
#if wxUSE_RICHEDIT
gs_hRichEdit = LoadLibrary(wxT("RICHED32.DLL"));
if (gs_hRichEdit == (HINSTANCE) NULL)
{
wxLogError(_("Could not initialise Rich Edit DLL"));
}
#endif // wxUSE_RICHEDIT
#endif // __WIN95__
#if wxUSE_OLE
@@ -517,15 +504,11 @@ void wxApp::CleanUp()
wxSetKeyboardHook(FALSE);
#ifdef __WIN95__
#if wxUSE_RICHEDIT
if (gs_hRichEdit != (HINSTANCE) NULL)
FreeLibrary(gs_hRichEdit);
#endif
#endif
#if wxUSE_PENWINDOWS
wxCleanUpPenWin();
#endif
@@ -1098,47 +1081,105 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event)
}
}
int wxApp::GetComCtl32Version() const
#if wxUSE_RICHEDIT
/* static */
bool wxApp::InitRichEdit(int version)
{
// have we loaded COMCTL32 yet?
HMODULE theModule = ::GetModuleHandle(wxT("COMCTL32"));
int version = 0;
wxCHECK_MSG( version >= 1 && version <= 3, FALSE,
_T("incorrect richedit control version requested") );
// if so, then we can check for the version
if (theModule)
if ( version <= gs_verRichEdit )
{
// InitCommonControlsEx is unique to 4.7 and later
FARPROC theProc = ::GetProcAddress(theModule, "InitCommonControlsEx");
// we've already got this or better
return TRUE;
}
if (! theProc)
{ // not found, must be 4.00
version = 400;
}
else
if ( gs_hRichEdit )
{
::FreeLibrary(gs_hRichEdit);
}
// always try load riched20.dll first - like this we won't have to reload
// it later if we're first asked for RE 1 and then for RE 2 or 3
wxString dllname = _T("riched20.dll");
gs_hRichEdit = ::LoadLibrary(dllname);
if ( !gs_hRichEdit && (version == 1) )
{
// fall back to RE 1
dllname = _T("riched32.dll");
gs_hRichEdit = ::LoadLibrary(dllname);
}
if ( !gs_hRichEdit )
{
wxLogSysError(_("Could not load Rich Edit DLL '%s'"), dllname.c_str());
gs_verRichEdit = -1;
return FALSE;
}
gs_verRichEdit = version;
return TRUE;
}
#endif // wxUSE_RICHEDIT
/* static */
int wxApp::GetComCtl32Version()
{
// TODO should use DllGetVersion() instead of this hack
// cache the result
static int s_verComCtl32 = -1; // MT-FIXME
if ( s_verComCtl32 == -1 )
{
s_verComCtl32 = 0;
// have we loaded COMCTL32 yet?
HMODULE theModule = ::GetModuleHandle(wxT("COMCTL32"));
// if so, then we can check for the version
if (theModule)
{
// The following symbol are unique to 4.71
// DllInstall
// FlatSB_EnableScrollBar FlatSB_GetScrollInfo FlatSB_GetScrollPos
// FlatSB_GetScrollProp FlatSB_GetScrollRange FlatSB_SetScrollInfo
// FlatSB_SetScrollPos FlatSB_SetScrollProp FlatSB_SetScrollRange
// FlatSB_ShowScrollBar
// _DrawIndirectImageList _DuplicateImageList
// InitializeFlatSB
// UninitializeFlatSB
// we could check for any of these - I chose DllInstall
FARPROC theProc = ::GetProcAddress(theModule, "DllInstall");
if (! theProc)
{
// not found, must be 4.70
version = 470;
// InitCommonControlsEx is unique to 4.7 and later
FARPROC theProc = ::GetProcAddress(theModule,
_T("InitCommonControlsEx"));
if ( !theProc )
{ // not found, must be 4.00
s_verComCtl32 = 400;
}
else
{ // found, must be 4.71
version = 471;
{
// The following symbol are unique to 4.71
// DllInstall
// FlatSB_EnableScrollBar FlatSB_GetScrollInfo FlatSB_GetScrollPos
// FlatSB_GetScrollProp FlatSB_GetScrollRange FlatSB_SetScrollInfo
// FlatSB_SetScrollPos FlatSB_SetScrollProp FlatSB_SetScrollRange
// FlatSB_ShowScrollBar
// _DrawIndirectImageList _DuplicateImageList
// InitializeFlatSB
// UninitializeFlatSB
// we could check for any of these - I chose DllInstall
FARPROC theProc = ::GetProcAddress(theModule, _T("DllInstall"));
if ( !theProc )
{
// not found, must be 4.70
s_verComCtl32 = 470;
}
else
{ // found, must be 4.71
s_verComCtl32 = 471;
}
}
}
}
return version;
return s_verComCtl32;
}
void wxExit()

File diff suppressed because it is too large Load Diff

View File

@@ -319,7 +319,9 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
wxBM->SetWidth(bm.bmWidth);
wxBM->SetHeight(bm.bmHeight);
wxBM->SetDepth(bm.bmPlanes);
#if WXWIN_COMPATIBILITY_2
wxBM->SetOk(TRUE);
#endif // WXWIN_COMPATIBILITY_2
retval = wxBM;
break;
}