本文整理汇总了C++中GetNumberCols函数的典型用法代码示例。如果您正苦于以下问题:C++ GetNumberCols函数的具体用法?C++ GetNumberCols怎么用?C++ GetNumberCols使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetNumberCols函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetClientSize
int wxDDGrid::StretchIt()
{
int new_width = GetClientSize().GetWidth() - GetRowLabelSize() - 10;
int fixedWidth = 0, numStretches = 0, numStretched = 0;
for( int i = 0; i < GetNumberCols(); ++i )
{
if( sf[i] == 0 ) fixedWidth += GetColSize(i);
else if( sf[i] < 0 )
{
AutoSizeColumn(i, false);
fixedWidth += GetColSize(i);
}
else
{
numStretches += sf[i];
numStretched += 1;
}
}
// Now either we have space for normal layout or resort to wxGrid default behaviour
if( numStretched && ((fixedWidth + numStretched * 10) < new_width) )
{
int stretchSpace = (new_width - fixedWidth) / numStretches;
//BeginBatch();
int i, max = GetNumberCols();
for(i = 0; i < max; ++i )
if( sf[i] > 0 )
SetColSize(i, stretchSpace * sf[i]);
//EndBatch();
return 1;
}
return 0;
}
示例2: return
//---------------------------------------------------------
bool CVIEW_Table_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;
}
}
//-----------------------------------------------------
EndBatch();
return( _Set_Records() );
}
示例3: SetMultiSelectMode
void CDDBaseGrid::SelectRow(long row)
{
if (row >= 0 && row < GetNumberRows() && GetNumberCols() > 0)
{
SetMultiSelectMode(TRUE);
GotoRow(row);
SelectRange(0, row, (GetNumberCols() - 1), row);
}
}
示例4: PQntuples
void ctlResultGrid::fillGrid( PGresult * result )
{
int rowCount = PQntuples( result );
int colCount = PQnfields( result );
// If this PGresult represents a non-query command
// (like an INSERT), there won't be any columns in
// the result set - just return
if( colCount == 0 )
return;
// Disable repaints to we don't flicker too much
BeginBatch();
// Clear out the old results (if any) and resize
// grid to match the result set
if( GetNumberRows())
DeleteRows( 0, GetNumberRows());
if( GetNumberCols())
DeleteCols( 0, GetNumberCols());
AppendRows( rowCount );
AppendCols( colCount );
EnableEditing( false );
// Copy the column names from the result set into the column headers
for( int col = 0; col < colCount; ++col )
SetColLabelValue( col, wxString( PQfname( result, col ), wxConvUTF8 ));
// Now copy each value from the result set into the grid
for( int row = 0; row < rowCount; ++row )
{
for( int col = 0; col < colCount; ++col )
{
if( PQgetisnull( result, row, col ))
SetCellValue( row, col, wxT( "" ));
else
SetCellValue( row, col, wxString( PQgetvalue( result, row, col ), wxConvUTF8 ));
}
}
// Resize each column to fit its content
AutoSizeColumns( false );
// Enable repaints
EndBatch();
}
示例5: GetNumberCols
bool CGridLabThresholds::_SetData(
CLabThresholds *pData,
const wxString &sKitName,
const wxChar * const *psLabels)
{
m_pData = pData;
bool bOK = CGridLocusColumns::SetupKit(
this,sKitName,true,m_bILS,true,true);
// set row labels
if(bOK)
{
const wxChar * const *pRowLabel;
int nColCount = GetNumberCols();
int j = 1;
for(pRowLabel = psLabels; (*pRowLabel) != NULL; pRowLabel++)
{
SetRowLabelValue(j++,*pRowLabel);
}
// put junk in row 1 to set cell width
_CreateGrid(m_nRows,nColCount);
for(j = 0; j < nColCount ; j++)
{
SetCellValue(1,j,"0000000000"); // set cell width
}
nwxGrid::UpdateLabelSizes(this);
AutoSize();
}
return bOK;
}
示例6: GetNumberCols
void CLayerTypeGrid::OnDClicked(int col,long row, RECT *rect,POINT *point,BOOL processed)
{
int lastColIndx = GetNumberCols() - 1;
CString cellText(QuickGetText(lastColIndx, row));
int layerType = atoi(cellText);
// Edit color if a layerType row (not a group name row)
// and double click was not in the layer type column.
if (layerType > -1 && col > 0)
{
CUGCell cell;
GetCell(col, row, &cell);
COLORREF color = cell.GetBackColor(); // current color
CPersistantColorDialog dialog(color);
if (dialog.DoModal() == IDOK)
{
color = dialog.GetColor();
cell.SetBackColor(color);
SetCell(col, row, &cell);
RedrawAll();
}
}
}
示例7: GetNumberRows
void CGridAlleleBase::CheckRowCount()
{
wxString s;
int nRows = GetNumberRows();
int nCols = GetNumberCols();
int nStart = nRows - 2;
int nCol;
int nRow;
if(nStart < 0)
{
nStart = 0;
}
for(nRow = nStart; nRow < nRows; nRow++)
{
for(nCol = 0; nCol < nCols; nCol++)
{
s = GetCellValue(nRow,nCol);
nwxString::Trim(&s);
if(s.Len())
{
nwxGrid::SetRowCount(nRows + 4);
nCol = nCols; // loop exit
nRow = nRows;
}
}
}
}
示例8: wxS
bool CGridLabThresholdsSample::SetData(CLabThresholds *pData,
const wxString &sKitName)
{
const wxChar * const psLabels[] =
{
FRACTION_MAX_PEAK,
PULLUP_FRACTIONAL_FILTER,
STUTTER_THRESHOLD,
PLUS_STUTTER_THRESHOLD,
ADENYLATION_THRESHOLD,
wxS("Min. heterozygote balance (0 - 1.0) "),
wxS("Min. homozygote threshold (RFU) "),
NULL
};
bool bOK = _SetData(pData,sKitName,psLabels);
if(bOK)
{
int nCols = GetNumberCols();
int i;
for(i = 0; i < nCols; i++)
{
SetCellEditor(
ROW_MIN_BOUND_HOMOZYGOTE,i,new wxGridCellFloatEditor(-1,0));
}
}
return bOK;
}
示例9: GetClientSize
void ctPropertyEditorGrid::OnSize(wxSizeEvent& event)
{
if (m_stretchableColumn != -1)
{
// This window's client size = the internal window's
// client size if it has no borders
wxSize sz = GetClientSize();
int totalSize = 0;
int i;
for (i = 0; i < GetNumberCols(); i ++)
{
if (i != m_stretchableColumn)
{
totalSize += GetColSize(i);
}
}
// Allow for grid lines
totalSize += 1;
int stretchSize = wxMax(5, sz.x - totalSize);
SetColSize(m_stretchableColumn, stretchSize);
}
event.Skip();
}
示例10: GetCellValue
const std::string wex::grid::get_selected_cells_value() const
{
// This does not work, only filled in for singly selected cells.
// wxGridCellCoordsArray cells = GetSelectedCells();
wxString text;
for (int i = 0; i < GetNumberRows(); i++)
{
bool value_added = false;
for (int j = 0; j < GetNumberCols(); j++)
{
if (IsInSelection(i, j))
{
if (value_added)
{
text << "\t";
}
text << GetCellValue(i, j);
value_added = true;
}
}
if (value_added)
{
text << "\n";
}
}
return text;
}
示例11: SetColSize
void ctlSQLGrid::AutoSizeColumn(int col, bool setAsMin, bool doLimit)
{
ColKeySizeHashMap::iterator it = colSizes.find(GetColKeyValue(col));
if (it != colSizes.end()) // Restore user-specified size
SetColSize(col, it->second);
else
wxGrid::AutoSizeColumn(col, setAsMin);
if (doLimit)
{
int newSize, oldSize;
int maxSize, totalSize = 0, availSize;
oldSize = GetColSize(col);
availSize = GetClientSize().GetWidth() - GetRowLabelSize();
maxSize = availSize / 2;
for (int i = 0 ; i < GetNumberCols() ; i++)
totalSize += GetColSize(i);
if (oldSize > maxSize && totalSize > availSize)
{
totalSize -= oldSize;
/* Shrink wide column to maxSize.
* If the rest of the columns are short, make sure to use all the remaining space,
* but no more than oldSize (which is enough according to AutoSizeColumns())
*/
newSize = wxMin(oldSize, wxMax(maxSize, availSize - totalSize));
SetColSize(col, newSize);
}
}
}
示例12: GetLabelFont
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();
}
示例13: tkz
void wex::grid::set_cells_value(
const wxGridCellCoords& start_coords,
const std::string& data)
{
tokenizer tkz(data, "\n");
auto start_at_row = start_coords.GetRow();
while (tkz.has_more_tokens())
{
const auto line(tkz.get_next_token());
tokenizer tkz(line, "\t");
auto next_col = start_coords.GetCol();
while (tkz.has_more_tokens() && next_col < GetNumberCols())
{
const std::string value = tkz.get_next_token();
if (!IsReadOnly(start_at_row, next_col))
{
set_grid_cell_value(wxGridCellCoords(start_at_row, next_col), value);
}
next_col++;
}
start_at_row++;
}
}
示例14: GetExportLine
wxString ctlSQLGrid::GetExportLine(int row, wxArrayInt cols)
{
wxString str;
unsigned int col;
if (GetNumberCols() == 0)
return str;
for (col = 0 ; col < cols.Count() ; col++)
{
if (col > 0)
str.Append(settings->GetCopyColSeparator());
wxString text = GetCellValue(row, cols[col]);
bool needQuote = false;
if (settings->GetCopyQuoting() == 1)
{
needQuote = IsColText(cols[col]);
}
else if (settings->GetCopyQuoting() == 2)
/* Quote everything */
needQuote = true;
if (needQuote)
str.Append(settings->GetCopyQuoteChar());
str.Append(text);
if (needQuote)
str.Append(settings->GetCopyQuoteChar());
}
return str;
}
示例15: GetNumberCols
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();
}
}