GTK1 fixes after wxObject-derived classes copy ctors/assignment operators simplifications (patch 1428863)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37441 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-02-10 15:41:06 +00:00
parent f4ec6bd20a
commit 8628b7d413
12 changed files with 1 additions and 88 deletions

View File

@@ -69,11 +69,9 @@ public:
wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); } wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); } wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
wxBitmap( const wxBitmap& bmp );
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM ); wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
~wxBitmap(); ~wxBitmap();
wxBitmap& operator = ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp ) const; bool operator == ( const wxBitmap& bmp ) const;
bool operator != ( const wxBitmap& bmp ) const; bool operator != ( const wxBitmap& bmp ) const;
bool Ok() const; bool Ok() const;

View File

@@ -36,11 +36,6 @@ public:
wxBrush( const wxBitmap &stippleBitmap ); wxBrush( const wxBitmap &stippleBitmap );
~wxBrush(); ~wxBrush();
wxBrush( const wxBrush &brush )
: wxBrushBase()
{ Ref(brush); }
wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
bool Ok() const { return m_refData != NULL; } bool Ok() const { return m_refData != NULL; }
bool operator == ( const wxBrush& brush ) const; bool operator == ( const wxBrush& brush ) const;

View File

@@ -53,12 +53,6 @@ public:
wxColour( const wxChar *colourName ) { InitFromName( wxString(colourName) ); } wxColour( const wxChar *colourName ) { InitFromName( wxString(colourName) ); }
#endif #endif
wxColour( const wxColour& col )
: wxGDIObject()
{ Ref(col); }
wxColour& operator = ( const wxColour& col ) { Ref(col); return *this; }
~wxColour(); ~wxColour();
bool Ok() const { return m_refData != NULL; } bool Ok() const { return m_refData != NULL; }

View File

@@ -28,7 +28,6 @@ public:
wxCursor(); wxCursor();
wxCursor( int cursorId ); wxCursor( int cursorId );
wxCursor( const wxCursor &cursor );
#if wxUSE_IMAGE #if wxUSE_IMAGE
wxCursor( const wxImage & image ); wxCursor( const wxImage & image );
#endif #endif
@@ -36,7 +35,6 @@ public:
int hotSpotX=-1, int hotSpotY=-1, int hotSpotX=-1, int hotSpotY=-1,
const char maskBits[]=0, wxColour *fg=0, wxColour *bg=0 ); const char maskBits[]=0, wxColour *fg=0, wxColour *bg=0 );
~wxCursor(); ~wxCursor();
wxCursor& operator = ( const wxCursor& cursor );
bool operator == ( const wxCursor& cursor ) const; bool operator == ( const wxCursor& cursor ) const;
bool operator != ( const wxCursor& cursor ) const; bool operator != ( const wxCursor& cursor ) const;
bool Ok() const; bool Ok() const;

View File

@@ -30,14 +30,11 @@ class WXDLLIMPEXP_CORE wxFont : public wxFontBase
{ {
public: public:
// ctors and such // ctors and such
wxFont() { Init(); } wxFont() { }
wxFont(const wxFont& font) : wxFontBase() { Init(); Ref(font); }
// wxGTK-specific // wxGTK-specific
wxFont(const wxString& fontname) wxFont(const wxString& fontname)
{ {
Init();
Create(fontname); Create(fontname);
} }
@@ -51,8 +48,6 @@ public:
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
Init();
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, family, style, weight, underlined, face, encoding);
} }
@@ -69,9 +64,6 @@ public:
~wxFont(); ~wxFont();
// assignment
wxFont& operator=(const wxFont& font);
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual int GetFamily() const; virtual int GetFamily() const;
@@ -104,9 +96,6 @@ public:
protected: protected:
virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
// common part of all ctors
void Init();
private: private:
DECLARE_DYNAMIC_CLASS(wxFont) DECLARE_DYNAMIC_CLASS(wxFont)
}; };

View File

@@ -28,7 +28,6 @@ class WXDLLIMPEXP_CORE wxIcon: public wxBitmap
{ {
public: public:
wxIcon(); wxIcon();
wxIcon( const wxIcon& icon);
wxIcon( const char **bits, int width=-1, int height=-1 ); wxIcon( const char **bits, int width=-1, int height=-1 );
// For compatibility with wxMSW where desired size is sometimes required to // For compatibility with wxMSW where desired size is sometimes required to
@@ -45,7 +44,6 @@ public:
{ {
} }
wxIcon& operator=(const wxIcon& icon);
bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; } bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; }
bool operator!=(const wxIcon& icon) const { return !(*this == icon); } bool operator!=(const wxIcon& icon) const { return !(*this == icon); }

View File

@@ -40,11 +40,6 @@ public:
wxPen( const wxColour &colour, int width = 1, int style = wxSOLID ); wxPen( const wxColour &colour, int width = 1, int style = wxSOLID );
~wxPen(); ~wxPen();
wxPen( const wxPen& pen )
: wxGDIObject()
{ Ref(pen); }
wxPen& operator = ( const wxPen& pen ) { Ref(pen); return *this; }
bool Ok() const { return m_refData != NULL; } bool Ok() const { return m_refData != NULL; }
bool operator == ( const wxPen& pen ) const; bool operator == ( const wxPen& pen ) const;

View File

@@ -80,11 +80,6 @@ public:
~wxRegion(); ~wxRegion();
wxRegion( const wxRegion& region )
: wxGDIObject()
{ Ref(region); }
wxRegion& operator = ( const wxRegion& region ) { Ref(region); return *this; }
bool Ok() const { return m_refData != NULL; } bool Ok() const { return m_refData != NULL; }
bool operator == ( const wxRegion& region ) const; bool operator == ( const wxRegion& region ) const;

View File

@@ -1038,12 +1038,6 @@ wxImage wxBitmap::ConvertToImage() const
return image; return image;
} }
wxBitmap::wxBitmap( const wxBitmap& bmp )
: wxBitmapBase()
{
Ref( bmp );
}
wxBitmap::wxBitmap( const wxString &filename, wxBitmapType type ) wxBitmap::wxBitmap( const wxString &filename, wxBitmapType type )
{ {
LoadFile( filename, type ); LoadFile( filename, type );
@@ -1075,14 +1069,6 @@ wxBitmap::~wxBitmap()
{ {
} }
wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp )
{
if ( m_refData != bmp.m_refData )
Ref( bmp );
return *this;
}
bool wxBitmap::operator == ( const wxBitmap& bmp ) const bool wxBitmap::operator == ( const wxBitmap& bmp ) const
{ {
return m_refData == bmp.m_refData; return m_refData == bmp.m_refData;

View File

@@ -153,13 +153,6 @@ wxCursor::wxCursor(const char bits[], int width, int height,
gdk_bitmap_unref( mask ); gdk_bitmap_unref( mask );
} }
wxCursor::wxCursor( const wxCursor &cursor )
: wxObject()
{
Ref( cursor );
}
#if wxUSE_IMAGE #if wxUSE_IMAGE
wxCursor::wxCursor( const wxImage & image ) wxCursor::wxCursor( const wxImage & image )
@@ -320,16 +313,6 @@ wxCursor::~wxCursor()
{ {
} }
wxCursor& wxCursor::operator = ( const wxCursor& cursor )
{
if (*this == cursor)
return (*this);
Ref( cursor );
return *this;
}
bool wxCursor::operator == ( const wxCursor& cursor ) const bool wxCursor::operator == ( const wxCursor& cursor ) const
{ {
return m_refData == cursor.m_refData; return m_refData == cursor.m_refData;

View File

@@ -474,14 +474,8 @@ void wxFontRefData::SetNativeFontInfo(const wxNativeFontInfo& info)
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
void wxFont::Init()
{
}
wxFont::wxFont(const wxNativeFontInfo& info) wxFont::wxFont(const wxNativeFontInfo& info)
{ {
Init();
(void) Create(info.GetXFontName()); (void) Create(info.GetXFontName());
} }

View File

@@ -32,18 +32,6 @@ wxIcon::wxIcon() : wxBitmap()
{ {
} }
wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap()
{
Ref(icon);
}
wxIcon& wxIcon::operator = ( const wxIcon& icon )
{
if (*this == icon) return (*this);
Ref(icon);
return *this;
}
void wxIcon::CopyFromBitmap(const wxBitmap& bmp) void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
{ {
wxIcon *icon = (wxIcon*)(&bmp); wxIcon *icon = (wxIcon*)(&bmp);