本文整理汇总了C++中CGridCellBase类的典型用法代码示例。如果您正苦于以下问题:C++ CGridCellBase类的具体用法?C++ CGridCellBase怎么用?C++ CGridCellBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGridCellBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetGridBkColor
//清除上次选中行
void QuoteTableCtrlGeneralSort::RefreshWnd()
{
COLORREF color = GetGridBkColor();
CRect rectCell, rectRow;
CCellID cell = GetCellFromPt(m_LastDownPoint);
CGridCellBase* pCell = GetCell(cell.row, cell.col);
BOOL bInTextArea = FALSE;
if (pCell)
{
if (GetCellRect(cell.row, cell.col, rectCell) &&
pCell->GetTextRect(rectCell))
{
bInTextArea = rectCell.PtInRect(m_LastDownPoint);
}
}
if ( bInTextArea )
{
for (int i=0; i<GetColumnCount(); i++)
{
pCell = GetCell(cell.row, i);
/* pCell->GetBackClr();*/
if (pCell)
{
pCell->SetState(/*pCell->GetState() | */m_iColProp->GetColumnMask(GetHeadID(i)));
pCell->SetBackClr(color);
}
}
}
Invalidate();
}
示例2: SaveParse
void GMassMobAppearGrid::SaveParse(GStageLevel* pStage)
{
CGridCellBase* cell = NULL;
GtLongNumberString num;
for( gint i = 1 ; i < GetRowCount() ; i++ )
{
GStageLevel::MassAppearMob mob;
cell = GetCell( i, 0 );
num.SetNumber( (gtchar*)cell->GetText() );
mob.mIndex = (guint32)num.GetNumber( 0 );
cell = GetCell( i, 1 );
num.SetNumber( (gtchar*)cell->GetText() );
mob.mLevel = (guint32)num.GetNumber( 0 );
cell = GetCell( i, 2 );
num.SetNumber( (gtchar*)cell->GetText() );
mob.mNumLine = (guint32)num.GetNumber( 0 );
cell = GetCell( i, 3 );
num.SetNumber( (gtchar*)cell->GetText() );
mob.mNumMobCount = (guint32)num.GetNumber( 0 );
pStage->AddMassAppearMob( mob );
}
}
示例3: OnSelectionChanged
void CResiduePane::OnSelectionChanged(NMHDR* pNMHDR, LRESULT* pResult)
{;
NM_GRIDVIEW * pnmgv = (NM_GRIDVIEW *)pNMHDR;
if (pnmgv!=NULL && m_residueGridCtrl !=NULL && m_residueGridCtrl->GetSelectedCount() > 0 )
{
if ( pnmgv->iRow >= 0 && pnmgv->iColumn >= 0 )
{
CGridCellBase* grid = m_residueGridCtrl->GetCell(pnmgv->iRow,pnmgv->iColumn);
if(grid==NULL)
return;
m_pProteinVistaRenderer->m_pLastPickObjectInst = (CProteinObjectInst*)grid->GetData();
}else
{
CCellRange range = m_residueGridCtrl->GetSelectedCellRange();
int row = range.GetMinRow();
int col = range.GetMinCol();
if ( row >= 0 && col >= 0 )
{
m_pProteinVistaRenderer->m_pLastPickObjectInst = (CProteinObjectInst*)m_residueGridCtrl->GetCell(row,col)->GetData();
//m_pProteinVistaRenderer->m_pLastPickObjectInst->
}
}
m_bSelectionChanged = TRUE;
}
}
示例4: OnNotify
/******************************************************************************
@author humkyung
@date 2012-07-10
@class CBusToBusView
@function OnNotify
@return BOOL
@param WPARAM wParam
@param LPARAM lParam
@param LRESULT* pResult
@brief
******************************************************************************/
BOOL CBusToBusView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if(wParam == m_wndGridCtrl.GetDlgCtrlID())
{
NM_GRIDVIEW* pGridView = (NM_GRIDVIEW*)(lParam);
if((GVN_ENDLABELEDIT == pGridView->hdr.code) && (1 == pGridView->iColumn))
{
CGridCellBase* pCell = m_wndGridCtrl.GetCell(pGridView->iRow, pGridView->iColumn);
CString sFromBus = pCell->GetText();
CGridCellBusCombo* pBusCombo = (CGridCellBusCombo*)m_wndGridCtrl.GetCell(pGridView->iRow, pGridView->iColumn + 1);
CString sToBus = pBusCombo->GetText();
if(sFromBus == sToBus)
{
AfxMessageBox(_T("From and To Bus are same") , MB_OK | MB_ICONWARNING);
m_wndGridCtrl.SetSelectedRange(pGridView->iRow , pGridView->iColumn,pGridView->iRow , pGridView->iColumn);
m_wndGridCtrl.SetFocusCell(pGridView->iRow , pGridView->iColumn);
return TRUE;
}
pBusCombo->m_sFromBus = sFromBus;
GetDocument()->SetModifiedFlag(TRUE);
}
return TRUE;
}
return CView::OnNotify(wParam, lParam, pResult);
}
示例5: DrawTitle
void QuoteTableCtrlGeneralSort::DrawTitle()
{
CGridCellBase* pCell;
for (int col =0; col<GetColumnCount(); col++)
{
pCell = GetCell(0, col);
pCell->SetText("");
}
}
示例6: GetCell
void CYTGridCtrl::SetSelectClr(COLORREF clr)
{
for (int row = 0; row < GetRowCount(); row++)
{
for(int col =0; col < GetColumnCount(); col++)
{
CGridCellBase* pCell = GetCell(row, col);
pCell->SetSelectColor(clr);
}
}
}
示例7: InsertInstrument
void CInstrumentGridCtrl::InsertInstrument(int rowIndex, const Instrument& instrument){
int columnIndex = 0;
GV_ITEM item;
item.mask = GVIF_TEXT;
item.row = rowIndex;
item.col = columnIndex;
item.strText = DataConverter::ConvertIntToString(rowIndex).c_str();
this->SetItem(&item);
columnIndex++;
item.col = columnIndex;
item.strText = instrument.GetInstrumentType().c_str();
this->SetItem(&item);
this->SetItemState(rowIndex, columnIndex, GVIS_READONLY);
columnIndex++;
item.col = columnIndex;
item.strText = instrument.GetInstrumentName().c_str();
this->SetItem(&item);
this->SetItemState(rowIndex, columnIndex, GVIS_READONLY);
columnIndex++;
item.col = columnIndex;
item.strText = instrument.GetInstrumentCode().c_str();
this->SetItem(&item);
this->SetItemState(rowIndex, columnIndex, GVIS_READONLY);
columnIndex++;
item.col = columnIndex;
item.strText = DataConverter::ConvertIntToString(instrument.GetContract().GetFeedingSourceID()).c_str();
this->SetItem(&item);
this->SetItemState(rowIndex, columnIndex, GVIS_READONLY);
columnIndex++;
item.col = columnIndex;
item.strText = DataConverter::ConvertIntToString(instrument.GetLimitOrderBook().GetFeedingSourceID()).c_str();
this->SetItem(&item);
this->SetItemState(rowIndex, columnIndex, GVIS_READONLY);
columnIndex++;
for(int i=0; i<this->columnCount; i++){
CGridCellBase* cellBase = this->GetCell(rowIndex, i);
LOGFONT* tempLogFont = cellBase->GetFont();
tempLogFont->lfHeight= this->fontSize;
cellBase->SetFont(tempLogFont);
}
}
示例8: GetCell
/**
@brief
@author
*/
int CGridCtrlEx::MultiCompare(const int& lhs, const int& rhs)
{
int nIndex = 0;
for(vector<int>::iterator itr = m_MultiSortCellNoEntry.begin();itr != m_MultiSortCellNoEntry.end();++itr,++nIndex)
{
if(-1 == (*itr)) continue;
CGridCellBase* pLhsCell = GetCell(lhs , *itr);
CGridCellBase* pRhsCell = GetCell(rhs , *itr);
int res = _tcscmp(pLhsCell->GetText() , pRhsCell->GetText());
if(0 != res)
{
return (0 == m_MultiSortDirEntry[nIndex]) ? res : -res;
}
}
return 0;
}
示例9: _T
void CInstrumentGridCtrl::InitHeader(){
const tchar* columnTitles[] = {_T("Type"), _T("Name"), _T("Code"), _T("Contract"), _T("LimitOrderBook")};
const COLORREF GREY = RGB(160, 160, 160);
int colCount = this->GetColumnCount();
for (int i = 0; i < colCount; i++){
GV_ITEM item;
item.mask = GVIF_TEXT;
item.row = 0;
item.col = i;
item.crBkClr = GREY;
item.strText = columnTitles[i];
BOOL temp = this->SetItem(&item);
CGridCellBase* cellBase = this->GetCell(0, i);
LOGFONT* tempLogFont = cellBase->GetFont();
tempLogFont->lfHeight= this->fontSize;;
cellBase->SetFont(tempLogFont);
}
}
示例10: SetFocus
void QuoteTableCtrlGeneralSort::OnLButtonDown(UINT nFlags, CPoint point)
{
/*CHSGridCtrl::OnLButtonDown(nFlags, point);*/
SetFocus();
RefreshWnd();
RefreashOtherWnd(g_LastSelectWnd);
g_LastSelectWnd = m_pTableFlag->nIndex;
CRect rectCell, rectRow;
CCellID cell = GetCellFromPt(point);
if (cell.row == 0) return;
CGridCellBase* pCell = GetCell(cell.row, cell.col);
BOOL bInTextArea = FALSE;
if (pCell)
{
if (GetCellRect(cell.row, cell.col, rectCell) &&
pCell->GetTextRect(rectCell))
{
bInTextArea = rectCell.PtInRect(point);
}
}
COLORREF selectbk = RGB(100,100,100);
if ( bInTextArea )
{
for (int i=0; i<GetColumnCount(); i++)
{
pCell = GetCell(cell.row, i);
if (pCell)
{
pCell->SetState(pCell->GetState() | m_iColProp->GetColumnMask(GetHeadID(i))| GVIS_SELECTED);
pCell->SetSelectColor(selectbk);
}
}
}
Invalidate();
m_LastDownPoint = point;
}
示例11: GetDocument
void CDBSchemaTableView::OnBtnMergeClicked()
{
int iSelectedRowCount = 0;
int iSelectedRows[2];
for(int i = GRIDHEADERROWCOUNT; i < GridTab.GetRowCount(); ++i)
{
CGridCellBase* pCell = GridTab.GetCell(i, 0);
if(CEditStyleBool::GetInstance().strTrue == pCell->GetText())
{
iSelectedRows[iSelectedRowCount++] = i - GRIDHEADERROWCOUNT;
if(iSelectedRowCount >= 2) break;
}
}
if(iSelectedRowCount == 2)
{
GetDocument()->MergeTable(iSelectedRows[0], iSelectedRows[1]);
}
iSelectedRowCount = 0;
for(int i = GRIDHEADERROWCOUNT; i < GridCol.GetRowCount(); ++i)
{
CGridCellBase* pCell = GridCol.GetCell(i, 0);
TTRACE(pCell->GetText());
if(CEditStyleBool::GetInstance().strTrue == pCell->GetText())
{
iSelectedRows[iSelectedRowCount++] = i - GRIDHEADERROWCOUNT;
if(iSelectedRowCount >= 2) break;
}
}
if(iSelectedRowCount == 2)
{
GetDocument()->MergeColumn(GridTabViewer.GetCurRecord(0), iSelectedRows[0], iSelectedRows[1]);
}
}
示例12: SetGrid
void CGridCellBase::operator=(CGridCellBase& cell)
{
if (this == &cell) return;
SetGrid(cell.GetGrid()); // do first in case of dependencies
SetText(cell.GetText());
SetImage(cell.GetImage());
SetData(cell.GetData());
SetState(cell.GetState());
SetFormat(cell.GetFormat());
SetTextClr(cell.GetTextClr());
SetBackClr(cell.GetBackClr());
SetFont(cell.IsDefaultFont()? NULL : cell.GetFont());
SetMargin(cell.GetMargin());
//Used for merge cells
//by Huang Wei
SetMergeCellID(cell.GetMergeCellID());
SetMergeRange(cell.GetMergeRange());
Show(cell.IsShow());
}
示例13: SetGridCtrlText
void CResiduePane::SetGridCtrlText()
{
CSTLArrayPDBRenderer & arrayPDBRenderer = m_pProteinVistaRenderer->m_arrayPDBRenderer;
if ( arrayPDBRenderer.size() == 0 )
return;
long vertIndex = 0;
for ( int iPDB = 0; iPDB < arrayPDBRenderer.size() ; iPDB++ )
{
CPDBInst * pPDBInst = arrayPDBRenderer[iPDB]->GetPDBInst();
for ( int iModel = 0 ; iModel < pPDBInst->m_arrayModelInst.size() ; iModel ++ )
{
CModelInst * pModelInst = pPDBInst->m_arrayModelInst[iModel];
long nChain = pModelInst->m_arrayChainInst.size();
for ( int iChain = 0 ; iChain < nChain ; iChain ++ )
{
CChainInst * pChainInst = pPDBInst->GetChainInst(iModel ,iChain);
CGridCellBase * pCell = m_residueGridCtrl->GetCell(vertIndex, 0 );
if ( pCell != NULL )
{
if ( pPDBInst->m_arrayModelInst.size() == 1 )
{
pCell->SetText(pChainInst->GetChain()->m_strPDBID);
}
else
{
CString strChain;
strChain.Format("[%d]%s", iModel, pChainInst->GetChain()->m_strPDBID);
pCell->SetText(strChain);
}
pCell->SetData((LPARAM)(pChainInst));
}
for ( int j = 0 ; j < pChainInst->m_arrayResidueInst.size() ; j++ )
{
CGridCellBase * pCell = m_residueGridCtrl->GetCell(vertIndex, j+1);
if ( pCell != NULL )
{
BOOL selectColor = 30;
long ss = pChainInst->m_arrayResidueInst[j]->GetResidue()->GetSS();
if ( ss == SS_NONE )
pCell->SetBackClr(RGB(min(180+selectColor,255), min(180+selectColor,255) , min(180+selectColor,255) ));
else if ( ss == SS_HELIX )
pCell->SetBackClr(RGB(min(180+selectColor,255), min(selectColor,255), min(selectColor,255) ));
else if ( ss == SS_SHEET )
pCell->SetBackClr(RGB(min(selectColor,255) ,min (180+selectColor, 255) ,min(selectColor,255) ));
CString strText;
CResidueInst * pResidueInst = pChainInst->m_arrayResidueInst[j];
if ( m_displayStyle == 0 )
strText.Format("%s" , pResidueInst->GetResidue()->m_residueNameOneChar);
if ( m_displayStyle == 1 )
strText.Format("%d %s" , pResidueInst->GetResidue()->GetResidueNum(), pResidueInst->GetResidue()->m_residueNameOneChar );
if ( m_displayStyle == 2 )
strText.Format("%d(%d) %s" , pResidueInst->GetResidue()->GetResidueNum(), j, pResidueInst->GetResidue()->m_residueNameOneChar );
if ( m_displayStyle == 3 )
strText.Format("%s" , pResidueInst->GetResidue()->GetResidueName() );
if ( m_displayStyle == 4 )
strText.Format("%d %s" , pResidueInst->GetResidue()->GetResidueNum(), pResidueInst->GetResidue()->GetResidueName() );
if ( m_displayStyle == 5 )
strText.Format("%d(%d) %s" , pResidueInst->GetResidue()->GetResidueNum(), j, pResidueInst->GetResidue()->GetResidueName() );
pCell->SetText(strText);
pCell->SetData((LPARAM)(pResidueInst));
}
}
vertIndex ++;
}
}
}
}
示例14: SetGrid
void CGridCellBase::operator=(const CGridCellBase& cell)
{
if (this == &cell) return;
SetGrid(cell.GetGrid()); // do first in case of dependencies
SetText(cell.GetText());
SetImage(cell.GetImage());
SetData(cell.GetData());
SetState(cell.GetState());
SetFormat(cell.GetFormat());
SetTextClr(cell.GetTextClr());
SetBackClr(cell.GetBackClr());
SetFont(cell.IsDefaultFont()? NULL : cell.GetFont());
SetMargin(cell.GetMargin());
}
示例15: ASSERT
/*****************************************************************************
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;
}