summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-11-20 18:25:14 -0500
committerPietro Gagliardi <[email protected]>2014-11-20 18:25:14 -0500
commit3d87f8c5ceddc7de2490ae6695b0d2751a8792c0 (patch)
tree34bad73e4cd462159c7bec17b99ac00041afa162
parent2ddafc82307ae7646ef949e86d2bdc96ca045424 (diff)
Implemented mouse hot-tracking for checkboxes. Clicking and dragging is still an issue, but :S
-rw-r--r--wintable/main.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/wintable/main.c b/wintable/main.c
index fe2491e..1c6dad0 100644
--- a/wintable/main.c
+++ b/wintable/main.c
@@ -324,14 +324,10 @@ static void track(struct table *t, LPARAM lParam)
BOOL prev;
intptr_t prevrow, prevcolumn;
- // TODO limit all this to if a checkbox is being hovered over
- lParamToRowColumn(t, lParam, &row, &column);
prev = t->lastmouse;
prevrow = t->lastmouseRow;
prevcolumn = t->lastmouseColumn;
- t->lastmouse = TRUE;
- t->lastmouseRow = row;
- t->lastmouseColumn = column;
+ t->lastmouse = lParamInCheckbox(t, lParam, &(t->lastmouseRow), &(t->lastmouseColumn));
if (prev)
if (prevrow != row || prevcolumn != column)
redrawRow(t, prevrow);
@@ -746,11 +742,9 @@ static void drawItem(struct table *t, HDC dc, intptr_t i, LONG y, LONG height, R
if (i == t->mouseDownRow && j == t->mouseDownColumn)
c = RGB(0, 0, 255);
} else if (t->lastmouse) {
-/*TODO pt.x = t->lastmouseX - t->hpos; // because t->lastmouseX is in client coordinates
- pt.y = t->lastmouseY; // ...but so are the vertical coordinates of rsel
- if (PtInRect(&rsel, pt) != 0)
+ if (i == t->lastmouseRow && j == t->lastmouseColumn)
c = RGB(0, 255, 0);
-*/ }
+ }
if (SetDCBrushColor(dc, c) == CLR_INVALID)
abort();
}