#include "StdAfx.h" #include "T2DlgItemAPTable.h" T2DlgItemAPTable::T2DlgItemAPTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItemImageTable(inDoc, inImageObj, inPalette) { mClickPoint = CPoint(-1, -1); mClickedCell.row = 0; mClickedCell.col = 0; } T2DlgItemAPTable::T2DlgItemAPTable(int inRows, int inCols, int inRowHeight, int inColWidth, int inCellDataSize, T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItemImageTable(inRows, inCols, inRowHeight, inColWidth, inCellDataSize, inDoc, inImageObj, inPalette) { } /*virtual*/ void T2DlgItemAPTable::DrawCell(CDC* pDC, const TableCellT& inCell) { if (EqualCell(inCell, mSelectedCell)) DrawCellSelf(pDC, inCell, true); else DrawCellSelf(pDC, inCell, false); } /*virtual*/ void T2DlgItemAPTable::DrawCellSelf(CDC* pDC, const TableCellT& inCell, BOOL selected) { CRect rect; if (FetchLocalCellFrame(inCell, rect)) { int save = pDC->SaveDC(); CBrush brush; brush.CreateSolidBrush(PALETTEINDEX(0)); CPen pen; pen.CreatePen(PS_SOLID, 0, PALETTEINDEX(255)); pDC->SelectObject(&brush); pDC->SelectObject(&pen); pDC->SetBkMode(TRANSPARENT); pDC->Rectangle(rect); char *theString = new char[128]; GetCellData(inCell, theString); pDC->DrawText(theString, rect, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX); delete[] theString; pDC->RestoreDC(save); } } /*virtual*/ void T2DlgItemAPTable::HiliteCell(CDC* pDC, const TableCellT& inCell) { T2DlgItemImageTable::HiliteCell(pDC, inCell); } /*virtual*/ void T2DlgItemAPTable::UnhiliteCell(CDC* pDC, const TableCellT& inCell) { T2DlgItemImageTable::UnhiliteCell(pDC, inCell); } /*virtual*/ void T2DlgItemAPTable::ClickCell(const TableCellT& inCell, const POINT& inPt) { CRect rect; if (FetchLocalCellFrame(inCell, rect)) { mClickPoint = inPt; mClickedCell = inCell; Notify(GetDlgCtrlID(), 0, (void *) &inPt); } }