本文整理汇总了C++中CHeaderCtrl::ClientToScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ CHeaderCtrl::ClientToScreen方法的具体用法?C++ CHeaderCtrl::ClientToScreen怎么用?C++ CHeaderCtrl::ClientToScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHeaderCtrl
的用法示例。
在下文中一共展示了CHeaderCtrl::ClientToScreen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnContextMenuHeader
void ColumnManager::OnContextMenuHeader(CWnd* pWnd, CPoint point, bool isGroundEnable /* = false*/)
{
CHeaderCtrl* pHeaderCtrl = (CHeaderCtrl*)pWnd;
if ((point.x == -1) && (point.y == -1))
{
CRect rect;
pHeaderCtrl->GetItemRect(0, &rect);
pHeaderCtrl->ClientToScreen(&rect);
point = rect.CenterPoint();
}
CMenu popup;
if (popup.CreatePopupMenu())
{
int columnCount = GetColumnCount();
CString temp;
UINT uCheckedFlags = MF_STRING | MF_ENABLED | MF_CHECKED;
UINT uUnCheckedFlags = MF_STRING | MF_ENABLED;
// build control menu
//temp.LoadString(IDS_STATUSLIST_SHOWGROUPS);
//popup.AppendMenu(isGroundEnable? uCheckedFlags : uUnCheckedFlags, columnCount, temp);
temp.LoadString(IDS_STATUSLIST_RESETCOLUMNORDER);
popup.AppendMenu(uUnCheckedFlags, columnCount + 2, temp);
popup.AppendMenu(MF_SEPARATOR);
// standard columns
AddMenuItem(&popup);
// user-prop columns:
// find relevant ones and sort 'em
std::map<CString, int> sortedProps;
for (int i = (int)itemName.size(); i < columnCount; ++i)
if (IsRelevant(i))
sortedProps[GetName(i)] = i;
if (!sortedProps.empty())
{
// add 'em to the menu
popup.AppendMenu(MF_SEPARATOR);
for (auto iter = sortedProps.cbegin(), end = sortedProps.cend(); iter != end; ++iter)
{
popup.AppendMenu(IsVisible(iter->second)
? uCheckedFlags
: uUnCheckedFlags
, iter->second
, iter->first);
}
}
// show menu & let user pick an entry
int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, pWnd);
if ((cmd >= 1) && (cmd < columnCount))
SetVisible(cmd, !IsVisible(cmd));
else if (cmd == columnCount)
{
pWnd->GetParent()->SendMessage(LVM_ENABLEGROUPVIEW, !isGroundEnable, NULL);
//EnableGroupView(!isGroundEnable);
}
else if (cmd == columnCount + 1)
RemoveUnusedProps();
else if (cmd == columnCount + 2)
{
temp.LoadString(IDS_CONFIRMRESETCOLUMNORDER);
if (MessageBox(pWnd->m_hWnd, temp, L"TortoiseGit", MB_YESNO | MB_ICONQUESTION) == IDYES)
ResetColumns(m_dwDefaultColumns);
}
}
}