Example #1
0
void CGridCellBase::operator=(const CGridCellBase& cell)
{
    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());
}
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);
	}
}
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);
	}
}
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());
}