本文整理汇总了C++中UIWindow::GetPrevSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ UIWindow::GetPrevSibling方法的具体用法?C++ UIWindow::GetPrevSibling怎么用?C++ UIWindow::GetPrevSibling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIWindow
的用法示例。
在下文中一共展示了UIWindow::GetPrevSibling方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnKeyPressed
bool Dialog::OnKeyPressed(Key key)
{
switch( key )
{
case Key::Up:
if( GetManager().GetFocusWnd() && this != GetManager().GetFocusWnd() )
{
// try to pass focus to previous siblings
UIWindow *r = GetManager().GetFocusWnd()->GetPrevSibling();
for( ; r; r = r->GetPrevSibling() )
{
if( r->GetVisibleCombined() && r->GetEnabledCombined() && GetManager().SetFocusWnd(r) ) break;
}
}
break;
case Key::Down:
if( GetManager().GetFocusWnd() && this != GetManager().GetFocusWnd() )
{
// try to pass focus to next siblings
UIWindow *r = GetManager().GetFocusWnd()->GetNextSibling();
for( ; r; r = r->GetNextSibling() )
{
if( r->GetVisibleCombined() && r->GetEnabledCombined() && GetManager().SetFocusWnd(r) ) break;
}
}
break;
case Key::Tab:
if( GetManager().GetFocusWnd() && this != GetManager().GetFocusWnd() )
{
// try to pass focus to next siblings ...
UIWindow *r = GetManager().GetFocusWnd()->GetNextSibling();
for( ; r; r = r->GetNextSibling() )
{
if( r->GetVisibleCombined() && r->GetEnabledCombined() && GetManager().SetFocusWnd(r) ) break;
}
if( r ) break;
// ... and then start from first one
r = GetFirstChild();
for( ; r; r = r->GetNextSibling() )
{
if( r->GetVisibleCombined() && r->GetEnabledCombined() && GetManager().SetFocusWnd(r) ) break;
}
}
break;
case Key::Enter:
case Key::NumEnter:
Close(_resultOK);
break;
case Key::Escape:
Close(_resultCancel);
break;
default:
return false;
}
return true;
}
示例2: ProcessPointerInternal
bool LayoutManager::ProcessPointerInternal(UIWindow* wnd, float x, float y, float z, Msg msg, int buttons, PointerType pointerType, unsigned int pointerID, bool topMostPass, bool insideTopMost)
{
insideTopMost |= wnd->GetTopMost();
if (!wnd->GetEnabled() || !wnd->GetVisible() || (insideTopMost && !topMostPass))
return false;
bool pointerInside = (x >= 0 && x < wnd->GetWidth() && y >= 0 && y < wnd->GetHeight());
if( (pointerInside || !wnd->GetClipChildren()) && GetCapture(pointerID) != wnd )
{
// route message to each child in reverse order until someone process it
for(UIWindow *w = wnd->GetLastChild(); w; w = w->GetPrevSibling() )
{
#ifndef NDEBUG
WindowWeakPtr wp(w);
#endif
if( ProcessPointerInternal(w, x - w->GetX(), y - w->GetY(), z, msg, buttons, pointerType, pointerID, topMostPass, insideTopMost) )
{
return true;
}
assert(wp.Get());
}
}
if( insideTopMost == topMostPass && (pointerInside || GetCapture(pointerID) == wnd) )
{
// window is captured or the pointer is inside the window
WindowWeakPtr wp(wnd);
bool msgProcessed = false;
switch( msg )
{
case Msg::PointerDown:
msgProcessed = wnd->OnPointerDown(x, y, buttons, pointerType, pointerID);
break;
case Msg::PointerUp:
case Msg::PointerCancel:
msgProcessed = wnd->OnPointerUp(x, y, buttons, pointerType, pointerID);
break;
case Msg::PointerMove:
msgProcessed = wnd->OnPointerMove(x, y, pointerType, pointerID);
break;
case Msg::MOUSEWHEEL:
msgProcessed = wnd->OnMouseWheel(x, y, z);
break;
case Msg::TAP:
msgProcessed = wnd->OnTap(x, y);
break;
default:
assert(false);
}
// if window did not process the message, it should not destroy itself
assert(msgProcessed || wp.Get());
if( wp.Get() && msgProcessed )
{
switch( msg )
{
case Msg::PointerDown:
case Msg::TAP:
SetFocusWnd(wnd); // may destroy wnd
default:
break;
}
if( wp.Get() && wnd != _hotTrackWnd.Get() )
{
if( _hotTrackWnd.Get() )
_hotTrackWnd->OnMouseLeave(); // may destroy wnd
if( wp.Get() && wnd->GetVisibleCombined() && wnd->GetEnabledCombined() )
{
_hotTrackWnd.Set(wnd);
_hotTrackWnd->OnMouseEnter(x, y);
}
}
}
return msgProcessed;
}
return false;
}