void CGridAnalysis::UpdateLabelSize() { if(m_nLabelSize) { SetRowLabelSize(m_nLabelSize + 6); } }
/* 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); }
ctlVarWindow::ctlVarWindow( wxWindow *parent, wxWindowID id ) : wxGrid( parent, id ), m_cells( NULL ), m_nameFont( GetDefaultCellFont()) { wxWindowBase::SetFont(settings->GetSystemFont()); // Create the grid control CreateGrid( 0, 0 ); SetRowLabelSize( 0 ); // Turn off the row labels // Set up three columns: name, value, and data type AppendCols( 3 ); SetColLabelValue( COL_NAME, _( "Name" )); SetColLabelValue( COL_TYPE, _( "Type" )); SetColLabelValue( COL_VALUE, _( "Value" )); EnableDragGridSize( true ); // EDB wants to hide certain PL variables. To do that, we // keep a hash of hidden names and a hash of hidden types... m_hiddenNames.insert( wxT( "found" )); m_hiddenNames.insert( wxT( "rowcount" )); m_hiddenNames.insert( wxT( "sqlcode" )); m_hiddenNames.insert( wxT( "sqlerrm" )); m_hiddenNames.insert( wxT( "_found" )); m_hiddenNames.insert( wxT( "_rowcount" )); m_hiddenNames.insert( wxT( "sqlstate" )); m_hiddenTypes.insert( wxT( "refcursor" )); }
void CGridAlleleBase::_FitString(const wxString &s, int nStartColumn) { int nCols = GetNumberCols(); int nRows = GetNumberRows(); int nCol; int nRow; if(nStartColumn < 0) { nStartColumn = (int)m_vsLeftColumns.size(); } if(nRows > 1 && nCols > 0) { for(nCol = nStartColumn; nCol < nCols; nCol++) { SetCellValue(1,nCol,s); } for(nRow = 0; nRow < nRows; nRow++) { SetRowLabelValue(nRow,wxEmptyString); } UpdateLabelSizes(); SetRowLabelSize(2); AutoSize(); } }
CModifierSeqListView::CModifierSeqListView(wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxGrid(parent, id, pos, size, style) { SetRowLabelSize(0); }
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 ); }
void DataGrid::showAllData() { updateData(); SetRowLabelSize(wxGRID_AUTOSIZE); AutoSizeRows(false); AutoSizeColumns(false); }
CListView::CListView(wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxGrid(parent, id, pos, size, style), m_selTemp(NULL) //m_attr(*wxBLUE, *wxLIGHT_GREY, wxNullFont) { SetRowLabelSize(0); }
//------------------------------------------------------------------------------ // custom grid implementation //------------------------------------------------------------------------------ CustomGrid::CustomGrid( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) : wxGrid( parent, id, pos, size, style, name ) { //create grid SetTable( new wxGridStringTable(0, 0), true, wxGridSelectRows ); //some general settings EnableEditing( false ); EnableGridLines( true ); EnableDragGridSize( false ); SetMargins( 0, 0 ); EnableDragColMove( false ); EnableDragColSize( false ); EnableDragRowSize( false ); //init rows pref wxFileConfig *pConf = GetOCPNConfigObject(); if (pConf) { pConf->SetPath(_T("/Settings/GRIB")); m_IsDigit = pConf->Read(_T("GribDataTableRowPref"), _T("XXX")); } if( m_IsDigit.Len() != wxString(_T("XXX")).Len() ) m_IsDigit = _T("XXX"); //create structure for all numerical rows for( unsigned int i = 0; i < m_IsDigit.Len(); i++ ){ m_NumRow.push_back(wxNOT_FOUND); m_NumRowVal.push_back(std::vector <double>()); } //init labels attr wxFont labelfont = GetOCPNGUIScaledFont_PlugIn( _T("Dialog") ).MakeBold(); SetLabelFont(labelfont); wxColour colour; GetGlobalColor(_T("DILG0"), &colour); SetLabelBackgroundColour(colour); //set row label size int w; GetTextExtent( _T("Ab"), &w, NULL, 0, 0, &labelfont); double x = (double)w * 6.5; SetRowLabelSize((int)x); //colour settings GetGlobalColor(_T("GREEN1"), &m_greenColour); GetGlobalColor(_T("DILG1"), &m_greyColour); #ifdef __WXOSX__ m_bLeftDown = false; #endif //connect events at dialog level Connect(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollEventHandler( CustomGrid::OnScroll ), NULL, this ); Connect(wxEVT_SIZE, wxSizeEventHandler( CustomGrid::OnResize ), NULL, this ); Connect(wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( CustomGrid::OnLabeClick ), NULL, this ); //connect events at grid level GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler( CustomGrid::OnMouseEvent ), NULL, this ); GetGridWindow()->Connect(wxEVT_LEFT_UP, wxMouseEventHandler( CustomGrid::OnMouseEvent ), NULL, this ); GetGridWindow()->Connect(wxEVT_MOTION, wxMouseEventHandler( CustomGrid::OnMouseEvent ), NULL, this ); //timer event m_tRefreshTimer.Connect(wxEVT_TIMER, wxTimerEventHandler( CustomGrid::OnRefreshTimer ), NULL, this); }
CRegisterView::CRegisterView(wxWindow *parent, wxWindowID id) : wxGrid(parent, id) { SetTable(new CRegTable(), true); SetRowLabelSize(0); SetColLabelSize(0); DisableDragRowSize(); AutoSizeColumns(); }
DSPRegisterView::DSPRegisterView(wxWindow *parent, wxWindowID id) : wxGrid(parent, id, wxDefaultPosition, wxSize(130, 120)) { SetTable(new CDSPRegTable(), 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(); }
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++; } }
//--------------------------------------------------------- bool CActive_Attributes_Control::Update_Table(void) { if( GetBatchCount() > 0 ) { return( false ); } BeginBatch(); //----------------------------------------------------- int Difference = (m_pTable->Get_Field_Count() - m_Field_Offset) - GetNumberCols(); if( Difference > 0 ) { AppendCols(Difference); } else if( (Difference = -Difference < GetNumberCols() ? -Difference : GetNumberCols()) > 0 ) { // here is (or was!?) a memory leak - solution: use own wxGridTableBase derived grid table class DeleteCols(0, Difference); } //----------------------------------------------------- for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++) { SetColLabelValue(iCol, m_pTable->Get_Field_Name(iField)); switch( m_pTable->Get_Field_Type(iField) ) { default: case SG_DATATYPE_Byte: case SG_DATATYPE_Char: case SG_DATATYPE_String: case SG_DATATYPE_Date: case SG_DATATYPE_Binary: SetColFormatCustom(iCol, wxGRID_VALUE_STRING); break; case SG_DATATYPE_Bit: case SG_DATATYPE_Word: case SG_DATATYPE_Short: case SG_DATATYPE_DWord: case SG_DATATYPE_Int: case SG_DATATYPE_ULong: case SG_DATATYPE_Long: case SG_DATATYPE_Color: SetColFormatNumber(iCol); break; case SG_DATATYPE_Float: case SG_DATATYPE_Double: SetColFormatFloat(iCol); break; } } //----------------------------------------------------- if( (Difference = m_pTable->Get_Count() - GetNumberRows()) > 0 ) { AppendRows(Difference); } else if( Difference < 0 && (Difference = -Difference < GetNumberRows() ? -Difference : GetNumberRows()) > 0 ) { DeleteRows(0, Difference); } //------------------------------------------------- for(int iRecord=0; iRecord<m_pTable->Get_Count(); iRecord++) { _Set_Record(iRecord); } //----------------------------------------------------- if( GetNumberCols() > 0 && GetNumberRows() > 0 ) { SetRowLabelSize(wxGRID_AUTOSIZE); if( m_Field_Offset ) // feature attributes { if( GetClientSize().x > GetRowLabelSize() ) { SetColSize(0, GetClientSize().x - GetRowLabelSize()); } } else // grid cell values { AutoSizeColumns(); } } Enable(GetNumberRows() > 0); m_pTable->Set_Modified(false); //----------------------------------------------------- EndBatch(); return( true ); }
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(); } }