void __fastcall TAddBoxType::grdAliquotMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { int Col = 0; int mouseUpRow = 0; grdAliquot->MouseToCell( X, Y, Col, mouseUpRow ); if ( mouseDownRow == -1 ) { Application->MessageBox( "Can not access row.\n" "Scroll down and try again.", "AddBoxType Message", MB_OK ); } else { if ( mouseDownRow == mouseUpRow ) { // if colour is already set, // unset it and remove row from list of selected rows // if colour is not set, // set it and add row to list of selected rows TColor colour; if ( grdAliquot->GetRowColour( mouseDownRow, colour ) ) { grdAliquot->DelRowColour( mouseDownRow ); } else { grdAliquot->SetRowColour( mouseDownRow, clLime ); } } else { MoveRow( mouseDownRow, grdAliquot->RowCount ); if ( mouseDownRow > mouseUpRow ) { // move rows down to make room for row moving up for ( int row=mouseDownRow; row>mouseUpRow; row-- ) { MoveRow( row-1, row ); } } else { // move rows up to make room for row moving down for ( int row=mouseDownRow; row<mouseUpRow; row++ ) { MoveRow( row+1, row ); } } MoveRow( grdAliquot->RowCount, mouseUpRow ); aliquotRowMoved = true; } } }
// TODO: cleanup LinkedInputResponseType LinkedOptionsMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, LinkedOptionsMenu *&pFocusedMenu ) { LinkedInputResponseType resp; if ( MenuI.button == MENU_BUTTON_LEFT ) { pFocusedMenu = this; resp = MoveRow( -1 ); if ( resp == LIRT_FORWARDED_PREV ) { Unfocus(); LinkedOptionsMenu *pMenu = GetPrevMenu(); pMenu->Focus(); pMenu->SetChoiceIndex( pMenu->GetChoiceCount()-1 ); pFocusedMenu = pMenu; } return resp; } else if ( MenuI.button == MENU_BUTTON_RIGHT ) { pFocusedMenu = this; resp = MoveRow( 1 ); if ( resp == LIRT_FORWARDED_NEXT ) { Unfocus(); LinkedOptionsMenu *pMenu = GetNextMenu(); pMenu->Focus(); pMenu->SetChoiceIndex( 0 ); pFocusedMenu = pMenu; } return resp; } else if ( MenuI.button == MENU_BUTTON_SELECT ) { Unfocus(); LinkedOptionsMenu *pMenu = GetNextMenu(); pMenu->Focus(); pFocusedMenu = pMenu; if ( pMenu == this ) return LIRT_STOP; else { m_SoundSwitchMenu.Play(); return LIRT_FORWARDED_NEXT; } } return LIRT_INVALID; }
NS_IMETHODIMP morkTable::MoveOid( // change position of row in unsorted table nsIMdbEnv* mev, // context const mdbOid* inOid, // row oid to find in table mdb_pos inHintFromPos, // suggested hint regarding start position mdb_pos inToPos, // desired new position for row inOid mdb_pos* outActualPos) // actual new position of row in table { mdb_err outErr = NS_OK; mdb_pos actualPos = -1; // meaning it was never found in table morkEnv* ev = morkEnv::FromMdbEnv(mev); if ( ev ) { if ( inOid && mTable_Store ) { morkRow* row = mTable_Store->GetRow(ev, inOid); if ( row ) actualPos = MoveRow(ev, row, inHintFromPos, inToPos); } else ev->NilPointerError(); outErr = ev->AsErr(); } if ( outActualPos ) *outActualPos = actualPos; return outErr; }
Board::Board(board_t mask) { unsigned int n = 1 << BitsPerRow; this->mask = mask; if (lookupTableLeft == (row_t *)0) { lookupTableLeft = new row_t[n]; scores = new score_t[n]; for (unsigned int i = 0; i < n; i++) lookupTableLeft[i] = MoveRow((row_t)i, false, &(scores[i])); lookupTableRight = new row_t[n]; for (unsigned int i = 0; i < n; i++) lookupTableRight[i] = MoveRow((row_t)i, true, (score_t *)0); } }
bool CColumnResizer::SetColumnWidth(int Col, int Width) { ASSERT(Col >= 0 && Col < m_Columns); bool retc = TRUE; if (Width < m_ColDef[Col].MinWidth) { // if below min width Width = m_ColDef[Col].MinWidth; // clamp width to min retc = FALSE; // tells header control to abort tracking } m_Delta = Width - m_ColVar[Col].Width; m_ColVar[Col].Width = Width; MakeColumnArray(); m_WndList = NULL; // operate on all rows MoveRow(Col); return(retc); }
NS_IMETHODIMP morkTable::MoveRow( // change position of row in unsorted table nsIMdbEnv* mev, // context nsIMdbRow* ioRow, // row oid to find in table mdb_pos inHintFromPos, // suggested hint regarding start position mdb_pos inToPos, // desired new position for row ioRow mdb_pos* outActualPos) // actual new position of row in table { mdb_pos actualPos = -1; // meaning it was never found in table mdb_err outErr = NS_OK; morkEnv* ev = morkEnv::FromMdbEnv(mev); if ( ev ) { morkRowObject *rowObj = (morkRowObject *) ioRow; morkRow* row = rowObj->mRowObject_Row; actualPos = MoveRow(ev, row, inHintFromPos, inToPos); outErr = ev->AsErr(); } if ( outActualPos ) *outActualPos = actualPos; return outErr; }
void CBCommandTable::HandleDNDDrop ( const JPoint& pt, const JArray<Atom>& typeList, const Atom action, const Time time, const JXWidget* source ) { JXSelectionManager* selMgr = GetSelectionManager(); JXDNDManager* dndMgr = GetDNDManager(); const Atom selName = dndMgr->GetDNDSelectionName(); if (source == this && action == dndMgr->GetDNDActionMoveXAtom()) { JPoint cell; if ((GetTableSelection()).GetSingleSelectedCell(&cell) && itsDNDRowIndex != JIndex(cell.y) && itsDNDRowIndex != JIndex(cell.y)+1) { JIndex newIndex = itsDNDRowIndex; if (newIndex > JIndex(cell.y)) { newIndex--; } newIndex = JMin(newIndex, GetRowCount()); itsCmdList->MoveElementToIndex(cell.y, newIndex); MoveRow(cell.y, newIndex); SelectSingleCell(JPoint(1, newIndex)); } } else if (source == this) { JPoint cell; if ((GetTableSelection()).GetSingleSelectedCell(&cell)) { itsCmdList->InsertElementAtIndex( itsDNDRowIndex, (itsCmdList->GetElement(cell.y)).Copy()); InsertRows(itsDNDRowIndex, 1); SelectSingleCell(JPoint(1, itsDNDRowIndex)); } } else { Atom returnType; unsigned char* data; JSize dataLength; JXSelectionManager::DeleteMethod delMethod; if (selMgr->GetData(selName, time, itsCommandXAtom, &returnType, &data, &dataLength, &delMethod)) { if (returnType == itsCommandXAtom) { const std::string s((char*) data, dataLength); std::istringstream input(s); CBCommandManager::CmdInfo cmdInfo = CBCommandManager::ReadCmdInfo(input, CBCommandManager::GetCurrentCmdInfoFileVersion()); if (!input.fail()) { const JIndex newIndex = JMax(JIndex(1), itsDNDRowIndex); itsCmdList->InsertElementAtIndex(newIndex, cmdInfo); InsertRows(newIndex, 1); SelectSingleCell(JPoint(1, newIndex)); if (action == dndMgr->GetDNDActionMoveXAtom()) { selMgr->SendDeleteRequest(selName, time); } } } selMgr->DeleteData(&data, delMethod); } } HandleDNDLeave(); }
void CColumnResizer::UpdateRow(WNDLIST WndList) { m_WndList = WndList; // operate on this row only MoveRow(0); // start from first column }