In the generic version of wxDataViewCtrl, all
cells are custom cells (nothing native). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38262 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,57 +32,8 @@ class wxDataViewCell: public wxDataViewCellBase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
||||||
|
~wxDataViewCell();
|
||||||
|
|
||||||
protected:
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
// wxDataViewTextCell
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
|
|
||||||
class wxDataViewTextCell: public wxDataViewCell
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxDataViewTextCell( const wxString &varianttype = wxT("string"),
|
|
||||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
|
||||||
|
|
||||||
bool SetValue( const wxVariant &value );
|
|
||||||
bool GetValue( wxVariant &value );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
// wxDataViewToggleCell
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
|
|
||||||
class wxDataViewToggleCell: public wxDataViewCell
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxDataViewToggleCell( const wxString &varianttype = wxT("bool"),
|
|
||||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
|
||||||
|
|
||||||
bool SetValue( const wxVariant &value );
|
|
||||||
bool GetValue( wxVariant &value );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
// wxDataViewCustomCell
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
|
|
||||||
class wxDataViewCustomCell: public wxDataViewCell
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
|
|
||||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
|
||||||
~wxDataViewCustomCell();
|
|
||||||
bool Init();
|
|
||||||
|
|
||||||
virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
|
virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
|
||||||
virtual wxSize GetSize() = 0;
|
virtual wxSize GetSize() = 0;
|
||||||
|
|
||||||
@@ -106,10 +57,64 @@ public:
|
|||||||
private:
|
private:
|
||||||
wxDC *m_dc;
|
wxDC *m_dc;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// wxDataViewCustomCell
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
|
class wxDataViewCustomCell: public wxDataViewCell
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
|
||||||
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// wxDataViewTextCell
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
|
class wxDataViewTextCell: public wxDataViewCustomCell
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDataViewTextCell( const wxString &varianttype = wxT("string"),
|
||||||
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
||||||
|
|
||||||
|
bool SetValue( const wxVariant &value );
|
||||||
|
bool GetValue( wxVariant &value );
|
||||||
|
|
||||||
|
bool Render( wxRect cell, wxDC *dc, int state );
|
||||||
|
wxSize GetSize();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// wxDataViewToggleCell
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
|
class wxDataViewToggleCell: public wxDataViewCustomCell
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDataViewToggleCell( const wxString &varianttype = wxT("bool"),
|
||||||
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
||||||
|
|
||||||
|
bool SetValue( const wxVariant &value );
|
||||||
|
bool GetValue( wxVariant &value );
|
||||||
|
|
||||||
|
bool Render( wxRect cell, wxDC *dc, int state );
|
||||||
|
wxSize GetSize();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
|
||||||
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// wxDataViewProgressCell
|
// wxDataViewProgressCell
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
@@ -217,6 +222,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class wxDataViewMainWindow;
|
friend class wxDataViewMainWindow;
|
||||||
|
friend class wxDataViewHeaderWindow;
|
||||||
wxDataViewListModelNotifier *m_notifier;
|
wxDataViewListModelNotifier *m_notifier;
|
||||||
wxDataViewMainWindow *m_clientArea;
|
wxDataViewMainWindow *m_clientArea;
|
||||||
wxDataViewHeaderWindow *m_headerArea;
|
wxDataViewHeaderWindow *m_headerArea;
|
||||||
|
@@ -139,16 +139,50 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewCell, wxDataViewCellBase)
|
|||||||
wxDataViewCell::wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode ) :
|
wxDataViewCell::wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode ) :
|
||||||
wxDataViewCellBase( varianttype, mode )
|
wxDataViewCellBase( varianttype, mode )
|
||||||
{
|
{
|
||||||
|
m_dc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxDataViewCell::~wxDataViewCell()
|
||||||
|
{
|
||||||
|
if (m_dc)
|
||||||
|
delete m_dc;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDC *wxDataViewCell::GetDC()
|
||||||
|
{
|
||||||
|
if (m_dc == NULL)
|
||||||
|
{
|
||||||
|
if (GetOwner() == NULL)
|
||||||
|
return NULL;
|
||||||
|
if (GetOwner()->GetOwner() == NULL)
|
||||||
|
return NULL;
|
||||||
|
m_dc = new wxClientDC( GetOwner()->GetOwner() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_dc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// wxDataViewCustomCell
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomCell, wxDataViewCell)
|
||||||
|
|
||||||
|
wxDataViewCustomCell::wxDataViewCustomCell( const wxString &varianttype,
|
||||||
|
wxDataViewCellMode mode ) :
|
||||||
|
wxDataViewCell( varianttype, mode )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// wxDataViewTextCell
|
// wxDataViewTextCell
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewTextCell, wxDataViewCell)
|
IMPLEMENT_ABSTRACT_CLASS(wxDataViewTextCell, wxDataViewCustomCell)
|
||||||
|
|
||||||
wxDataViewTextCell::wxDataViewTextCell( const wxString &varianttype, wxDataViewCellMode mode ) :
|
wxDataViewTextCell::wxDataViewTextCell( const wxString &varianttype, wxDataViewCellMode mode ) :
|
||||||
wxDataViewCell( varianttype, mode )
|
wxDataViewCustomCell( varianttype, mode )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,15 +196,25 @@ bool wxDataViewTextCell::GetValue( wxVariant &value )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxDataViewTextCell::Render( wxRect cell, wxDC *dc, int state )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSize wxDataViewTextCell::GetSize()
|
||||||
|
{
|
||||||
|
return wxSize(80,20);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// wxDataViewToggleCell
|
// wxDataViewToggleCell
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleCell, wxDataViewCell)
|
IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleCell, wxDataViewCustomCell)
|
||||||
|
|
||||||
wxDataViewToggleCell::wxDataViewToggleCell( const wxString &varianttype,
|
wxDataViewToggleCell::wxDataViewToggleCell( const wxString &varianttype,
|
||||||
wxDataViewCellMode mode ) :
|
wxDataViewCellMode mode ) :
|
||||||
wxDataViewCell( varianttype, mode )
|
wxDataViewCustomCell( varianttype, mode )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,46 +228,16 @@ bool wxDataViewToggleCell::GetValue( wxVariant &value )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
bool wxDataViewToggleCell::Render( wxRect cell, wxDC *dc, int state )
|
||||||
// wxDataViewCustomCell
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomCell, wxDataViewCell)
|
|
||||||
|
|
||||||
wxDataViewCustomCell::wxDataViewCustomCell( const wxString &varianttype,
|
|
||||||
wxDataViewCellMode mode ) :
|
|
||||||
wxDataViewCell( varianttype, mode )
|
|
||||||
{
|
|
||||||
m_dc = NULL;
|
|
||||||
|
|
||||||
Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDataViewCustomCell::Init()
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataViewCustomCell::~wxDataViewCustomCell()
|
wxSize wxDataViewToggleCell::GetSize()
|
||||||
{
|
{
|
||||||
if (m_dc)
|
return wxSize(20,20);
|
||||||
delete m_dc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDC *wxDataViewCustomCell::GetDC()
|
|
||||||
{
|
|
||||||
if (m_dc == NULL)
|
|
||||||
{
|
|
||||||
if (GetOwner() == NULL)
|
|
||||||
return NULL;
|
|
||||||
if (GetOwner()->GetOwner() == NULL)
|
|
||||||
return NULL;
|
|
||||||
m_dc = new wxClientDC( GetOwner()->GetOwner() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_dc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// wxDataViewProgressCell
|
// wxDataViewProgressCell
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user