diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:19:14 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:19:14 +0200 |
commit | 01eb8253196672c969a39587e90b49321a182428 (patch) | |
tree | 4a3b71d7913de519744466c9227fda6461c4f0b5 /wx+/context_menu.h | |
parent | 5.0 (diff) | |
download | FreeFileSync-01eb8253196672c969a39587e90b49321a182428.tar.gz FreeFileSync-01eb8253196672c969a39587e90b49321a182428.tar.bz2 FreeFileSync-01eb8253196672c969a39587e90b49321a182428.zip |
5.1
Diffstat (limited to 'wx+/context_menu.h')
-rw-r--r-- | wx+/context_menu.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/wx+/context_menu.h b/wx+/context_menu.h index 894da832..8f80fac2 100644 --- a/wx+/context_menu.h +++ b/wx+/context_menu.h @@ -27,12 +27,12 @@ namespace zen class ContextMenu : private wxEvtHandler { public: - void addItem(const wxString& label, const std::function<void()>& command, const wxBitmap* bmp = NULL, bool enabled = true) + void addItem(const wxString& label, const std::function<void()>& command, const wxBitmap* bmp = nullptr, bool enabled = true) { wxMenuItem* newItem = new wxMenuItem(&menu, wxID_ANY, label); - if (bmp) newItem->SetBitmap(*bmp); - if (!enabled) newItem->Enable(false); - menu.Append(newItem); //do NOT append item before setting bitmap! wxWidgets screws up for yet another crappy reason + 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); //do not enable BEFORE appending item! wxWidgets screws up for yet another crappy reason menu.Connect(newItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(ContextMenu::onSelection), new GenericCommand(command), /*pass ownership*/ this); } |