replaced all int/size_t indices in wxControlWithItems API with unsigned int (committing on behalf of ABX)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-03-23 22:05:23 +00:00
parent 5aa67d6619
commit aa61d35253
112 changed files with 1367 additions and 1414 deletions

View File

@@ -55,7 +55,7 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
style, validator, name );
}
bool wxCheckListBox::IsChecked( int index ) const
bool wxCheckListBox::IsChecked(unsigned int index) const
{
wxCHECK_MSG( m_list != NULL, false, wxT("invalid checklistbox") );
@@ -74,7 +74,7 @@ bool wxCheckListBox::IsChecked( int index ) const
return false;
}
void wxCheckListBox::Check( int index, bool check )
void wxCheckListBox::Check(unsigned int index, bool check )
{
wxCHECK_RET( m_list != NULL, wxT("invalid checklistbox") );

View File

@@ -133,7 +133,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
GtkWidget *menu = gtk_menu_new();
for (size_t i = 0; i < (size_t)n; i++)
for (unsigned int i = 0; i < n; i++)
{
GtkAddHelper(menu, i, choices[i]);
}
@@ -164,27 +164,27 @@ int wxChoice::DoAppend( const wxString &item )
return GtkAddHelper(menu, GetCount(), item);
}
int wxChoice::DoInsert( const wxString &item, int pos )
int wxChoice::DoInsert( const wxString &item, unsigned int pos )
{
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice control") );
wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index"));
if ((size_t)pos == GetCount())
if (pos == GetCount())
return DoAppend(item);
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
// if the item to insert is at or before the selection, and the selection is valid
if ((pos <= m_selection_hack) && (m_selection_hack != wxNOT_FOUND))
if (((int)pos <= m_selection_hack) && (m_selection_hack != wxNOT_FOUND))
{
// move the selection forward one
m_selection_hack++;
}
return GtkAddHelper(menu, (size_t)pos, item);
return GtkAddHelper(menu, pos, item);
}
void wxChoice::DoSetItemClientData( int n, void* clientData )
void wxChoice::DoSetItemClientData(unsigned int n, void* clientData)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
@@ -194,7 +194,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
node->SetData( (wxObject*) clientData );
}
void* wxChoice::DoGetItemClientData( int n ) const
void* wxChoice::DoGetItemClientData(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") );
@@ -204,7 +204,7 @@ void* wxChoice::DoGetItemClientData( int n ) const
return node->GetData();
}
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
@@ -216,7 +216,7 @@ void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
node->SetData( (wxObject*) clientData );
}
wxClientData* wxChoice::DoGetItemClientObject( int n ) const
wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") );
@@ -256,24 +256,24 @@ void wxChoice::Clear()
m_selection_hack = wxNOT_FOUND;
}
void wxChoice::Delete( int n )
void wxChoice::Delete(unsigned int n)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid choice") );
// VZ: apparently GTK+ doesn't have a built-in function to do it (not even
// in 2.0), hence this dumb implementation -- still better than nothing
int i;
size_t count = GetCount();
unsigned int i;
unsigned int count = GetCount();
wxCHECK_RET( IsValid(n), _T("invalid index in wxChoice::Delete") );
// if the item to delete is before the selection, and the selection is valid
if ((n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND))
if (((int)n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND))
{
// move the selection back one
m_selection_hack--;
}
else if (n == m_selection_hack)
else if ((int)n == m_selection_hack)
{
// invalidate the selection
m_selection_hack = wxNOT_FOUND;
@@ -287,7 +287,7 @@ void wxChoice::Delete( int n )
wxArrayString items;
wxArrayPtrVoid itemsData;
items.Alloc(count);
for ( i = 0; (size_t)i < count; i++ )
for ( i = 0; i < count; i++ )
{
if ( i != n )
{
@@ -320,7 +320,7 @@ void wxChoice::Delete( int n )
Clear();
for ( i = 0; (size_t)i < count - 1; i++ )
for ( i = 0; i < count - 1; i++ )
{
Append(items[i]);
@@ -372,12 +372,12 @@ int wxChoice::GetSelection() const
}
void wxChoice::SetString( int n, const wxString& str )
void wxChoice::SetString(unsigned int n, const wxString& str )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid choice") );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
unsigned int count = 0;
GList *child = menu_shell->children;
while (child)
{
@@ -401,12 +401,12 @@ void wxChoice::SetString( int n, const wxString& str )
}
}
wxString wxChoice::GetString( int n ) const
wxString wxChoice::GetString(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid choice") );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
unsigned int count = 0;
GList *child = menu_shell->children;
while (child)
{
@@ -432,12 +432,12 @@ wxString wxChoice::GetString( int n ) const
return wxEmptyString;
}
size_t wxChoice::GetCount() const
unsigned int wxChoice::GetCount() const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid choice") );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
size_t count = 0;
unsigned int count = 0;
GList *child = menu_shell->children;
while (child)
{
@@ -455,7 +455,7 @@ void wxChoice::SetSelection( int n )
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
// set the local selection variable manually
if ((n >= 0) && ((size_t)n < GetCount()))
if (IsValid((unsigned int)n))
{
// a valid selection has been made
m_selection_hack = n;
@@ -498,7 +498,7 @@ void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style)
}
}
int wxChoice::GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item)
int wxChoice::GtkAddHelper(GtkWidget *menu, unsigned int pos, const wxString& item)
{
wxCHECK_MSG(pos<=m_clientList.GetCount(), -1, wxT("invalid index"));
@@ -575,10 +575,10 @@ wxSize wxChoice::DoGetBestSize() const
if ( m_widget )
{
int width;
size_t count = GetCount();
for ( size_t n = 0; n < count; n++ )
unsigned int count = GetCount();
for ( unsigned int n = 0; n < count; n++ )
{
GetTextExtent( GetString(n), &width, NULL, NULL, NULL );
GetTextExtent(GetString(n), &width, NULL, NULL, NULL );
if ( width > ret.x )
ret.x = width;
}

View File

@@ -347,7 +347,7 @@ int wxComboBox::DoAppend( const wxString &item )
gtk_widget_show( list_item );
const size_t count = GetCount();
const unsigned int count = GetCount();
if ( m_clientDataList.GetCount() < count )
m_clientDataList.Append( (wxObject*) NULL );
@@ -361,7 +361,7 @@ int wxComboBox::DoAppend( const wxString &item )
return count - 1;
}
int wxComboBox::DoInsert( const wxString &item, int pos )
int wxComboBox::DoInsert( const wxString &item, unsigned int pos )
{
wxCHECK_MSG( !(GetWindowStyle() & wxCB_SORT), -1,
wxT("can't insert into sorted list"));
@@ -370,7 +370,7 @@ int wxComboBox::DoInsert( const wxString &item, int pos )
wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index") );
if ((size_t)pos == GetCount())
if (pos == GetCount())
return Append(item);
DisableEvents();
@@ -393,7 +393,7 @@ int wxComboBox::DoInsert( const wxString &item, int pos )
gtk_widget_show( list_item );
const size_t count = GetCount();
const unsigned int count = GetCount();
if ( m_clientDataList.GetCount() < count )
m_clientDataList.Insert( pos, (wxObject*) NULL );
@@ -407,7 +407,7 @@ int wxComboBox::DoInsert( const wxString &item, int pos )
return pos;
}
void wxComboBox::DoSetItemClientData( int n, void* clientData )
void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
@@ -417,7 +417,7 @@ void wxComboBox::DoSetItemClientData( int n, void* clientData )
node->SetData( (wxObject*) clientData );
}
void* wxComboBox::DoGetItemClientData( int n ) const
void* wxComboBox::DoGetItemClientData(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") );
@@ -426,7 +426,7 @@ void* wxComboBox::DoGetItemClientData( int n ) const
return node ? node->GetData() : NULL;
}
void wxComboBox::DoSetItemClientObject( int n, wxClientData* clientData )
void wxComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
@@ -438,7 +438,7 @@ void wxComboBox::DoSetItemClientObject( int n, wxClientData* clientData )
node->SetData( (wxObject*) clientData );
}
wxClientData* wxComboBox::DoGetItemClientObject( int n ) const
wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, wxT("invalid combobox") );
@@ -472,7 +472,7 @@ void wxComboBox::Clear()
InvalidateBestSize();
}
void wxComboBox::Delete( int n )
void wxComboBox::Delete(unsigned int n)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
@@ -509,7 +509,7 @@ void wxComboBox::Delete( int n )
InvalidateBestSize();
}
void wxComboBox::SetString(int n, const wxString &text)
void wxComboBox::SetString(unsigned int n, const wxString &text)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
@@ -583,7 +583,7 @@ int wxComboBox::GetCurrentSelection() const
return wxNOT_FOUND;
}
wxString wxComboBox::GetString( int n ) const
wxString wxComboBox::GetString(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") );
@@ -625,14 +625,14 @@ wxString wxComboBox::GetStringSelection() const
return wxEmptyString;
}
size_t wxComboBox::GetCount() const
unsigned int wxComboBox::GetCount() const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
size_t count = 0;
unsigned int count = 0;
while (child) { count++; child = child->next; }
return count;
}
@@ -929,10 +929,10 @@ wxSize wxComboBox::DoGetBestSize() const
if ( m_widget )
{
int width;
size_t count = GetCount();
for ( size_t n = 0; n < count; n++ )
unsigned int count = GetCount();
for ( unsigned int n = 0; n < count; n++ )
{
GetTextExtent( GetString(n), &width, NULL, NULL, NULL );
GetTextExtent(GetString(n), &width, NULL, NULL, NULL );
if ( width > ret.x )
ret.x = width;
}

View File

@@ -573,7 +573,7 @@ wxListBox::~wxListBox()
// adding items
// ----------------------------------------------------------------------------
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos)
{
wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );
@@ -593,12 +593,12 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
wxCHECK_RET( pos <= length, wxT("invalid index in wxListBox::InsertItems") );
size_t nItems = items.GetCount();
unsigned int nItems = items.GetCount();
int index;
if (m_strings)
{
for (size_t n = 0; n < nItems; n++)
for (unsigned int n = 0; n < nItems; n++)
{
index = m_strings->Add( items[n] );
@@ -619,7 +619,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
{
if (pos == length)
{
for ( size_t n = 0; n < nItems; n++ )
for ( unsigned int n = 0; n < nItems; n++ )
{
GtkAddItem( items[n] );
@@ -629,7 +629,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
else
{
wxList::compatibility_iterator node = m_clientList.Item( pos );
for ( size_t n = 0; n < nItems; n++ )
for ( unsigned int n = 0; n < nItems; n++ )
{
GtkAddItem( items[n], pos+n );
@@ -757,8 +757,8 @@ void wxListBox::DoSetItems( const wxArrayString& items,
if ( clientData )
{
size_t count = items.GetCount();
for ( size_t n = 0; n < count; n++ )
unsigned int count = items.GetCount();
for ( unsigned int n = 0; n < count; n++ )
{
SetClientData(n, clientData[n]);
}
@@ -799,7 +799,7 @@ void wxListBox::Clear()
m_strings->Clear();
}
void wxListBox::Delete( int n )
void wxListBox::Delete(unsigned int n)
{
wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );
@@ -831,7 +831,7 @@ void wxListBox::Delete( int n )
// client data
// ----------------------------------------------------------------------------
void wxListBox::DoSetItemClientData( int n, void* clientData )
void wxListBox::DoSetItemClientData(unsigned int n, void* clientData)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
@@ -841,7 +841,7 @@ void wxListBox::DoSetItemClientData( int n, void* clientData )
node->SetData( (wxObject*) clientData );
}
void* wxListBox::DoGetItemClientData( int n ) const
void* wxListBox::DoGetItemClientData(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
@@ -851,7 +851,7 @@ void* wxListBox::DoGetItemClientData( int n ) const
return node->GetData();
}
void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData )
void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
@@ -863,7 +863,7 @@ void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData )
node->SetData( (wxObject*) clientData );
}
wxClientData* wxListBox::DoGetItemClientObject( int n ) const
wxClientData* wxListBox::DoGetItemClientObject(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") );
@@ -898,7 +898,7 @@ wxString wxListBox::GetRealLabel(GList *item) const
return str;
}
void wxListBox::SetString( int n, const wxString &string )
void wxListBox::SetString(unsigned int n, const wxString &string)
{
wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );
@@ -923,7 +923,7 @@ void wxListBox::SetString( int n, const wxString &string )
}
}
wxString wxListBox::GetString( int n ) const
wxString wxListBox::GetString(unsigned int n) const
{
wxCHECK_MSG( m_list != NULL, wxEmptyString, wxT("invalid listbox") );
@@ -938,7 +938,7 @@ wxString wxListBox::GetString( int n ) const
return wxEmptyString;
}
size_t wxListBox::GetCount() const
unsigned int wxListBox::GetCount() const
{
wxCHECK_MSG( m_list != NULL, 0, wxT("invalid listbox") );
@@ -1216,7 +1216,7 @@ wxSize wxListBox::DoGetBestSize() const
int wLine;
// Find the widest line
for(size_t i = 0; i < GetCount(); i++) {
for(unsigned int i = 0; i < GetCount(); i++) {
wxString str(GetString(i));
GetTextExtent(str, &wLine, NULL);
lbWidth = wxMax(lbWidth, wLine);

View File

@@ -206,8 +206,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
SetMajorDim(majorDim == 0 ? n : majorDim, style);
int num_of_cols = GetColumnCount();
int num_of_rows = GetRowCount();
unsigned int num_of_cols = GetColumnCount();
unsigned int num_of_rows = GetRowCount();
GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
@@ -290,7 +290,7 @@ wxRadioBox::~wxRadioBox()
}
}
bool wxRadioBox::Show( bool show )
bool wxRadioBox::Show(bool show)
{
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
@@ -375,7 +375,7 @@ int wxRadioBox::GetSelection(void) const
return wxNOT_FOUND;
}
wxString wxRadioBox::GetString( int n ) const
wxString wxRadioBox::GetString(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid radiobox") );
@@ -397,7 +397,7 @@ void wxRadioBox::SetLabel( const wxString& label )
GTKSetLabelForFrame(GTK_FRAME(m_widget), label);
}
void wxRadioBox::SetString( int item, const wxString& label )
void wxRadioBox::SetString(unsigned int item, const wxString& label)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
@@ -429,7 +429,7 @@ bool wxRadioBox::Enable( bool enable )
return true;
}
bool wxRadioBox::Enable( int item, bool enable )
bool wxRadioBox::Enable(unsigned int item, bool enable)
{
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
@@ -446,7 +446,7 @@ bool wxRadioBox::Enable( int item, bool enable )
return true;
}
bool wxRadioBox::IsItemEnabled(int item) const
bool wxRadioBox::IsItemEnabled(unsigned int item) const
{
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
@@ -461,7 +461,7 @@ bool wxRadioBox::IsItemEnabled(int item) const
return GTK_WIDGET_SENSITIVE(GTK_WIDGET(button));
}
bool wxRadioBox::Show( int item, bool show )
bool wxRadioBox::Show(unsigned int item, bool show)
{
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
@@ -479,7 +479,7 @@ bool wxRadioBox::Show( int item, bool show )
return true;
}
bool wxRadioBox::IsItemShown(int item) const
bool wxRadioBox::IsItemShown(unsigned int item) const
{
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
@@ -492,7 +492,7 @@ bool wxRadioBox::IsItemShown(int item) const
return GTK_WIDGET_VISIBLE(GTK_WIDGET(button));
}
size_t wxRadioBox::GetCount() const
unsigned int wxRadioBox::GetCount() const
{
return m_boxes.GetCount();
}