From dfb118a820d89ff61c0077c5b8d13fc2836ea503 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 17 Sep 2012 09:14:40 +0000 Subject: [PATCH] CtrlLib: MenuBar::Execute now allows only single level of local menus git-svn-id: svn://ultimatepp.org/upp/trunk@5365 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/MenuBar.cpp | 6 +++++- uppsrc/CtrlLib/src.tpp/MenuBar$en-us.tpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/uppsrc/CtrlLib/MenuBar.cpp b/uppsrc/CtrlLib/MenuBar.cpp index 32e569d9b..eb9fb0027 100644 --- a/uppsrc/CtrlLib/MenuBar.cpp +++ b/uppsrc/CtrlLib/MenuBar.cpp @@ -556,10 +556,14 @@ void MenuBar::PopUp(Ctrl *owner, Point p, Size rsz) void MenuBar::Execute(Ctrl *owner, Point p) { - if(IsEmpty()) return; + static int level; // Used to prevent another local menu to be opened (repeated right-click) + if(IsEmpty() || level > 0) + return; + ++level; PopUp(owner, p); EventLoop(this); CloseMenu(); + --level; } void MenuBar::Execute(Ctrl *owner, Callback1 proc, Point p) diff --git a/uppsrc/CtrlLib/src.tpp/MenuBar$en-us.tpp b/uppsrc/CtrlLib/src.tpp/MenuBar$en-us.tpp index 7f82349b9..c02364484 100644 --- a/uppsrc/CtrlLib/src.tpp/MenuBar$en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/MenuBar$en-us.tpp @@ -146,4 +146,4 @@ to [%-*@3 sz].&] onst]&] [s2; Returns the maximum icons size.&] [s3;%- &] -[s0; ] \ No newline at end of file +[s0; ]] \ No newline at end of file