X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fe3dc50545b43c324617ed2a0cdfde0f9298d05a..2289dcea2ba6b6c1ef9dd9076fb9c632fe009f89:/src/mac/carbon/listbox.cpp diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 377a91d3f6..7c8ca90473 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -9,10 +9,12 @@ // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "listbox.h" #endif +#include "wx/wxprec.h" + #include "wx/app.h" #include "wx/listbox.h" #include "wx/button.h" @@ -28,7 +30,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) BEGIN_EVENT_TABLE(wxListBox, wxControl) #ifndef __WXMAC_OSX__ - EVT_SIZE( wxListBox::OnSize ) +// EVT_SIZE( wxListBox::OnSize ) EVT_CHAR( wxListBox::OnChar ) #endif END_EVENT_TABLE() @@ -440,22 +442,7 @@ void wxListBox::Clear() void wxListBox::SetSelection(int N, bool select) { - if ( N == wxNOT_FOUND ) - { - // unselect everything - int sel = MacGetSelection() ; - if ( sel != wxNOT_FOUND ) - { - UInt32 id = sel + 1 ; - verify_noerr( - m_peer->SetSelectedItems( 1 , & id , kDataBrowserItemsRemove ) - ); - } - - return; - } - - wxCHECK_RET( N >= 0 && N < m_noItems, + wxCHECK_RET( N == wxNOT_FOUND || (N >= 0 && N < m_noItems) , wxT("invalid index in wxListBox::SetSelection") ); if ( N == wxNOT_FOUND ) @@ -669,7 +656,7 @@ void wxListBox::MacDelete( int n ) UInt32 id = m_noItems+1 ; verify_noerr( m_peer->RemoveItems( kDataBrowserNoItem , 1 , (UInt32*) &id , kDataBrowserItemNoProperty ) ) ; - for ( int i = 0 ; i < selectionBefore.GetCount() ; ++i ) + for ( size_t i = 0 ; i < selectionBefore.GetCount() ; ++i ) { int current = selectionBefore[i] ; if ( current == n ) @@ -779,7 +766,7 @@ int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const m_peer->GetSelectionAnchor( &first , &last ) ; if ( first != kDataBrowserNoItem ) { - for ( int i = first ; i <= last ; ++i ) + for ( size_t i = first ; i <= last ; ++i ) { if ( m_peer->IsItemSelected( i ) ) { @@ -879,7 +866,7 @@ void wxListBox::OnChar(wxKeyEvent& event) n = -1; } - event.m_commandInt = n; + event.SetInt(n); GetEventHandler()->ProcessEvent(event); } @@ -906,7 +893,7 @@ void wxListBox::OnChar(wxKeyEvent& event) event.SetClientData( GetClientData(line) ); event.SetString( GetString(line) ); - event.m_commandInt = line ; + event.SetInt(line); GetEventHandler()->ProcessEvent(event); }