bool MPopupMenu::OnCommand(MWidget* pWindow, const char* szMessage) { if(GetType()==MPMT_VERTICAL) Show(false); else Select((MMenuItem*)NULL); MListener* pListener = GetListener(); if(pListener!=NULL) pListener->OnCommand(this, szMessage); return true; }
bool MMsgBox::OnCommand(MWidget* pWindow, const char* szMessage) { MListener* pListener = GetListener(); if(pListener==NULL) return false; if(pWindow==m_pOK && strcmp(szMessage, MBTN_CLK_MSG)==0){ if(m_nType==MT_YESNO) pListener->OnCommand(this, MMSGBOX_YES); else pListener->OnCommand(this, MMSGBOX_OK); return true; } else if(pWindow==m_pCancel && strcmp(szMessage, MBTN_CLK_MSG)==0){ if(m_nType==MT_YESNO) pListener->OnCommand(this, MMSGBOX_NO); else pListener->OnCommand(this, MMSGBOX_CANCEL); return true; } return false; }