aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-03 19:11:15 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-03 19:11:15 +0200
commit5fb8df682831045c4619b65403c4a24d7583d2e9 (patch)
treed84973aa41a6e7f5230a9510c467321e0dd88433
parentdf88618efb32274e7b21493c48483d4761d2f9a3 (diff)
downloadEpisodeBrowser-5fb8df682831045c4619b65403c4a24d7583d2e9.tar.gz
Remove m_bHeader from ListView.
If it is relevant to add height for a header for a given list view, it is better to override Height and do it there.
-rw-r--r--c/datalistview.cpp4
-rw-r--r--c/datalistview.h2
-rw-r--r--c/listview.cpp15
-rw-r--r--c/listview.h3
4 files changed, 9 insertions, 15 deletions
diff --git a/c/datalistview.cpp b/c/datalistview.cpp
index cdc6dfb..e6cc6ca 100644
--- a/c/datalistview.cpp
+++ b/c/datalistview.cpp
@@ -30,9 +30,9 @@ DataListView::DataListView(const HWND hWndParent)
ListView_InsertColumn(hWnd, DLVSIVALUE, &lvc);
}
-int DataListView::Height(int bHeader)
+int DataListView::Height()
{
- return m_height? m_height: ListView::Height(bHeader);
+ return m_height? m_height: ListView::Height();
}
void DataListView::ResizeColumns(int w)
diff --git a/c/datalistview.h b/c/datalistview.h
index c094d0e..5a4c7ca 100644
--- a/c/datalistview.h
+++ b/c/datalistview.h
@@ -9,7 +9,7 @@
struct DataListView : public ListView
{
DataListView(HWND hWndParent);
- int Height(int bHeader = -1) override;
+ int Height() override;
void ResizeColumns(int w) override;
void SetHeight(int h);
void ShowEpisode(int iEpisode);
diff --git a/c/listview.cpp b/c/listview.cpp
index c2f5593..e5d22b2 100644
--- a/c/listview.cpp
+++ b/c/listview.cpp
@@ -11,19 +11,16 @@ static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
ListView::ListView(const HWND hWndParent, const HMENU hMenu, const DWORD dwStyle)
{
m_hWndParent = hWndParent;
- m_bHeader = !(dwStyle & LVS_NOCOLUMNHEADER);
hWnd = require(CreateWindowEx(
WS_EX_CLIENTEDGE,
WC_LISTVIEW,
L"",
dwStyle|WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS,
0, 0, 0, 0,
- m_hWndParent, hMenu, GetModuleHandle(NULL), this));
-
- if (require(SetProp(hWnd, L"this", (HANDLE)this)))
- m_proc0 = (WNDPROC)SetWindowLongPtr(hWnd,
- GWLP_WNDPROC, (LONG_PTR)::WndProc);
+ hWndParent, hMenu, GetModuleHandle(NULL), this));
+ m_proc0 = (WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)::WndProc);
+ require(SetProp(hWnd, L"this", (HANDLE)this));
ListView_SetExtendedListViewStyle(hWnd, LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER);
SendMessage(hWnd, WM_SETFONT, (WPARAM)g_hfNormal, MAKELPARAM(FALSE, 0));
}
@@ -37,12 +34,10 @@ bool ListView::FindNextItem(LVITEM* const lvi, const LPARAM lParam)
}
/* Naively calculate height of list view. */
-int ListView::Height(int bHeader)
+int ListView::Height()
{
- if (bHeader == -1)
- bHeader = m_bHeader;
const int cItem = ListView_GetItemCount(hWnd);
- return cItem? Dpi(bHeader? 27: 4)+cItem*Dpi(19): 0;
+ return Dpi(4)+cItem*Dpi(19);
}
void ListView::ResizeColumns(int) {}
diff --git a/c/listview.h b/c/listview.h
index c812cd8..1de6cc1 100644
--- a/c/listview.h
+++ b/c/listview.h
@@ -10,12 +10,11 @@ struct ListView
ListView(HWND hWndParent, HMENU hMenu, DWORD dwStyle);
bool FindNextItem(LVITEM* lvi, LPARAM lParam);
- virtual int Height(int bHeader = -1);
+ virtual int Height();
virtual void ResizeColumns(int w);
virtual void UpdateTheme(BOOL bThemeActive);
virtual LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
protected:
- int m_bHeader = 1;
WNDPROC m_proc0;
HWND m_hWndParent;
};