Add GetDefaultType() to all standard wxDataViewRenderer-derived classes.

This makes it possible to refer to the associated wxVariant types without hard
coding the string constants, i.e. instead of writing "string" (error prone as
typos are not detected) it is now possible to write wxDataViewTextRenderer::
GetDefaultType().

This will also make it simpler to write generic (in C++ templates sense) code
using renderers.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-12-20 21:51:54 +00:00
parent 4d9afe351a
commit 615b49692c
5 changed files with 134 additions and 33 deletions

View File

@@ -1904,10 +1904,17 @@ protected:
class wxDataViewTextRenderer : public wxDataViewRenderer
{
public:
/**
Returns the wxVariant type used with this renderer.
@since 3.1.0
*/
static wxString GetDefaultType();
/**
The ctor.
*/
wxDataViewTextRenderer(const wxString& varianttype = "string",
wxDataViewTextRenderer(const wxString& varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
};
@@ -1930,10 +1937,17 @@ public:
class wxDataViewIconTextRenderer : public wxDataViewRenderer
{
public:
/**
Returns the wxVariant type used with this renderer.
@since 3.1.0
*/
static wxString GetDefaultType();
/**
The ctor.
*/
wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText",
wxDataViewIconTextRenderer(const wxString& varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
};
@@ -1951,11 +1965,18 @@ public:
class wxDataViewProgressRenderer : public wxDataViewRenderer
{
public:
/**
Returns the wxVariant type used with this renderer.
@since 3.1.0
*/
static wxString GetDefaultType();
/**
The ctor.
*/
wxDataViewProgressRenderer(const wxString& label = wxEmptyString,
const wxString& varianttype = "long",
const wxString& varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
};
@@ -1997,10 +2018,17 @@ public:
class wxDataViewToggleRenderer : public wxDataViewRenderer
{
public:
/**
Returns the wxVariant type used with this renderer.
@since 3.1.0
*/
static wxString GetDefaultType();
/**
The ctor.
*/
wxDataViewToggleRenderer(const wxString& varianttype = "bool",
wxDataViewToggleRenderer(const wxString& varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT);
};
@@ -2075,10 +2103,17 @@ public:
class wxDataViewDateRenderer : public wxDataViewRenderer
{
public:
/**
Returns the wxVariant type used with this renderer.
@since 3.1.0
*/
static wxString GetDefaultType();
/**
The ctor.
*/
wxDataViewDateRenderer(const wxString& varianttype = "datetime",
wxDataViewDateRenderer(const wxString& varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
int align = wxDVR_DEFAULT_ALIGNMENT);
};
@@ -2107,10 +2142,17 @@ public:
class wxDataViewCustomRenderer : public wxDataViewRenderer
{
public:
/**
Returns the wxVariant type used with this renderer.
@since 3.1.0
*/
static wxString GetDefaultType();
/**
Constructor.
*/
wxDataViewCustomRenderer(const wxString& varianttype = "string",
wxDataViewCustomRenderer(const wxString& varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT);
@@ -2310,10 +2352,17 @@ protected:
class wxDataViewBitmapRenderer : public wxDataViewRenderer
{
public:
/**
Returns the wxVariant type used with this renderer.
@since 3.1.0
*/
static wxString GetDefaultType();
/**
The ctor.
*/
wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap",
wxDataViewBitmapRenderer(const wxString& varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT);
};