/*static*/ bool Win32MenuItemImpl::invokeCallback(int menuItemUID) { for(size_t i = 0; i < itemsWithCallbacks.size(); i++) { Win32MenuItemImpl::NativeMenuItem* item = itemsWithCallbacks[i]; if(item->menuItemID == menuItemUID) { BoundMethod* cb = (BoundMethod*) item->callback; // TODO: Handle exceptions in some way try { ValueList args; cb->Call(args); } catch(...) { std::cout << "Menu callback failed" << std::endl; } return true; } } return false; }
/*static*/ bool Win32TrayItem::InvokeLeftClickCallback(int trayIconID) { for(size_t i = 0; i < trayItems.size(); i++) { Win32TrayItem* item = trayItems[i]; if(item->trayIconData && item->trayIconData->uID == trayIconID) { if(item->callback) { BoundMethod* cb = (BoundMethod*) item->callback; // TODO: Handle exceptions in some way try { ValueList args; cb->Call(args); } catch(...) { std::cout << "Menu callback failed" << std::endl; } return true; } } } return false; }