本文整理汇总了C++中CIconMenu::TrackPopupMenuEx方法的典型用法代码示例。如果您正苦于以下问题:C++ CIconMenu::TrackPopupMenuEx方法的具体用法?C++ CIconMenu::TrackPopupMenuEx怎么用?C++ CIconMenu::TrackPopupMenuEx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIconMenu
的用法示例。
在下文中一共展示了CIconMenu::TrackPopupMenuEx方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBnClickedOk
void CBrowseRefsDlg::OnBnClickedOk()
{
if (m_bPickOne || m_ListRefLeafs.GetSelectedCount() != 2)
{
OnOK();
return;
}
CIconMenu popupMenu;
popupMenu.CreatePopupMenu();
std::vector<CShadowTree*> selectedLeafs;
GetSelectedLeaves(selectedLeafs);
popupMenu.AppendMenuIcon(1, GetSelectedRef(true, false), IDI_LOG);
popupMenu.SetDefaultItem(1);
popupMenu.AppendMenuIcon(2, GetTwoSelectedRefs(selectedLeafs, m_sLastSelected, _T("..")), IDI_LOG);
popupMenu.AppendMenuIcon(3, GetTwoSelectedRefs(selectedLeafs, m_sLastSelected, _T("...")), IDI_LOG);
RECT rect;
GetDlgItem(IDOK)->GetWindowRect(&rect);
int selection = popupMenu.TrackPopupMenuEx(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, rect.left, rect.top, this, 0);
switch (selection)
{
case 1:
OnOK();
break;
case 2:
{
m_bPickedRefSet = true;
m_pickedRef = GetTwoSelectedRefs(selectedLeafs, m_sLastSelected, _T(".."));
OnOK();
}
break;
case 3:
{
m_bPickedRefSet = true;
m_pickedRef = GetTwoSelectedRefs(selectedLeafs, m_sLastSelected, _T("..."));
OnOK();
}
break;
default:
break;
}
}
示例2: ShowContextMenu
void CRepositoryBrowser::ShowContextMenu(CPoint point, TShadowFilesTreeList &selectedLeafs, eSelectionType selType)
{
CIconMenu popupMenu;
popupMenu.CreatePopupMenu();
bool bAddSeparator = false;
if (selectedLeafs.size() == 1)
{
popupMenu.AppendMenuIcon(eCmd_Open, IDS_REPOBROWSE_OPEN, IDI_OPEN);
popupMenu.SetDefaultItem(eCmd_Open, FALSE);
if (selType == ONLY_FILES || selType == ONLY_FILESSUBMODULES)
{
popupMenu.AppendMenuIcon(eCmd_OpenWith, IDS_LOG_POPUP_OPENWITH, IDI_OPEN);
popupMenu.AppendMenuIcon(eCmd_OpenWithAlternativeEditor, IDS_LOG_POPUP_VIEWREV);
}
popupMenu.AppendMenu(MF_SEPARATOR);
if (m_bHasWC && (selType == ONLY_FILES || selType == ONLY_FILESSUBMODULES))
{
popupMenu.AppendMenuIcon(eCmd_CompareWC, IDS_LOG_POPUP_COMPARE, IDI_DIFF);
bAddSeparator = true;
}
if (bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
bAddSeparator = false;
CString temp;
temp.LoadString(IDS_MENULOG);
popupMenu.AppendMenuIcon(eCmd_ViewLog, temp, IDI_LOG);
if (selType == ONLY_FILES)
{
if (m_bHasWC)
popupMenu.AppendMenuIcon(eCmd_Blame, IDS_LOG_POPUP_BLAME, IDI_BLAME);
popupMenu.AppendMenu(MF_SEPARATOR);
temp.LoadString(IDS_LOG_POPUP_SAVE);
popupMenu.AppendMenuIcon(eCmd_SaveAs, temp, IDI_SAVEAS);
}
bAddSeparator = true;
}
if (!selectedLeafs.empty() && selType == ONLY_FILES && m_bHasWC)
{
popupMenu.AppendMenuIcon(eCmd_Revert, IDS_LOG_POPUP_REVERTTOREV, IDI_REVERT);
bAddSeparator = true;
}
if (bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
bAddSeparator = false;
if (!selectedLeafs.empty())
{
popupMenu.AppendMenuIcon(eCmd_CopyPath, IDS_STATUSLIST_CONTEXT_COPY, IDI_COPYCLIP);
popupMenu.AppendMenuIcon(eCmd_CopyHash, IDS_COPY_COMMIT_HASH, IDI_COPYCLIP);
}
eCmd cmd = (eCmd)popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN|TPM_RETURNCMD, point.x, point.y, this, 0);
switch(cmd)
{
case eCmd_ViewLog:
{
CString sCmd;
sCmd.Format(_T("/command:log /path:\"%s\\%s\""), g_Git.m_CurrentDir, selectedLeafs.at(0)->GetFullName());
if (selectedLeafs.at(0)->m_bSubmodule)
sCmd += _T(" /submodule");
CAppUtils::RunTortoiseGitProc(sCmd);
}
break;
case eCmd_Blame:
{
CAppUtils::LaunchTortoiseBlame(g_Git.m_CurrentDir + _T("\\") + selectedLeafs.at(0)->GetFullName(), m_sRevision);
}
break;
case eCmd_Open:
if (!selectedLeafs.at(0)->m_bSubmodule && selectedLeafs.at(0)->m_bFolder)
{
FillListCtrlForTreeNode(selectedLeafs.at(0)->m_hTree);
m_RepoTree.SelectItem(selectedLeafs.at(0)->m_hTree);
return;
}
OpenFile(selectedLeafs.at(0)->GetFullName(), OPEN, selectedLeafs.at(0)->m_bSubmodule, selectedLeafs.at(0)->m_hash);
break;
case eCmd_OpenWith:
OpenFile(selectedLeafs.at(0)->GetFullName(), OPEN_WITH, selectedLeafs.at(0)->m_bSubmodule, selectedLeafs.at(0)->m_hash);
break;
case eCmd_OpenWithAlternativeEditor:
OpenFile(selectedLeafs.at(0)->GetFullName(), ALTERNATIVEEDITOR, selectedLeafs.at(0)->m_bSubmodule, selectedLeafs.at(0)->m_hash);
break;
case eCmd_CompareWC:
{
CTGitPath file(selectedLeafs.at(0)->GetFullName());
CGitDiff::Diff(&file, &file, GIT_REV_ZERO, m_sRevision);
}
break;
//.........这里部分代码省略.........
示例3: ShowContextMenu
//.........这里部分代码省略.........
}
}
if(pTree->IsFrom(L"refs/heads"))
{
if(bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
CString temp;
temp.LoadString(IDS_MENUBRANCH);
popupMenu.AppendMenuIcon(eCmd_CreateBranch, temp, IDI_COPY);
}
if(pTree->IsFrom(L"refs/tags"))
{
if(bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
CString temp;
temp.LoadString(IDS_MENUTAG);
popupMenu.AppendMenuIcon(eCmd_CreateTag, temp, IDI_TAG);
temp.LoadString(IDS_PROC_BROWSEREFS_DELETEALLTAGS);
popupMenu.AppendMenuIcon(eCmd_DeleteAllTags, temp, IDI_DELETE);
if (!remotes.empty())
{
popupMenu.AppendMenu(MF_SEPARATOR);
int i = 0;
for (auto it = remotes.cbegin(); it != remotes.cend(); ++it, ++i)
{
temp.Format(IDS_DELETEREMOTETAGON, (LPCTSTR)*it);
popupMenu.AppendMenuIcon(eCmd_DeleteRemoteTag | (i << 16), temp, IDI_DELETE);
}
}
}
}
int selection = popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN | TPM_RETURNCMD, point.x, point.y, this, 0);
switch ((eCmd)(selection & 0xFFFF))
{
case eCmd_ViewLog:
{
CLogDlg dlg;
dlg.SetRange(g_Git.FixBranchName(selectedLeafs[0]->GetRefName()));
dlg.DoModal();
}
break;
case eCmd_ViewLogRange:
{
CLogDlg dlg;
dlg.SetRange(GetTwoSelectedRefs(selectedLeafs, m_sLastSelected, _T("..")));
dlg.DoModal();
}
break;
case eCmd_ViewLogRangeReachableFromOnlyOne:
{
CLogDlg dlg;
dlg.SetRange(GetTwoSelectedRefs(selectedLeafs, m_sLastSelected, _T("...")));
dlg.DoModal();
}
break;
case eCmd_RepoBrowser:
CAppUtils::RunTortoiseGitProc(_T("/command:repobrowser /path:\"") + g_Git.m_CurrentDir + _T("\" /rev:") + selectedLeafs[0]->GetRefName());
break;
case eCmd_DeleteBranch:
case eCmd_DeleteRemoteBranch:
{
if(ConfirmDeleteRef(selectedLeafs))
DoDeleteRefs(selectedLeafs);
Refresh();
示例4: ShowContextMenu
void CRepositoryBrowser::ShowContextMenu(CPoint point, TShadowFilesTreeList &selectedLeafs, eSelectionType selType)
{
CIconMenu popupMenu;
popupMenu.CreatePopupMenu();
bool bAddSeparator = false;
if (selectedLeafs.size() == 1)
{
popupMenu.AppendMenuIcon(eCmd_Open, IDS_REPOBROWSE_OPEN, IDI_OPEN);
popupMenu.SetDefaultItem(eCmd_Open, FALSE);
if (selType == ONLY_FILES || selType == ONLY_FILESSUBMODULES)
{
popupMenu.AppendMenuIcon(eCmd_OpenWith, IDS_LOG_POPUP_OPENWITH, IDI_OPEN);
popupMenu.AppendMenuIcon(eCmd_OpenWithAlternativeEditor, IDS_LOG_POPUP_VIEWREV);
}
popupMenu.AppendMenu(MF_SEPARATOR);
if (m_bHasWC && (selType == ONLY_FILES || selType == ONLY_FILESSUBMODULES))
{
popupMenu.AppendMenuIcon(eCmd_CompareWC, IDS_LOG_POPUP_COMPARE, IDI_DIFF);
bAddSeparator = true;
}
if (bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
bAddSeparator = false;
CString temp;
temp.LoadString(IDS_MENULOG);
popupMenu.AppendMenuIcon(eCmd_ViewLog, temp, IDI_LOG);
if (selectedLeafs[0]->m_bSubmodule)
{
temp.LoadString(IDS_MENULOGSUBMODULE);
popupMenu.AppendMenuIcon(eCmd_ViewLogSubmodule, temp, IDI_LOG);
}
if (selType == ONLY_FILES)
{
if (m_bHasWC)
popupMenu.AppendMenuIcon(eCmd_Blame, IDS_LOG_POPUP_BLAME, IDI_BLAME);
popupMenu.AppendMenu(MF_SEPARATOR);
temp.LoadString(IDS_LOG_POPUP_SAVE);
popupMenu.AppendMenuIcon(eCmd_SaveAs, temp, IDI_SAVEAS);
}
bAddSeparator = true;
}
if (!selectedLeafs.empty() && selType == ONLY_FILES && m_bHasWC)
{
popupMenu.AppendMenuIcon(eCmd_Revert, IDS_LOG_POPUP_REVERTTOREV, IDI_REVERT);
bAddSeparator = true;
}
if (bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
bAddSeparator = false;
if (selectedLeafs.size() == 1 && selType == ONLY_FILES)
{
popupMenu.AppendMenuIcon(eCmd_PrepareDiff, IDS_PREPAREDIFF, IDI_DIFF);
if (!m_sMarkForDiffFilename.IsEmpty())
{
CString diffWith;
if (selectedLeafs.at(0)->GetFullName() == m_sMarkForDiffFilename)
diffWith = m_sMarkForDiffVersion;
else
{
PathCompactPathEx(diffWith.GetBuffer(40), m_sMarkForDiffFilename, 39, 0);
diffWith.ReleaseBuffer();
diffWith += _T(":") + m_sMarkForDiffVersion.ToString().Left(g_Git.GetShortHASHLength());
}
CString menuEntry;
menuEntry.Format(IDS_MENUDIFFNOW, (LPCTSTR)diffWith);
popupMenu.AppendMenuIcon(eCmd_PrepareDiff_Compare, menuEntry, IDI_DIFF);
}
popupMenu.AppendMenu(MF_SEPARATOR);
}
if (!selectedLeafs.empty())
{
popupMenu.AppendMenuIcon(eCmd_CopyPath, IDS_STATUSLIST_CONTEXT_COPY, IDI_COPYCLIP);
popupMenu.AppendMenuIcon(eCmd_CopyHash, IDS_COPY_COMMIT_HASH, IDI_COPYCLIP);
}
eCmd cmd = (eCmd)popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN|TPM_RETURNCMD, point.x, point.y, this, 0);
switch(cmd)
{
case eCmd_ViewLog:
case eCmd_ViewLogSubmodule:
{
CString sCmd;
sCmd.Format(_T("/command:log /path:\"%s\\%s\""), (LPCTSTR)g_Git.m_CurrentDir, (LPCTSTR)selectedLeafs.at(0)->GetFullName());
if (cmd == eCmd_ViewLog && selectedLeafs.at(0)->m_bSubmodule)
sCmd += _T(" /submodule");
CAppUtils::RunTortoiseGitProc(sCmd);
}
//.........这里部分代码省略.........
示例5: ShowContextMenu
//.........这里部分代码省略.........
remoteName = pTree->GetRefName();
remoteName = remoteName.Mid(13);
remoteName = remoteName.Tokenize(L"/", dummy);
if(!remoteName.IsEmpty())
{
CString temp;
temp.Format(IDS_PROC_BROWSEREFS_FETCHFROM, remoteName);
popupMenu.AppendMenuIcon(eCmd_Fetch, temp, IDI_PULL);
temp.LoadString(IDS_DELETEREMOTETAG);
popupMenu.AppendMenuIcon(eCmd_DeleteRemoteTag, temp, IDI_DELETE);
}
}
}
if(pTree->IsFrom(L"refs/heads"))
{
if(bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
CString temp;
temp.LoadString(IDS_MENUBRANCH);
popupMenu.AppendMenuIcon(eCmd_CreateBranch, temp, IDI_COPY);
}
if(pTree->IsFrom(L"refs/tags"))
{
if(bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
CString temp;
temp.LoadString(IDS_MENUTAG);
popupMenu.AppendMenuIcon(eCmd_CreateTag, temp, IDI_TAG);
}
}
eCmd cmd=(eCmd)popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN|TPM_RETURNCMD, point.x, point.y, this, 0);
switch(cmd)
{
case eCmd_ViewLog:
{
CLogDlg dlg;
dlg.SetStartRef(selectedLeafs[0]->GetRefName());
dlg.DoModal();
}
break;
case eCmd_RepoBrowser:
CAppUtils::RunTortoiseProc(_T("/command:repobrowser /path:\"") + g_Git.m_CurrentDir + _T("\" /rev:") + selectedLeafs[0]->GetRefName());
break;
case eCmd_DeleteBranch:
case eCmd_DeleteRemoteBranch:
{
if(ConfirmDeleteRef(selectedLeafs))
DoDeleteRefs(selectedLeafs, true);
Refresh();
}
break;
case eCmd_DeleteTag:
{
if(ConfirmDeleteRef(selectedLeafs))
DoDeleteRefs(selectedLeafs, true);
Refresh();
}
break;
case eCmd_ShowReflog:
{
CRefLogDlg refLogDlg(this);
refLogDlg.m_CurrentBranch = selectedLeafs[0]->GetRefName();
refLogDlg.DoModal();