本文整理汇总了C++中Control::MapRootToMyPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Control::MapRootToMyPos方法的具体用法?C++ Control::MapRootToMyPos怎么用?C++ Control::MapRootToMyPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Control
的用法示例。
在下文中一共展示了Control::MapRootToMyPos方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLButtonUp
// TODO: quite possibly the real logic for generating "click" events is
// more complicated
// (x, y) is in the coordinates of the root window
LRESULT EventMgr::OnLButtonUp(WPARAM keys, int x, int y, bool& wasHandled)
{
Vec<CtrlAndOffset> controls;
uint16 wantedInputMask = bit::FromBit<uint16>(Control::WantsMouseClickBit);
size_t count = CollectWindowsAt(wndRoot, x, y, wantedInputMask, &controls);
if (0 == count)
return 0;
// TODO: should this take z-order into account?
Control *c = controls.Last().c;
c->MapRootToMyPos(x, y);
NotifyClicked(c, x, y);
NotifyNamedEventClicked(c, x, y);
return 0;
}
示例2: OnMouseMove
// TODO: optimize by getting both mouse over and mouse move windows in one call
// x, y is a position in the root window
LRESULT EventMgr::OnMouseMove(WPARAM keys, int x, int y, bool& wasHandled)
{
Vec<CtrlAndOffset> windows;
Control *c;
uint16 wantedInputMask = bit::FromBit<uint16>(Control::WantsMouseOverBit);
size_t count = CollectWindowsAt(wndRoot, x, y, wantedInputMask, &windows);
if (0 == count) {
if (currOver) {
currOver->SetIsMouseOver(false);
currOver->NotifyMouseLeave();
currOver = nullptr;
}
} else {
// TODO: should this take z-order into account ?
c = windows.Last().c;
if (c != currOver) {
if (currOver) {
currOver->SetIsMouseOver(false);
currOver->NotifyMouseLeave();
}
currOver = c;
currOver->SetIsMouseOver(true);
currOver->NotifyMouseEnter();
}
}
wantedInputMask = bit::FromBit<uint16>(Control::WantsMouseMoveBit);
count = CollectWindowsAt(wndRoot, x, y, wantedInputMask, &windows);
if (0 == count)
return 0;
c = windows.Last().c;
c->MapRootToMyPos(x, y);
c->NotifyMouseMove(x, y);
return 0;
}