commit 4f0e656e88abcd464fecda151f141418e951f3b2
parent 3e4c0f44234fd37f44e950bc34570980c8c22efe
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sat, 30 Nov 2019 09:50:34 -0500
listview: add a "Visible columns:" label at the top of the header context menu
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/listview.cpp b/src/listview.cpp
@@ -584,23 +584,24 @@ void ListView::headerMenu(const int x, const int y)
enum { ACTION_RESTORE = 800 };
Menu menu;
+ menu.disable(menu.addAction("Visible columns:", 0));
for(int i = 0; i < columnCount(); i++) {
const auto id = menu.addAction(m_cols[i].label.c_str(), i | (1 << 8));
- if(columnWidth(id))
+ if(columnWidth(i))
menu.check(id);
}
menu.addSeparator();
menu.addAction("Reset columns", ACTION_RESTORE);
- const int id = menu.show(x, y, handle());
+ const int cmd = menu.show(x, y, handle());
- if(id == ACTION_RESTORE)
+ if(cmd == ACTION_RESTORE)
resetColumns();
- else if(id >> 8 == 1) {
- const int col = id & 0xff;
+ else if(cmd >> 8 == 1) {
+ const int col = cmd & 0xff;
resizeColumn(col, columnWidth(col) ? 0 : m_cols[col].width);
}
}