Beispiel #1
0
void SpecialFolderItem::Invoke(int button)
{
	const struct _ITEMIDLIST * pidl = check_pidl();

	if ((INVOKE_DBL|INVOKE_LEFT) == button)
	{
		m_pMenu->hide_on_click();
		if (pidl) exec_folder_click(pidl);
		return;
	}

	if (INVOKE_RIGHT & button)
	{
		ShowContextMenu(NULL, pidl);
		return;
	}

	if (INVOKE_DRAG & button)
	{
		m_pMenu->start_drag(NULL, pidl);
		return;
	}

	if (INVOKE_LEFT & button)
	{
		if (m_pSubMenu && (MENU_ID_SF != m_pSubMenu->m_MenuID))
			m_pMenu->HideChild(); // hide contextmenu
	}

	FolderItem::Invoke(button);
}
Beispiel #2
0
item_equipBag::item_equipBag(CPlayer *w_player)
	:player(w_player)
{
	ui.btn_sale->setVisible(true);
	ui.btn_sort->setVisible(true);
	ui.tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);

	m_item = player->get_bag_equip();
	m_storageItem = player->get_storage_equip();

	CurrentPage = 1;
	ui.edit_page_all->setText(QString::number(4));

	popMenu = new QMenu();
	action_use = new QAction(QStringLiteral("装备"), this);
	action_storage = new QAction(QStringLiteral("入库"), this);
	action_sale = new QAction(QStringLiteral("销售"), this);
	popMenu->addAction(action_use);
	popMenu->addAction(action_storage);
	popMenu->addAction(action_sale);

	connect(ui.btn_sale, SIGNAL(clicked()), this, SLOT(on_btn_sale_clicked()));
	connect(ui.btn_sort, SIGNAL(clicked()), this, SLOT(on_btn_sort_clicked()));
	connect(ui.btn_pgUp, SIGNAL(clicked()), this, SLOT(on_btn_pgUp_clicked()));
	connect(ui.btn_pgDn, SIGNAL(clicked()), this, SLOT(on_btn_pgDn_clicked()));
	connect(ui.tableWidget, SIGNAL(cellEntered(int, int)), this, SLOT(ShowItemInfo(int, int)));
	connect(ui.tableWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(ShowContextMenu(QPoint)));

	connect(action_use, SIGNAL(triggered(bool)), this, SLOT(on_action_use(bool)));
	connect(action_storage, SIGNAL(triggered(bool)), this, SLOT(on_action_storage(bool)));
	connect(action_sale, SIGNAL(triggered(bool)), this, SLOT(on_action_sale(bool)));
}
Beispiel #3
0
LRESULT TaskButton::HandleMessage(HWND window, UINT msg, WPARAM wParam, LPARAM lParam, NPARAM) {
  switch (msg) {
  case WM_MOUSEMOVE:
    ActivateState(State::Hover);
    return 0;

  case WM_MOUSELEAVE:
    ClearState(State::Hover);
    return 0;

  case WM_TIMER:
    if (wParam == mFlashInterval) {
      mPane->ToggleState(State::Flashing);
    }
    return 0;

  case WM_LBUTTONUP:
    SelectTask();
    return 0;

  case WM_RBUTTONUP:
    ShowContextMenu();
    return 0;

  case WM_MBUTTONUP:
    OpenTaskProcess();
    return 0;
  }
  return mEventHandler->HandleMessage(window, msg, wParam, lParam, this);
};
Beispiel #4
0
void CEditFrameView::OnContextMenu(CWnd* /*pWnd*/, CPoint point) 
{
	if (!ShowContextMenu (point))
	{
		Default ();
	}
}
Beispiel #5
0
void CFileExplore::OnRclickFileList(NMHDR* pNMHDR, LRESULT* pResult) 
{
	CPoint	point;
	GetCursorPos(&point);
	
	HTREEITEM hItem =	m_DirTree.GetSelectedItem();
	POSITION pos = m_FileList.GetFirstSelectedItemPosition();
	if(hItem!=NULL&&pos!=NULL)
	{
		CString	strDirPath;
		while(hItem!=m_hRoot)
		{
			strDirPath = _T("\\") + m_DirTree.GetItemText(hItem)+strDirPath;
			hItem =  m_DirTree.GetParentItem(hItem);
		}

		int nItem = m_FileList.GetNextSelectedItem(pos);
		strDirPath = m_strStartFolder + strDirPath + _T('\\') + m_FileList.GetItemText(nItem,0);
		
		int RetCmd = ShowContextMenu(0,GetSafeHwnd(), strDirPath, point.x, point.y, NULL,&m_pContextMenu2, &m_pContextMenu3);
		if(RetCmd==19)
		{
			m_FileList.EditLabel(nItem);			
		}
	}
	
	*pResult = 0;
}
Beispiel #6
0
//-----------------------------------------------------------------------------
//! Reimplemented
//-----------------------------------------------------------------------------
void tSteerPanel::keyPressEvent( QKeyEvent* event )
{
    switch( event->key() )
    {
    case Key::Plus:
        {
            if( m_pPanelWidget != 0)
            {
                m_pPanelWidget->StartZoomIn();
            }
        }
        break;

    case Key::Minus: 
        {
            if( m_pPanelWidget != 0)
            {
                m_pPanelWidget->StartZoomOut();
            }            
        }
        break;
    case Key::Menu:
        {
            if( event->isAutoRepeat() ) break;
            ShowContextMenu();
        } 
        break;

    default:
        {
            tPanel::keyPressEvent( event );
        }   
        break;
    }
}
Beispiel #7
0
void MyListCtrl::OnContextMenu(wxContextMenuEvent& event)
{
    if (GetEditControl() == NULL)
    {
        wxPoint point = event.GetPosition();
        // If from keyboard
        if ( (point.x == -1) && (point.y == -1) )
        {
            wxSize size = GetSize();
            point.x = size.x / 2;
            point.y = size.y / 2;
        }
        else
        {
            point = ScreenToClient(point);
        }
        ShowContextMenu(point);
    }
    else
    {
        // the user is editing:
        // allow the text control to display its context menu
        // if it has one (it has on Windows) rather than display our one
        event.Skip();
    }
}
	void OnRightButtonDown(HWND hwnd)
	{
		auto_track = false;//弹出菜单时禁用自动跟踪窗口

		POINT pt;
		GetCursorPos(&pt);
		HMENU hMenu = CreatePopupMenu();

		lua_getglobal(L, "OnRightButtonDown");
		if(lua_isfunction(L, -1))
		{
			if(lua_pcall(L, 0, 1, 0))
			{
				error_handler(L);
			}
		}

		ShowContextMenu(L, hMenu);

		if(GetMenuItemCount(hMenu)==0)
		{
			AppendMenuW(hMenu, MF_BYPOSITION | MF_STRING, MENU_EXIT, L"退出程序(&E)");
		}

		//
		SetForegroundWindow(hwnd);
		TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
		DestroyMenu(hMenu);

		auto_track = true;
	}
FReply SProfilerThreadView::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
	FReply Reply = FReply::Unhandled();

	if( IsReady() )
	{
		const FVector2D MousePositionOnButtonUp = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
		const bool bIsValidForMouseClick = MousePositionOnButtonUp.Equals( MousePositionOnButtonDown, MOUSE_SNAP_DISTANCE );

		if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
		{
			if( bIsLeftMousePressed )
			{
				// Release the mouse, we are no longer dragging.
				Reply = FReply::Handled().ReleaseMouseCapture();
			}

			bIsLeftMousePressed = false;
		}
		else if( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
		{
			if( bIsRightMousePressed )
			{
				if( bIsValidForMouseClick )
				{
					ShowContextMenu( MouseEvent.GetScreenSpacePosition() );
					Reply = FReply::Handled();
				}
			}
			bIsRightMousePressed = false;
		}
	}

	return Reply;
}
void CMSOffice2007DemoView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	if (!ShowContextMenu(point))
	{
		Default();
	}
}
void CRepositoryBrowser::OnContextMenu_RepoList(CPoint point)
{
	TShadowFilesTreeList selectedLeafs;
	selectedLeafs.reserve(m_RepoList.GetSelectedCount());

	bool folderSelected = false;
	bool filesSelected = false;
	bool submodulesSelected = false;

	POSITION pos = m_RepoList.GetFirstSelectedItemPosition();
	while (pos)
	{
		CShadowFilesTree * item = (CShadowFilesTree *)m_RepoList.GetItemData(m_RepoList.GetNextSelectedItem(pos));
		if (item->m_bSubmodule)
			submodulesSelected = true;
		if (item->m_bFolder)
			folderSelected = true;
		else
			filesSelected = true;
		selectedLeafs.push_back(item);
	}

	eSelectionType selType = ONLY_FILES;
	if (folderSelected && filesSelected)
		selType = MIXED_FOLDERS_FILES;
	else if (folderSelected)
		selType = ONLY_FOLDERS;
	else if (submodulesSelected)
		selType = ONLY_FILESSUBMODULES;
	ShowContextMenu(point, selectedLeafs, selType);
}
Beispiel #12
0
INT_PTR CALLBACK MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) {
	case WM_INITDIALOG:
	    MainInitDialog(hWnd);
	    break;

	case WM_DROPFILES:
	    MainDropFiles(hWnd, (HDROP) wParam);
	    break;

	case WM_APP:
	    FireCommand(CommandDelayBuffer);
	    break;

	case WM_COMMAND:
	    MainCommand(hWnd, LOWORD(wParam));
	    break;

	case WM_NOTIFY:
	    return MainNotify(hWnd, (LPNMHDR) lParam);
	    break;

	case WM_SIZE:
	    MainSize(hWnd, LOWORD(lParam), HIWORD(lParam));
	    break;

	case WM_MENUSELECT:
	    MainMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam));
	    break;

	case WM_TIMER:
	    RtfWindowTimer();;
	    break;

	case WM_CONTEXTMENU:
	    {
		HWND hParam = (HWND) wParam;
		HWND hRtfChild = GetDlgItem(hWnd, ID_RTF);
		if (hParam == hWnd || hParam == hRtfChild)
		    ShowContextMenu(LOWORD(lParam), HIWORD(lParam));
	    }
	    break;

	case WM_HELP:
	    MainCommand(hWnd, ID_HELPCONTENTS);
	    break;

	case WM_CLOSE:
	    RegistryWriteWindowPos(hWnd);
	    if (Running)
		AbortExecution();
	    PostQuitMessage(0);
	    break;
    }

    return FALSE;
}
Beispiel #13
0
void ChatPanel::OnMouseEvent(OpWidget *widget, INT32 pos, INT32 x, INT32 y, MouseButton button, BOOL down, UINT8 nclicks)
{
	if (widget != m_rooms_view)
	{
		return;
	}

	if (!down && button == MOUSE_BUTTON_2)
	{
		ShowContextMenu(OpPoint(x+widget->GetRect().x,y+widget->GetRect().y),FALSE,FALSE);
		return;
	}

	OpTreeModelItem* item;

	item = m_rooms_view->GetItemByPosition(pos);

	if (item == NULL)
	{
		return;
	}

	BOOL click_state_ok = (IsSingleClick() && !down && nclicks == 1) || nclicks == 2;

	if (click_state_ok && button == MOUSE_BUTTON_1)
	{
		if (item->GetType() == OpTreeModelItem::CHATROOM_TYPE)
		{
			ChatRoom* chat_room = g_m2_engine->GetChatRoom(item->GetID());

			if (chat_room)
			{
				OpString room;
				chat_room->GetName(room);

				ChatInfo chat_info(room, OpStringC());

				g_application->GoToChat(chat_room->GetAccountID(),
					chat_info, TRUE);
			}
		}
		else if (item->GetType() == OpTreeModelItem::CHATTER_TYPE)
		{
			ChatRoom* chatter = g_m2_engine->GetChatter(item->GetID());
			if (chatter)
			{
				OpString chatter_name;
				chatter->GetName(chatter_name);

				ChatInfo chat_info(chatter_name, OpStringC());

				g_application->GoToChat(chatter->GetAccountID(),
					chat_info, FALSE);
			}
		}
	}
}
BOOL CollectionNavigationPane::OnContextMenu(OpWidget* widget, INT32 child_index, const OpPoint &menu_point, const OpRect *avoid_rect, BOOL keyboard_invoked)
{
	if (!widget || widget->GetType() != WIDGET_TYPE_TREEVIEW)
		return FALSE;

	// Needed for split view layout
	int x = widget->GetRect(FALSE).x + menu_point.x;
	int y = widget->GetRect(FALSE).y + menu_point.y;
	return ShowContextMenu(OpPoint(x,y), FALSE, static_cast<OpTreeView*>(widget),FALSE);
}
Beispiel #15
0
QLabel1::QLabel1(QWidget *parent) :
    QLabel(parent)
{
    this->type1 = "QLabel";
    this->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(ShowContextMenu(QPoint)));
    coder1 = new CodeEditor;
    connect(coder1,SIGNAL(closed()),this,SLOT(changecode()));

}
Beispiel #16
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_CREATE:
		SetupNotificationIcon(hWnd);
		break;

	case WM_APP:
        switch(lParam)
        {
		case WM_CONTEXTMENU:
			ShowContextMenu(hWnd);
            break;
        }
		break;

	case WM_COMMAND:
		{
			int wmId, wmEvent;
			wmId = LOWORD(wParam);
			wmEvent = HIWORD(wParam);
			switch (wmId)
			{
			case IDM_EXIT:
				DestroyWindow(hWnd);
				break;
			case ID_FILE_OPTIONS:
				ShowOptionsDialog(hWnd);
				break;
			default:
				return DefWindowProc(hWnd, message, wParam, lParam);
			}
		}
		break;

	case WM_DESTROY:
		Shell_NotifyIcon(NIM_DELETE, &niData);
		UnhookWindowsHookEx(hKeyboardHook);
		PostQuitMessage(0);
		break;

	case WMU_POP_OPTIONS_DIALOG:
		ShowOptionsDialog(hWnd);
		break;

	case WMU_LAUNCH_BROWSER:
		LaunchBrowser();
		break;

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
Beispiel #17
0
void TitleItem::Mouse(HWND hwnd, UINT uMsg, DWORD wParam, DWORD lParam)
{
    Menu *p = m_pMenu;

    switch(uMsg) {
    case WM_RBUTTONUP:
        if (m_bActive)
        {
#ifdef MENU_ROLLUP
            if (0x8000 & GetAsyncKeyState(VK_MENU))
            {
                p->m_bOnTop = false == p->m_bOnTop;
                p->SetZPos();
            }
            else
#endif
            if (wParam & MK_SHIFT)
                ShowContextMenu(NULL, m_pidl);
            else
                p->HideThis();
        }
        break;

    case WM_LBUTTONDBLCLK:
#ifdef MENU_ROLLUP
        p->m_bIconized = false == p->m_bIconized;
        p->redraw();
#else
        p->m_bOnTop = false == p->m_bOnTop;
        p->SetZPos();
#endif
        break;

    case WM_LBUTTONDOWN:
        UpdateWindow(hwnd);
        p->SetPinned(true);
        SetCursor(MenuInfo.move_cursor);
        SendMessage(hwnd, WM_SYSCOMMAND, 0xf012, 0);
        SetCursor(MenuInfo.arrow_cursor);
        p->SetZPos();
        if (false == p->m_bOnTop)
        {
            HWND hwnd = window_under_mouse();
            if (hwnd && (WS_EX_TOPMOST & GetWindowLong(hwnd, GWL_EXSTYLE)))
                p->m_bOnTop = true, p->SetZPos();
        }
        break;

    case WM_MOUSEMOVE:
    case WM_RBUTTONDOWN:
        Active(1);
        break;
    }
}
Beispiel #18
0
bool caStripPlot::eventFilter(QObject *obj, QEvent *event)
{
    if (event->type() == QEvent::MouseButtonPress) {
        int nButton = ((QMouseEvent*) event)->button();
        if(nButton==2) {
            //printf("emit from %s\n", this->objectName().toAscii().constData());
            QPoint p;
            emit ShowContextMenu(p);
        }
    }
    return QObject::eventFilter(obj, event);
}
Beispiel #19
0
LRESULT CALLBACK WProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
int wmId, wmEvent;

   switch (uMsg) {
      case WM_DESTROY:
         niData.uFlags = 0;
         Shell_NotifyIcon(NIM_DELETE,&niData);
         if (HookEnabled == 1) {
            HookEnabled = 0;
            releasehook();
         }
         PostQuitMessage(0);
         return(0);
         break;

      case TRAY_MSG:
        switch (lParam) {
           case WM_RBUTTONDOWN:
           case WM_CONTEXTMENU:
              ShowContextMenu(hWnd);
              break;
        }
        break;

      case WM_COMMAND:
        wmId    = LOWORD(wParam);
        wmEvent = HIWORD(wParam);

        switch (wmId) {
           case SWM_ENABLE:
              if (HookEnabled == 0) {
                 if (installhook()) {
                    HookEnabled = 1;
                 }
              }
              break;

           case SWM_DISABLE:
              if (HookEnabled == 1) {
                 releasehook();
                 HookEnabled = 0;
              }
              break;

           case SWM_EXIT:
              DestroyWindow(hWnd);
              break;
        }
        break;
   }

   return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
Beispiel #20
0
void CBrowseRefsDlg::OnContextMenu_RefTreeCtrl(CPoint point)
{
	CPoint clientPoint=point;
	m_RefTreeCtrl.ScreenToClient(&clientPoint);

	HTREEITEM hTreeItem=m_RefTreeCtrl.HitTest(clientPoint);
	if(hTreeItem!=NULL)
		m_RefTreeCtrl.Select(hTreeItem,TVGN_CARET);

	VectorPShadowTree tree;
	ShowContextMenu(point,hTreeItem,tree);
}
Beispiel #21
0
void FenetreZoom::OnMenuContext(wxContextMenuEvent& event)
{
    wxPoint point = event.GetPosition();
    // If from keyboard
    if (point.x == -1 && point.y == -1) {
        wxSize size = GetSize();
        point.x = size.x / 2;
        point.y = size.y / 2;
    } else {
        point = ScreenToClient(point);
    }
    ShowContextMenu(point);
}
Beispiel #22
0
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
	if (msg == WM_TRAY) {
		if (lParam == WM_LBUTTONDOWN) {
			HookMouse();
		}
		else if (lParam == WM_MBUTTONDOWN) {
			Sleep(3000);
			HookMouse();
		}
		else if (lParam == WM_RBUTTONDOWN) {
			ShowContextMenu(hwnd);
		}
	}
	else if (msg == WM_TASKBARCREATED) {
		tray_added = 0;
		UpdateTray();
	}
	else if (msg == WM_COMMAND) {
		int wmId = LOWORD(wParam), wmEvent = HIWORD(wParam);
		if (wmId == SWM_FIND) {
			HookMouse();
		}
		else if (wmId == SWM_FINDDELAY) {
			Sleep(3000);
			HookMouse();
		}
		else if (wmId == SWM_FINDALL) {
			FindAllWnds();
		}
		else if (wmId == SWM_ABOUT) {
			MessageBox(NULL, l10n->about, l10n->about_title, MB_ICONINFORMATION|MB_OK);
		}
		else if (wmId == SWM_EXIT) {
			DestroyWindow(hwnd);
		}
	}
	else if (msg == WM_DESTROY) {
		showerror = 0;
		UnhookMouse();
		RemoveTray();
		PostQuitMessage(0);
		return 0;
	}
	else if (msg == WM_LBUTTONDOWN || msg == WM_MBUTTONDOWN || msg == WM_RBUTTONDOWN) {
		// Hide the window if clicked on, this might happen if it wasn't hidden by the hooks for some reason
		ShowWindow(hwnd, SW_HIDE);
		// Since we take away the cursor, make sure the mouse is unhooked
		UnhookMouse();
	}
	return DefWindowProc(hwnd, msg, wParam, lParam);
}
Beispiel #23
0
static LRESULT CALLBACK TrayWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
	case TRAY_MESSAGE:
		switch(lParam)
		{
		case WM_LBUTTONDBLCLK:
			break;
		case WM_RBUTTONDOWN:
		case WM_CONTEXTMENU:
			ShowContextMenu(hWnd);
			break;
		}
		break;
	case WM_COMMAND:
		switch(wParam)
		{
		case ID_QUIT:
			PostQuitMessage(0);
			break;
		case ID_SHOWDEBUG:
			{
				char newtitle[1024];
				HWND hConsole;

				/* Can't use GetConsoleWindow otherwise we lose Win9x support */
				_snprintf(newtitle,sizeof(newtitle),"foo_%08x",GetCurrentProcessId());
				SetConsoleTitle(newtitle);
				do
				{
					Sleep(40);
					hConsole = FindWindow(NULL,newtitle);
				} while(!hConsole);
				SetConsoleTitle("CVSNT Lockserver debug window");

				/* For some reason this doesn't 'take' the first time around, so
				   we do it twice */
				g_bTestMode = true;
				ShowWindow(hConsole,SW_SHOW);
				Sleep(40);
				ShowWindow(hConsole,SW_SHOW);
				break;
			}
		}
		break;
	}

	return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
Beispiel #24
0
static void OnContextMenu(HWND hWnd, int xPos, int yPos, HWND hChild)
{
	if (hChild == s_hCombo)
	{
		ShowContextMenu(hWnd, IDCM_LIBRARY, xPos, yPos);
		return;
	}

	if (hChild == s_hList)
	{
/*
		// Find out where the cursor was and select that item from the list
		POINT pt;
		pt.x = xPos;
		pt.y = yPos;
		ScreenToClient(&pt);
		DWORD dw = (DWORD) SendMessage(m_hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y));
*/

		ShowContextMenu(hWnd, IDCM_SNIPPET, xPos, yPos);
		return;
	}
}
Beispiel #25
0
void CBrowseRefsDlg::OnContextMenu_ListRefLeafs(CPoint point)
{
	std::vector<CShadowTree*> selectedLeafs;
	selectedLeafs.reserve(m_ListRefLeafs.GetSelectedCount());
	POSITION pos=m_ListRefLeafs.GetFirstSelectedItemPosition();
	while(pos)
	{
		selectedLeafs.push_back(
			(CShadowTree*)m_ListRefLeafs.GetItemData(
				m_ListRefLeafs.GetNextSelectedItem(pos)));
	}

	ShowContextMenu(point,m_RefTreeCtrl.GetSelectedItem(),selectedLeafs);
}
void CRepositoryBrowser::OnContextMenu_RepoTree(CPoint point)
{
	CPoint clientPoint = point;
	m_RepoTree.ScreenToClient(&clientPoint);

	HTREEITEM hTreeItem = m_RepoTree.HitTest(clientPoint);
	if (hTreeItem == NULL)
		return;

	TShadowFilesTreeList selectedLeafs;
	selectedLeafs.push_back((CShadowFilesTree *)m_RepoTree.GetItemData(hTreeItem));

	ShowContextMenu(point, selectedLeafs, ONLY_FOLDERS);
}
void CSpiderTaskTree::OnRclick(NMHDR* , LRESULT* pResult) 
{
	HTREEITEM hItem;
	
	*pResult = 0;

	hItem = HitTest (CPoint (m_rbPt.x, m_rbPt.y));

	if (hItem)
		SelectItem (hItem);
	else
		return;

	ShowContextMenu ();
}
Beispiel #28
0
PlotViewer::PlotViewer(QWidget *parent, const arma::vec &x, const arma::vec &y, arma::vec z, QString x_label, QString y_label) :
    QDialog(parent),
    ui(new Ui::PlotViewer),
    context_menu_("Plot Options", this),
    directory_(QDir::homePath())
{
    ui->setupUi(this);
    plot_ = findChild<QCustomPlot *>("plot");
    plot_->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(plot_, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(ShowContextMenu(QPoint)));
    AddContextMenuItems();
    typedef std::vector<double> stdvec;
    arma::field<arma::vec> x_parts;
    arma::field<arma::vec> y_parts;
    arma::vec unique_z = arma::unique(z);
    x_parts.set_size(unique_z.n_rows);
    y_parts.set_size(unique_z.n_rows);
    QVector<QColor> colors(unique_z.n_rows);
    colors.append(QColor(228,26,28));
    colors.append(QColor(55,126,184));
    colors.append(QColor(77,175,74));
    colors.append(QColor(152,78,163));
    colors.append(QColor(255,127,0));
    colors.append(QColor(255,255,51));
    colors.append(QColor(166,86,40));
    colors.append(QColor(247,129,191));
    colors.append(QColor(153,153,153));

    plot_->xAxis->setLabel(x_label);
    plot_->yAxis->setLabel(y_label);
    plot_->xAxis->setRange(x.min(), x.max());
    plot_->yAxis->setRange(y.min(), y.max());
    for (arma::uword i = 0; i < unique_z.n_rows; ++i){
        QPen pen(colors[i]);
        arma::uvec ind = arma::find(z == unique_z(i));
        QVector<double> x_qvec = QVector<double>::fromStdVector(arma::conv_to<stdvec>::from(x(ind)));
        QVector<double> y_qvec = QVector<double>::fromStdVector(arma::conv_to<stdvec>::from(y(ind)));
        plot_->addGraph();
        plot_->graph(i)->setName(QString::number(i));
        plot_->graph(i)->setData(x_qvec, y_qvec);
        plot_->graph(i)->setPen(pen);
        plot_->graph(i)->setScatterStyle(QCPScatterStyle::ssDisc);
        plot_->legend->setVisible(true);
        plot_->graph(i)->addToLegend();
    }
    plot_->replot();
}
void wxGxContentView::OnContextMenu(wxContextMenuEvent& event)
{
    //event.Skip();
    wxPoint point = event.GetPosition();
    // If from keyboard
    if (point.x == -1 && point.y == -1)
	{
        wxSize size = GetSize();
        point.x = size.x / 2;
        point.y = size.y / 2;
    }
	else
	{
        point = ScreenToClient(point);
    }
    ShowContextMenu(point);
}
void CDownloads_Bittorrent_Files::OnRclick(NMHDR *, LRESULT *pResult)
{
	HTREEITEM hItem;

	CPoint pt; GetCursorPos (&pt);
	ScreenToClient (&pt);
	
	hItem = HitTest (pt);
	
	if (hItem)
	{
		GetTreeCtrl ().SelectItem (hItem);	
		ShowContextMenu (hItem);
	}
	
	*pResult = 0;
}