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
{
DECLARE_NO_COPY_CLASS(wxAppBase)
public:
wxAppBase();
virtual ~wxAppBase();

View File

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

View File

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

View File

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

View File

@@ -20,6 +20,8 @@
class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
{
DECLARE_NO_COPY_CLASS(wxCursorRefData)
friend class WXDLLEXPORT wxBitmap;
friend class WXDLLEXPORT wxCursor;
public:
@@ -42,7 +44,9 @@ public:
wxCursor();
// 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,
const char maskBits[] = NULL);

View File

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

View File

@@ -23,6 +23,8 @@ class WXDLLEXPORT wxPalette;
class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
{
DECLARE_NO_COPY_CLASS(wxPaletteRefData)
friend class WXDLLEXPORT wxPalette;
public:
wxPaletteRefData();
@@ -40,7 +42,9 @@ class WXDLLEXPORT wxPalette: public wxGDIObject
public:
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();

View File

@@ -117,8 +117,9 @@ class WXDLLEXPORT wxMutexLocker
{
public:
// lock the mutex in the ctor
wxMutexLocker(wxMutex& mutex) : m_mutex(mutex)
{ m_isOk = m_mutex.Lock() == wxMUTEX_NO_ERROR; }
wxMutexLocker(wxMutex& mutex)
: m_isOk(FALSE), m_mutex(mutex)
{ m_isOk = ( m_mutex.Lock() == wxMUTEX_NO_ERROR ); }
// returns TRUE if mutex was successfully locked in ctor
bool IsOk() const
@@ -220,6 +221,8 @@ private:
class WXDLLEXPORT wxCondition
{
DECLARE_NO_COPY_CLASS(wxCondition)
public:
// constructor and destructor
@@ -275,6 +278,8 @@ private:
class WXDLLEXPORT wxSemaphoreInternal;
class WXDLLEXPORT wxSemaphore
{
DECLARE_NO_COPY_CLASS(wxSemaphore)
public:
// 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
@@ -561,7 +566,7 @@ public:
extern bool WXDLLEXPORT wxIsWaitingForThread();
// implement wxCriticalSection using mutexes
inline wxCriticalSection::wxCriticalSection() { }
inline wxCriticalSection::wxCriticalSection() : m_mutex() { }
inline wxCriticalSection::~wxCriticalSection() { }
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
class WXDLLEXPORT wxWindowDisabler
{
DECLARE_NO_COPY_CLASS(wxWindowDisabler)
public:
wxWindowDisabler(wxWindow *winToSkip = (wxWindow *)NULL);
~wxWindowDisabler();

View File

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

View File

@@ -341,13 +341,13 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
}
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_hBitmap = NULL ;
m_hPict = NULL ;
@@ -355,7 +355,7 @@ wxBitmapRefData::wxBitmapRefData()
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)
{
switch (data->m_bitmapType)
@@ -699,8 +699,6 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
SetGWorld( (GWorldPtr) GetHBITMAP() , NULL ) ;
// Render image
RGBColor colorRGB ;
register unsigned char* data = image.GetData();
char* destinationBase = GetPixBaseAddr( pixMap );
register unsigned char* destination = (unsigned char*) destinationBase ;
@@ -1050,30 +1048,30 @@ WXHMETAFILE wxBitmap::GetPict() const
*/
wxMask::wxMask()
: m_maskBitmap(NULL)
{
m_maskBitmap = 0;
}
// Construct a mask from a bitmap and a colour indicating
// the transparent area
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
: m_maskBitmap(NULL)
{
m_maskBitmap = 0;
Create(bitmap, colour);
}
// Construct a mask from a bitmap and a palette index indicating
// the transparent area
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
: m_maskBitmap(NULL)
{
m_maskBitmap = 0;
Create(bitmap, paletteIndex);
}
// Construct a mask from a mono bitmap (copies the bitmap).
wxMask::wxMask(const wxBitmap& bitmap)
: m_maskBitmap(NULL)
{
m_maskBitmap = 0;
Create(bitmap);
}
@@ -1122,7 +1120,7 @@ bool wxMask::Create(const wxBitmap& bitmap)
bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
{
// TODO
wxCHECK_MSG( 0, false, wxT("Not implemented"));
wxCHECK_MSG( 0, false, wxT("wxMask::Create not yet implemented"));
return FALSE;
}
@@ -1205,6 +1203,10 @@ bool wxMask::PointMasked(int x, int y)
* wxBitmapHandler
*/
wxBitmapHandler::~wxBitmapHandler()
{
}
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
{
return FALSE;

View File

@@ -341,13 +341,13 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
}
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_hBitmap = NULL ;
m_hPict = NULL ;
@@ -355,7 +355,7 @@ wxBitmapRefData::wxBitmapRefData()
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)
{
switch (data->m_bitmapType)
@@ -699,8 +699,6 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
SetGWorld( (GWorldPtr) GetHBITMAP() , NULL ) ;
// Render image
RGBColor colorRGB ;
register unsigned char* data = image.GetData();
char* destinationBase = GetPixBaseAddr( pixMap );
register unsigned char* destination = (unsigned char*) destinationBase ;
@@ -1050,30 +1048,30 @@ WXHMETAFILE wxBitmap::GetPict() const
*/
wxMask::wxMask()
: m_maskBitmap(NULL)
{
m_maskBitmap = 0;
}
// Construct a mask from a bitmap and a colour indicating
// the transparent area
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
: m_maskBitmap(NULL)
{
m_maskBitmap = 0;
Create(bitmap, colour);
}
// Construct a mask from a bitmap and a palette index indicating
// the transparent area
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
: m_maskBitmap(NULL)
{
m_maskBitmap = 0;
Create(bitmap, paletteIndex);
}
// Construct a mask from a mono bitmap (copies the bitmap).
wxMask::wxMask(const wxBitmap& bitmap)
: m_maskBitmap(NULL)
{
m_maskBitmap = 0;
Create(bitmap);
}
@@ -1122,7 +1120,7 @@ bool wxMask::Create(const wxBitmap& bitmap)
bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
{
// TODO
wxCHECK_MSG( 0, false, wxT("Not implemented"));
wxCHECK_MSG( 0, false, wxT("wxMask::Create not yet implemented"));
return FALSE;
}
@@ -1205,6 +1203,10 @@ bool wxMask::PointMasked(int x, int y)
* wxBitmapHandler
*/
wxBitmapHandler::~wxBitmapHandler()
{
}
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
{
return FALSE;