reuse wxObjectRefData for various ref-counted classes (closes #10886)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61025 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -110,16 +110,10 @@ class wxGridDirectionOperations;
|
||||
// class is not documented and is not public at all
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxGridCellWorker : public wxClientDataContainer
|
||||
class WXDLLIMPEXP_ADV wxGridCellWorker : public wxClientDataContainer, public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
wxGridCellWorker() { m_nRef = 1; }
|
||||
|
||||
// this class is ref counted: it is created with ref count of 1, so
|
||||
// calling DecRef() once will delete it. Calling IncRef() allows to lock
|
||||
// it until the matching DecRef() is called
|
||||
void IncRef() { m_nRef++; }
|
||||
void DecRef() { if ( --m_nRef == 0 ) delete this; }
|
||||
wxGridCellWorker() { }
|
||||
|
||||
// interpret renderer parameters: arbitrary string whose interpretatin is
|
||||
// left to the derived classes
|
||||
@@ -131,8 +125,6 @@ protected:
|
||||
virtual ~wxGridCellWorker();
|
||||
|
||||
private:
|
||||
size_t m_nRef;
|
||||
|
||||
// suppress the stupid gcc warning about the class having private dtor and
|
||||
// no friends
|
||||
friend class wxGridCellWorkerDummyFriend;
|
||||
@@ -297,7 +289,7 @@ protected:
|
||||
// class may be returned by wxGridTable::GetAttr().
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxGridCellAttr : public wxClientDataContainer
|
||||
class WXDLLIMPEXP_ADV wxGridCellAttr : public wxClientDataContainer, public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
enum wxAttrKind
|
||||
@@ -336,12 +328,6 @@ public:
|
||||
wxGridCellAttr *Clone() const;
|
||||
void MergeWith(wxGridCellAttr *mergefrom);
|
||||
|
||||
// this class is ref counted: it is created with ref count of 1, so
|
||||
// calling DecRef() once will delete it. Calling IncRef() allows to lock
|
||||
// it until the matching DecRef() is called
|
||||
void IncRef() { m_nRef++; }
|
||||
void DecRef() { if ( --m_nRef == 0 ) delete this; }
|
||||
|
||||
// setters
|
||||
void SetTextColour(const wxColour& colText) { m_colText = colText; }
|
||||
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
|
||||
@@ -419,9 +405,6 @@ private:
|
||||
void Init(wxGridCellAttr *attrDefault = NULL);
|
||||
|
||||
|
||||
// the ref count - when it goes to 0, we die
|
||||
size_t m_nRef;
|
||||
|
||||
wxColour m_colText,
|
||||
m_colBack;
|
||||
wxFont m_font;
|
||||
|
Reference in New Issue
Block a user