bool ListView1::InitiateDrag(BPoint point, bool wasSelected) { printf("InitiateDrag():"); point.PrintToStream(); BRow *row=FocusRow(); if (row==NULL) return false; /* if ((CDMode==DATACD_INDEX) || (CDMode==BOOTABLECD_INDEX)) { // yes? then we are not in audio mode folderRow=new FolderRow(((FolderRow *)row)->GetFilename(), ((FolderRow *)row)->IsFolder(), ((FolderRow *)row)->GetBitmap()); } else */ if ((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX)){ audioRow=new AudioRow(((AudioRow *)row)->GetTrackNumber(),((AudioRow *)row)->GetFilename(), ((AudioRow *)row)->GetPregap(), ((AudioRow *)row)->GetBytes(), ((AudioRow *)row)->GetLength()); audioRow->SetCDTitle(((AudioRow *)row)->GetCDTitle()); audioRow->SetIndexList(((AudioRow *)row)->GetIndexList()); audioRow->SetPregap(((AudioRow *)row)->GetPregap()); audioRow->SetStartFrame(((AudioRow *)row)->GetStartFrame()); audioRow->SetEndFrame(((AudioRow *)row)->GetEndFrame()); // audioRow->SetStartTime(((AudioRow *)row)->GetStartTime()); // audioRow->SetEndTime(((AudioRow *)row)->GetEndTime()); //audioRow=new AudioRow(*((AudioRow *)row)); } BMessage *message=new BMessage(LISTITEM_DROPPED); BRect rect; if (GetRowRect(row, &rect)) { void *r=(void *)row; message->AddPointer("from", r); if (!((FolderRow *)row)->IsFolder()) message->AddInt32("index", (int32)IndexOf(row)); DragMessage(message, rect); // if ((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX)) // RemoveRow(IndexOf(row)); //delete row; } return true; }
bool PartitionListView::InitiateDrag(BPoint rowPoint, bool wasSelected) { PartitionListRow* draggedRow = dynamic_cast<PartitionListRow*>(RowAt(rowPoint)); if (draggedRow == NULL) return false; const char* draggedPath = draggedRow->DevicePath(); if (draggedPath == NULL) return false; BRect draggedRowRect; GetRowRect(draggedRow, &draggedRowRect); BMessage dragMessage(B_MIME_DATA); dragMessage.AddData("text/plain", B_MIME_TYPE, draggedPath, strlen(draggedPath)); DragMessage(&dragMessage, draggedRowRect, NULL); return true; }