diff options
| author | Pietro Gagliardi <[email protected]> | 2014-11-17 10:21:43 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-11-17 10:21:43 -0500 |
| commit | d893ba6c03f5d6bcc3ab38971f589ae05d532a9e (patch) | |
| tree | 71f1b524e532dfbb00e52035fc4b1e80e9e07d45 | |
| parent | c8f732c44bb967213abb6d43402d6017c527e2fe (diff) | |
Added redrawRow() to the Windows Table and changed WM_SETFOCUS/WM_KILLFOCUS handling to use it. It will be used for selections later.
| -rw-r--r-- | wintable/main.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/wintable/main.c b/wintable/main.c index 503a755..826fe30 100644 --- a/wintable/main.c +++ b/wintable/main.c @@ -159,6 +159,24 @@ static intptr_t lastVisible(struct table *t, RECT cliprect, LONG rowHeight) return last; } +static void redrawRow(struct table *t, intptr_t row) +{ + RECT r; + intptr_t height; + + r = realClientRect(t); + height = rowHeight(t); + if (row < t->firstVisible || row > lastVisible(t, r, height)) // not visible; don't bother + return; + r.top = (row - t->firstVisible) * height + t->headerHeight; + r.bottom = r.top + height; + // keep the width and height the same; it spans the client area anyway + if (InvalidateRect(t->hwnd, &r, TRUE) == 0) + abort(); + if (UpdateWindow(t->hwnd) == 0) + abort(); +} + static intptr_t hitTestColumn(struct table *t, int x) { HDITEMW item; @@ -744,9 +762,8 @@ if (ImageList_GetIconSize(t->imagelist, &unused, &(t->imagelistHeight)) == 0)abo case WM_SETFOCUS: case WM_KILLFOCUS: // all we need to do here is redraw the highlight - // TODO localize to just the selected item // TODO ensure giving focus works right - redrawAll(t); + redrawRow(t, t->selected); return 0; case WM_KEYDOWN: keySelect(t, wParam, lParam); |
