Ejemplo n.º 1
2
void CSummaryView::OnContextMenu(HWND /*hWnd*/, CPoint pt)
{
    WTL::CMenu m;
    m.LoadMenu(IDR_POPUP_RESULTS_SUMMARY);
    CResultContext context(this, m,pt);
    if ( !m_resultSlot || !m_resultSlot->OnContextResult(context) )
    {
        //if nobody handled it, then do it ourselves
        BOOL id = m.GetSubMenu(0).TrackPopupMenuEx(TPM_RETURNCMD, pt.x, pt.y, m_hWnd, NULL);
        if (id)
            PostMessage(WM_COMMAND, id);
    }
}
Ejemplo n.º 2
0
void CMyEdit::OnContextMenu(HWND phWnd, CPoint pPoint)
{
	WTL::CMenu m;
	m.LoadMenu(IDR_POPUP_ERRORLOG);
	m.EnableMenuItem(ID_EDIT_COPY, !CanCopy());
	unsigned int id = m.GetSubMenu(0).TrackPopupMenuEx(TPM_RETURNCMD, pPoint.x, pPoint.y, m_hWnd, NULL);
	switch (id)
	{
	case ID_EDIT_COPY:
		Copy();
		break;
	case ID_EDIT_CLEARALL:
		SetWindowText(_T(""));
		break;
	case ID_EDIT_SELECT_ALL:
		SetSelAll(true);
		break;
	}
}
Ejemplo n.º 3
0
void CBookmarksView::OnContextMenu(HWND /*phWnd*/, CPoint pPoint)
{
    WTL::CMenu m;
    m.LoadMenu(IDR_POPUP_BOOKMARKS);
    bool noCount = m_list.GetItemCount() == 0;
    bool noSelection = m_list.GetSelectedCount() == 0;
    m.EnableMenuItem(ID_BOOKMARKS_OPEN, noCount || noSelection ? MF_DISABLED : MF_ENABLED);
    m.EnableMenuItem(ID_BOOKMARKS_SAVE, noCount ? MF_DISABLED : MF_ENABLED);
    m.EnableMenuItem(ID_BOOKMARKS_CLEAR, noCount ? MF_DISABLED : MF_ENABLED);
    m.EnableMenuItem(ID_BOOKMARKS_LOADMERGE, noCount ? MF_DISABLED : MF_ENABLED);
    m.EnableMenuItem(ID_BOOKMARKS_DELETEFROMLIST, noCount || noSelection ? MF_DISABLED : MF_ENABLED);

    unsigned int id = m.GetSubMenu(0).TrackPopupMenuEx(TPM_RETURNCMD, pPoint.x, pPoint.y, m_hWnd, NULL);
    switch (id)
    {
    case ID_BOOKMARKS_OPEN:
    {
        OnOpen();
    }
    break;
    case ID_BOOKMARKS_SAVE:
    {
        OnSaveFile();
    }
    break;
    case ID_BOOKMARKS_LOAD:
    {
        OnLoadFile();
    }
    break;
    case ID_BOOKMARKS_LOADMERGE:
    {
        OnLoadFile(true);
    }
    break;
    case ID_BOOKMARKS_DELETEFROMLIST:
    {
        OnDeleteLines();
    }
    break;
    case ID_BOOKMARKS_CLEAR:
    {
        if (MessageBox(CLEAR_BOOKMARKS_MSG, _T("Warning"), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) != IDYES) {
            return;
        }
        OnClear(NULL, NULL, NULL);
    }
    break;
    }
}
Ejemplo n.º 4
0
void CSyntaxView::OnContextMenu(HWND /*phWnd*/, CPoint pPoint)
{
	WTL::CMenu m;
	m.LoadMenu(IDR_POPUP_SYNTAX);
	m.EnableMenuItem(ID_EDIT_COPY, m_list.GetSelectedCount() == 0);
	m.EnableMenuItem(ID_EDIT_COPYALL, m_list.GetItemCount() == 0);
	m.EnableMenuItem(ID_SYNTAX_LOCATEERROR, m_list.GetItemCount() == 0);
	unsigned int id = m.GetSubMenu(0).TrackPopupMenuEx(TPM_RETURNCMD, pPoint.x, pPoint.y, m_hWnd, NULL);
	switch (id)
	{
	case ID_EDIT_COPY:
		{
			int row = m_list.GetSelectedIndex();
			std::_tstring clip;
			FormatRow(m_list, row, clip);
			SetClipboard(clip);
		}
		break;
	case ID_EDIT_COPYALL:
		{
			std::_tstring clip;
			for (int i = 0; i < m_list.GetItemCount(); ++i)
			{
				if (!clip.empty())
					clip += _T("\r\n");
				FormatRow(m_list, i, clip);
			}
			SetClipboard(clip);
		}
		break;
	case ID_SYNTAX_LOCATEERROR:	
		{
			int row = m_list.GetSelectedIndex();
			if (row > -1)
			{
				CString code;
				m_list.GetItemText(row, 1, code);
				ShowHelp((const TCHAR *)code);
			}
		}
		break;
	}
}