Use wxDataViewRenderer::PrepareForItem() in all ports
wxOSX and wxGTK previously used their own methods for handling the enabled state and the attributes of the items being rendered, change them to reuse the same methods as the generic implementation, i.e. SetEnabled() and SetAttr() and remove the port-specific GtkSetAttr(), OSXApplyAttr() and so on. This has the advantage of ensuring that the logic is the same for all platforms (e.g. item enabled status wasn't handled in the same way in wxGTK as in the other ports previously) and hopefully makes the code simpler by cutting down on the number of virtual methods. Notice that GtkSupportsAttrs() optimization was removed as it didn't seem to be worth the bother (we basically saved a call to a virtual model method at a price of a virtual renderer method call) and preserving it would have complicated things needlessly.
This commit is contained in:
@@ -83,12 +83,9 @@ public:
|
||||
const wxDataViewItem& item,
|
||||
unsigned col);
|
||||
|
||||
// called to ensure that the given attribute will be used for rendering the
|
||||
// next cell (which had been already associated with this renderer before)
|
||||
virtual void OSXApplyAttr(const wxDataViewItemAttr& attr);
|
||||
|
||||
// called to set the state of the next cell to be rendered
|
||||
virtual void OSXApplyEnabled(bool enabled);
|
||||
protected:
|
||||
virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE;
|
||||
virtual void SetEnabled(bool enabled) wxOVERRIDE;
|
||||
#endif // Cocoa
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user