From ed50041589974d31296cb30dc1897f7fba6336c2 Mon Sep 17 00:00:00 2001 From: B Stack Date: Wed, 20 Nov 2019 08:36:44 -0500 Subject: add upstream 10.18 --- wx+/context_menu.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'wx+/context_menu.h') 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 /* -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 -- cgit