void CatheterGrid::resetDefaultGrid(int nrows) { cmdCount = 0; DeleteRows(0, GetNumberRows()); for (int i = 0; i < nrows; i++) addGridRow(true); formatDefaultGrid(nrows); setRowReadOnly(0, false); }
void CatheterGrid::formatDefaultGrid(int nrows) { SetColLabelValue(CHANNEL_COL, wxT("Channel")); SetColLabelValue(CURRENT_COL, wxT("Current (mA)")); SetColLabelValue(DIRECTION_COL, wxT("Direction")); SetColLabelValue(DELAY_COL, wxT("Delay (ms)")); //HideRowLabels(); SetColFormatNumber(CHANNEL_COL); //channel address SetColFormatFloat(CURRENT_COL); // MA current //default is String for Direction SetColFormatNumber(DELAY_COL); //delay for (int i = 0; i < nrows; i++) formatDefaultRow(i); setRowReadOnly(0, false); }
void CatheterGrid::formatDefaultRow(int row) { if (row >= GetNumberRows()) return; const wxString direction_opts[] = { DIRNEGSTR, DIRPOSSTR }; wxString channel_opts[NCHANNELS + 1]; channel_opts[0] = GLOBALSTR; for (int i = 1; i <= NCHANNELS; i++) channel_opts[i] = wxString::Format("%d", i); SetCellEditor(row, CHANNEL_COL, new wxGridCellChoiceEditor(WXSIZEOF(channel_opts), (const wxString*)channel_opts)); SetCellEditor(row, CURRENT_COL, new wxGridCellFloatEditor(3, 3)); SetCellRenderer(row, CURRENT_COL, new wxGridCellFloatRenderer()); SetCellEditor(row, DIRECTION_COL, new wxGridCellChoiceEditor(WXSIZEOF(direction_opts), direction_opts)); SetCellEditor(row, DELAY_COL, new wxGridCellNumberEditor(0, MAX_DELAY)); SetCellRenderer(row, DELAY_COL, new wxGridCellNumberRenderer()); SetCellValue(row, DELAY_COL, wxT("0")); setRowReadOnly(row, true); }
CatheterCmdGrid::CatheterCmdGrid(const CatheterCmdGrid& C) : wxGrid(C.GetParent(), wxID_ANY), cmd_count(C.cmd_count), dir_choices{ wxT("neg"), wxT("pos") } { dir_choices[DIR_POS] = wxT("pos"); dir_choices[DIR_NEG] = wxT("neg"); CreateGrid(NCHANNELS, NFIELDS); SetColLabelValue(CHANNEL_COL, wxT("Channel")); SetColLabelValue(CURRENT_COL, wxT("Current (MA)")); SetColLabelValue(DIR_COL, wxT("Direction")); SetColLabelValue(DELAY_COL, wxT("Delay (ms)")); //HideRowLabels(); // set column attributes GetTable()->SetAttrProvider(new wxGridCellAttrProvider()); for (int i = 0; i < NFIELDS; i++) GetTable()->GetAttrProvider()->SetColAttr(new wxGridCellAttr(), i); SetColFormatNumber(CHANNEL_COL); //channel address SetColFormatFloat(CURRENT_COL); // MA current SetColFormatNumber(DELAY_COL); //delay wxGridCellAttr* dirAttr = GetTable()->GetAttrProvider()->GetAttr(0, DIR_COL, wxGridCellAttr::Col); wxGridCellAttr* channelAttr = GetTable()->GetAttrProvider()->GetAttr(0, CHANNEL_COL, wxGridCellAttr::Col); if (channelAttr == NULL || dirAttr == NULL) { printf("attribute is NULL\n"); exit(EXIT_FAILURE); } dirAttr->SetEditor(new wxGridCellChoiceEditor(2, dir_choices)); channelAttr->SetEditor(new wxGridCellNumberEditor(1, NCHANNELS)); SetColAttr(DIR_COL, dirAttr); SetColAttr(CHANNEL_COL, channelAttr); for (int i = 1; i < GetNumberRows(); i++) { setRowReadOnly(i, true); } appendCommandRow(); }
void CatheterGrid::OnGridCellChanging(wxGridEvent& e) { // called when edited cell loses focus // last value: GetCellValue(row, col) // pending value: e.GetString() int row = e.GetRow(); int col = e.GetCol(); switch (col) { case CHANNEL_COL: // setGridRowChannel(row, wxAtoi(e.GetString())); setGridRowChannel(row, e.GetString()); break; case CURRENT_COL: setGridRowcurrentMilliAmp(row, wxAtof(e.GetString())); break; case DIRECTION_COL: setGridRowDirection(row, (wxStrcmp(DIRPOSSTR, e.GetString()) ? DIR_NEG : DIR_POS)); break; case DELAY_COL: setGridRowDelayMS(row, wxAtoi(e.GetString())); break; } if (row == cmdCount && isGridRowComplete(row)) { cmdCount++; if (cmdCount < GetNumberRows()) setRowReadOnly(cmdCount, false); else addGridRow(false); // wxMessageBox(wxString::Format("completed command %d", cmdCount)); } e.Skip(); }
void CatheterCmdGrid::appendCommandRow() { cmd_count++; if (cmd_count >= GetNumberRows()) AppendRows(1); setRowReadOnly(cmd_count - 1, false); }
void EditPanel::appendCommandRow() { cmd_grid->incrementCmdCount(); if (cmd_grid->getCmdCount() >= cmd_grid->GetNumberRows()) cmd_grid->AppendRows(1); setRowReadOnly(cmd_grid->getCmdCount() - 1, false); }
bool QTable::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setNumRows((int)static_QUType_int.get(_o+1)); break; case 1: setNumCols((int)static_QUType_int.get(_o+1)); break; case 2: setShowGrid((bool)static_QUType_bool.get(_o+1)); break; case 3: hideRow((int)static_QUType_int.get(_o+1)); break; case 4: hideColumn((int)static_QUType_int.get(_o+1)); break; case 5: showRow((int)static_QUType_int.get(_o+1)); break; case 6: showColumn((int)static_QUType_int.get(_o+1)); break; case 7: static_QUType_bool.set(_o,isRowHidden((int)static_QUType_int.get(_o+1))); break; case 8: static_QUType_bool.set(_o,isColumnHidden((int)static_QUType_int.get(_o+1))); break; case 9: setColumnWidth((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 10: setRowHeight((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 11: adjustColumn((int)static_QUType_int.get(_o+1)); break; case 12: adjustRow((int)static_QUType_int.get(_o+1)); break; case 13: setColumnStretchable((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break; case 14: setRowStretchable((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break; case 15: static_QUType_bool.set(_o,isColumnStretchable((int)static_QUType_int.get(_o+1))); break; case 16: static_QUType_bool.set(_o,isRowStretchable((int)static_QUType_int.get(_o+1))); break; case 17: setSorting((bool)static_QUType_bool.get(_o+1)); break; case 18: swapRows((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 19: swapRows((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3)); break; case 20: swapColumns((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 21: swapColumns((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3)); break; case 22: swapCells((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3),(int)static_QUType_int.get(_o+4)); break; case 23: setLeftMargin((int)static_QUType_int.get(_o+1)); break; case 24: setTopMargin((int)static_QUType_int.get(_o+1)); break; case 25: setCurrentCell((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 26: clearSelection(); break; case 27: clearSelection((bool)static_QUType_bool.get(_o+1)); break; case 28: setColumnMovingEnabled((bool)static_QUType_bool.get(_o+1)); break; case 29: setRowMovingEnabled((bool)static_QUType_bool.get(_o+1)); break; case 30: setReadOnly((bool)static_QUType_bool.get(_o+1)); break; case 31: setRowReadOnly((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break; case 32: setColumnReadOnly((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break; case 33: setDragEnabled((bool)static_QUType_bool.get(_o+1)); break; case 34: static_QUType_bool.set(_o,dragEnabled()); break; case 35: insertRows((int)static_QUType_int.get(_o+1)); break; case 36: insertRows((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 37: insertColumns((int)static_QUType_int.get(_o+1)); break; case 38: insertColumns((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 39: removeRow((int)static_QUType_int.get(_o+1)); break; case 40: removeRows((const QMemArray<int>&)*((const QMemArray<int>*)static_QUType_ptr.get(_o+1))); break; case 41: removeColumn((int)static_QUType_int.get(_o+1)); break; case 42: removeColumns((const QMemArray<int>&)*((const QMemArray<int>*)static_QUType_ptr.get(_o+1))); break; case 43: editCell((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 44: editCell((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3)); break; case 45: setRowLabels((const QStringList&)*((const QStringList*)static_QUType_ptr.get(_o+1))); break; case 46: setColumnLabels((const QStringList&)*((const QStringList*)static_QUType_ptr.get(_o+1))); break; case 47: columnWidthChanged((int)static_QUType_int.get(_o+1)); break; case 48: rowHeightChanged((int)static_QUType_int.get(_o+1)); break; case 49: columnIndexChanged((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3)); break; case 50: rowIndexChanged((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3)); break; case 51: columnClicked((int)static_QUType_int.get(_o+1)); break; case 52: doAutoScroll(); break; case 53: doValueChanged(); break; case 54: updateGeometriesSlot(); break; default: return QScrollView::qt_invoke( _id, _o ); } return TRUE; }
void CatheterGrid::addGridRow(bool readOnly) { AppendRows(1); formatDefaultRow(GetNumberRows() - 1); setRowReadOnly(GetNumberRows() - 1, readOnly); }