1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#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);
}
}
|