Use virtual functions to convert NSObject to the correct type in wxDVC.

Instead of trying to determine the type of the value which should be extracted
from the NSObject we receive from NSOutlineView, just pass it to a virtual
method in the renderer which knows which type does it need.

This fixes the problem with editing boolean/checkbox columns and makes the
code more elegant.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62490 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-10-23 23:49:26 +00:00
parent 795dac4c86
commit 9461dd8c71
2 changed files with 160 additions and 40 deletions

View File

@@ -85,7 +85,7 @@ public:
#if wxOSX_USE_COCOA
// called when a value was edited by user
virtual void OSXOnCellChanged(const wxVariant& value,
virtual void OSXOnCellChanged(NSObject *value,
const wxDataViewItem& item,
unsigned col);
#endif // Cocoa
@@ -197,7 +197,12 @@ public:
//
virtual bool MacRender();
protected:
#if wxOSX_USE_COCOA
virtual void OSXOnCellChanged(NSObject *value,
const wxDataViewItem& item,
unsigned col);
#endif // Cocoa
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
};
@@ -281,8 +286,7 @@ public:
virtual bool MacRender();
#if wxOSX_USE_COCOA
// called when a value was edited by user
virtual void OSXOnCellChanged(const wxVariant& value,
virtual void OSXOnCellChanged(NSObject *value,
const wxDataViewItem& item,
unsigned col);
#endif // Cocoa
@@ -306,7 +310,12 @@ public:
//
virtual bool MacRender();
protected:
#if wxOSX_USE_COCOA
virtual void OSXOnCellChanged(NSObject *value,
const wxDataViewItem& item,
unsigned col);
#endif // Cocoa
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
};
@@ -326,7 +335,12 @@ public:
//
virtual bool MacRender();
protected:
#if wxOSX_USE_COCOA
virtual void OSXOnCellChanged(NSObject *value,
const wxDataViewItem& item,
unsigned col);
#endif // Cocoa
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
};
@@ -345,7 +359,12 @@ public:
//
virtual bool MacRender();
protected:
#if wxOSX_USE_COCOA
virtual void OSXOnCellChanged(NSObject *value,
const wxDataViewItem& item,
unsigned col);
#endif // Cocoa
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
};