summaryrefslogtreecommitdiff
path: root/wx+/context_menu.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-11-20 08:36:44 -0500
committerB Stack <bgstack15@gmail.com>2019-11-20 08:36:44 -0500
commited50041589974d31296cb30dc1897f7fba6336c2 (patch)
treee2c5c7b1f98e64011b1ee8ca4e9bb9157510dfe7 /wx+/context_menu.h
parentMerge branch '10.17' into 'master' (diff)
downloadFreeFileSync-ed50041589974d31296cb30dc1897f7fba6336c2.tar.gz
FreeFileSync-ed50041589974d31296cb30dc1897f7fba6336c2.tar.bz2
FreeFileSync-ed50041589974d31296cb30dc1897f7fba6336c2.zip
add upstream 10.18
Diffstat (limited to 'wx+/context_menu.h')
-rw-r--r--wx+/context_menu.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/wx+/context_menu.h b/wx+/context_menu.h
index d856db03..08a313bf 100644
--- a/wx+/context_menu.h
+++ b/wx+/context_menu.h
@@ -14,7 +14,7 @@
#include <wx/app.h>
/*
-A context menu supporting C++11 lambda callbacks!
+A context menu supporting lambda callbacks!
Usage:
ContextMenu menu;
@@ -56,7 +56,7 @@ public:
void addSeparator() { menu_->AppendSeparator(); }
- void addSubmenu(const wxString& label, ContextMenu& submenu, const wxBitmap* bmp = nullptr) //invalidates submenu!
+ void addSubmenu(const wxString& label, ContextMenu& submenu, const wxBitmap* bmp = nullptr, bool enabled = true) //invalidates submenu!
{
//transfer submenu commands:
commandList_.insert(submenu.commandList_.begin(), submenu.commandList_.end());
@@ -67,6 +67,7 @@ public:
wxMenuItem* newItem = new wxMenuItem(menu_.get(), wxID_ANY, label, L"", wxITEM_NORMAL, submenu.menu_.release()); //menu owns item, item owns submenu!
if (bmp) newItem->SetBitmap(*bmp); //do not set AFTER appending item! wxWidgets screws up for yet another crappy reason
menu_->Append(newItem);
+ if (!enabled) newItem->Enable(false);
}
void popup(wxWindow& wnd, const wxPoint& pos = wxDefaultPosition) //show popup menu + process lambdas
bgstack15