diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
commit | c0c336500955a23e344651e5412c9d9d441ef4ee (patch) | |
tree | 790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2DlgItemAPTable.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2DlgItemAPTable.cpp | 59 |
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); + } } |