added DECLARE_NO_COPY_CLASS where appropriate since wxObject should not

provide implicit copy constructor or assignement (will be corrected)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Gilles Depeyrot
2002-05-08 13:30:26 +00:00
parent a4ac80e181
commit be52b34172
12 changed files with 90 additions and 60 deletions

View File

@@ -92,6 +92,8 @@ private:
class WXDLLEXPORT wxAppBase : public wxEvtHandler class WXDLLEXPORT wxAppBase : public wxEvtHandler
{ {
DECLARE_NO_COPY_CLASS(wxAppBase)
public: public:
wxAppBase(); wxAppBase();
virtual ~wxAppBase(); virtual ~wxAppBase();

View File

@@ -37,6 +37,8 @@ class WXDLLEXPORT wxWindowBase;
class WXDLLEXPORT wxControlContainer class WXDLLEXPORT wxControlContainer
{ {
DECLARE_NO_COPY_CLASS(wxControlContainer)
public: public:
// ctors and such // ctors and such
wxControlContainer(wxWindow *winParent = NULL); wxControlContainer(wxWindow *winParent = NULL);

View File

@@ -240,6 +240,8 @@ private:
// log everything to a "FILE *", stderr by default // log everything to a "FILE *", stderr by default
class WXDLLEXPORT wxLogStderr : public wxLog class WXDLLEXPORT wxLogStderr : public wxLog
{ {
DECLARE_NO_COPY_CLASS(wxLogStderr)
public: public:
// redirect log output to a FILE // redirect log output to a FILE
wxLogStderr(FILE *fp = (FILE *) NULL); wxLogStderr(FILE *fp = (FILE *) NULL);
@@ -293,7 +295,7 @@ protected:
class WXDLLEXPORT wxLogNull class WXDLLEXPORT wxLogNull
{ {
public: public:
wxLogNull() { m_flagOld = wxLog::EnableLogging(FALSE); } wxLogNull() : m_flagOld(wxLog::EnableLogging(FALSE)) { }
~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); } ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); }
private: private:

View File

@@ -32,6 +32,7 @@ class WXDLLEXPORT wxImage;
class WXDLLEXPORT wxMask: public wxObject class WXDLLEXPORT wxMask: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxMask) DECLARE_DYNAMIC_CLASS(wxMask)
DECLARE_NO_COPY_CLASS(wxMask)
public: public:
wxMask(); wxMask();
@@ -65,6 +66,8 @@ enum { kMacBitmapTypeUnknownType , kMacBitmapTypeGrafWorld, kMacBitmapTypePict ,
class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
{ {
DECLARE_NO_COPY_CLASS(wxBitmapRefData)
friend class WXDLLEXPORT wxBitmap; friend class WXDLLEXPORT wxBitmap;
friend class WXDLLEXPORT wxIcon; friend class WXDLLEXPORT wxIcon;
friend class WXDLLEXPORT wxCursor; friend class WXDLLEXPORT wxCursor;
@@ -94,22 +97,21 @@ class WXDLLEXPORT wxBitmapHandler: public wxBitmapHandlerBase
{ {
DECLARE_DYNAMIC_CLASS(wxBitmapHandler) DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
public: public:
wxBitmapHandler() { m_name = ""; m_extension = ""; m_type = 0; }; wxBitmapHandler() : m_name(), m_extension(), m_type(0) { }
#ifdef __DARWIN__ virtual ~wxBitmapHandler();
virtual ~wxBitmapHandler() { }
#endif
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1); 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, virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight); int desiredWidth, int desiredHeight);
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL); virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
inline void SetName(const wxString& name) { m_name = name; } void SetName(const wxString& name) { m_name = name; }
inline void SetExtension(const wxString& ext) { m_extension = ext; } void SetExtension(const wxString& ext) { m_extension = ext; }
inline void SetType(long type) { m_type = type; } void SetType(long type) { m_type = type; }
inline wxString GetName() const { return m_name; } wxString GetName() const { return m_name; }
inline wxString GetExtension() const { return m_extension; } wxString GetExtension() const { return m_extension; }
inline long GetType() const { return m_type; } long GetType() const { return m_type; }
protected: protected:
wxString m_name; wxString m_name;
wxString m_extension; wxString m_extension;
@@ -128,7 +130,8 @@ public:
wxBitmap(); // Platform-specific wxBitmap(); // Platform-specific
// Copy constructors // Copy constructors
inline wxBitmap(const wxBitmap& bitmap) wxBitmap(const wxBitmap& bitmap)
: wxBitmapBase()
{ Ref(bitmap); } { Ref(bitmap); }
// Initialize with raw data. // Initialize with raw data.

View File

@@ -20,6 +20,8 @@
class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
{ {
DECLARE_NO_COPY_CLASS(wxCursorRefData)
friend class WXDLLEXPORT wxBitmap; friend class WXDLLEXPORT wxBitmap;
friend class WXDLLEXPORT wxCursor; friend class WXDLLEXPORT wxCursor;
public: public:
@@ -42,7 +44,9 @@ public:
wxCursor(); wxCursor();
// Copy constructors // Copy constructors
inline wxCursor(const wxCursor& cursor) { Ref(cursor); } wxCursor(const wxCursor& cursor)
: wxBitmap()
{ Ref(cursor); }
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1, wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL); const char maskBits[] = NULL);

View File

@@ -51,6 +51,7 @@ class wxMacPortStateHelper ;
class WXDLLEXPORT wxDC: public wxDCBase class WXDLLEXPORT wxDC: public wxDCBase
{ {
DECLARE_DYNAMIC_CLASS(wxDC) DECLARE_DYNAMIC_CLASS(wxDC)
DECLARE_NO_COPY_CLASS(wxDC)
public: public:

View File

@@ -23,6 +23,8 @@ class WXDLLEXPORT wxPalette;
class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
{ {
DECLARE_NO_COPY_CLASS(wxPaletteRefData)
friend class WXDLLEXPORT wxPalette; friend class WXDLLEXPORT wxPalette;
public: public:
wxPaletteRefData(); wxPaletteRefData();
@@ -40,7 +42,9 @@ class WXDLLEXPORT wxPalette: public wxGDIObject
public: public:
wxPalette(); wxPalette();
inline wxPalette(const wxPalette& palette) { Ref(palette); } wxPalette(const wxPalette& palette)
: wxGDIObject()
{ Ref(palette); }
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
~wxPalette(); ~wxPalette();

View File

@@ -117,8 +117,9 @@ class WXDLLEXPORT wxMutexLocker
{ {
public: public:
// lock the mutex in the ctor // lock the mutex in the ctor
wxMutexLocker(wxMutex& mutex) : m_mutex(mutex) wxMutexLocker(wxMutex& mutex)
{ m_isOk = m_mutex.Lock() == wxMUTEX_NO_ERROR; } : m_isOk(FALSE), m_mutex(mutex)
{ m_isOk = ( m_mutex.Lock() == wxMUTEX_NO_ERROR ); }
// returns TRUE if mutex was successfully locked in ctor // returns TRUE if mutex was successfully locked in ctor
bool IsOk() const bool IsOk() const
@@ -220,6 +221,8 @@ private:
class WXDLLEXPORT wxCondition class WXDLLEXPORT wxCondition
{ {
DECLARE_NO_COPY_CLASS(wxCondition)
public: public:
// constructor and destructor // constructor and destructor
@@ -275,6 +278,8 @@ private:
class WXDLLEXPORT wxSemaphoreInternal; class WXDLLEXPORT wxSemaphoreInternal;
class WXDLLEXPORT wxSemaphore class WXDLLEXPORT wxSemaphore
{ {
DECLARE_NO_COPY_CLASS(wxSemaphore)
public: public:
// specifying a maxcount of 0 actually makes wxSemaphore behave as if there // specifying a maxcount of 0 actually makes wxSemaphore behave as if there
// is no upper limit, if maxcount is 1 the semaphore behaves as a mutex // is no upper limit, if maxcount is 1 the semaphore behaves as a mutex
@@ -561,7 +566,7 @@ public:
extern bool WXDLLEXPORT wxIsWaitingForThread(); extern bool WXDLLEXPORT wxIsWaitingForThread();
// implement wxCriticalSection using mutexes // implement wxCriticalSection using mutexes
inline wxCriticalSection::wxCriticalSection() { } inline wxCriticalSection::wxCriticalSection() : m_mutex() { }
inline wxCriticalSection::~wxCriticalSection() { } inline wxCriticalSection::~wxCriticalSection() { }
inline void wxCriticalSection::Enter() { (void)m_mutex.Lock(); } inline void wxCriticalSection::Enter() { (void)m_mutex.Lock(); }

View File

@@ -375,6 +375,8 @@ WXDLLEXPORT void wxFlushEvents();
// ctor and enables them back in its dtor // ctor and enables them back in its dtor
class WXDLLEXPORT wxWindowDisabler class WXDLLEXPORT wxWindowDisabler
{ {
DECLARE_NO_COPY_CLASS(wxWindowDisabler)
public: public:
wxWindowDisabler(wxWindow *winToSkip = (wxWindow *)NULL); wxWindowDisabler(wxWindow *winToSkip = (wxWindow *)NULL);
~wxWindowDisabler(); ~wxWindowDisabler();

View File

@@ -83,6 +83,7 @@ private:
static bool ms_isSilent; static bool ms_isSilent;
DECLARE_DYNAMIC_CLASS(wxValidator) DECLARE_DYNAMIC_CLASS(wxValidator)
DECLARE_NO_COPY_CLASS(wxValidator)
}; };
WXDLLEXPORT_DATA(extern const wxValidator) wxDefaultValidator; WXDLLEXPORT_DATA(extern const wxValidator) wxDefaultValidator;

View File

@@ -59,7 +59,7 @@ void wxMacDestroyColorTable( CTabHandle colors )
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue )
{ {
(**newColors).ctTable[index].value = index; (**newColors).ctTable[index].value = index;
(**newColors).ctTable[index].rgb.red = red ;// someRedValue; (**newColors).ctTable[index].rgb.red = red ; // someRedValue;
(**newColors).ctTable[index].rgb.green = green ; // someGreenValue; (**newColors).ctTable[index].rgb.green = green ; // someGreenValue;
(**newColors).ctTable[index].rgb.blue = blue ; // someBlueValue; (**newColors).ctTable[index].rgb.blue = blue ; // someBlueValue;
} }
@@ -341,13 +341,13 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
} }
wxBitmapRefData::wxBitmapRefData() wxBitmapRefData::wxBitmapRefData()
: m_width(0)
, m_height(0)
, m_depth(0)
, m_ok(FALSE)
, m_numColors(0)
, m_quality(0)
{ {
m_ok = FALSE;
m_width = 0;
m_height = 0;
m_depth = 0;
m_quality = 0;
m_numColors = 0;
m_bitmapMask = NULL; m_bitmapMask = NULL;
m_hBitmap = NULL ; m_hBitmap = NULL ;
m_hPict = NULL ; m_hPict = NULL ;
@@ -355,7 +355,7 @@ wxBitmapRefData::wxBitmapRefData()
m_bitmapType = kMacBitmapTypeUnknownType ; m_bitmapType = kMacBitmapTypeUnknownType ;
} }
// TODO move this do a public function of Bitmap Ref // TODO move this to a public function of Bitmap Ref
static void DisposeBitmapRefData(wxBitmapRefData *data) static void DisposeBitmapRefData(wxBitmapRefData *data)
{ {
switch (data->m_bitmapType) switch (data->m_bitmapType)
@@ -699,8 +699,6 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
SetGWorld( (GWorldPtr) GetHBITMAP() , NULL ) ; SetGWorld( (GWorldPtr) GetHBITMAP() , NULL ) ;
// Render image // Render image
RGBColor colorRGB ;
register unsigned char* data = image.GetData(); register unsigned char* data = image.GetData();
char* destinationBase = GetPixBaseAddr( pixMap ); char* destinationBase = GetPixBaseAddr( pixMap );
register unsigned char* destination = (unsigned char*) destinationBase ; register unsigned char* destination = (unsigned char*) destinationBase ;
@@ -1050,30 +1048,30 @@ WXHMETAFILE wxBitmap::GetPict() const
*/ */
wxMask::wxMask() wxMask::wxMask()
: m_maskBitmap(NULL)
{ {
m_maskBitmap = 0;
} }
// Construct a mask from a bitmap and a colour indicating // Construct a mask from a bitmap and a colour indicating
// the transparent area // the transparent area
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour) wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
: m_maskBitmap(NULL)
{ {
m_maskBitmap = 0;
Create(bitmap, colour); Create(bitmap, colour);
} }
// Construct a mask from a bitmap and a palette index indicating // Construct a mask from a bitmap and a palette index indicating
// the transparent area // the transparent area
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex) wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
: m_maskBitmap(NULL)
{ {
m_maskBitmap = 0;
Create(bitmap, paletteIndex); Create(bitmap, paletteIndex);
} }
// Construct a mask from a mono bitmap (copies the bitmap). // Construct a mask from a mono bitmap (copies the bitmap).
wxMask::wxMask(const wxBitmap& bitmap) wxMask::wxMask(const wxBitmap& bitmap)
: m_maskBitmap(NULL)
{ {
m_maskBitmap = 0;
Create(bitmap); Create(bitmap);
} }
@@ -1121,8 +1119,8 @@ bool wxMask::Create(const wxBitmap& bitmap)
// the transparent area // the transparent area
bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
{ {
// TODO // TODO
wxCHECK_MSG( 0, false, wxT("Not implemented")); wxCHECK_MSG( 0, false, wxT("wxMask::Create not yet implemented"));
return FALSE; return FALSE;
} }
@@ -1205,6 +1203,10 @@ bool wxMask::PointMasked(int x, int y)
* wxBitmapHandler * wxBitmapHandler
*/ */
wxBitmapHandler::~wxBitmapHandler()
{
}
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
{ {
return FALSE; return FALSE;

View File

@@ -59,7 +59,7 @@ void wxMacDestroyColorTable( CTabHandle colors )
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue )
{ {
(**newColors).ctTable[index].value = index; (**newColors).ctTable[index].value = index;
(**newColors).ctTable[index].rgb.red = red ;// someRedValue; (**newColors).ctTable[index].rgb.red = red ; // someRedValue;
(**newColors).ctTable[index].rgb.green = green ; // someGreenValue; (**newColors).ctTable[index].rgb.green = green ; // someGreenValue;
(**newColors).ctTable[index].rgb.blue = blue ; // someBlueValue; (**newColors).ctTable[index].rgb.blue = blue ; // someBlueValue;
} }
@@ -341,13 +341,13 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
} }
wxBitmapRefData::wxBitmapRefData() wxBitmapRefData::wxBitmapRefData()
: m_width(0)
, m_height(0)
, m_depth(0)
, m_ok(FALSE)
, m_numColors(0)
, m_quality(0)
{ {
m_ok = FALSE;
m_width = 0;
m_height = 0;
m_depth = 0;
m_quality = 0;
m_numColors = 0;
m_bitmapMask = NULL; m_bitmapMask = NULL;
m_hBitmap = NULL ; m_hBitmap = NULL ;
m_hPict = NULL ; m_hPict = NULL ;
@@ -355,7 +355,7 @@ wxBitmapRefData::wxBitmapRefData()
m_bitmapType = kMacBitmapTypeUnknownType ; m_bitmapType = kMacBitmapTypeUnknownType ;
} }
// TODO move this do a public function of Bitmap Ref // TODO move this to a public function of Bitmap Ref
static void DisposeBitmapRefData(wxBitmapRefData *data) static void DisposeBitmapRefData(wxBitmapRefData *data)
{ {
switch (data->m_bitmapType) switch (data->m_bitmapType)
@@ -699,8 +699,6 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
SetGWorld( (GWorldPtr) GetHBITMAP() , NULL ) ; SetGWorld( (GWorldPtr) GetHBITMAP() , NULL ) ;
// Render image // Render image
RGBColor colorRGB ;
register unsigned char* data = image.GetData(); register unsigned char* data = image.GetData();
char* destinationBase = GetPixBaseAddr( pixMap ); char* destinationBase = GetPixBaseAddr( pixMap );
register unsigned char* destination = (unsigned char*) destinationBase ; register unsigned char* destination = (unsigned char*) destinationBase ;
@@ -1050,30 +1048,30 @@ WXHMETAFILE wxBitmap::GetPict() const
*/ */
wxMask::wxMask() wxMask::wxMask()
: m_maskBitmap(NULL)
{ {
m_maskBitmap = 0;
} }
// Construct a mask from a bitmap and a colour indicating // Construct a mask from a bitmap and a colour indicating
// the transparent area // the transparent area
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour) wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
: m_maskBitmap(NULL)
{ {
m_maskBitmap = 0;
Create(bitmap, colour); Create(bitmap, colour);
} }
// Construct a mask from a bitmap and a palette index indicating // Construct a mask from a bitmap and a palette index indicating
// the transparent area // the transparent area
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex) wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
: m_maskBitmap(NULL)
{ {
m_maskBitmap = 0;
Create(bitmap, paletteIndex); Create(bitmap, paletteIndex);
} }
// Construct a mask from a mono bitmap (copies the bitmap). // Construct a mask from a mono bitmap (copies the bitmap).
wxMask::wxMask(const wxBitmap& bitmap) wxMask::wxMask(const wxBitmap& bitmap)
: m_maskBitmap(NULL)
{ {
m_maskBitmap = 0;
Create(bitmap); Create(bitmap);
} }
@@ -1121,8 +1119,8 @@ bool wxMask::Create(const wxBitmap& bitmap)
// the transparent area // the transparent area
bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
{ {
// TODO // TODO
wxCHECK_MSG( 0, false, wxT("Not implemented")); wxCHECK_MSG( 0, false, wxT("wxMask::Create not yet implemented"));
return FALSE; return FALSE;
} }
@@ -1205,6 +1203,10 @@ bool wxMask::PointMasked(int x, int y)
* wxBitmapHandler * wxBitmapHandler
*/ */
wxBitmapHandler::~wxBitmapHandler()
{
}
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
{ {
return FALSE; return FALSE;