void ofxUISortableList::goingDown()// what to do if the active widget is getting bumped down the list order { int swapIndex = activeWidgetIndex + 1; swapListItems(activeWidgetIndex, swapIndex); activeWidgetIndex++; refreshPositions(); }
void ofxUISortableList::reshuffle(std::vector<string> ordering)// reshuffle based on saved ordering { for (int i = 0; i < ordering.size(); i++) { ofxUIDraggableLabelButton* listItem = listItems[i]; if(listItem->getSortID()!=ordering.at(i)) { for(int j = 0; j< listItems.size(); j++) { ofxUIDraggableLabelButton* _listItem = listItems[j]; if(_listItem->getSortID()==ordering.at(i)) { // swap i, j swapListItems(i, j); } } } } refreshPositions(); }
void ProcEditor::onDownButtonClicked() { int row = actionList->currentRow(); if( row == ( actionList->count() - 1 ) ) return; QListWidgetItem *item = actionList->item( row ); if( item == NULL ) return; QListWidgetItem *nextItem = actionList->item( row + 1 ); if( nextItem == NULL ) return; CProcedure *proc = CWidgetManager::getInstance()->getParser()->getProc( currentProc.toUtf8().constData() ); if( proc == NULL ) return; if( !proc->swap( row, row + 1 ) ) return; swapListItems( row, row + 1 ); actionList->setCurrentRow( row + 1 ); }