Esempio n. 1
0
void wxListBox::MacDelete( int n )
{
    wxArrayInt selectionBefore ;
    MacGetSelections( selectionBefore ) ;

    UInt32 id = m_noItems+1 ;
    verify_noerr( m_peer->RemoveItems( kDataBrowserNoItem , 1 , (UInt32*) &id , kDataBrowserItemNoProperty ) ) ;
    for ( size_t i = 0 ; i < selectionBefore.GetCount() ; ++i )
    {
        int current = selectionBefore[i] ;
        if ( current == n )
        {
            // selection was deleted
            MacSetSelection( current , false ) ;
        }
        else if ( current > n )
        {
            // something behind the deleted item was selected -> move up
            MacSetSelection( current - 1 , true ) ;
            MacSetSelection( current , false ) ;
        }
    }
    // refresh all
    verify_noerr( m_peer->UpdateItems( kDataBrowserNoItem , 1 , (UInt32*) kDataBrowserNoItem , kDataBrowserItemNoProperty , kDataBrowserItemNoProperty ) ) ;
}
Esempio n. 2
0
void wxListBox::DoSetSelection(int N, bool select)
{
    wxCHECK_RET( IsValid(N),
        wxT("invalid index in wxListBox::SetSelection") );
    MacSetSelection( N , select ) ;
    GetSelections( m_selectionPreImage ) ;
}
Esempio n. 3
0
void wxListBox::DoSetSelection(int N, bool select)
{
    wxCHECK_RET( N == wxNOT_FOUND || (N >= 0 && N < m_noItems) ,
        wxT("invalid index in wxListBox::SetSelection") );

    if ( N == wxNOT_FOUND )
        MacDeselectAll() ;
    else
        MacSetSelection( N , select ) ;
}
Esempio n. 4
0
void wxListBox::MacInsert( int n , const wxString& text)
{
    wxArrayInt selectionBefore ;
    MacGetSelections( selectionBefore ) ;

    UInt32 id = m_noItems ; // this has already been increased
    verify_noerr( m_peer->AddItems( kDataBrowserNoItem , 1 ,  (UInt32*) &id , kDataBrowserItemNoProperty ) ) ;

    for ( int i = selectionBefore.GetCount()-1 ; i >= 0 ; --i )
    {
        int current = selectionBefore[i] ;
        if ( current >= n )
        {
            MacSetSelection( current + 1 , true ) ;
            MacSetSelection( current , false ) ;
        }
    }

    // refresh all
    verify_noerr( m_peer->UpdateItems( kDataBrowserNoItem , 1 , (UInt32*) kDataBrowserNoItem , kDataBrowserItemNoProperty , kDataBrowserItemNoProperty ) ) ;
}