CtrlCore: Cocoa Fixed menu hotkeys

git-svn-id: svn://ultimatepp.org/upp/trunk@12618 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-12-14 08:49:25 +00:00
parent d5c61a393a
commit 866f4da2c7
3 changed files with 20 additions and 4 deletions

View file

@ -12,8 +12,10 @@ protected:
static void SyncMainMenu(bool force);
void *menubar = NULL;
Event<Bar&> MainMenu;
public:
void SetMainMenu(Event<Bar&> menu);
virtual bool HotKey(dword key);
//$ };
void SetMainMenu(Event<Bar&> menu);
//$ };

View file

@ -2,7 +2,7 @@
namespace Upp {
#define LLOG(x) // DLOG(x)
#define LLOG(x) // DLOG(x)
Ptr<Ctrl> Ctrl::focusCtrl;
Ptr<Ctrl> Ctrl::focusCtrlWnd;

View file

@ -3,7 +3,7 @@
#ifdef PLATFORM_COCOA
#define LLOG(x) DLOG(x)
#define LLOG(x) // DLOG(x)
namespace Upp {
@ -195,6 +195,11 @@ bool CocoMenuBar::IsEmpty() const
}
}
- (void)menuDidClose:(NSMenu *)menu {
CocoMenu *m = (CocoMenu *)menu;
[m removeAllItems];
}
-(void)submenuAction:(id)sender {
if(ptr)
proc(*ptr);
@ -218,6 +223,15 @@ void TopWindow::SetMainMenu(Event<Bar&> menu)
CocoMenuBar& bar = *(CocoMenuBar *)menubar;
bar.Set(menu);
SyncMainMenu(true);
MainMenu = menu;
}
bool TopWindow::HotKey(dword key)
{
LLOG("TopWindow::HotKey " << GetKeyDesc(key));
if(Bar::Scan(MainMenu, key))
return true;
return Ctrl::HotKey(key);
}
TopWindow *TopWindow::GetMenuTopWindow()