ITSMenu* PlayListPane::GetMenu(UINT idx) { switch (idx) { case BTN_Options: { PrgAPI* pAPI = PRGAPI(); MediaPlayer* pPlayer = pAPI->GetMediaPlayer(); MenuManager* pMM = pAPI->GetMenuManager(); MenuCommandsEnum cmd = (MenuCommandsEnum) idx; ITSMenu& mnu = GetInternalMenu(M_Main); pMM->PreparePlayerCommands(*pPlayer); mnu.CheckMenuItem(MI_ShowNumbers, m_PlayList.GetConfigurationOption(CPlayListListCtrl::C_ShowNumbers) != 0); return &mnu; } break; case BTN_QuickSearch: { PrgAPI* pAPI = PRGAPI(); QuickSearchDlg* pQSDlg = pAPI->GetQuickSearchDlg(); pQSDlg->SetSearchText(_T("")); pQSDlg->ShowRelative(AfxGetMainWnd(), QuickSearchDlg::RP_Centered); return NULL; } break; default: return NULL; } return NULL; }
void CTeenSpiritDlg::ShowTrayMenu(CPoint& pt) { PrgAPI* pAPI = PRGAPI(); MenuManager* pMM = pAPI->GetMenuManager(); ITSMenu& trayMenu = pMM->GetMenu(MenuManager::MNU_Tray); pMM->PrepareMenu(MenuManager::MNU_Tray); pMM->PreparePlayerCommands(*pAPI->GetMediaPlayer()); //=== This handling is done because otherwise the menu will not disappear when the user clicks outside SetForegroundWindow(); trayMenu.TrackPopupMenu(pt.x, pt.y, GetSafeHwnd()); PostMessage(WM_NULL, 0, 0); }