本文整理汇总了C++中CGridCellBase::SetCoords方法的典型用法代码示例。如果您正苦于以下问题:C++ CGridCellBase::SetCoords方法的具体用法?C++ CGridCellBase::SetCoords怎么用?C++ CGridCellBase::SetCoords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGridCellBase
的用法示例。
在下文中一共展示了CGridCellBase::SetCoords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteTreeBranch
/*****************************************************************************
This may delete one or more rows depending on the makeup of the tree branch.
It's analagous to deleting a file directory with all files and sub-directories
deleted, too.
*****************************************************************************/
int CTreeColumn::DeleteTreeBranch( int aiRow, // Row that the tree branch begins on
BOOL abRedraw) // T=redraw; F=don't
// returns: nbr of rows deleted
{
ASSERT( aiRow >= -1);
ASSERT( m_pGrid != NULL); // Must call TreeSetup(), first
if( aiRow < m_iFixedRowCount
|| aiRow >= m_iRowCount)
return 0;
int iRowDeleteCount = 0;
m_bAllowDraw = FALSE; // prevents crash during reset
// get level of initial row to delete from tree
CGridTreeCell* pGridTreeCell = (CGridTreeCell*)m_pGrid->GetCell( aiRow, m_iColumnWithTree);
unsigned char ucLevelCurrent = CHAR_MAX;
if( pGridTreeCell != NULL)
{
// delete just the parent
ucLevelCurrent = pGridTreeCell->GetLevel();
if( m_pGrid->DeleteRow( aiRow) )
{
iRowDeleteCount++;
m_iRowCount--;
}
}
// see if any children need to be deleted, too
unsigned char ucLevel;
while( aiRow < m_iRowCount)
{
pGridTreeCell = (CGridTreeCell*)m_pGrid->GetCell( aiRow, m_iColumnWithTree);
if( pGridTreeCell == NULL)
break;
ucLevel = pGridTreeCell->GetLevel();
if( ucLevel <= ucLevelCurrent)
break;
if( !m_pGrid->DeleteRow( aiRow) )
break;
iRowDeleteCount++;
m_iRowCount--;
}
ASSERT( m_iRowCount == m_pGrid->GetRowCount() );
// have to re-number all cells below deletion point
if( iRowDeleteCount > 0)
{
int iRow;
int iColumnCount = m_pGrid->GetColumnCount();
for( iRow=aiRow; iRow < m_iRowCount; iRow++)
{
int iCol;
for (iCol = 0; iCol < iColumnCount; iCol++)
{
CGridCellBase* pGridCellBase = m_pGrid->GetCell( iRow, iCol);
if( pGridCellBase != NULL)
{
pGridCellBase->SetCoords( iRow, iCol);
}
}
}
}
m_bAllowDraw = TRUE;
TreeRefreshRows();
if( abRedraw)
m_pGrid->Invalidate();
return iRowDeleteCount;
}
示例2: TreeSetup
//.........这里部分代码省略.........
{
ASSERT( apucTreeLevelAry != NULL);
ASSERT( aiNbrElements >= 0);
ASSERT( aiRow >= -1);
ASSERT( m_pGrid != NULL); // Must call TreeSetup(), first
ASSERT( m_iFixedRowCount >= 0);
ASSERT( m_pRuntimeClassTreeCell != NULL);
if( aiNbrElements <= 0)
return -1;
// if user specified 0 or -1, adjust
int iRowForAppend = 0;
if( m_iRowCount <= m_iFixedRowCount)
aiRow = -1; // if no non-fixed rows, then gotta append
if( aiRow <= -1)
{
iRowForAppend = -1;
aiRow = m_iRowCount;
}
else if( aiRow < m_iFixedRowCount)
aiRow = m_iFixedRowCount;
m_bAllowDraw = FALSE; // prevents crash during reset
// retain old cell properties: establishes size for
// tree drawing box based on current font
CGridTreeCell GridCellCopy;
GridCellCopy.SetTreeColumn( this);
CGridCellBase* pCurrCell = m_pGrid->GetCell( m_iRowCount-1, m_iColumnWithTree);
if (pCurrCell)
GridCellCopy = *pCurrCell;
// insert rows while replacing tree column cells to tree cell type
int iCellRow = aiRow;
int i1;
for( i1=0; i1 < aiNbrElements; i1++)
{
// CGridCtrl's InsertRow() requires a -1 to append values to
// the end of the grid
if( iRowForAppend != -1)
iRowForAppend = iCellRow;
if( m_pGrid->InsertRow( "", iRowForAppend) < 0)
{
aiRow = -1; // error
break;
}
if( !m_pGrid->SetCellType( iCellRow,
m_iColumnWithTree,
m_pRuntimeClassTreeCell ) )
{
aiRow = -1; // error
break;
}
CGridTreeCell* pGridTreeCell = (CGridTreeCell*)m_pGrid->GetCell( iCellRow, m_iColumnWithTree);
if( pGridTreeCell != NULL)
{
pGridTreeCell->SetTreeColumn( this);
pGridTreeCell->SetLevelAndHide( *apucTreeLevelAry );
pGridTreeCell->SetViewable( TRUE);
}
iCellRow++;
m_iRowCount++;
apucTreeLevelAry++;
}
ASSERT( m_iRowCount == m_pGrid->GetRowCount() );
// have to re-number all cells below insertion point
if( aiRow > 0)
{
int iRow;
int iColumnCount = m_pGrid->GetColumnCount();
for( iRow=iCellRow; iRow < m_iRowCount; iRow++)
{
int iCol;
for (iCol = 0; iCol < iColumnCount; iCol++)
{
CGridCellBase* pGridCellBase = m_pGrid->GetCell( iRow, iCol);
if( pGridCellBase != NULL)
{
pGridCellBase->SetCoords( iRow, iCol);
}
}
}
}
m_bAllowDraw = TRUE;
TreeRefreshRows();
if( abRedraw)
m_pGrid->Invalidate();
return aiRow;
}