commit 3945abbd662f24d777a492a8b24c7e4a8addf085
parent d0a496189101d3e1d057a81a98c63b5c933d8541
Author: cfillion <cfillion@users.noreply.github.com>
Date: Tue, 24 Oct 2017 03:36:12 -0700
listview: refactor setExStyle and its usage
Diffstat:
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/listview.cpp b/src/listview.cpp
@@ -36,16 +36,18 @@ ListView::ListView(HWND handle, const Columns &columns)
for(const Column &col : columns)
addColumn(col);
- setExStyle(LVS_EX_FULLROWSELECT, true);
+ int style = LVS_EX_FULLROWSELECT;
#ifdef LVS_EX_LABELTIP
- // unsupported by SWELL, but always enabled on OS X anyway
- setExStyle(LVS_EX_LABELTIP, true);
+ // unsupported by SWELL, but always enabled on macOS anyway
+ style |= LVS_EX_LABELTIP;
#endif
#ifdef LVS_EX_DOUBLEBUFFER
- setExStyle(LVS_EX_DOUBLEBUFFER, true);
+ style |= LVS_EX_DOUBLEBUFFER;
#endif
+
+ setExStyle(style);
}
void ListView::setExStyle(const int style, const bool enable)
@@ -571,7 +573,7 @@ void ListView::resetColumns()
void ListView::restoreState(Serializer::Data &data)
{
m_customizable = true;
- setExStyle(LVS_EX_HEADERDRAGDROP, true); // enable column reordering
+ setExStyle(LVS_EX_HEADERDRAGDROP); // enable column reordering
if(data.empty())
return;
diff --git a/src/listview.hpp b/src/listview.hpp
@@ -179,7 +179,7 @@ private:
bool onContextMenu(HWND, int, int) override;
static int adjustWidth(int);
- void setExStyle(int style, bool enable);
+ void setExStyle(int style, bool enable = true);
void setSortArrow(bool);
void handleDoubleClick();
void handleColumnClick(LPARAM lpnmlistview);