void ctlSQLGrid::OnMouseWheel(wxMouseEvent &event) { if (event.ControlDown() || event.CmdDown()) { wxFont fontlabel = GetLabelFont(); wxFont fontcells = GetDefaultCellFont(); if (event.GetWheelRotation() > 0) { fontlabel.SetPointSize(fontlabel.GetPointSize() - 1); fontcells.SetPointSize(fontcells.GetPointSize() - 1); } else { fontlabel.SetPointSize(fontlabel.GetPointSize() + 1); fontcells.SetPointSize(fontcells.GetPointSize() + 1); } SetLabelFont(fontlabel); SetDefaultCellFont(fontcells); SetColLabelSize(fontlabel.GetPointSize() * 4); SetDefaultRowSize(fontcells.GetPointSize() * 2); for (int index = 0; index < GetNumberCols(); index++) SetColSize(index, -1); ForceRefresh(); } else event.Skip(); }
/* make settings for the grid here instead in the constructor */ void CBOINCGridCtrl::Setup() { //make grid cursor invisible SetCellHighlightPenWidth(0); SetCellHighlightROPenWidth(0); //change default selection colours SetSelectionBackground(*wxLIGHT_GREY); SetSelectionForeground(*wxBLACK); // SetRowLabelSize(1);//hide row labels SetColLabelSize(20); //make header row smaller as default SetColLabelAlignment(wxALIGN_LEFT,wxALIGN_CENTER); EnableGridLines(false); EnableDragRowSize(false);//prevent the user from changing the row height with the mouse EnableDragCell(false); EnableEditing(false);//make the whole grid read-only SetDefaultCellBackgroundColour(*wxWHITE); #ifdef __WXMAC__ SetLabelFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); SetDefaultCellFont(wxFont(12, wxSWISS, wxNORMAL, wxNORMAL, FALSE)); #else SetLabelFont(*wxNORMAL_FONT); #endif this->SetScrollLineX(5); this->SetScrollLineY(5); }
LogMessagesViewer::LogMessagesViewer( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxGrid( parent, id, pos, size, style, name ), _timer( this ) { // grid CreateGrid( 0, 4 ); EnableEditing( false ); EnableGridLines( false ); EnableDragGridSize( false ); SetMargins( 0, 0 ); // columns //EnableDragColMove( false ); EnableDragColSize( true ); SetColLabelSize( 20 ); SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); // rows EnableDragRowSize( true ); SetRowLabelSize( 40 ); SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); // label appearance SetColLabelValue( 0, _T( "description" ) ); SetColLabelValue( 1, _T( "source" ) ); SetColLabelValue( 2, _T( "line" ) ); SetColLabelValue( 3, _T( "clock" ) ); // cell defaults SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); coca::getLogger().addHandler( *this ); _timer.Start( 200 ); }
DSPRegisterView::DSPRegisterView(wxWindow *parent, wxWindowID id) : wxGrid(parent, id, wxDefaultPosition, wxSize(130, 120)) { SetTable(new CDSPRegTable(), true); SetRowLabelSize(0); SetColLabelSize(0); DisableDragRowSize(); AutoSizeColumns(); }
CRegisterView::CRegisterView(wxWindow *parent, wxWindowID id) : wxGrid(parent, id) { SetTable(new CRegTable(), true); SetRowLabelSize(0); SetColLabelSize(0); DisableDragRowSize(); AutoSizeColumns(); }
CWatchView::CWatchView(wxWindow* parent, wxWindowID id) : wxGrid(parent, id) { m_watch_table = new CWatchTable(); SetTable(m_watch_table, true); SetRowLabelSize(0); SetColLabelSize(0); DisableDragRowSize(); Bind(wxEVT_GRID_CELL_RIGHT_CLICK, &CWatchView::OnMouseDownR, this); Bind(wxEVT_MENU, &CWatchView::OnPopupMenu, this); }
MyGrid::MyGrid(wxNotebook * parent) : wxGrid(parent, wxID_ANY) { CreateGrid(30, 30); SetRowLabelSize(50); SetColLabelSize(25); SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); SetLabelFont(wxFont(9, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD)); for (int i = 0; i < 30; i++) { this->SetRowSize(i, 25); } }
CRegisterView::CRegisterView(wxWindow* parent, wxWindowID id) : wxGrid(parent, id) { m_register_table = new CRegTable(); SetTable(m_register_table, true); SetRowLabelSize(0); SetColLabelSize(0); DisableDragRowSize(); Bind(wxEVT_GRID_CELL_RIGHT_CLICK, &CRegisterView::OnMouseDownR, this); Bind(wxEVT_MENU, &CRegisterView::OnPopupMenu, this); AutoSizeColumns(); }
CGridLocus::CGridLocus( COARlocus *pLocusEdit, wxWindow *parent, wxWindowID id, bool bReadOnly) : _CGridEdit(parent,id,bReadOnly), m_pLocusEdited(pLocusEdit) { wxSize sz; size_t nCount = m_pLocusEdited->AlleleCount(); size_t j; int nCol = nCount ? (int) nCount : 1; int nRow = nCount ? nLABELS : 1; int i; int k; CreateGrid(nRow,nCol); if(!nCount) { SetRowLabelValue(0,wxEmptyString); SetColLabelValue(0,wxEmptyString); SetReadOnly(0,0,true); SetReadOnly(0,1,true); SetReadOnly(1,0,true); SetReadOnly(1,1,true); } else { bool bAmel = m_pLocusEdited->IsAmel(); for(i = 0; i < nRow; i++) { s = _T(labels[i]); SetRowLabelValue(i,s); SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); } for(j = 0; j < nCount; j++) { k = (int)j; _ImplementColumn(k,bAmel); } TransferDataToWindow(); nwxGrid::UpdateLabelSizes(this); } DisableDragRowSize(); DisableDragColSize(); SetColLabelSize(GetRowSize(0)); s.Empty(); }
ctlSQLGrid::ctlSQLGrid(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size) : wxGrid(parent, id, pos, size, wxWANTS_CHARS | wxVSCROLL | wxHSCROLL) { // Set cells font wxFont fntCells(settings->GetSQLFont()); SetDefaultCellFont(fntCells); // Set labels font wxFont fntLabel(settings->GetSystemFont()); fntLabel.SetWeight(wxBOLD); SetLabelFont(fntLabel); SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTER); SetRowLabelSize(50); SetDefaultRowSize(fntCells.GetPointSize() * 2); SetColLabelSize(fntLabel.GetPointSize() * 4); SetDefaultCellOverflow(false); Connect(wxID_ANY, wxEVT_GRID_LABEL_LEFT_DCLICK, wxGridEventHandler(ctlSQLGrid::OnLabelDoubleClick)); }
GLIDebugVariableGrid::GLIDebugVariableGrid(wxWindow *parent, wxWindowID id, uint displayFlags, const wxPoint& pos, const wxSize& size, long style, const wxString& name): wxGrid(parent, id, pos, size, style, name), gridFlags(displayFlags), internalCellEditCounter(0) { //Create a drag target SetDropTarget(new GridDnDText(this)); //Create the grid of 3 columns CreateGrid(0, 3, wxGrid::wxGridSelectRows); //Set the label values SetColLabelValue(NAME_COLUMN_INDEX, wxT("Name")); SetColLabelValue(VALUE_COLUMN_INDEX, wxT("Value")); SetColLabelValue(TYPE_COLUMN_INDEX, wxT("Type")); SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_TOP); SetColLabelSize(17); //Set the column sizes SetColSize(NAME_COLUMN_INDEX, 125); SetColSize(VALUE_COLUMN_INDEX, 200); SetColSize(TYPE_COLUMN_INDEX, 115); //Turn off row labels SetRowLabelSize(0); //Turn off cell overflowing SetDefaultCellOverflow(false); //Setup default colours SetDefaultCellBackgroundColour(*wxWHITE); SetDefaultCellTextColour (*wxBLACK); SetGridLineColour (gridGrey); SetLabelBackgroundColour(gridGrey); SetLabelTextColour (*wxBLACK); }
// // -- Special version of wxGrid to allow use of fast comboboxes and grid columns auto fit // wxDDGrid::wxDDGrid(wxWindow *parent, wxWindowID id): wxGrid(parent, id, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_BESTWRAP, wxT("")), m_selTemp(NULL), keepFit(1) { // Initially all columns have s-factor=1 for( unsigned i = 0; i < 10; ++i ) sf[i] = 1; Connect( wxEVT_SIZE, wxSizeEventHandler( wxDDGrid::OnSizeEvt) ); // Adjust the default row height to be more compact wxFont font = GetLabelFont(); int nWidth = 0; int nHeight = 18; GetTextExtent(wxT("W"), &nWidth, &nHeight, NULL, NULL, &font); SetColLabelSize(nHeight + 6); SetRowLabelSize(35); #ifdef __WXGTK__ SetDefaultRowSize(nHeight + 8, TRUE); #else SetDefaultRowSize(nHeight + 4, TRUE); #endif }
CGridColorGrid::CGridColorGrid( wxWindow *parent, wxWindowID id) : wxGrid(parent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE | wxWANTS_CHARS) { wxFont fnStatus = CGridAnalysis::GetFontStatus(); int nRow; size_t i; const size_t N = sizeof(aROWS) / sizeof(aROWS[0]); CreateGrid((int)ROW_COUNT,1); SetRowLabelSize(1); SetColLabelSize(1); DisableDragColSize(); DisableDragRowSize(); nwxGrid::SetAllReadOnly(this,true); fnStatus.SetPointSize(GetDefaultCellFont().GetPointSize()); SetColLabelValue(0,wxEmptyString); const ROW_INFO *pRow = aROWS; for(i = 0; i < N; i++) { nRow = (int) pRow->nRow; SetRowLabelValue(nRow,wxEmptyString); SetCellValue(nRow,0,pRow->psLabel); pRow++; } SetRowLabelValue((int)ROW_ATTN,wxEmptyString); SetCellFont((int) ROW_ATTN,0,fnStatus); SetCellValue((int) ROW_ATTN,0,CGridAnalysis::g_sStatusNeedsAttention); SetCellAlignment(wxALIGN_CENTRE,(int)ROW_ATTN,0); SetRowLabelValue((int)ROW_OK,wxEmptyString); SetCellFont((int) ROW_OK,0,fnStatus); SetCellValue((int) ROW_OK,0,CGridAnalysis::g_sStatusOK); SetCellAlignment(wxALIGN_CENTRE,(int)ROW_OK,0); }
void THDContentGrid::Refresh() { // Update the table to account for current index state. BeginBatch(); // Give wxGrid ownership over the pointer, so it's destroyed at the proper time. table = new THDContentTable(model); ClearColumns(); SetTable(table, true); SetRowLabelSize(0); SetColLabelSize(0); EnableEditing(false); EnableDragRowSize(false); EnableDragColSize(false); if (GetNumberRows() > 0) { // Scroll by entire rows int rowSize = GetRowSize(0); if (rowSize > 0) SetScrollLineY(rowSize); // Size all columns for (int col = 0; col < table->columns.size(); col++) { THDContentColumn &colObj = table->columns[col]; wxClientDC dc(GetParent()); int width = colObj.visualizer->GetWidth(dc); SetColMinimalWidth(col, width); SetColSize(col, width); } } EndBatch(); }
CGridAttrGrid::CGridAttrGrid(wxWindow *parent, wxWindowID id) : wxGrid(parent,id,wxDefaultPosition,wxDefaultSize, wxBORDER_SIMPLE | wxWANTS_CHARS) { CreateGrid((int) ROW_ATTR_COUNT,1); SetRowLabelSize(1); SetColLabelSize(1); DisableDragColSize(); DisableDragRowSize(); nwxGrid::SetAllReadOnly(this,true); SetColLabelValue(0,wxEmptyString); const ROW_INFO *pRow = aROWS_ATTR; const size_t N = sizeof(aROWS_ATTR) / sizeof(aROWS_ATTR[0]); size_t i; int nRow; for(i = 0; i < N; i++) { nRow = (int) pRow->nRow; SetRowLabelValue(nRow,wxEmptyString); SetCellValue(nRow,0,pRow->psLabel); pRow++; } }
CGridAlerts::CGridAlerts( COARmessages *pMsgEdit, wxWindow *parent, wxWindowID id, int nType, bool bReadOnly) : _CGridEdit(parent,id,bReadOnly), m_pMsgEdit(pMsgEdit), m_nChannelColumn(-1), m_nLocusColumn(-1), m_nInCellChangeEvent(0) { int bChannel = !!(nType & TYPE_CHANNEL); int bLocus = !!(nType & TYPE_LOCUS); size_t nCount = m_pMsgEdit->GetMessageCount(); if(nCount) { const wxString sDisable(_T("Enabled")); int nColCount = 2 + bChannel + bLocus; int nCol = nColCount; CreateGrid((int)nCount,nColCount); SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); SetColLabelValue(--nCol,_T("Alert")); SetColLabelValue(--nCol,sDisable); if(bChannel) { SetColLabelValue(--nCol,LABEL_CHANNEL); m_nChannelColumn = nCol; } if(bLocus) { SetColLabelValue(--nCol,LABEL_LOCUS); m_nLocusColumn = nCol; } SetRowLabelSize(2); for(size_t j = 0; j < nCount; j++) { nCol = nColCount; SetCellAlignment((int)j,--nCol,wxALIGN_LEFT,wxALIGN_CENTRE); SetBoolCell((int)j,--nCol); SetCellAlignment((int)j,nCol,wxALIGN_CENTRE,wxALIGN_CENTRE); if(bChannel) { SetCellAlignment((int)j,m_nChannelColumn,wxALIGN_CENTRE,wxALIGN_CENTRE); SetReadOnly((int)j,m_nChannelColumn,true); } if(bLocus) { SetCellAlignment((int)j,m_nLocusColumn,wxALIGN_LEFT,wxALIGN_CENTRE); SetReadOnly((int)j,m_nLocusColumn,true); } SetRowLabelValue((int)j,wxEmptyString); } TransferDataToWindow(); SetColLabelSize(GetRowSize(0)); } else { CreateGrid(1,1); nwxGrid::SetMessageGrid(this,_T("There are no " COAR_NOTICE_DISPLAY)); } AutoSizeColumns(); DisableDragRowSize(); if(bReadOnly) { DisableDragColSize(); } }
bool CGridAnalysis::TransferDataToGrid( COARfile *pFile, COARsampleSort *pSort, int nLabelType, int nLabelTypeName, wxDC *pdc) { int nAMEL = -1; bool bError = false; // set up row/col count size_t nRowCount = pSort->GetCount(); size_t nAlleleColCount = pFile->GetLocusCount(); size_t nColCount = nAlleleColCount + CFrameAnalysis::FIRST_LOCUS_COLUMN + 1; DCholder xxx(this,pdc); m_nLabelSize = 0; m_setColChannelChange.clear(); nwxGridBatch xBatch(this); bError = (!nRowCount) || (!nAlleleColCount) || (!_SetGridSize((int) nRowCount,(int)nColCount)); if(!bError) { // set up column headers wxString sLabel; wxString sLocus; wxString sChannel; SetColLabelValue(CFrameAnalysis::STATUS_COLUMN,_T("")); SetColLabelValue(CFrameAnalysis::ILS_COLUMN,_T("ILS")); SetColLabelValue(CFrameAnalysis::CHANNEL_ALERT_COLUMN,_T("Channels")); int nPrevChannel = 0; int nChannel; int nCol; size_t i; const COARdirectoryAlerts *pDirAlerts = pFile->GetDirectoryAlerts(); // set up column labels for(i = 0, nCol = CFrameAnalysis::FIRST_LOCUS_COLUMN; i < nAlleleColCount; ++i,++nCol) { sLocus = pFile->GetLocusName(i); nChannel = pFile->GetChannelNr(i); sLabel = wxString::Format("%s-%d",sLocus.c_str(),nChannel); if(pDirAlerts->GetBaseLocusAlertsByLocus(sLocus) != NULL) { sLabel.Append(_T(" *")); } if(nChannel != nPrevChannel) { m_setColChannelChange.insert(nCol - 1); nPrevChannel = nChannel; } SetColLabelValue(nCol,sLabel); if(!strncmp(sLabel.MakeUpper().c_str(),"AMEL",4)) { nAMEL = nCol; } } nCol = (int)nColCount - 1; SetColLabelValue(nCol,"+Ctrl"); m_setColChannelChange.insert(nCol - 1); m_setColChannelChange.insert(nCol); UpdateGrid(pFile,pSort,nLabelType,nLabelTypeName); UpdateLabelSize(); SetGridCursor(0,CFrameAnalysis::ILS_COLUMN); SetColLabelSize(GetRowSize(0) + 2); } return !bError; }