Add a simple test of wxDataViewIndexListModel to the sample

This is useful to investigate inconsistencies in its behaviour between
the generic and the native GTK versions that can't be easily checked in
the automatic unit tests.
This commit is contained in:
Vadim Zeitlin
2019-09-12 18:51:36 +02:00
parent eca006da06
commit f99b80612a
2 changed files with 105 additions and 3 deletions

View File

@@ -269,3 +269,38 @@ class MyListStoreDerivedModel : public wxDataViewListStore
public:
virtual bool IsEnabledByRow(unsigned int row, unsigned int col) const wxOVERRIDE;
};
// ----------------------------------------------------------------------------
// MyIndexListModel
// ----------------------------------------------------------------------------
class MyIndexListModel : public wxDataViewIndexListModel
{
public:
MyIndexListModel() { }
void Fill(const wxArrayString& strings)
{
m_strings = strings;
Reset(m_strings.size());
}
// Implement base class pure virtual methods.
unsigned GetColumnCount() const wxOVERRIDE { return 1; }
wxString GetColumnType(unsigned) const wxOVERRIDE { return "string"; }
unsigned GetCount() const wxOVERRIDE { return m_strings.size(); }
void GetValueByRow(wxVariant& val, unsigned row, unsigned) const wxOVERRIDE
{
val = m_strings[row];
}
bool SetValueByRow(const wxVariant&, unsigned, unsigned) wxOVERRIDE
{
return false;
}
private:
wxArrayString m_strings;
wxDECLARE_NO_COPY_CLASS(MyIndexListModel);
};