Added wxDataViewProgressCell with native code

for GTK 2.6 and fallbacks otherwise.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37729 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2006-02-25 13:13:05 +00:00
parent 8045736e4d
commit ad63bf413b
5 changed files with 143 additions and 7 deletions

View File

@@ -42,16 +42,21 @@ public:
{ m_bools.Add( 0 ); m_bools.Add( 1 ); }
for (i = 0; i < 500; i++)
{ m_colours.Add( wxT("red") ); m_colours.Add( wxT("green") ); }
for (i = 0; i < 1000; i++)
{ m_progress.Add( i/10 ); }
}
virtual size_t GetNumberOfRows()
{ return 1000; }
virtual size_t GetNumberOfCols()
{ return 5; }
{ return 6; }
// as reported by wxVariant
virtual wxString GetColType( size_t col )
{
if (col == 5)
return wxT("long");
if (col == 3)
return wxT("bool");
@@ -60,14 +65,18 @@ public:
virtual wxVariant GetValue( size_t col, size_t row )
{
if (col == 5)
{
return (long) m_progress[row];
} else
if (col == 4)
{
return m_colours[row];
} else
if (col == 3)
{
return (bool) m_bools[row];
} else
if (col == 4)
{
return m_colours[row];
}
if (col == 2)
{
return m_list[row];
@@ -95,6 +104,7 @@ public:
wxArrayString m_list;
wxArrayInt m_bools;
wxArrayString m_colours;
wxArrayInt m_progress;
};
// -------------------------------------
@@ -232,6 +242,8 @@ MyFrame::MyFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h):
column = new wxDataViewColumn( wxT("custom"), custom_cell, 4 );
dataview_left->AppendColumn( column );
dataview_left->AppendProgressColumn( wxT("progress"), 5 );
// Right wxDataViewCtrl using the same model
dataview_right = new wxDataViewCtrl( this, -1 );
dataview_right->AssociateModel( model );