]> git.saurik.com Git - wxWidgets.git/commitdiff
added DECLARE_NO_COPY_CLASS where appropriate since wxObject should not
authorGilles Depeyrot <gilles_depeyrot@mac.com>
Wed, 8 May 2002 13:30:26 +0000 (13:30 +0000)
committerGilles Depeyrot <gilles_depeyrot@mac.com>
Wed, 8 May 2002 13:30:26 +0000 (13:30 +0000)
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

12 files changed:
include/wx/app.h
include/wx/containr.h
include/wx/log.h
include/wx/mac/bitmap.h
include/wx/mac/cursor.h
include/wx/mac/dc.h
include/wx/mac/palette.h
include/wx/thread.h
include/wx/utils.h
include/wx/validate.h
src/mac/bitmap.cpp
src/mac/carbon/bitmap.cpp

index 801c549d6483df0d0b7590bc0e30cba1085da793..489194ab3bd1f0d9708dce2519a27574f6e1c444 100644 (file)
@@ -92,6 +92,8 @@ private:
 
 class WXDLLEXPORT wxAppBase : public wxEvtHandler
 {
+    DECLARE_NO_COPY_CLASS(wxAppBase)
+        
 public:
     wxAppBase();
     virtual ~wxAppBase();
index 7139ef424272c900d4cc4498f387c6a32adb9ae7..b74b2c2a8feb212a65ff5e0e353ae60392838936 100644 (file)
@@ -37,6 +37,8 @@ class WXDLLEXPORT wxWindowBase;
 
 class WXDLLEXPORT wxControlContainer
 {
+    DECLARE_NO_COPY_CLASS(wxControlContainer)
+        
 public:
     // ctors and such
     wxControlContainer(wxWindow *winParent = NULL);
index 28272c9b9c7dac2ea414f6fbdeea4b4f0976bab8..f505a1623708218c6c1d10c674570fd2b54168b5 100644 (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,8 +295,8 @@ protected:
 class WXDLLEXPORT wxLogNull
 {
 public:
-    wxLogNull() { m_flagOld = wxLog::EnableLogging(FALSE); }
-    ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld);   }
+    wxLogNull() : m_flagOld(wxLog::EnableLogging(FALSE)) { }
+    ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); }
 
 private:
     bool m_flagOld; // the previous value of the wxLog::ms_doLog
index 02f03186fc72a43119d61fd69d827656d1be53ef..1b0873f0af36bac807758e60d127d57b5d273f1d 100644 (file)
@@ -31,7 +31,8 @@ class WXDLLEXPORT wxImage;
 // transparently.
 class WXDLLEXPORT wxMask: public wxObject
 {
-  DECLARE_DYNAMIC_CLASS(wxMask)
+    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;
@@ -81,10 +84,10 @@ public:
   wxPalette     m_bitmapPalette;
   int           m_quality;
 
-       int                     m_bitmapType ;
-       WXHMETAFILE     m_hPict ;
-       WXHBITMAP   m_hBitmap;
-       WXHICON     m_hIcon ;
+  int          m_bitmapType ;
+  WXHMETAFILE  m_hPict ;
+  WXHBITMAP     m_hBitmap;
+  WXHICON       m_hIcon ;
   wxMask *      m_bitmapMask; // Optional mask
 };
 
@@ -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.
index 250005009140ec4773cdf5c4c71e71f18e9edc57..7609aca59f17643636172201a947c09cae0d1773 100644 (file)
@@ -20,6 +20,8 @@
 
 class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
 {
+    DECLARE_NO_COPY_CLASS(wxCursorRefData)
+        
     friend class WXDLLEXPORT wxBitmap;
     friend class WXDLLEXPORT wxCursor;
 public:
@@ -27,7 +29,7 @@ public:
     ~wxCursorRefData();
 
 protected:
-  WXHCURSOR m_hCursor;
+    WXHCURSOR m_hCursor;
 };
 
 #define M_CURSORDATA ((wxCursorRefData *)m_refData)
@@ -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);
index ead1ae68d96415f8220f8a2cf316ac3d29b0a79a..e48f2b7dee13d727176607edb447dcf424f8238f 100644 (file)
@@ -50,7 +50,8 @@ class wxMacPortStateHelper ;
 
 class WXDLLEXPORT wxDC: public wxDCBase
 {
-  DECLARE_DYNAMIC_CLASS(wxDC)
+    DECLARE_DYNAMIC_CLASS(wxDC)
+    DECLARE_NO_COPY_CLASS(wxDC)
 
   public:
 
index 8925c53d4e572ee4493245c2a2f5da070c22b4e3..8894340703043de6e03bba2b3d2feb9e9d231d65 100644 (file)
@@ -23,13 +23,15 @@ class WXDLLEXPORT wxPalette;
 
 class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
 {
+    DECLARE_NO_COPY_CLASS(wxPaletteRefData)
+    
     friend class WXDLLEXPORT wxPalette;
 public:
     wxPaletteRefData();
     ~wxPaletteRefData();
 protected:
-               wxColour* m_palette;
-               wxInt32         m_count ;
+    wxColour* m_palette;
+    wxInt32   m_count ;
 };
 
 #define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
@@ -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();
index 60f5c7c5c44b7f4fdf2c71252a438817fb4b2442..319829ba71f509e6b1ba8f0e805bdd26111370f7 100644 (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
@@ -548,7 +553,7 @@ public:
     // wxApp then should block all "dangerous" messages
     extern bool WXDLLEXPORT wxIsWaitingForThread();
 #elif defined(__WXMAC__)
-   extern void WXDLLEXPORT wxMutexGuiLeaveOrEnter();
+    extern void WXDLLEXPORT wxMutexGuiLeaveOrEnter();
 
     // returns TRUE if the main thread has GUI lock
     extern bool WXDLLEXPORT wxGuiOwnedByMainThread();
@@ -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(); }
index 73737d91dce10d0ceedb1658d8ad0b3d482f0569..2b984a8d4c0a05834b8711143ac974560abef230 100644 (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();
index 0cd221045c1c34d95bde088be584979eabc8747e..3851adada2853fe0515ab6fee7cdf3be855bc269 100644 (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;
index c8b6ea5a430d013936791d64ca93c8f565db1594..ddabfe2384f0cbabafbd3d9cf80bca52f6eef009 100644 (file)
@@ -59,7 +59,7 @@ void wxMacDestroyColorTable( CTabHandle colors )
 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green ,  int blue )
 {
     (**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.blue = blue ; // someBlueValue;
 }
@@ -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);
 }
 
@@ -1121,8 +1119,8 @@ bool wxMask::Create(const wxBitmap& bitmap)
 // the transparent area
 bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
 {
-// TODO
-    wxCHECK_MSG( 0, false, wxT("Not implemented"));
+    // TODO
+    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;
index c8b6ea5a430d013936791d64ca93c8f565db1594..ddabfe2384f0cbabafbd3d9cf80bca52f6eef009 100644 (file)
@@ -59,7 +59,7 @@ void wxMacDestroyColorTable( CTabHandle colors )
 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green ,  int blue )
 {
     (**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.blue = blue ; // someBlueValue;
 }
@@ -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);
 }
 
@@ -1121,8 +1119,8 @@ bool wxMask::Create(const wxBitmap& bitmap)
 // the transparent area
 bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
 {
-// TODO
-    wxCHECK_MSG( 0, false, wxT("Not implemented"));
+    // TODO
+    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;