From 422b2f183ae643a8bcdaa1ba76f8f2ff34b42d1b Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 18 Dec 2014 19:46:56 -0500 Subject: [PATCH] Added images and checkboxes to rowHeight(). Split out the text part into textHeight(); we'll be needing it later (when implementing vertical centering). --- wintable/new/coord.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/wintable/new/coord.h b/wintable/new/coord.h index be0dbd7..5810cb9 100644 --- a/wintable/new/coord.h +++ b/wintable/new/coord.h @@ -1,7 +1,7 @@ // 4 december 2014 -// TODO find a better place for this -static LONG rowHeight(struct table *t, HDC dc, BOOL select) +// TODO find a better place for these +static LONG textHeight(struct table *t, HDC dc, BOOL select) { BOOL release; HFONT prevfont, newfont; @@ -26,6 +26,23 @@ static LONG rowHeight(struct table *t, HDC dc, BOOL select) return tm.tmHeight; } +#define tableImageWidth() GetSystemMetrics(SM_CXSMICON) +#define tableImageHeight() GetSystemMetrics(SM_CYSMICON) + +static LONG rowHeight(struct table *t, HDC dc, BOOL select) +{ + LONG height; + LONG tmHeight; + + height = tableImageHeight(); // start with this to avoid two function calls + tmHeight = textHeight(t, dc, select); + if (height < tmHeight) + height = tmHeight; + if (height < t->checkboxHeight) + height = t->checkboxHeight; + return height; +} + #define rowht(t) rowHeight(t, NULL, TRUE) struct rowcol {