本文整理汇总了C++中UIWindow::GetParent方法的典型用法代码示例。如果您正苦于以下问题:C++ UIWindow::GetParent方法的具体用法?C++ UIWindow::GetParent怎么用?C++ UIWindow::GetParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIWindow
的用法示例。
在下文中一共展示了UIWindow::GetParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessPointer
bool LayoutManager::ProcessPointer(float x, float y, float z, Msg msg, int button, PointerType pointerType, unsigned int pointerID)
{
#ifndef NDEBUG
_lastPointerLocation[pointerID] = Vector2(x, y);
#endif
if(UIWindow *captured = GetCapture(pointerID) )
{
// calc relative mouse position and route message to captured window
for(UIWindow *wnd = captured; _desktop.Get() != wnd; wnd = wnd->GetParent() )
{
assert(wnd);
x -= wnd->GetX();
y -= wnd->GetY();
}
if( ProcessPointerInternal(captured, x, y, z, msg, button, pointerType, pointerID, true) ||
ProcessPointerInternal(captured, x, y, z, msg, button, pointerType, pointerID, false))
return true;
}
else
{
// handle all children of the desktop recursively; offer to topmost windows first
if( ProcessPointerInternal(_desktop.Get(), x, y, z, msg, button, pointerType, pointerID, true) ||
ProcessPointerInternal(_desktop.Get(), x, y, z, msg, button, pointerType, pointerID, false))
return true;
}
if( _hotTrackWnd.Get() )
{
_hotTrackWnd->OnMouseLeave();
_hotTrackWnd.Set(nullptr);
}
return false;
}
示例2: SetFocusWnd
bool LayoutManager::SetFocusWnd(UIWindow* wnd)
{
assert(!_dbgFocusIsChanging);
if( _focusWnd.Get() != wnd )
{
WindowWeakPtr wp(wnd);
WindowWeakPtr oldFocusWnd(_focusWnd.Get());
// try setting new focus. it should not change _focusWnd
#ifndef NDEBUG
_dbgFocusIsChanging = true;
#endif
bool focusAccepted = wnd && wnd->GetEnabledCombined() && wnd->GetVisibleCombined() && wnd->OnFocus(true);
#ifndef NDEBUG
_dbgFocusIsChanging = false;
#endif
if( !focusAccepted && wp.Get() && oldFocusWnd.Get() )
{
for(UIWindow *w = wp.Get()->GetParent(); w; w = w->GetParent() )
{
if( w == oldFocusWnd.Get() )
{
// don't reset focus from parent
return false;
}
}
}
// set new focus
_focusWnd.Set(focusAccepted ? wp.Get() : nullptr);
assert(!_focusWnd.Get() || _focusWnd->GetEnabledCombined() && _focusWnd->GetVisibleCombined());
// reset old focus
if( oldFocusWnd.Get() && oldFocusWnd.Get() != _focusWnd.Get() )
{
oldFocusWnd->OnFocus(false); // _focusWnd may be destroyed here
if( oldFocusWnd.Get() && oldFocusWnd->eventLostFocus )
oldFocusWnd->eventLostFocus();
}
}
return nullptr != _focusWnd.Get();
}