void AuroraTrackSelectorDialog::InitDrag(wxListCtrl* list) { wxString text; // 1: find selected items, return false is there isn't text.Clear(); int selectedItemsCount = list->GetSelectedItemCount(); printf("Selected %d items\n", selectedItemsCount); fflush(stdout); text << selectedItemsCount << TRAILING_SLASH; int idx = 0; long *itemsList = new long [selectedItemsCount]; long item = -1; for( ;; ) { item = list->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if( item > -1 ) { printf("appending %d item\n", item); fflush(stdout); text << list->GetItemText(item) << TRAILING_SLASH; itemsList[idx++] = item; } else break; } // 2: build DropSource ad do drag'n'drop wxTextDataObject tdo(text); AFTrackDropSource tds(tdo, list); tds.DoDragDrop(); printf("dragdrop done\n"); fflush(stdout); // 3: delete items from source for(idx = (selectedItemsCount-1); idx >= 0; idx--) list->DeleteItem(itemsList[idx]); delete [] itemsList; ToggleControls(); printf("exiting initdrag\n"); fflush(stdout); }
/** * Put statistics of all terminals into allocated location pointed by * stat. */ int TerminalDriverStatistics(struct termstat *stat){ struct termstat* t = stat; tds(t); return 0; }