More checkbox mouse movement code.
This commit is contained in:
parent
2cf1168830
commit
cc165b48ff
|
@ -133,31 +133,44 @@ static void loadCheckboxThemeData(struct table *t)
|
||||||
panic("error releasing Table DC for loading checkbox theme data");
|
panic("error releasing Table DC for loading checkbox theme data");
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLER(checkboxMouseMoveHandler)
|
static void redrawCheckboxRect(struct table *t, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct rowcol rc;
|
struct rowcol rc;
|
||||||
RECT r;
|
RECT r;
|
||||||
|
POINT pt;
|
||||||
|
|
||||||
|
rc = lParamToRowColumn(t, lParam);
|
||||||
|
if (rc.row == -1 && rc.column == -1)
|
||||||
|
return;
|
||||||
|
if (t->columnTypes[rc.column] != tableColumnCheckbox)
|
||||||
|
return;
|
||||||
|
if (!rowColumnToClientRect(t, rc, &r))
|
||||||
|
return;
|
||||||
|
// TODO only the checkbox rect?
|
||||||
|
if (InvalidateRect(t->hwnd, &r, TRUE) == 0)
|
||||||
|
panic("error redrawing Table checkbox rect for mouse events");
|
||||||
|
}
|
||||||
|
|
||||||
|
HANDLER(checkboxMouseMoveHandler)
|
||||||
|
{
|
||||||
|
// don't actually check to see if the mouse is in the checkbox rect
|
||||||
|
// if there's scrolling without mouse movement, that will change
|
||||||
|
// instead, drawCell() will handle it
|
||||||
if (!t->checkboxMouseOverLast) {
|
if (!t->checkboxMouseOverLast) {
|
||||||
t->checkboxMouseOverLast = TRUE;
|
t->checkboxMouseOverLast = TRUE;
|
||||||
retrack(t);
|
retrack(t);
|
||||||
}
|
} else
|
||||||
// TODO redraw old cell
|
redrawCheckboxRect(t, t->checkboxMouseOverLastPoint);
|
||||||
// TODO we could probably optimize these by only checking the checkbox rects
|
|
||||||
t->checkboxMouseOverLastPoint = lParam;
|
t->checkboxMouseOverLastPoint = lParam;
|
||||||
rc = lParamToRowColumn(t, t->checkboxMouseOverLastPoint);
|
redrawCheckboxRect(t, t->checkboxMouseOverLastPoint);
|
||||||
if (rc.row != -1 && rc.column != -1)
|
|
||||||
if (t->columnTypes[rc.column] == tableColumnCheckbox)
|
|
||||||
if (rowColumnToClientRect(t, rc, &r))
|
|
||||||
if (InvalidateRect(t->hwnd, &r, TRUE) == 0)
|
|
||||||
panic("error queueing Table checkbox for redraw after mouse over");
|
|
||||||
*lResult = 0;
|
*lResult = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLER(checkboxMouseLeaveHandler)
|
HANDLER(checkboxMouseLeaveHandler)
|
||||||
{
|
{
|
||||||
// TODO redraw old cell
|
if (t->checkboxMouseOverLast)
|
||||||
|
redrawCheckboxRect(t, t->checkboxMouseOverLastPoint);
|
||||||
// TODO remember what I wanted to do here in the case of a held mouse button
|
// TODO remember what I wanted to do here in the case of a held mouse button
|
||||||
t->checkboxMouseOverLast = FALSE;
|
t->checkboxMouseOverLast = FALSE;
|
||||||
*lResult = 0;
|
*lResult = 0;
|
||||||
|
|
Loading…
Reference in New Issue