commit 2743c364f448c58ae59e7df78605e19b2e56f332
parent 05d32f06437f2dddbbc982c80e7cc702e54ece20
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sun, 3 Dec 2017 21:28:48 -0800
listview: don't emit selection change event whenever an item's content is changed on Windows
Diffstat:
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/listview.cpp b/src/listview.cpp
@@ -430,14 +430,14 @@ void ListView::onNotify(LPNMHDR info, LPARAM lParam)
{
switch(info->code) {
case LVN_ITEMCHANGED:
- m_onSelect();
+ onItemChanged(lParam);
break;
case NM_CLICK:
case NM_DBLCLK:
- handleClick(info->code == NM_DBLCLK);
+ onClick(info->code == NM_DBLCLK);
break;
case LVN_COLUMNCLICK:
- handleColumnClick(lParam);
+ onColumnClick(lParam);
break;
};
}
@@ -501,7 +501,17 @@ bool ListView::onContextMenu(HWND dialog, int x, int y)
return true;
}
-void ListView::handleClick(const bool dbclick)
+void ListView::onItemChanged(const LPARAM lParam)
+{
+#ifdef _WIN32
+ const auto info = reinterpret_cast<LPNMLISTVIEW>(lParam);
+
+ if(info->uChanged & LVIF_STATE)
+#endif
+ m_onSelect();
+}
+
+void ListView::onClick(const bool dbclick)
{
bool overIcon;
@@ -513,7 +523,7 @@ void ListView::handleClick(const bool dbclick)
}
}
-void ListView::handleColumnClick(const LPARAM lParam)
+void ListView::onColumnClick(const LPARAM lParam)
{
const auto info = reinterpret_cast<LPNMLISTVIEW>(lParam);
const int col = info->iSubItem;
diff --git a/src/listview.hpp b/src/listview.hpp
@@ -184,8 +184,9 @@ private:
void setExStyle(int style, bool enable = true);
void setSortArrow(bool);
- void handleClick(bool dbclick);
- void handleColumnClick(LPARAM lpnmlistview);
+ void onItemChanged(LPARAM lpnmlistview);
+ void onClick(bool dbclick);
+ void onColumnClick(LPARAM lpnmlistview);
int translate(int userIndex) const;
int translateBack(int internalIndex) const;
void headerMenu(int x, int y);