fix MSVC warnings about conversions between pointers and longs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -260,38 +260,41 @@ int wxDataViewModel::Compare( const wxDataViewItem &item1, const wxDataViewItem
|
|||||||
wxString str1 = value1.GetString();
|
wxString str1 = value1.GetString();
|
||||||
wxString str2 = value2.GetString();
|
wxString str2 = value2.GetString();
|
||||||
int res = str1.Cmp( str2 );
|
int res = str1.Cmp( str2 );
|
||||||
if (res) return res;
|
if (res)
|
||||||
} else
|
return res;
|
||||||
if (value1.GetType() == wxT("long"))
|
}
|
||||||
|
else if (value1.GetType() == wxT("long"))
|
||||||
{
|
{
|
||||||
long l1 = value1.GetLong();
|
long l1 = value1.GetLong();
|
||||||
long l2 = value2.GetLong();
|
long l2 = value2.GetLong();
|
||||||
long res = l1-l2;
|
long res = l1-l2;
|
||||||
if (res) return res;
|
if (res)
|
||||||
} else
|
return res;
|
||||||
if (value1.GetType() == wxT("double"))
|
}
|
||||||
|
else if (value1.GetType() == wxT("double"))
|
||||||
{
|
{
|
||||||
double d1 = value1.GetDouble();
|
double d1 = value1.GetDouble();
|
||||||
double d2 = value2.GetDouble();
|
double d2 = value2.GetDouble();
|
||||||
if (d1 < d2) return 1;
|
if (d1 < d2)
|
||||||
if (d1 > d2) return -1;
|
return 1;
|
||||||
} else
|
if (d1 > d2)
|
||||||
if (value1.GetType() == wxT("datetime"))
|
return -1;
|
||||||
|
}
|
||||||
|
else if (value1.GetType() == wxT("datetime"))
|
||||||
{
|
{
|
||||||
wxDateTime dt1 = value1.GetDateTime();
|
wxDateTime dt1 = value1.GetDateTime();
|
||||||
wxDateTime dt2 = value2.GetDateTime();
|
wxDateTime dt2 = value2.GetDateTime();
|
||||||
if (dt1.IsEarlierThan(dt2)) return 1;
|
if (dt1.IsEarlierThan(dt2))
|
||||||
if (dt2.IsEarlierThan(dt1)) return -11;
|
return 1;
|
||||||
|
if (dt2.IsEarlierThan(dt1))
|
||||||
|
return -11;
|
||||||
}
|
}
|
||||||
|
|
||||||
// items must be different
|
// items must be different
|
||||||
unsigned long litem1 = (unsigned long) item1.GetID();
|
wxUIntPtr id1 = wxPtrToUInt(item1.GetID()),
|
||||||
unsigned long litem2 = (unsigned long) item2.GetID();
|
id2 = wxPtrToUInt(item2.GetID());
|
||||||
|
|
||||||
if (!ascending)
|
return ascending ? id1 - id2 : id2 - id1;
|
||||||
return litem2-litem2;
|
|
||||||
|
|
||||||
return litem1-litem2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
@@ -312,7 +315,7 @@ wxDataViewIndexListModel::wxDataViewIndexListModel( unsigned int initial_size )
|
|||||||
// build initial index
|
// build initial index
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 1; i < initial_size+1; i++)
|
for (i = 1; i < initial_size+1; i++)
|
||||||
m_hash.Add( (void*) i );
|
m_hash.Add( wxUIntToPtr(i) );
|
||||||
m_lastIndex = initial_size + 1;
|
m_lastIndex = initial_size + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +333,7 @@ void wxDataViewIndexListModel::Reset( unsigned int new_size )
|
|||||||
// build initial index
|
// build initial index
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 1; i < new_size+1; i++)
|
for (i = 1; i < new_size+1; i++)
|
||||||
m_hash.Add( (void*) i );
|
m_hash.Add( wxUIntToPtr(i) );
|
||||||
m_lastIndex = new_size + 1;
|
m_lastIndex = new_size + 1;
|
||||||
|
|
||||||
wxDataViewModel::Cleared();
|
wxDataViewModel::Cleared();
|
||||||
@@ -341,8 +344,8 @@ void wxDataViewIndexListModel::RowPrepended()
|
|||||||
m_ordered = false;
|
m_ordered = false;
|
||||||
|
|
||||||
unsigned int id = m_lastIndex++;
|
unsigned int id = m_lastIndex++;
|
||||||
m_hash.Insert( (void*) id, 0 );
|
m_hash.Insert( wxUIntToPtr(id), 0 );
|
||||||
wxDataViewItem item( (void*) id );
|
wxDataViewItem item( wxUIntToPtr(id) );
|
||||||
ItemAdded( wxDataViewItem(0), item );
|
ItemAdded( wxDataViewItem(0), item );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,16 +354,16 @@ void wxDataViewIndexListModel::RowInserted( unsigned int before )
|
|||||||
m_ordered = false;
|
m_ordered = false;
|
||||||
|
|
||||||
unsigned int id = m_lastIndex++;
|
unsigned int id = m_lastIndex++;
|
||||||
m_hash.Insert( (void*) id, before );
|
m_hash.Insert( wxUIntToPtr(id), before );
|
||||||
wxDataViewItem item( (void*) id );
|
wxDataViewItem item( wxUIntToPtr(id) );
|
||||||
ItemAdded( wxDataViewItem(0), item );
|
ItemAdded( wxDataViewItem(0), item );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataViewIndexListModel::RowAppended()
|
void wxDataViewIndexListModel::RowAppended()
|
||||||
{
|
{
|
||||||
unsigned int id = m_lastIndex++;
|
unsigned int id = m_lastIndex++;
|
||||||
m_hash.Add( (void*) id );
|
m_hash.Add( wxUIntToPtr(id) );
|
||||||
wxDataViewItem item( (void*) id );
|
wxDataViewItem item( wxUIntToPtr(id) );
|
||||||
ItemAdded( wxDataViewItem(0), item );
|
ItemAdded( wxDataViewItem(0), item );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,27 +517,27 @@ void wxDataViewVirtualListModel::Reset( unsigned int new_size )
|
|||||||
void wxDataViewVirtualListModel::RowPrepended()
|
void wxDataViewVirtualListModel::RowPrepended()
|
||||||
{
|
{
|
||||||
m_lastIndex++;
|
m_lastIndex++;
|
||||||
wxDataViewItem item( (void*) 0 );
|
wxDataViewItem item( NULL );
|
||||||
ItemAdded( wxDataViewItem(0), item );
|
ItemAdded( wxDataViewItem(0), item );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataViewVirtualListModel::RowInserted( unsigned int before )
|
void wxDataViewVirtualListModel::RowInserted( unsigned int before )
|
||||||
{
|
{
|
||||||
m_lastIndex++;
|
m_lastIndex++;
|
||||||
wxDataViewItem item( (void*) before );
|
wxDataViewItem item( wxUIntToPtr(before) );
|
||||||
ItemAdded( wxDataViewItem(0), item );
|
ItemAdded( wxDataViewItem(0), item );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataViewVirtualListModel::RowAppended()
|
void wxDataViewVirtualListModel::RowAppended()
|
||||||
{
|
{
|
||||||
m_lastIndex++;
|
m_lastIndex++;
|
||||||
wxDataViewItem item( (void*) m_lastIndex );
|
wxDataViewItem item( wxUIntToPtr(m_lastIndex) );
|
||||||
ItemAdded( wxDataViewItem(0), item );
|
ItemAdded( wxDataViewItem(0), item );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataViewVirtualListModel::RowDeleted( unsigned int row )
|
void wxDataViewVirtualListModel::RowDeleted( unsigned int row )
|
||||||
{
|
{
|
||||||
wxDataViewItem item( (void*) row );
|
wxDataViewItem item( wxUIntToPtr(row) );
|
||||||
wxDataViewModel::ItemDeleted( wxDataViewItem(0), item );
|
wxDataViewModel::ItemDeleted( wxDataViewItem(0), item );
|
||||||
m_lastIndex++;
|
m_lastIndex++;
|
||||||
}
|
}
|
||||||
@@ -548,7 +551,7 @@ void wxDataViewVirtualListModel::RowsDeleted( const wxArrayInt &rows )
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < sorted.GetCount(); i++)
|
for (i = 0; i < sorted.GetCount(); i++)
|
||||||
{
|
{
|
||||||
wxDataViewItem item( (void*) sorted[i] );
|
wxDataViewItem item( wxUIntToPtr(sorted[i]) );
|
||||||
array.Add( item );
|
array.Add( item );
|
||||||
}
|
}
|
||||||
wxDataViewModel::ItemsDeleted( wxDataViewItem(0), array );
|
wxDataViewModel::ItemsDeleted( wxDataViewItem(0), array );
|
||||||
@@ -573,7 +576,7 @@ unsigned int wxDataViewVirtualListModel::GetRow( const wxDataViewItem &item ) co
|
|||||||
|
|
||||||
wxDataViewItem wxDataViewVirtualListModel::GetItem( unsigned int row ) const
|
wxDataViewItem wxDataViewVirtualListModel::GetItem( unsigned int row ) const
|
||||||
{
|
{
|
||||||
return wxDataViewItem( (void*) row );
|
return wxDataViewItem( wxUIntToPtr(row) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDataViewVirtualListModel::HasDefaultCompare() const
|
bool wxDataViewVirtualListModel::HasDefaultCompare() const
|
||||||
|
@@ -2203,7 +2203,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dataitem = wxDataViewItem( (void*) item );
|
dataitem = wxDataViewItem( wxUIntToPtr(item) );
|
||||||
}
|
}
|
||||||
|
|
||||||
model->GetValue( value, dataitem, col->GetModelColumn());
|
model->GetValue( value, dataitem, col->GetModelColumn());
|
||||||
@@ -2995,10 +2995,11 @@ int wxDataViewMainWindow::GetLineAt( unsigned int y ) const
|
|||||||
{
|
{
|
||||||
const wxDataViewModel *model = GetOwner()->GetModel();
|
const wxDataViewModel *model = GetOwner()->GetModel();
|
||||||
|
|
||||||
if (GetOwner()->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
|
// check for the easy case first
|
||||||
{
|
if ( !GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) )
|
||||||
// TODO make more efficient
|
return y / m_lineHeight;
|
||||||
|
|
||||||
|
// TODO make more efficient
|
||||||
unsigned int row = 0;
|
unsigned int row = 0;
|
||||||
unsigned int yy = 0;
|
unsigned int yy = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -3045,13 +3046,6 @@ int wxDataViewMainWindow::GetLineAt( unsigned int y ) const
|
|||||||
|
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return y / m_lineHeight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const
|
int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const
|
||||||
@@ -3159,7 +3153,7 @@ wxDataViewItem wxDataViewMainWindow::GetItemByRow(unsigned int row) const
|
|||||||
{
|
{
|
||||||
if (!m_root)
|
if (!m_root)
|
||||||
{
|
{
|
||||||
return wxDataViewItem( (void*) row );
|
return wxDataViewItem( wxUIntToPtr(row) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user