6eec70b984
This commit adds no changes in functionality but paves way for the upcoming improvements of wxDataViewCustomRenderer. First, introduce wxDataViewCustomRendererBase class in order to allow implementing behaviour common to custom renderers in all ports in this class instead of triplicating it. This required splitting monolithic dataview.h in more parts, now we have wx/dvrenderer.h which defines wxDataViewRendererBase and the new wxDataViewCustomRendererBase and includes wx/port/dvrenderer.h which define wxDataViewRenderer and wx/port/dvrenderers.h which defines all the other renderer classes. Also bring renderers hierarchy in the generic version closer to other ports: all standard renderer classes now inherit from wxDataViewRenderer and not wxDataViewCustomRenderer in for consistency with the other ports. wxDataViewRenderer itself still does derive from wxDataViewCustomRendererBase, unlike elsewhere, but this is unavoidable considering that all generic renderers are custom ones. Finally do some cleanup in OS X part of the code: correct indentation, spacing, comment style. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
106 lines
3.1 KiB
C++
106 lines
3.1 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Name: wx/osx/dvrenderer.h
|
|
// Purpose: wxDataViewRenderer for OS X wxDataViewCtrl implementations
|
|
// Author: Vadim Zeitlin
|
|
// Created: 2009-11-07 (extracted from wx/osx/dataview.h)
|
|
// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
|
|
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
|
// Licence: wxWindows licence
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef _WX_OSX_DVRENDERER_H_
|
|
#define _WX_OSX_DVRENDERER_H_
|
|
|
|
class wxDataViewRendererNativeData;
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// wxDataViewRenderer
|
|
// ----------------------------------------------------------------------------
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewRenderer : public wxDataViewRendererBase
|
|
{
|
|
public:
|
|
// constructors / destructor
|
|
// -------------------------
|
|
|
|
wxDataViewRenderer(const wxString& varianttype,
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
int align = wxDVR_DEFAULT_ALIGNMENT);
|
|
|
|
virtual ~wxDataViewRenderer();
|
|
|
|
// inherited methods from wxDataViewRendererBase
|
|
// ---------------------------------------------
|
|
|
|
virtual int GetAlignment() const
|
|
{
|
|
return m_alignment;
|
|
}
|
|
virtual wxDataViewCellMode GetMode() const
|
|
{
|
|
return m_mode;
|
|
}
|
|
virtual bool GetValue(wxVariant& value) const
|
|
{
|
|
value = m_value;
|
|
return true;
|
|
}
|
|
|
|
// NB: in Carbon this is always identical to the header alignment
|
|
virtual void SetAlignment(int align);
|
|
virtual void SetMode(wxDataViewCellMode mode);
|
|
virtual bool SetValue(const wxVariant& newValue)
|
|
{
|
|
m_value = newValue;
|
|
return true;
|
|
}
|
|
|
|
virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
|
|
virtual wxEllipsizeMode GetEllipsizeMode() const;
|
|
|
|
// implementation
|
|
// --------------
|
|
|
|
const wxVariant& GetValue() const
|
|
{
|
|
return m_value;
|
|
}
|
|
|
|
wxDataViewRendererNativeData* GetNativeData() const
|
|
{
|
|
return m_NativeDataPtr;
|
|
}
|
|
|
|
// a call to the native data browser function to render the data;
|
|
// returns true if the data value could be rendered, false otherwise
|
|
virtual bool MacRender() = 0;
|
|
|
|
void SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr);
|
|
|
|
|
|
#if wxOSX_USE_COCOA
|
|
// called when a value was edited by user
|
|
virtual void OSXOnCellChanged(NSObject *value,
|
|
const wxDataViewItem& item,
|
|
unsigned col);
|
|
#endif // Cocoa
|
|
|
|
private:
|
|
// contains the alignment flags
|
|
int m_alignment;
|
|
|
|
// storing the mode that determines how the cell is going to be shown
|
|
wxDataViewCellMode m_mode;
|
|
|
|
// data used by implementation of the native renderer
|
|
wxDataViewRendererNativeData* m_NativeDataPtr;
|
|
|
|
// value that is going to be rendered
|
|
wxVariant m_value;
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
|
|
};
|
|
|
|
#endif // _WX_OSX_DVRENDERER_H_
|
|
|