aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-03-31 00:24:52 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-03-31 00:24:52 +0200
commit4ec130efd5131f7cf2c48a1625291efdd522e048 (patch)
tree62c1b6c2d8762a448653f95726e7d6d4df1d176a /c
parentf7e97646dd9a20f0e4db266c94c79529d8edf169 (diff)
downloadEpisodeBrowser-4ec130efd5131f7cf2c48a1625291efdd522e048.tar.gz
Set minimum window height.
Diffstat (limited to 'c')
-rw-r--r--c/defs.h1
-rw-r--r--c/listview.c9
-rw-r--r--c/main.c13
3 files changed, 20 insertions, 3 deletions
diff --git a/c/defs.h b/c/defs.h
index fd258f6..afa3927 100644
--- a/c/defs.h
+++ b/c/defs.h
@@ -13,6 +13,7 @@ void UpdateLayout();
/* listview.c */
HWND LvCreate(HMENU);
+int LvHeight(HWND);
void LvSetTheme(HWND, int);
/* episodelistview.c */
diff --git a/c/listview.c b/c/listview.c
index 82c6459..a528e44 100644
--- a/c/listview.c
+++ b/c/listview.c
@@ -69,6 +69,15 @@ LvProc(HWND hLv, UINT uMsg, WPARAM wParam, LPARAM lParam)
return CallWindowProc(LvPrevProc, hLv, uMsg, wParam, lParam);
}
+/* Naively calculate height of list view. */
+int
+LvHeight(HWND hLv)
+{
+ int iCount;
+ iCount = ListView_GetItemCount(hLv);
+ return iCount? 27+iCount*19: 0;
+}
+
/* Enable/disable non-classic list view theme. */
void
LvSetTheme(HWND hLv, int bUseTheme)
diff --git a/c/main.c b/c/main.c
index 1e79634..09227b9 100644
--- a/c/main.c
+++ b/c/main.c
@@ -99,6 +99,13 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_SIZE:
UpdateLayout();
break;
+ case WM_GETMINMAXINFO:
+ {
+ LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
+ extern HWND HDlv;
+ lpMMI->ptMinTrackSize.y = LvHeight(HDlv)+80;
+ break;
+ }
case WM_CREATE:
{
HWnd = hWnd;
@@ -250,7 +257,7 @@ void
UpdateLayout()
{
HWND hElv, hDlv;
- int cxColumn, cyDlv, iCount;
+ int cxColumn, cyDlv;
RECT rc;
static int cxVScroll = 0;
@@ -261,8 +268,7 @@ UpdateLayout()
/* Resize data list view. */
hDlv = GetDlgItem(HWnd, IDC_DATALISTVIEW);
- iCount = ListView_GetItemCount(hDlv);
- cyDlv = rc.bottom - (iCount ? 27+iCount*19 : 0);
+ cyDlv = rc.bottom - LvHeight(hDlv);
MoveWindow(hDlv, 0, cyDlv, rc.right, rc.bottom, TRUE);
cxColumn = ListView_GetColumnWidth(hDlv, 0);
@@ -277,6 +283,7 @@ UpdateLayout()
ListView_SetColumnWidth(hElv, 1, rc.right-cxColumn-cxVScroll-4);
}
+/* Try to style application according to current Windows theme. */
void
UpdateTheme()
{