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:
@@ -50,7 +50,8 @@ class WXDLLEXPORT wxString;
|
|||||||
// Bitmap flags
|
// Bitmap flags
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
wxBITMAP_TYPE_BMP = 1,
|
wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility!
|
||||||
|
wxBITMAP_TYPE_BMP,
|
||||||
wxBITMAP_TYPE_BMP_RESOURCE,
|
wxBITMAP_TYPE_BMP_RESOURCE,
|
||||||
wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
|
wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
|
||||||
wxBITMAP_TYPE_ICO,
|
wxBITMAP_TYPE_ICO,
|
||||||
@@ -73,12 +74,12 @@ enum
|
|||||||
wxBITMAP_TYPE_PNM_RESOURCE,
|
wxBITMAP_TYPE_PNM_RESOURCE,
|
||||||
wxBITMAP_TYPE_PCX,
|
wxBITMAP_TYPE_PCX,
|
||||||
wxBITMAP_TYPE_PCX_RESOURCE,
|
wxBITMAP_TYPE_PCX_RESOURCE,
|
||||||
wxBITMAP_TYPE_PICT,
|
wxBITMAP_TYPE_PICT,
|
||||||
wxBITMAP_TYPE_PICT_RESOURCE,
|
wxBITMAP_TYPE_PICT_RESOURCE,
|
||||||
wxBITMAP_TYPE_ICON,
|
wxBITMAP_TYPE_ICON,
|
||||||
wxBITMAP_TYPE_ICON_RESOURCE,
|
wxBITMAP_TYPE_ICON_RESOURCE,
|
||||||
wxBITMAP_TYPE_MACCURSOR ,
|
wxBITMAP_TYPE_MACCURSOR,
|
||||||
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
|
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
|
||||||
wxBITMAP_TYPE_ANY = 50
|
wxBITMAP_TYPE_ANY = 50
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -45,12 +45,7 @@ class WXDLLEXPORT wxMenu;
|
|||||||
class WXDLLEXPORT wxMenuItemBase : public wxObject
|
class WXDLLEXPORT wxMenuItemBase : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// some compilers need a default constructor here, do not use
|
wxMenuItemBase() { }
|
||||||
wxMenuItemBase() {}
|
|
||||||
|
|
||||||
/* This makes no sense (lots of asserts on MSW) so commenting out -- JACS
|
|
||||||
{ wxFAIL_MSG( wxT("illegal call") ); }
|
|
||||||
*/
|
|
||||||
|
|
||||||
// creation
|
// creation
|
||||||
static wxMenuItem *New(wxMenu *parentMenu = (wxMenu *)NULL,
|
static wxMenuItem *New(wxMenu *parentMenu = (wxMenu *)NULL,
|
||||||
|
@@ -83,7 +83,16 @@ public:
|
|||||||
virtual bool ProcessMessage(WXMSG* pMsg);
|
virtual bool ProcessMessage(WXMSG* pMsg);
|
||||||
void DeletePendingObjects();
|
void DeletePendingObjects();
|
||||||
bool ProcessIdle();
|
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:
|
public:
|
||||||
int m_nCmdShow;
|
int m_nCmdShow;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: bitmap.h
|
// Name: wx/msw/bitmap.h
|
||||||
// Purpose: wxBitmap class
|
// Purpose: wxBitmap class
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -16,109 +16,57 @@
|
|||||||
#pragma interface "bitmap.h"
|
#pragma interface "bitmap.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/gdiobj.h"
|
#include "wx/msw/gdiimage.h"
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
#include "wx/palette.h"
|
#include "wx/palette.h"
|
||||||
|
|
||||||
// Bitmap
|
|
||||||
class WXDLLEXPORT wxDC;
|
class WXDLLEXPORT wxDC;
|
||||||
class WXDLLEXPORT wxControl;
|
class WXDLLEXPORT wxControl;
|
||||||
class WXDLLEXPORT wxBitmap;
|
class WXDLLEXPORT wxBitmap;
|
||||||
class WXDLLEXPORT wxBitmapHandler;
|
class WXDLLEXPORT wxBitmapHandler;
|
||||||
class WXDLLEXPORT wxIcon;
|
class WXDLLEXPORT wxIcon;
|
||||||
|
class WXDLLEXPORT wxMask;
|
||||||
class WXDLLEXPORT wxCursor;
|
class WXDLLEXPORT wxCursor;
|
||||||
class WXDLLEXPORT wxControl;
|
class WXDLLEXPORT wxControl;
|
||||||
|
|
||||||
// A mask is a mono bitmap used for drawing bitmaps
|
// ----------------------------------------------------------------------------
|
||||||
// transparently.
|
// Bitmap data
|
||||||
class WXDLLEXPORT wxMask: public wxObject
|
//
|
||||||
|
// 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:
|
public:
|
||||||
wxBitmapRefData();
|
wxBitmapRefData();
|
||||||
~wxBitmapRefData();
|
virtual ~wxBitmapRefData() { Free(); }
|
||||||
|
|
||||||
|
virtual void Free();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int m_width;
|
int m_numColors;
|
||||||
int m_height;
|
wxPalette m_bitmapPalette;
|
||||||
int m_depth;
|
int m_quality;
|
||||||
bool m_ok;
|
|
||||||
int m_numColors;
|
|
||||||
wxPalette m_bitmapPalette;
|
|
||||||
int m_quality;
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
// MSW-specific
|
||||||
WXHBITMAP m_hBitmap;
|
// ------------
|
||||||
wxDC * m_selectedInto; // So bitmap knows whether it's been selected into
|
|
||||||
// a device context (for error checking)
|
// this field is solely for error checking: we detect selecting a bitmap
|
||||||
wxMask * m_bitmapMask; // Option mask
|
// into more than one DC at once or deleting a bitmap still selected into a
|
||||||
#endif
|
// 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:
|
public:
|
||||||
// default ctor creates an invalid bitmap, you must Create() it later
|
// default ctor creates an invalid bitmap, you must Create() it later
|
||||||
wxBitmap() { Init(); }
|
wxBitmap() { Init(); }
|
||||||
@@ -159,82 +107,169 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxBitmap& operator=(const wxCursor& cursor)
|
||||||
|
{
|
||||||
|
(void)CopyFromCursor(cursor);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~wxBitmap();
|
virtual ~wxBitmap();
|
||||||
|
|
||||||
// copies the contents and mask of the given (colour) icon to the bitmap
|
// copies the contents and mask of the given (colour) icon to the bitmap
|
||||||
bool CopyFromIcon(const wxIcon& icon);
|
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(int width, int height, int depth = -1);
|
||||||
virtual bool Create(void *data, long type, 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 LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE);
|
||||||
virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
|
virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
|
||||||
|
|
||||||
bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); }
|
wxBitmapRefData *GetBitmapData() const { return (wxBitmapRefData *)m_refData; }
|
||||||
int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); }
|
|
||||||
int GetHeight() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_height : 0); }
|
int GetQuality() const { return (GetBitmapData() ? GetBitmapData()->m_quality : 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);
|
|
||||||
void SetQuality(int q);
|
void SetQuality(int q);
|
||||||
void SetOk(bool isOk);
|
|
||||||
#if WXWIN_COMPATIBILITY
|
wxPalette* GetPalette() const { return (GetBitmapData() ? (& GetBitmapData()->m_bitmapPalette) : (wxPalette*) NULL); }
|
||||||
wxPalette *GetColourMap() const { return GetPalette(); }
|
|
||||||
void SetColourMap(wxPalette *cmap) { SetPalette(*cmap); };
|
|
||||||
#endif
|
|
||||||
wxPalette* GetPalette() const { return (M_BITMAPDATA ? (& M_BITMAPDATA->m_bitmapPalette) : (wxPalette*) NULL); }
|
|
||||||
void SetPalette(const wxPalette& palette);
|
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) ;
|
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; }
|
||||||
bool operator!=(const wxBitmap& bitmap) { return m_refData != bitmap.m_refData; }
|
bool operator!=(const wxBitmap& bitmap) { return m_refData != bitmap.m_refData; }
|
||||||
|
|
||||||
// Format handling
|
#if WXWIN_COMPATIBILITY_2
|
||||||
static wxList& GetHandlers() { return sm_handlers; }
|
void SetOk(bool isOk);
|
||||||
static void AddHandler(wxBitmapHandler *handler);
|
#endif // WXWIN_COMPATIBILITY_2
|
||||||
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);
|
|
||||||
|
|
||||||
static void InitStandardHandlers();
|
#if WXWIN_COMPATIBILITY
|
||||||
static void CleanUpHandlers();
|
wxPalette *GetColourMap() const { return GetPalette(); }
|
||||||
|
void SetColourMap(wxPalette *cmap) { SetPalette(*cmap); };
|
||||||
protected:
|
#endif // WXWIN_COMPATIBILITY
|
||||||
static wxList sm_handlers;
|
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
public:
|
public:
|
||||||
void SetHBITMAP(WXHBITMAP bmp);
|
void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); }
|
||||||
WXHBITMAP GetHBITMAP() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hBitmap : 0); }
|
WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); }
|
||||||
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);
|
|
||||||
|
|
||||||
// Creates a bitmap that matches the device context's depth, from
|
void SetSelectedInto(wxDC *dc) { if (GetBitmapData()) GetBitmapData()->m_selectedInto = dc; }
|
||||||
// an arbitray bitmap. At present, the original bitmap must have an
|
wxDC *GetSelectedInto() const { return (GetBitmapData() ? GetBitmapData()->m_selectedInto : (wxDC*) NULL); }
|
||||||
// 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
|
// Creates a bitmap that matches the device context's depth, from an
|
||||||
// the wrong depth). wxDC::SelectObject will compare the depth of the bitmap
|
// arbitray bitmap. At present, the original bitmap must have an associated
|
||||||
// with the DC's depth, and create a new bitmap if the depths differ.
|
// palette. (TODO: use a default palette if no palette exists.) This
|
||||||
// Eventually we should perhaps make this a public API function so that
|
// function is necessary for you to Blit an arbitrary bitmap (which may
|
||||||
// an app can efficiently produce bitmaps of the correct depth.
|
// have the wrong depth). wxDC::SelectObject will compare the depth of the
|
||||||
// The Windows solution is to use SetDibBits to blit an arbotrary DIB directly to a DC, but
|
// bitmap with the DC's depth, and create a new bitmap if the depths
|
||||||
// this is too Windows-specific, hence this solution of quietly converting the wxBitmap.
|
// differ. Eventually we should perhaps make this a public API function so
|
||||||
// Contributed by Frederic Villeneuve <frederic.villeneuve@natinst.com>
|
// 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;
|
wxBitmap GetBitmapForDC(wxDC& dc) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
virtual wxGDIImageRefData *CreateData() const
|
||||||
|
{ return new wxBitmapRefData; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef __WIN32__
|
||||||
|
// common part of CopyFromIcon/CopyFromCursor for Win32
|
||||||
|
bool CopyFromIconOrCursor(const wxGDIImage& icon);
|
||||||
|
#endif // __WIN32__
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
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
|
#endif
|
||||||
// _WX_BITMAP_H_
|
// _WX_BITMAP_H_
|
||||||
|
@@ -1,67 +1,82 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: cursor.h
|
// Name: wx/msw/cursor.h
|
||||||
// Purpose: wxCursor class
|
// Purpose: wxCursor class
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_CURSOR_H_
|
#ifndef _WX_CURSOR_H_
|
||||||
#define _WX_CURSOR_H_
|
#define _WX_CURSOR_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "cursor.h"
|
#pragma interface "cursor.h"
|
||||||
#endif
|
#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:
|
public:
|
||||||
wxCursorRefData(void);
|
wxCursorRefData();
|
||||||
~wxCursorRefData(void);
|
virtual ~wxCursorRefData() { Free(); }
|
||||||
|
|
||||||
protected:
|
virtual void Free();
|
||||||
WXHCURSOR m_hCursor;
|
|
||||||
bool m_destroyCursor;
|
// for compatibility
|
||||||
|
public:
|
||||||
|
bool m_destroyCursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
|
|
||||||
#define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
|
|
||||||
|
|
||||||
// Cursor
|
// Cursor
|
||||||
class WXDLLEXPORT wxCursor: public wxBitmap
|
class WXDLLEXPORT wxCursor : public wxCursorBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxCursor)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxCursor(void);
|
wxCursor();
|
||||||
|
|
||||||
// Copy constructors
|
// Copy constructors
|
||||||
inline wxCursor(const wxCursor& cursor) { Ref(cursor); }
|
wxCursor(const wxCursor& cursor) { Ref(cursor); }
|
||||||
|
|
||||||
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
|
wxCursor(const char bits[], int width, int height,
|
||||||
const char maskBits[] = NULL);
|
int hotSpotX = -1, int hotSpotY = -1,
|
||||||
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_CUR_RESOURCE,
|
const char maskBits[] = NULL);
|
||||||
int hotSpotX = 0, int hotSpotY = 0);
|
wxCursor(const wxString& name,
|
||||||
wxCursor(int cursor_type);
|
long flags = wxBITMAP_TYPE_CUR_RESOURCE,
|
||||||
~wxCursor(void);
|
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; }
|
void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); }
|
||||||
bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
|
WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); }
|
||||||
bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; }
|
|
||||||
|
|
||||||
void SetHCURSOR(WXHCURSOR cursor);
|
protected:
|
||||||
inline WXHCURSOR GetHCURSOR(void) const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
|
virtual wxGDIImageRefData *CreateData() const { return new wxCursorRefData; }
|
||||||
|
|
||||||
bool FreeResource(bool force = FALSE);
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxCursor)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,22 +1,41 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: dib.h
|
// Name: wx/msw/dib.h
|
||||||
// Purpose: Routines for loading and saving DIBs
|
// Purpose: Routines for loading and saving DIBs
|
||||||
// Author: Various
|
// Author: Various
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_DIB_H_
|
#ifndef _WX_DIB_H_
|
||||||
#define _WX_DIB_H_
|
#define _WX_DIB_H_
|
||||||
|
|
||||||
class WXDLLEXPORT wxBitmap;
|
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
|
// 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
|
// Load device independent bitmap into device dependent bitmap
|
||||||
wxBitmap *wxLoadBitmap(wxChar *filename, wxColourMap **colourmap = NULL);
|
wxBitmap *wxLoadBitmap(wxChar *filename, wxColourMap **colourmap = NULL);
|
||||||
@@ -30,5 +49,5 @@ HANDLE wxReadDIB2(LPTSTR lpFileName);
|
|||||||
LPSTR wxFindDIBBits (LPSTR lpbi);
|
LPSTR wxFindDIBBits (LPSTR lpbi);
|
||||||
HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo);
|
HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo);
|
||||||
|
|
||||||
#endif
|
#endif // _WX_DIB_H_
|
||||||
|
|
||||||
|
@@ -1,66 +1,64 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: gdiobj.h
|
// Name: wx/msw/gdiobj.h
|
||||||
// Purpose: wxGDIObject class: base class for other GDI classes
|
// Purpose: wxGDIObject class: base class for other GDI classes
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_GDIOBJ_H_
|
#ifndef _WX_GDIOBJ_H_
|
||||||
#define _WX_GDIOBJ_H_
|
#define _WX_GDIOBJ_H_
|
||||||
|
|
||||||
#include "wx/object.h"
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "gdiobj.h"
|
#pragma interface "gdiobj.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// wxGDIRefData is the reference-counted data part of a GDI object.
|
#include "wx/object.h" // base class
|
||||||
// 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
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxGDIRefData: public wxObjectRefData {
|
// ----------------------------------------------------------------------------
|
||||||
public:
|
// wxGDIRefData is the base class for wxXXXData structures which contain the
|
||||||
inline wxGDIRefData(void)
|
// 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:
|
||||||
public:
|
wxGDIObject() { m_visible = FALSE; };
|
||||||
inline wxGDIObject(void) { m_visible = FALSE; };
|
|
||||||
inline ~wxGDIObject(void) {};
|
|
||||||
|
|
||||||
// Creates the resource
|
// Creates the resource
|
||||||
virtual bool RealizeResource(void) { return FALSE; };
|
virtual bool RealizeResource() { return FALSE; };
|
||||||
|
|
||||||
// Frees the resource
|
// Frees the resource
|
||||||
virtual bool FreeResource(bool WXUNUSED(force) = FALSE) { return FALSE; };
|
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.
|
// Returns handle.
|
||||||
virtual WXHANDLE GetResourceHandle(void) { return 0; }
|
virtual WXHANDLE GetResourceHandle() { return 0; }
|
||||||
|
|
||||||
virtual bool GetVisible(void) { return m_visible; }
|
virtual bool GetVisible() { return m_visible; }
|
||||||
virtual void SetVisible(bool v) { m_visible = v; }
|
virtual void SetVisible(bool v) { m_visible = v; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_visible; // Can a pointer to this object be safely taken?
|
bool m_visible; // TRUE only if we should delete this object ourselves
|
||||||
// - only if created within FindOrCreate...
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxGDIObject)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: icon.h
|
// Name: wx/msw/icon.h
|
||||||
// Purpose: wxIcon class
|
// Purpose: wxIcon class
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -16,34 +16,49 @@
|
|||||||
#pragma interface "icon.h"
|
#pragma interface "icon.h"
|
||||||
#endif
|
#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
|
// 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:
|
public:
|
||||||
wxIconRefData();
|
wxIconRefData() { }
|
||||||
~wxIconRefData();
|
virtual ~wxIconRefData() { Free(); }
|
||||||
|
|
||||||
public:
|
virtual void Free();
|
||||||
WXHICON m_hIcon;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define M_ICONDATA ((wxIconRefData *)m_refData)
|
|
||||||
#define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Icon
|
// Icon
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
class WXDLLEXPORT wxIcon : public wxBitmap
|
|
||||||
{
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxIcon)
|
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxIcon : public wxIconBase
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
wxIcon();
|
wxIcon();
|
||||||
|
|
||||||
@@ -51,61 +66,35 @@ public:
|
|||||||
wxIcon(const wxIcon& icon) { Ref(icon); }
|
wxIcon(const wxIcon& icon) { Ref(icon); }
|
||||||
|
|
||||||
wxIcon(const char bits[], int width, int height);
|
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);
|
int desiredWidth = -1, int desiredHeight = -1);
|
||||||
~wxIcon();
|
virtual ~wxIcon();
|
||||||
|
|
||||||
bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
|
virtual bool LoadFile(const wxString& name,
|
||||||
int desiredWidth = -1, int desiredHeight = -1);
|
long type = wxBITMAP_TYPE_ICO_RESOURCE,
|
||||||
|
int desiredWidth = -1, int desiredHeight = -1);
|
||||||
|
|
||||||
wxIcon& operator = (const wxIcon& icon)
|
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
|
bool operator == (const wxIcon& icon) const
|
||||||
{ return m_refData == icon.m_refData; }
|
{ return m_refData == icon.m_refData; }
|
||||||
bool operator != (const wxIcon& icon) const
|
bool operator != (const wxIcon& icon) const
|
||||||
{ return m_refData != icon.m_refData; }
|
{ return m_refData != icon.m_refData; }
|
||||||
|
|
||||||
void SetHICON(WXHICON ico);
|
wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
|
||||||
WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
|
|
||||||
|
|
||||||
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);
|
protected:
|
||||||
};
|
virtual wxGDIImageRefData *CreateData() const
|
||||||
|
|
||||||
// TODO: Put these in separate, private header
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
|
|
||||||
{
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
|
|
||||||
|
|
||||||
public:
|
|
||||||
wxICOFileHandler()
|
|
||||||
{
|
{
|
||||||
m_name = "ICO icon file";
|
return new wxIconRefData;
|
||||||
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);
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxIcon)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -220,6 +220,23 @@ inline void wxRGBToColour(wxColour& c, COLORREF rgb)
|
|||||||
c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(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()
|
// 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
|
// returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
|
||||||
|
@@ -19,6 +19,10 @@
|
|||||||
// define this to 0 when building wxBase library
|
// define this to 0 when building wxBase library
|
||||||
#define wxUSE_GUI 1
|
#define wxUSE_GUI 1
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// compatibility settings
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define WXWIN_COMPATIBILITY 0
|
#define WXWIN_COMPATIBILITY 0
|
||||||
// Compatibility with 1.68 API.
|
// Compatibility with 1.68 API.
|
||||||
// Level 0: no backward compatibility, all new features
|
// Level 0: no backward compatibility, all new features
|
||||||
@@ -26,6 +30,19 @@
|
|||||||
// the compatibility code is now very minimal so there
|
// the compatibility code is now very minimal so there
|
||||||
// is little advantage to setting it to 1.
|
// 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
|
// General features
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -300,6 +317,13 @@
|
|||||||
// See note above about using FAFA and CTL3D.
|
// See note above about using FAFA and CTL3D.
|
||||||
#endif
|
#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
|
#define wxUSE_COMMON_DIALOGS 1
|
||||||
// On rare occasions (e.g. using DJGPP) may want
|
// On rare occasions (e.g. using DJGPP) may want
|
||||||
// to omit common dialogs
|
// to omit common dialogs
|
||||||
|
@@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
wxStaticBitmap(wxWindow *parent,
|
wxStaticBitmap(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxBitmap& label,
|
const wxGDIImage& label,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxBitmap& label,
|
const wxGDIImage& label,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
@@ -50,15 +50,15 @@ public:
|
|||||||
|
|
||||||
virtual ~wxStaticBitmap() { Free(); }
|
virtual ~wxStaticBitmap() { Free(); }
|
||||||
|
|
||||||
virtual void SetIcon(const wxIcon& icon) { SetBitmap(icon); }
|
void SetIcon(const wxIcon& icon) { SetImage(icon); }
|
||||||
virtual void SetBitmap(const wxBitmap& bitmap);
|
void SetBitmap(const wxBitmap& bitmap) { SetImage(bitmap); }
|
||||||
|
|
||||||
// assert failure is provoked by an attempt to get an icon from bitmap or
|
// assert failure is provoked by an attempt to get an icon from bitmap or
|
||||||
// vice versa
|
// vice versa
|
||||||
const wxIcon& GetIcon() const
|
const wxIcon& GetIcon() const
|
||||||
{ wxASSERT( m_isIcon ); return *m_image.icon; }
|
{ wxASSERT( m_isIcon ); return *(wxIcon *)m_image; }
|
||||||
const wxBitmap& GetBitmap() const
|
const wxBitmap& GetBitmap() const
|
||||||
{ wxASSERT( !m_isIcon ); return *m_image.bitmap; }
|
{ wxASSERT( !m_isIcon ); return *(wxBitmap *)m_image; }
|
||||||
|
|
||||||
// overriden base class virtuals
|
// overriden base class virtuals
|
||||||
virtual bool AcceptsFocus() const { return FALSE; }
|
virtual bool AcceptsFocus() const { return FALSE; }
|
||||||
@@ -70,21 +70,19 @@ public:
|
|||||||
#endif // __WIN16__
|
#endif // __WIN16__
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init() { m_isIcon = TRUE; m_image.icon = NULL; }
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
void Init() { m_isIcon = TRUE; m_image = NULL; }
|
||||||
void Free();
|
void Free();
|
||||||
|
|
||||||
// TRUE if icon/bitmap is valid
|
// TRUE if icon/bitmap is valid
|
||||||
bool ImageIsOk() const;
|
bool ImageIsOk() const;
|
||||||
|
|
||||||
|
void SetImage(const wxGDIImage& image);
|
||||||
|
|
||||||
// we can have either an icon or a bitmap
|
// we can have either an icon or a bitmap
|
||||||
bool m_isIcon;
|
bool m_isIcon;
|
||||||
union
|
wxGDIImage *m_image;
|
||||||
{
|
|
||||||
wxIcon *icon;
|
|
||||||
wxBitmap *bitmap;
|
|
||||||
} m_image;
|
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: tbarbase.h
|
// Name: wx/tbarbase.h
|
||||||
// Purpose: Base class for toolbar classes
|
// Purpose: Base class for toolbar classes
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -21,7 +21,8 @@
|
|||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
|
|
||||||
#if wxUSE_THREADS
|
#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__
|
#ifdef __GNUG__
|
||||||
#pragma interface "thread.h"
|
#pragma interface "thread.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -37,28 +38,31 @@
|
|||||||
// constants
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef enum
|
enum wxMutexError
|
||||||
{
|
{
|
||||||
wxMUTEX_NO_ERROR = 0,
|
wxMUTEX_NO_ERROR = 0,
|
||||||
wxMUTEX_DEAD_LOCK, // Mutex has been already locked by THE CALLING thread
|
wxMUTEX_DEAD_LOCK, // Mutex has been already locked by THE CALLING thread
|
||||||
wxMUTEX_BUSY, // Mutex has been already locked by ONE thread
|
wxMUTEX_BUSY, // Mutex has been already locked by ONE thread
|
||||||
wxMUTEX_UNLOCKED,
|
wxMUTEX_UNLOCKED,
|
||||||
wxMUTEX_MISC_ERROR
|
wxMUTEX_MISC_ERROR
|
||||||
} wxMutexError;
|
};
|
||||||
|
|
||||||
typedef enum
|
enum wxThreadError
|
||||||
{
|
{
|
||||||
wxTHREAD_NO_ERROR = 0, // No error
|
wxTHREAD_NO_ERROR = 0, // No error
|
||||||
wxTHREAD_NO_RESOURCE, // No resource left to create a new thread
|
wxTHREAD_NO_RESOURCE, // No resource left to create a new thread
|
||||||
wxTHREAD_RUNNING, // The thread is already running
|
wxTHREAD_RUNNING, // The thread is already running
|
||||||
wxTHREAD_NOT_RUNNING, // The thread isn't running
|
wxTHREAD_NOT_RUNNING, // The thread isn't running
|
||||||
wxTHREAD_MISC_ERROR // Some other error
|
wxTHREAD_MISC_ERROR // Some other error
|
||||||
} wxThreadError;
|
};
|
||||||
|
|
||||||
// defines the interval of priority
|
// defines the interval of priority
|
||||||
#define WXTHREAD_MIN_PRIORITY 0u
|
enum
|
||||||
#define WXTHREAD_DEFAULT_PRIORITY 50u
|
{
|
||||||
#define WXTHREAD_MAX_PRIORITY 100u
|
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
|
// 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
|
// 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
|
// threads of the same process. For the platforms which don't have native
|
||||||
// support for critical sections, they're implemented entirely in terms of
|
// 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
|
class WXDLLEXPORT wxCriticalSectionInternal;
|
||||||
// functions inline - but this can't be done under MSW
|
|
||||||
#if defined(__WXMSW__)
|
// in order to avoid any overhead under platforms where critical sections are
|
||||||
class WXDLLEXPORT wxCriticalSectionInternal;
|
// just mutexes make all wxCriticalSection class functions inline
|
||||||
#define WXCRITICAL_INLINE
|
#if !defined(__WXMSW__) && !defined(__WXPM__) && !defined(__WXMAC__)
|
||||||
#elif defined(__WXMAC__)
|
|
||||||
class WXDLLEXPORT wxCriticalSectionInternal;
|
|
||||||
#define WXCRITICAL_INLINE
|
|
||||||
#elif defined(__WXPM__)
|
|
||||||
#define WXCRITICAL_INLINE
|
|
||||||
#else // !MSW && !PM
|
|
||||||
#define WXCRITICAL_INLINE inline
|
#define WXCRITICAL_INLINE inline
|
||||||
|
|
||||||
|
#define wxCRITSECT_IS_MUTEX 1
|
||||||
|
#else // MSW || Mac || OS2
|
||||||
|
#define WXCRITICAL_INLINE
|
||||||
|
|
||||||
|
#define wxCRITSECT_IS_MUTEX 0
|
||||||
#endif // MSW/!MSW
|
#endif // MSW/!MSW
|
||||||
|
|
||||||
// you should consider wxCriticalSectionLocker whenever possible instead of
|
// you should consider wxCriticalSectionLocker whenever possible instead of
|
||||||
@@ -165,11 +172,18 @@ private:
|
|||||||
wxCriticalSection(const wxCriticalSection&);
|
wxCriticalSection(const wxCriticalSection&);
|
||||||
wxCriticalSection& operator=(const wxCriticalSection&);
|
wxCriticalSection& operator=(const wxCriticalSection&);
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXMAC__)
|
#if wxCRITSECT_IS_MUTEX
|
||||||
wxCriticalSectionInternal *m_critsect;
|
|
||||||
#else // !MSW
|
|
||||||
wxMutex m_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
|
// keep your preprocessor name space clean
|
||||||
|
@@ -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__)
|
#if defined(__WXMSW__) && defined(__WIN95__)
|
||||||
# include "wx/msw/tbar95.h"
|
# include "wx/msw/tbar95.h"
|
||||||
@@ -20,4 +39,4 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _TOOLBAR_H_BASE_
|
// _WX_TOOLBAR_H_BASE_
|
||||||
|
@@ -499,7 +499,8 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
|
|||||||
for (wxNode * node = First (); node; node = node->Next ())
|
for (wxNode * node = First (); node; node = node->Next ())
|
||||||
{
|
{
|
||||||
wxPen *each_pen = (wxPen *) node->Data ();
|
wxPen *each_pen = (wxPen *) node->Data ();
|
||||||
if (each_pen && each_pen->GetVisible() &&
|
if (each_pen &&
|
||||||
|
each_pen->GetVisible() &&
|
||||||
each_pen->GetWidth () == width &&
|
each_pen->GetWidth () == width &&
|
||||||
each_pen->GetStyle () == style &&
|
each_pen->GetStyle () == style &&
|
||||||
each_pen->GetColour ().Red () == colour.Red () &&
|
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
|
// returning a pointer to an automatic variable and hanging on to it
|
||||||
// (dangling pointer).
|
// (dangling pointer).
|
||||||
pen->SetVisible(TRUE);
|
pen->SetVisible(TRUE);
|
||||||
|
|
||||||
return pen;
|
return pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,19 +544,23 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
|
|||||||
for (wxNode * node = First (); node; node = node->Next ())
|
for (wxNode * node = First (); node; node = node->Next ())
|
||||||
{
|
{
|
||||||
wxBrush *each_brush = (wxBrush *) node->Data ();
|
wxBrush *each_brush = (wxBrush *) node->Data ();
|
||||||
if (each_brush && each_brush->GetVisible() &&
|
if (each_brush &&
|
||||||
|
each_brush->GetVisible() &&
|
||||||
each_brush->GetStyle () == style &&
|
each_brush->GetStyle () == style &&
|
||||||
each_brush->GetColour ().Red () == colour.Red () &&
|
each_brush->GetColour ().Red () == colour.Red () &&
|
||||||
each_brush->GetColour ().Green () == colour.Green () &&
|
each_brush->GetColour ().Green () == colour.Green () &&
|
||||||
each_brush->GetColour ().Blue () == colour.Blue ())
|
each_brush->GetColour ().Blue () == colour.Blue ())
|
||||||
return each_brush;
|
return each_brush;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Yes, we can return a pointer to this in a later FindOrCreateBrush call,
|
// Yes, we can return a pointer to this in a later FindOrCreateBrush call,
|
||||||
// because we created it within FindOrCreateBrush. Safeguards against
|
// because we created it within FindOrCreateBrush. Safeguards against
|
||||||
// returning a pointer to an automatic variable and hanging on to it
|
// returning a pointer to an automatic variable and hanging on to it
|
||||||
// (dangling pointer).
|
// (dangling pointer).
|
||||||
wxBrush *brush = new wxBrush (colour, style);
|
wxBrush *brush = new wxBrush (colour, style);
|
||||||
|
|
||||||
brush->SetVisible(TRUE);
|
brush->SetVisible(TRUE);
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,19 +571,19 @@ void wxBrushList::RemoveBrush (wxBrush * brush)
|
|||||||
|
|
||||||
wxFontList::~wxFontList ()
|
wxFontList::~wxFontList ()
|
||||||
{
|
{
|
||||||
wxNode *node = First ();
|
wxNode *node = First ();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
// Only delete objects that are 'visible', i.e.
|
// Only delete objects that are 'visible', i.e.
|
||||||
// that have been created using FindOrCreate...,
|
// that have been created using FindOrCreate...,
|
||||||
// where the pointers are expected to be shared
|
// where the pointers are expected to be shared
|
||||||
// (and therefore not deleted by any one part of an app).
|
// (and therefore not deleted by any one part of an app).
|
||||||
wxFont *font = (wxFont *) node->Data ();
|
wxFont *font = (wxFont *) node->Data ();
|
||||||
wxNode *next = node->Next ();
|
wxNode *next = node->Next ();
|
||||||
if (font->GetVisible())
|
if (font->GetVisible())
|
||||||
delete font;
|
delete font;
|
||||||
node = next;
|
node = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFontList::AddFont (wxFont * font)
|
void wxFontList::AddFont (wxFont * font)
|
||||||
@@ -596,27 +602,27 @@ wxFont *wxFontList::
|
|||||||
for (wxNode * node = First (); node; node = node->Next ())
|
for (wxNode * node = First (); node; node = node->Next ())
|
||||||
{
|
{
|
||||||
wxFont *each_font = (wxFont *) node->Data ();
|
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->GetPointSize () == PointSize &&
|
||||||
each_font->GetStyle () == Style &&
|
each_font->GetStyle () == Style &&
|
||||||
each_font->GetWeight () == Weight &&
|
each_font->GetWeight () == Weight &&
|
||||||
each_font->GetUnderlined () == underline &&
|
each_font->GetUnderlined () == underline &&
|
||||||
//#if defined(__X__)
|
|
||||||
// each_font->GetFontId () == FamilyOrFontId) /* New font system */
|
|
||||||
//#else
|
|
||||||
#if defined(__WXGTK__)
|
#if defined(__WXGTK__)
|
||||||
(each_font->GetFamily() == FamilyOrFontId ||
|
(each_font->GetFamily() == FamilyOrFontId ||
|
||||||
(each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) &&
|
(each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) &&
|
||||||
#else
|
#else
|
||||||
each_font->GetFamily() == FamilyOrFontId &&
|
each_font->GetFamily() == FamilyOrFontId &&
|
||||||
#endif
|
#endif
|
||||||
((each_font->GetFaceName() == wxT("")) || each_font->GetFaceName() == Face) &&
|
((each_font->GetFaceName() == wxT("")) || each_font->GetFaceName() == Face) &&
|
||||||
(encoding == wxFONTENCODING_DEFAULT || each_font->GetEncoding() == encoding))
|
(encoding == wxFONTENCODING_DEFAULT || each_font->GetEncoding() == encoding))
|
||||||
//#endif
|
|
||||||
return each_font;
|
return each_font;
|
||||||
}
|
}
|
||||||
wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face, encoding);
|
wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face, encoding);
|
||||||
|
|
||||||
font->SetVisible(TRUE);
|
font->SetVisible(TRUE);
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -894,11 +894,10 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
free(lpDIBh);
|
free(lpDIBh);
|
||||||
free(lpBits);
|
free(lpBits);
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_2
|
||||||
// check the wxBitmap object
|
// check the wxBitmap object
|
||||||
if( bitmap.GetHBITMAP() )
|
bitmap.GetBitmapData()->SetOk();
|
||||||
bitmap.SetOk( TRUE );
|
#endif // WXWIN_COMPATIBILITY_2
|
||||||
else
|
|
||||||
bitmap.SetOk( FALSE );
|
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
143
src/msw/app.cpp
143
src/msw/app.cpp
@@ -129,14 +129,10 @@ HBRUSH wxDisableButtonBrush = (HBRUSH) 0;
|
|||||||
|
|
||||||
LRESULT WXDLLEXPORT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM);
|
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
|
#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
|
#endif
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -193,15 +189,6 @@ bool wxApp::Initialize()
|
|||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
InitCommonControls();
|
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__
|
#endif // __WIN95__
|
||||||
|
|
||||||
#if wxUSE_OLE
|
#if wxUSE_OLE
|
||||||
@@ -517,15 +504,11 @@ void wxApp::CleanUp()
|
|||||||
|
|
||||||
wxSetKeyboardHook(FALSE);
|
wxSetKeyboardHook(FALSE);
|
||||||
|
|
||||||
#ifdef __WIN95__
|
|
||||||
|
|
||||||
#if wxUSE_RICHEDIT
|
#if wxUSE_RICHEDIT
|
||||||
if (gs_hRichEdit != (HINSTANCE) NULL)
|
if (gs_hRichEdit != (HINSTANCE) NULL)
|
||||||
FreeLibrary(gs_hRichEdit);
|
FreeLibrary(gs_hRichEdit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_PENWINDOWS
|
#if wxUSE_PENWINDOWS
|
||||||
wxCleanUpPenWin();
|
wxCleanUpPenWin();
|
||||||
#endif
|
#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?
|
wxCHECK_MSG( version >= 1 && version <= 3, FALSE,
|
||||||
HMODULE theModule = ::GetModuleHandle(wxT("COMCTL32"));
|
_T("incorrect richedit control version requested") );
|
||||||
int version = 0;
|
|
||||||
|
|
||||||
// if so, then we can check for the version
|
if ( version <= gs_verRichEdit )
|
||||||
if (theModule)
|
|
||||||
{
|
{
|
||||||
// InitCommonControlsEx is unique to 4.7 and later
|
// we've already got this or better
|
||||||
FARPROC theProc = ::GetProcAddress(theModule, "InitCommonControlsEx");
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (! theProc)
|
if ( gs_hRichEdit )
|
||||||
{ // not found, must be 4.00
|
{
|
||||||
version = 400;
|
::FreeLibrary(gs_hRichEdit);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// 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
|
// InitCommonControlsEx is unique to 4.7 and later
|
||||||
// DllInstall
|
FARPROC theProc = ::GetProcAddress(theModule,
|
||||||
// FlatSB_EnableScrollBar FlatSB_GetScrollInfo FlatSB_GetScrollPos
|
_T("InitCommonControlsEx"));
|
||||||
// FlatSB_GetScrollProp FlatSB_GetScrollRange FlatSB_SetScrollInfo
|
|
||||||
// FlatSB_SetScrollPos FlatSB_SetScrollProp FlatSB_SetScrollRange
|
if ( !theProc )
|
||||||
// FlatSB_ShowScrollBar
|
{ // not found, must be 4.00
|
||||||
// _DrawIndirectImageList _DuplicateImageList
|
s_verComCtl32 = 400;
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
else
|
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()
|
void wxExit()
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -319,7 +319,9 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
wxBM->SetWidth(bm.bmWidth);
|
wxBM->SetWidth(bm.bmWidth);
|
||||||
wxBM->SetHeight(bm.bmHeight);
|
wxBM->SetHeight(bm.bmHeight);
|
||||||
wxBM->SetDepth(bm.bmPlanes);
|
wxBM->SetDepth(bm.bmPlanes);
|
||||||
|
#if WXWIN_COMPATIBILITY_2
|
||||||
wxBM->SetOk(TRUE);
|
wxBM->SetOk(TRUE);
|
||||||
|
#endif // WXWIN_COMPATIBILITY_2
|
||||||
retval = wxBM;
|
retval = wxBM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user