本文整理汇总了C++中IteratorPtr::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ IteratorPtr::IsValid方法的具体用法?C++ IteratorPtr::IsValid怎么用?C++ IteratorPtr::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IteratorPtr
的用法示例。
在下文中一共展示了IteratorPtr::IsValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawChildren
bool nuiContainer::DrawChildren(nuiDrawContext* pContext)
{
CheckValid();
IteratorPtr pIt;
if (mReverseRender)
{
for (pIt = GetLastChild(); pIt && pIt->IsValid(); GetPreviousChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
if (pItem)
DrawChild(pContext, pItem);
}
delete pIt;
}
else
{
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
if (pItem)
DrawChild(pContext, pItem);
}
delete pIt;
}
return true;
}
示例2: SilentInvalidateChildren
void nuiContainer::SilentInvalidateChildren(bool Recurse)
{
CheckValid();
IteratorPtr pIt;
if (Recurse)
{
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiContainerPtr pCont = dynamic_cast<nuiContainerPtr>(pItem);
if (pCont)
pCont->SilentInvalidateChildren(Recurse);
pItem->SilentInvalidate();
}
}
else
{
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
pItem->SilentInvalidate();
}
}
delete pIt;
}
示例3: GetIdealItem
nuiWidgetPtr nuiList::GetIdealItem(nuiSize X,nuiSize Y)
{
if (mOrientation == nuiVertical)
{
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiRect r(mRects[pItem]);
if (r.IsInside(X, Y))
{
delete pIt;
return pItem;
}
}
delete pIt;
}
else if (mOrientation == nuiHorizontal)
{
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiRect r(mRects[pItem]);
if (r.IsInside(X, Y))
{
delete pIt;
return pItem;
}
}
delete pIt;
}
return NULL;
}
示例4: GetIdealNextItem
nuiWidgetPtr nuiList::GetIdealNextItem(nuiSize X,nuiSize Y)
{
if (mOrientation == nuiVertical)
{
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiRect r(mRects[pItem]);
if (Y < (r.Top() + r.GetHeight() * .5))
{
delete pIt;
return pItem;
}
}
delete pIt;
}
else if (mOrientation == nuiHorizontal)
{
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiRect r(mRects[pItem]);
if (Y < (r.Left() + r.GetWidth() * .5))
{
delete pIt;
return pItem;
}
}
delete pIt;
}
return NULL;
}
示例5: CalcIdealSize
nuiRect nuiList::CalcIdealSize()
{
nuiRect rect;
nuiSize Height=0,Width=0;
mPositions.clear();
if (mOrientation == nuiVertical)
{
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiRect Rect;
Rect = pItem->GetIdealRect();
Rect.RoundToAbove();
mPositions.push_back(Rect);
nuiSize w = Rect.GetWidth();
nuiSize h = Rect.GetHeight();
Width = MAX(Width, w+2);
Height +=h;
Height = (nuiSize)ToAbove(Height);
}
delete pIt;
}
else
{
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiRect Rect;
Rect = pItem->GetIdealRect();
Rect.RoundToAbove();
mPositions.push_back(Rect);
nuiSize w=Rect.GetWidth();
nuiSize h=Rect.GetHeight();
Height = MAX(Height, h+2);
Width += w;
Width = (nuiSize)ToAbove(Width);
}
delete pIt;
}
rect.Set(mRect.mLeft, mRect.mTop, Width, Height);
mPositions.push_front(rect);
// OUT("Ideal Size: %d x %d\n",Width,Height);
mIdealRect = rect.Size();
return mIdealRect;
}
示例6: CalcIdealSize
nuiRect nuiZoomView::CalcIdealSize()
{
nuiRect rect;
nuiSize HorizontalZoomLevel = mHorizontalZoomLevel;
nuiSize VerticalZoomLevel = mVerticalZoomLevel;
if (mpVerticalSlider)
VerticalZoomLevel = mpVerticalSlider->GetRange().GetValue();
if (mpHorizontalSlider)
HorizontalZoomLevel = mpHorizontalSlider->GetRange().GetValue();
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiRect itemRect = pItem->GetIdealRect();
itemRect.SetSize(itemRect.GetWidth() * HorizontalZoomLevel, itemRect.GetHeight() * VerticalZoomLevel);
rect.Union(rect, itemRect);
}
delete pIt;
rect.mLeft = 0;
rect.mTop = 0;
mIdealRect = rect;
return mIdealRect;
}
示例7: Draw
bool nuiScrollView::Draw(nuiDrawContext* pContext)
{
nuiSize scrollv = (mpVertical->IsVisible() && !mForceNoVertical && !mVerticalIsExternal)?mBarSize:0;
nuiSize scrollh = (mpHorizontal->IsVisible() && !mForceNoHorizontal && !mHorizontalIsExternal)?mBarSize:0;
nuiRect rect(0.0f,0.0f,mRect.GetWidth()-scrollv, mRect.GetHeight()-scrollh);
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiRect intersect;
if (intersect.Intersect(rect, pItem->GetOverDrawRect(true, true)))
{
DrawChild(pContext, pItem);
}
}
delete pIt;
if (GetDebug())
{
pContext->SetStrokeColor(nuiColor("red"));
pContext->DrawRect(GetRect().Size(), eStrokeShape);
pContext->SetStrokeColor(nuiColor("blue"));
pContext->DrawRect(GetIdealRect().Size(), eStrokeShape);
pContext->SetStrokeColor("yellow");
float h = GetRect().GetHeight() - scrollh - 1;
pContext->DrawLine(0, h, GetRect().GetWidth(), h);
}
return true;
}
示例8: GetChildIterator
nuiContainer::IteratorPtr nuiContainer::GetChildIterator(nuiWidgetPtr pChild, bool DoRefCounting)
{
CheckValid();
IteratorPtr pIt = GetFirstChild(DoRefCounting);
while (pIt->IsValid() && pIt->GetWidget() != pChild)
GetNextChild(pIt);
return pIt;
}
示例9: DispatchMouseUnclick
bool nuiContainer::DispatchMouseUnclick(const nglMouseInfo& rInfo)
{
CheckValid();
nuiAutoRef;
if (!mMouseEventEnabled || mTrashed)
return false;
bool hasgrab = HasGrab(rInfo.TouchId);
if (IsDisabled() && !hasgrab)
return false;
nglMouseInfo info(rInfo);
GlobalToLocal(info.X, info.Y);
// Get a chance to preempt the mouse event before the children get it:
if (PreMouseUnclicked(info))
{
Ungrab();
return true;
}
if (IsInsideFromRoot(rInfo.X, rInfo.Y) || hasgrab)
{
if (!hasgrab)
{
IteratorPtr pIt;
for (pIt = GetLastChild(false); pIt && pIt->IsValid(); GetPreviousChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
if (pItem)
{
if (IsEnabled())
{
if ((pItem)->DispatchMouseUnclick(rInfo))
{
delete pIt;
return true;
}
}
}
}
delete pIt;
}
bool res = PreUnclicked(info);
if (!res)
{
res = MouseUnclicked(info);
res |= Unclicked(info);
}
res = res | (!mClickThru);
if (res)
Ungrab();
return res;
}
return false;
}
示例10: SetRect
bool nuiPositioner::SetRect(const nuiRect& rRect)
{
nuiWidget::SetRect(rRect);
//NGL_OUT(_T("nuiPositioner::SetRect: %d x %d\n"),(int)rRect.GetWidth(),(int)rRect.GetHeight());
nuiWidget::LayoutConstraint contraint;
contraint.mMaxWidth = rRect.GetWidth();
contraint.mMaxHeight = rRect.GetHeight();
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
pItem->SetLayoutConstraint(contraint);
}
delete pIt;
mIdealRect = CalcIdealSize();
nuiRect mainrect(rRect.Size());
pIt = NULL;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
nuiRect rect = pItem->GetIdealRect().Size();
if (mExpandWidth)
rect.SetSize(mainrect.GetWidth(), rect.GetHeight());
if (mExpandHeight)
rect.SetSize(rect.GetWidth(), mainrect.GetHeight());
rect.SetPosition(mPPosition, mainrect);
if (mLimitBounds)
rect.Intersect(rect, mainrect);
rect.RoundToBiggest();
pItem->SetLayout(rect);
}
delete pIt;
return true;
}
示例11: SetChildrenLayoutAnimationDuration
void nuiContainer::SetChildrenLayoutAnimationDuration(float duration)
{
CheckValid();
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
pItem->SetLayoutAnimationDuration(duration);
}
delete pIt;
}
示例12: CallDisconnectTopLevel
void nuiContainer::CallDisconnectTopLevel(nuiTopLevel* pTopLevel)
{
CheckValid();
nuiWidget::CallDisconnectTopLevel(pTopLevel);
IteratorPtr pIt;
for (pIt = GetFirstChild(true); pIt && pIt->IsValid(); GetNextChild(pIt))
{
pIt->GetWidget()->CallDisconnectTopLevel(pTopLevel);
}
delete pIt;
}
示例13: SetChildrenLayoutAnimationEasing
void nuiContainer::SetChildrenLayoutAnimationEasing(const nuiEasingMethod& rMethod)
{
CheckValid();
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
pItem->SetLayoutAnimationEasing(rMethod);
}
delete pIt;
}
示例14: GetUnselected
uint nuiList::GetUnselected(nuiWidgetList& unselitems)
{
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
if (!pItem->IsSelected())
unselitems.push_back(pItem);
}
delete pIt;
return unselitems.size();
}
示例15: GetChild
nuiWidgetPtr nuiContainer::GetChild(const nglString& rName, bool ResolveNameAsPath)
{
CheckValid();
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
if (pItem->GetObjectName() == rName)
{
delete pIt;
return pItem;
}
}
delete pIt;
if (!ResolveNameAsPath) // Are we allowed to search the complete tree?
return NULL;
nuiWidgetPtr pNode = this;
nglString name = rName;
if (name[0] == '/')
{
// Get the root of the tree:
pNode = GetRoot();
name.DeleteLeft(1); // Remove the '/'
}
// Get all the nodes and remove the slashes:
std::vector<nglString> tokens;
name.Tokenize(tokens, _T('/'));
size_t i;
size_t count = tokens.size();
for (i = 0; i < count; i++)
{
nglString& rTok = tokens[i];
//Node* pOld = pNode;
if (rTok == _T(".."))
pNode = pNode->GetParent();
else
pNode = pNode->GetChild(rTok, false);
if (!pNode)
{
//NUI_OUT("Tried to find %s on %s", rTok.GetChars(), pOld->GetParamCString(ParamIds::Name));
return NULL;
}
}
return pNode;
}