summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemAPTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/T2DlgItemAPTable.cpp')
-rw-r--r--src/T2DLL/T2DlgItemAPTable.cpp59
1 files changed, 46 insertions, 13 deletions
diff --git a/src/T2DLL/T2DlgItemAPTable.cpp b/src/T2DLL/T2DlgItemAPTable.cpp
index 7e042f2..11282ff 100644
--- a/src/T2DLL/T2DlgItemAPTable.cpp
+++ b/src/T2DLL/T2DlgItemAPTable.cpp
@@ -1,31 +1,64 @@
#include "T2DlgItemAPTable.h"
-TableCellT T2DlgItemAPTable::GetClickedCell() {
+T2DlgItemAPTable::T2DlgItemAPTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette)
+ : T2DlgItemImageTable(inDoc, inImageObj, inPalette)
+{
+ mClickPoint = CPoint(-1, -1);
+ mClickedCell.row = 0;
+ mClickedCell.col = 0;
}
-CPoint T2DlgItemAPTable::GetClickPoint() {
+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*/ T2DlgItemAPTable::~T2DlgItemAPTable() {
+/*virtual*/ void T2DlgItemAPTable::DrawCell(CDC* pDC, const TableCellT& inCell) {
+ if (EqualCell(inCell, mSelectedCell))
+ DrawCellSelf(pDC, inCell, true);
+ else
+ DrawCellSelf(pDC, inCell, false);
}
-T2DlgItemAPTable::T2DlgItemAPTable(T2TowerDoc*, T2ImageObj*, CPalette*) {
-}
+/*virtual*/ void T2DlgItemAPTable::DrawCellSelf(CDC* pDC, const TableCellT& inCell, BOOL selected) {
+ CRect rect;
+ if (FetchLocalCellFrame(inCell, rect)) {
+ int save = pDC->SaveDC();
-T2DlgItemAPTable::T2DlgItemAPTable(int, int, int, int, int, T2TowerDoc*, T2ImageObj*, CPalette*) {
-}
+ CBrush brush;
+ brush.CreateSolidBrush(PALETTEINDEX(0));
-/*virtual*/ void T2DlgItemAPTable::DrawCell(CDC*, const TableCellT&) {
-}
+ CPen pen;
+ pen.CreatePen(PS_SOLID, 0, PALETTEINDEX(255));
+
+ pDC->SelectObject(&brush);
+ pDC->SelectObject(&pen);
+ pDC->SetBkMode(TRANSPARENT);
+
+ pDC->Rectangle(rect);
+
+ char *text = new char[128];
+ GetCellData(inCell, text);
+ pDC->DrawText(text, rect, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
+ delete[] text;
-/*virtual*/ void T2DlgItemAPTable::DrawCellSelf(CDC*, const TableCellT&, int) {
+ pDC->RestoreDC(save);
+ }
}
-/*virtual*/ void T2DlgItemAPTable::HiliteCell(CDC*, const TableCellT&) {
+/*virtual*/ void T2DlgItemAPTable::HiliteCell(CDC* pDC, const TableCellT& inCell) {
+ T2DlgItemImageTable::HiliteCell(pDC, inCell);
}
-/*virtual*/ void T2DlgItemAPTable::UnhiliteCell(CDC*, const TableCellT&) {
+/*virtual*/ void T2DlgItemAPTable::UnhiliteCell(CDC* pDC, const TableCellT& inCell) {
+ T2DlgItemImageTable::UnhiliteCell(pDC, inCell);
}
-/*virtual*/ void T2DlgItemAPTable::ClickCell(const TableCellT&, const POINT&) {
+/*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);
+ }
}