(blind) fix for VC6 build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -42,18 +42,18 @@ MyMusicTreeModel::MyMusicTreeModel()
|
|||||||
|
|
||||||
// setup pop music
|
// setup pop music
|
||||||
m_pop = new MyMusicTreeModelNode( m_root, wxT("Pop music") );
|
m_pop = new MyMusicTreeModelNode( m_root, wxT("Pop music") );
|
||||||
m_pop->Append(
|
m_pop->Append(
|
||||||
new MyMusicTreeModelNode( m_pop, wxT("You are not alone"), wxT("Michael Jackson"), 1995 ) );
|
new MyMusicTreeModelNode( m_pop, wxT("You are not alone"), wxT("Michael Jackson"), 1995 ) );
|
||||||
m_pop->Append(
|
m_pop->Append(
|
||||||
new MyMusicTreeModelNode( m_pop, wxT("Take a bow"), wxT("Madonna"), 1994 ) );
|
new MyMusicTreeModelNode( m_pop, wxT("Take a bow"), wxT("Madonna"), 1994 ) );
|
||||||
m_root->Append( m_pop );
|
m_root->Append( m_pop );
|
||||||
|
|
||||||
// setup classical music
|
// setup classical music
|
||||||
m_classical = new MyMusicTreeModelNode( m_root, wxT("Classical music") );
|
m_classical = new MyMusicTreeModelNode( m_root, wxT("Classical music") );
|
||||||
m_ninth = new MyMusicTreeModelNode( m_classical, wxT("Ninth symphony"),
|
m_ninth = new MyMusicTreeModelNode( m_classical, wxT("Ninth symphony"),
|
||||||
wxT("Ludwig van Beethoven"), 1824 );
|
wxT("Ludwig van Beethoven"), 1824 );
|
||||||
m_classical->Append( m_ninth );
|
m_classical->Append( m_ninth );
|
||||||
m_classical->Append( new MyMusicTreeModelNode( m_classical, wxT("German Requiem"),
|
m_classical->Append( new MyMusicTreeModelNode( m_classical, wxT("German Requiem"),
|
||||||
wxT("Johannes Brahms"), 1868 ) );
|
wxT("Johannes Brahms"), 1868 ) );
|
||||||
m_root->Append( m_classical );
|
m_root->Append( m_classical );
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ int MyMusicTreeModel::GetYear( const wxDataViewItem &item ) const
|
|||||||
return node->m_year;
|
return node->m_year;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyMusicTreeModel::AddToClassical( const wxString &title, const wxString &artist,
|
void MyMusicTreeModel::AddToClassical( const wxString &title, const wxString &artist,
|
||||||
unsigned int year )
|
unsigned int year )
|
||||||
{
|
{
|
||||||
if (!m_classical)
|
if (!m_classical)
|
||||||
@@ -115,7 +115,7 @@ void MyMusicTreeModel::Delete( const wxDataViewItem &item )
|
|||||||
{
|
{
|
||||||
wxASSERT(node == m_root);
|
wxASSERT(node == m_root);
|
||||||
|
|
||||||
// don't make the control completely empty:
|
// don't make the control completely empty:
|
||||||
wxLogError("Cannot remove the root item!");
|
wxLogError("Cannot remove the root item!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -176,16 +176,16 @@ void MyMusicTreeModel::GetValue( wxVariant &variant,
|
|||||||
switch (col)
|
switch (col)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
variant = node->m_title;
|
variant = node->m_title;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
variant = node->m_artist;
|
variant = node->m_artist;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
variant = (long) node->m_year;
|
variant = (long) node->m_year;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
variant = node->m_quality;
|
variant = node->m_quality;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// wxMac doesn't conceal the popularity progress renderer, return 0 for containers
|
// wxMac doesn't conceal the popularity progress renderer, return 0 for containers
|
||||||
@@ -215,20 +215,20 @@ bool MyMusicTreeModel::SetValue( const wxVariant &variant,
|
|||||||
MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) item.GetID();
|
MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) item.GetID();
|
||||||
switch (col)
|
switch (col)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
node->m_title = variant.GetString();
|
node->m_title = variant.GetString();
|
||||||
return true;
|
return true;
|
||||||
case 1:
|
case 1:
|
||||||
node->m_artist = variant.GetString();
|
node->m_artist = variant.GetString();
|
||||||
return true;
|
return true;
|
||||||
case 2:
|
case 2:
|
||||||
node->m_year = variant.GetLong();
|
node->m_year = variant.GetLong();
|
||||||
return true;
|
return true;
|
||||||
case 3:
|
case 3:
|
||||||
node->m_quality = variant.GetString();
|
node->m_quality = variant.GetString();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxLogError( wxT("MyMusicTreeModel::SetValue: wrong column") );
|
wxLogError( wxT("MyMusicTreeModel::SetValue: wrong column") );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -260,7 +260,7 @@ bool MyMusicTreeModel::IsContainer( const wxDataViewItem &item ) const
|
|||||||
return node->IsContainer();
|
return node->IsContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int MyMusicTreeModel::GetChildren( const wxDataViewItem &parent,
|
unsigned int MyMusicTreeModel::GetChildren( const wxDataViewItem &parent,
|
||||||
wxDataViewItemArray &array ) const
|
wxDataViewItemArray &array ) const
|
||||||
{
|
{
|
||||||
MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) parent.GetID();
|
MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) parent.GetID();
|
||||||
@@ -319,7 +319,7 @@ MyListModel::MyListModel() :
|
|||||||
m_virtualItems = INITIAL_NUMBER_OF_ITEMS;
|
m_virtualItems = INITIAL_NUMBER_OF_ITEMS;
|
||||||
|
|
||||||
// the first 100 items are really stored in this model;
|
// the first 100 items are really stored in this model;
|
||||||
// all the others are synthetized on request
|
// all the others are synthetized on request
|
||||||
for (unsigned int i = 0; i < 100; i++)
|
for (unsigned int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
@@ -349,8 +349,9 @@ void MyListModel::DeleteItem( const wxDataViewItem &item )
|
|||||||
|
|
||||||
void MyListModel::DeleteItems( const wxDataViewItemArray &items )
|
void MyListModel::DeleteItems( const wxDataViewItemArray &items )
|
||||||
{
|
{
|
||||||
|
unsigned i;
|
||||||
wxArrayInt rows;
|
wxArrayInt rows;
|
||||||
for (unsigned int i = 0; i < items.GetCount(); i++)
|
for (int i = 0; i < items.GetCount(); i++)
|
||||||
{
|
{
|
||||||
unsigned int row = GetRow( items[i] );
|
unsigned int row = GetRow( items[i] );
|
||||||
if (row < m_array.GetCount())
|
if (row < m_array.GetCount())
|
||||||
@@ -369,7 +370,7 @@ void MyListModel::DeleteItems( const wxDataViewItemArray &items )
|
|||||||
// row will be deleted first. Otherwise the
|
// row will be deleted first. Otherwise the
|
||||||
// remaining indeces would all be wrong.
|
// remaining indeces would all be wrong.
|
||||||
rows.Sort( my_sort_reverse );
|
rows.Sort( my_sort_reverse );
|
||||||
for (unsigned int i = 0; i < rows.GetCount(); i++)
|
for (i = 0; i < rows.GetCount(); i++)
|
||||||
m_array.RemoveAt( rows[i] );
|
m_array.RemoveAt( rows[i] );
|
||||||
|
|
||||||
// This is just to test if wxDataViewCtrl can
|
// This is just to test if wxDataViewCtrl can
|
||||||
@@ -394,12 +395,12 @@ void MyListModel::GetValueByRow( wxVariant &variant,
|
|||||||
variant = wxString::Format( wxT("virtual row %d"), row );
|
variant = wxString::Format( wxT("virtual row %d"), row );
|
||||||
else
|
else
|
||||||
variant = m_array[ row ];
|
variant = m_array[ row ];
|
||||||
}
|
}
|
||||||
else if (col==1)
|
else if (col==1)
|
||||||
{
|
{
|
||||||
wxDataViewIconText data( wxT("test"), m_icon[ row%2 ] );
|
wxDataViewIconText data( wxT("test"), m_icon[ row%2 ] );
|
||||||
variant << data;
|
variant << data;
|
||||||
}
|
}
|
||||||
else if (col==2)
|
else if (col==2)
|
||||||
{
|
{
|
||||||
if (row >= m_array.GetCount())
|
if (row >= m_array.GetCount())
|
||||||
@@ -409,7 +410,7 @@ void MyListModel::GetValueByRow( wxVariant &variant,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MyListModel::GetAttrByRow( unsigned int row, unsigned int col,
|
bool MyListModel::GetAttrByRow( unsigned int row, unsigned int col,
|
||||||
wxDataViewItemAttr &attr )
|
wxDataViewItemAttr &attr )
|
||||||
{
|
{
|
||||||
if (col != 2)
|
if (col != 2)
|
||||||
|
Reference in New Issue
Block a user