// -------------------------------------------------------------------------------- // void guPLSoListBox::MoveSelection( void ) { if( ( m_TracksOrder != wxNOT_FOUND ) || ( m_PLIds.Count() != 1 ) || ( m_PLTypes[ 0 ] != guPLAYLIST_TYPE_STATIC ) ) return; wxArrayInt MoveIds; wxArrayInt MoveIndex; wxArrayInt ItemIds; // Copy the elements we are going to move unsigned long cookie; int item = GetFirstSelected( cookie ); while( item != wxNOT_FOUND ) { MoveIndex.Add( item ); MoveIds.Add( m_Items[ item ].m_SongId ); item = GetNextSelected( cookie ); } // Get the position where to move it int InsertPos; if( m_DragOverItem != wxNOT_FOUND ) InsertPos = m_DragOverItem + m_DragOverAfter; else InsertPos = m_Items.Count(); // Remove the elements from the original position int index; int count = MoveIndex.Count(); for( index = count - 1; index >= 0; index-- ) { m_Items.RemoveAt( MoveIndex[ index ] ); if( MoveIndex[ index ] < InsertPos ) InsertPos--; } count = m_Items.Count(); for( index = 0; index < count; index++ ) { ItemIds.Add( m_Items[ index ].m_SongId ); } count = MoveIds.Count(); for( index = 0; index < count; index++ ) { ItemIds.Insert( MoveIds[ index ], InsertPos + index ); } // Save it to the database m_Db->UpdateStaticPlayList( m_PLIds[ 0 ], ItemIds ); m_Db->UpdateStaticPlayListFile( m_PLIds[ 0 ] ); ReloadItems(); }
void WadListBox::GetSelections(wxArrayInt& selection) const { selection.clear(); unsigned long cookie; int index = GetFirstSelected(cookie); while (index != wxNOT_FOUND) { selection.push_back(index); index = GetNextSelected(cookie); } }
void TTreeView::DoActivate(bool flag) { EnableDrawing(); XGDraw draw(this); draw.SetFont(XGFont::LoadFont(1)); for (uint32 item = GetFirstSelected(); item; item = GetNextSelected( item )) { RedrawItem(draw,(TableEntryRecord *)item); } XGView::DoActivate(flag); }
// -------------------------------------------------------------------------------- // int guPLSoListBox::GetSelectedSongs( guTrackArray * tracks, const bool isdrag ) const { unsigned long cookie; guPLSoListBox * self = wxConstCast( this, guPLSoListBox ); self->m_ItemsMutex.Lock(); int item = GetFirstSelected( cookie ); while( item != wxNOT_FOUND ) { tracks->Add( new guTrack( m_Items[ item ] ) ); item = GetNextSelected( cookie ); } self->m_ItemsMutex.Unlock(); return tracks->Count(); }
// -------------------------------------------------------------------------------- // int guPLSoListBox::GetPlayListSetIds( wxArrayInt * setids ) const { unsigned long cookie; if( m_PLSetIds.Count() ) { int item = GetFirstSelected( cookie ); while( item != wxNOT_FOUND ) { setids->Add( m_PLSetIds[ item ] ); item = GetNextSelected( cookie ); } } return setids->Count(); }
int wxVListBox::GetFirstSelected(unsigned long& cookie) const { cookie = 0; return GetNextSelected(cookie); }