本文整理汇总了C++中GuiControl::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiControl::getParent方法的具体用法?C++ GuiControl::getParent怎么用?C++ GuiControl::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiControl
的用法示例。
在下文中一共展示了GuiControl::getParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attachToCanvas
void MenuBar::attachToCanvas(GuiCanvas *owner, S32 pos)
{
if(owner == NULL || isAttachedToCanvas())
return;
// This is set for popup menus in the onAttachToMenuBar() callback
mCanvas = owner;
PlatformWindowSDL *pWindow = dynamic_cast<PlatformWindowSDL*>(owner->getPlatformWindow());
if(pWindow == NULL)
return;
// Setup the native menu bar
GuiMenuBar *hWindowMenu = static_cast<GuiMenuBar*>( pWindow->getMenuHandle() );
if( hWindowMenu == NULL && !Journal::IsPlaying() )
hWindowMenu = _FindMenuBarCtrl();
if(hWindowMenu)
{
pWindow->setMenuHandle( hWindowMenu );
GuiControl *base = hWindowMenu->getParent();
while( base->getParent() )
{
base = base->getParent();
}
mCanvas->setMenuBar( base );
}
}
示例2: processTick
void GuiRolloutCtrl::processTick()
{
// We do nothing here if we're NOT animating
if ( !mIsAnimating )
return;
// Sanity check to fix non collapsing panels.
if ( mAnimateStep == 0 )
mAnimateStep = 1;
S32 newHeight = getHeight();
// We're collapsing ourself down (Hiding our contents)
if( mCollapsing )
{
if ( newHeight < mAnimateDestHeight )
newHeight = mAnimateDestHeight;
else if ( ( newHeight - mAnimateStep ) < mAnimateDestHeight )
newHeight = mAnimateDestHeight;
if ( newHeight == mAnimateDestHeight )
mIsAnimating = false;
else
newHeight -= mAnimateStep;
if( !mIsAnimating )
{
mIsExpanded = false;
}
}
else // We're expanding ourself (Showing our contents)
{
if ( newHeight > mAnimateDestHeight )
newHeight = mAnimateDestHeight;
else if ( ( newHeight + mAnimateStep ) > mAnimateDestHeight )
newHeight = mAnimateDestHeight;
if ( newHeight == mAnimateDestHeight )
mIsAnimating = false;
else
newHeight += mAnimateStep;
if ( !mIsAnimating )
mIsExpanded = true;
}
if ( newHeight != getHeight() )
setHeight( newHeight );
if ( !mIsAnimating )
{
if( mCollapsing )
onCollapsed_callback();
else if( !mCollapsing )
onExpanded_callback();
calculateHeights();
}
GuiControl* parent = getParent();
if ( parent )
{
parent->childResized( this );
// if our parent's parent is a scroll control, scrollvisible.
GuiScrollCtrl* scroll = dynamic_cast<GuiScrollCtrl*>( parent->getParent() );
if ( scroll )
{
scroll->scrollRectVisible( getBounds() );
}
}
}