void CpermoDlg::OnRButtonDown(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 CPoint p; //传递过来的坐标为相对于窗口左上角的坐标,WM_CONTEXTMENU传递过来的是屏幕坐标 GetCursorPos(&p);//鼠标点的屏幕坐标 m_Menu.CheckMenuItem(SelectedInterface + START_INDEX, MF_BYCOMMAND | MF_CHECKED); int nID = m_Menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RETURNCMD, p.x, p.y, this); switch (nID) { case IDM_TOPMOST: OnTopmost(); break; case IDM_GREEN: OnGreen(); break; case IDM_BLUE: OnBlue(); break; case IDM_BLACK: OnBlack(); break; case IDM_RED: OnRed(); break; case IDM_ORANGE: OnOrange(); break; case IDM_EXIT: OnExit(); break; case IDM_AUTOHIDE: OnAutoHide(); break; case IDM_SHOWBYHOVER: SetShowWay(); break; case IDM_SHOWBYLDOWN: SetShowWay(); break; case IDM_TRANS0: OnTrans0(); break; case IDM_TRANS10: OnTrans10(); break; case IDM_TRANS20: OnTrans20(); break; case IDM_TRANS30: OnTrans30(); break; case IDM_TRANS40: OnTrans40(); break; case IDM_TRANS50: OnTrans50(); break; case IDM_TRANS60: OnTrans60(); break; case IDM_TRANS70: OnTrans70(); break; case IDM_TRANS80: OnTrans80(); break; case IDM_TRANS90: OnTrans90(); break; case IDM_FONTSIZE12: SetFontSize(12); break; case IDM_FONTSIZE13: SetFontSize(13); break; case IDM_FONTSIZE14: SetFontSize(14); break; case IDM_FONTSIZE15: SetFontSize(15); break; case IDM_FONTSIZE16: SetFontSize(16); break; case IDM_FONTSIZE17: SetFontSize(17); break; case IDM_FONTSIZE18: SetFontSize(18); break; case IDM_AUTOSTART: SetAutoRun(); break; case IDM_SHOWNETINFO: ShowNetInfo(); break; case 0: return; default: {m_Menu.CheckMenuItem(SelectedInterface + START_INDEX, MF_BYCOMMAND | MF_UNCHECKED); SelectedInterface = nID - START_INDEX; } break; } CDialog::OnRButtonDown(nFlags, point); }
eOSState cMenuSearchResults::ProcessKey(eKeys Key) { bool HadSubMenu = HasSubMenu(); eOSState state = cOsdMenu::ProcessKey(Key); if (!HasSubMenu() && HadSubMenu) // navigation in summary could have changed current item, so update it UpdateCurrent(); if (state == osUnknown) { switch (Key) { case k0: if(!HasSubMenu()) { toggleKeys = 1 - toggleKeys; SetHelpKeys(true); } state = osContinue; break; case kGreen: state = OnGreen(); break; case kYellow: state = OnYellow(); break; case kOk: case kInfo: if(HasSubMenu()) { state = cOsdMenu::ProcessKey(Key); break; } if (Count()) state = ShowSummary(); else state = osBack; break; default: break; } } if (!HasSubMenu()) { if ((HadSubMenu || gl_TimerProgged) && Update()) { if (gl_TimerProgged) // when using epgsearch's timer edit menu, update is delayed because of SVDRP { gl_TimerProgged = 0; SetHelpKeys(); } Display(); } if (Key != kNone) SetHelpKeys(); if (gl_InfoConflict) { gl_InfoConflict = 0; if (Interface->Confirm(tr("Timer conflict! Show?"))) state = AddSubMenu(new cMenuConflictCheck()); } } return state; }