void CExpressionTreeDlg::OnContextMenu(CWnd *pWnd, CPoint point) { setSelectedNode(getNodeFromPoint(point)); if(m_selectedNode == NULL) return; CMenu menu; if(!menu.LoadMenu(IDR_CONTEXTMENU_TREE)) { showWarning(_T("LoadMenu failed")); return; } if(m_selectedNode->isBreakPoint()) { removeMenuItem(menu, ID_SETBREAKPOINT); } else { removeMenuItem(menu, ID_CLEARBREAKPOINT); } menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, point.x,point.y, this); }
void MainWindow::deviceRemoved(QDBusMessage message) { int index; QString devicePath; #ifdef USEHAL devicePath = message.arguments().at(0).toString(); if (devicePath.startsWith("/org/freedesktop/Hal/devices/storage_serial")) #else QDBusObjectPath path = message.arguments().at(0).value<QDBusObjectPath>(); devicePath = path.path(); if (devicePath.startsWith("/org/freedesktop/UDisks/devices/")) #endif { QLinkedList<DeviceItem *> list = pPlatform->getDeviceList(); QLinkedList<DeviceItem *>::iterator i; for (i = list.begin(); i != list.end(); ++i) { if ((*i)->getUDI() == devicePath) { if (removeMenuItem((*i)->getDisplayString()) != -1) { pPlatform->removeDeviceFromList(devicePath); break; } } } } }
PyObject* py_remove_menu_item(PyObject *, PyObject *args) { long widget, menu, id; if (!PyArg_ParseTuple(args, (char*)"lll:removeMenuItem", &widget, &menu, &id)) return NULL; return Py_BuildValue((char*)"l", removeMenuItem(widget, menu, (QAction*)id)); }
void CShowGrafView::OnRButtonDown(UINT nFlags, CPoint point) { GraphArray &ga = getDoc()->getGraphArray(); if(ga.OnLButtonDown(nFlags, point, m_coordinateSystem.getTransformation())) { CMenu menu; if(!menu.LoadMenu(IDR_MENUSELECTGRAF)) { showWarning(_T("Loadmenu failed")); return; } removeMenuItem(menu, ga.getSelectedItem()->getGraph().isVisible() ? ID_SELECTMENU_SHOW : ID_SELECTMENU_HIDE); ClientToScreen(&point); menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x+10,point.y, theApp.getMainWindow()); } else { __super::OnRButtonDown(nFlags, point); } }