本文整理汇总了C++中GuiControl::addObject方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiControl::addObject方法的具体用法?C++ GuiControl::addObject怎么用?C++ GuiControl::addObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiControl
的用法示例。
在下文中一共展示了GuiControl::addObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createContent
//-----------------------------------------------------------------------------
// GuiInspectorDynamicGroup - add custom controls
//-----------------------------------------------------------------------------
bool GuiInspectorDynamicGroup::createContent()
{
if(!Parent::createContent())
return false;
// encapsulate the button in a dummy control.
GuiControl* shell = new GuiControl();
shell->setDataField( StringTable->insert("profile"), NULL, "GuiTransparentProfile" );
if( !shell->registerObject() )
{
delete shell;
return false;
}
// add a button that lets us add new dynamic fields.
GuiBitmapButtonCtrl* addFieldBtn = new GuiBitmapButtonCtrl();
{
SimObject* profilePtr = Sim::findObject("InspectorDynamicFieldButton");
if( profilePtr != NULL )
addFieldBtn->setControlProfile( dynamic_cast<GuiControlProfile*>(profilePtr) );
// FIXME Hardcoded image
addFieldBtn->setBitmap("tools/gui/images/iconAdd.png");
char commandBuf[64];
dSprintf(commandBuf, 64, "%d.addDynamicField();", this->getId());
addFieldBtn->setField("command", commandBuf);
addFieldBtn->setSizing(horizResizeLeft,vertResizeCenter);
//addFieldBtn->setField("buttonMargin", "2 2");
addFieldBtn->resize(Point2I(getWidth() - 20,2), Point2I(16, 16));
addFieldBtn->registerObject("zAddButton");
}
shell->resize(Point2I(0,0), Point2I(getWidth(), 28));
shell->addObject(addFieldBtn);
// save off the shell control, so we can push it to the bottom of the stack in inspectGroup()
mAddCtrl = shell;
mStack->addObject(shell);
return true;
}
示例2: onChildAdded
void GuiTabBookCtrl::onChildAdded( GuiControl *child )
{
GuiTabPageCtrl *page = dynamic_cast<GuiTabPageCtrl*>(child);
if( !page )
{
Con::warnf("GuiTabBookCtrl::onChildAdded - attempting to add NON GuiTabPageCtrl as child page");
SimObject *simObj = reinterpret_cast<SimObject*>(child);
removeObject( simObj );
if( mActivePage )
{
mActivePage->addObject( simObj );
}
else
{
Con::warnf("GuiTabBookCtrl::onChildAdded - unable to find active page to reassign ownership of new child control to, placing on parent");
GuiControl *rent = getParent();
if( rent )
rent->addObject( simObj );
}
return;
}
TabHeaderInfo newPage;
newPage.Page = page;
newPage.TabRow = -1;
newPage.TabColumn = -1;
mPages.push_back( newPage );
// Calculate Page Information
calculatePageTabs();
if( page->getFitBook() )
fitPage( page );
// Select this Page
selectPage( page );
}
示例3: addObject
void GuiFormCtrl::addObject(SimObject *newObj )
{
if( ( mHasMenu && size() > 1) || (!mHasMenu && size() > 0 ) )
{
Con::warnf("GuiFormCtrl::addObject - Forms may only have one *direct* child - Placing on Parent!");
GuiControl* parent = getParent();
if ( parent )
parent->addObject( newObj );
return;
}
GuiControl *newCtrl = dynamic_cast<GuiControl*>( newObj );
GuiFormCtrl*formCtrl = dynamic_cast<GuiFormCtrl*>( newObj );
if( newCtrl && formCtrl )
newCtrl->setCanSave( true );
else if ( newCtrl )
newCtrl->setCanSave( false );
Parent::addObject( newObj );
}
示例4: open
void PostEffectVis::open( PostEffect *pfx )
{
GuiControl *content = _getContentControl();
// If we already have this PostEffect added
// remove it first so we can recreate its controls.
VisVector::iterator itr = mWindows.begin();
for ( ; itr != mWindows.end(); itr++ )
{
if ( itr->pfx == pfx )
{
for ( U32 i = 0; i < TexCount; i++ )
{
// Deleting the GuiWindowCtrl will automatically also delete
// any child controls we have allocated.
if ( itr->window[i] )
itr->window[i]->deleteObject();
}
mWindows.erase_fast( itr );
break;
}
}
// Allocate VisWindow struct.
mWindows.increment();
VisWindow &window = mWindows.last();
window.pfx = pfx;
for ( U32 i = 0; i < TexCount; i++ )
{
// Only allocate window/bitmaps for input textures that are actually used.
if ( i > Target )
{
if ( pfx->mTexFilename[i-1].isEmpty() )
{
window.window[i] = NULL;
window.bmp[i] = NULL;
continue;
}
}
// Allocate GuiWindowCtrl
GuiWindowCtrl *winCtrl = new GuiWindowCtrl();
winCtrl->setPosition( Point2I( 50, 50 ) + Point2I( 15, 15 ) * i );
winCtrl->setExtent( 347, 209 );
winCtrl->setMinExtent( Point2I( 150, 100 ) );
winCtrl->setMobility( true, true, true, true, false, false );
winCtrl->setCanResize( true, true );
winCtrl->setDataField( StringTable->insert( "closeCommand" ), NULL, "PfxVis::onWindowClosed( $ThisControl );" );
winCtrl->registerObject();
window.window[i] = winCtrl;
_setDefaultCaption( window, i );
// Allocate background GuiBitmapCtrl
GuiBitmapCtrl *bmpCtrl = new GuiBitmapCtrl();
bmpCtrl->setPosition( 3, 23 );
bmpCtrl->setSizing( GuiControl::horizResizeWidth, GuiControl::vertResizeHeight );
bmpCtrl->setExtent( 341, 181 );
bmpCtrl->setDataField( StringTable->insert( "wrap" ), NULL, "1" );
bmpCtrl->setBitmap( "tools/gui/images/transp_grid" );
bmpCtrl->registerObject();
winCtrl->addObject( bmpCtrl );
// Allocate GuiBitmapCtrl
bmpCtrl = new GuiBitmapCtrl();
bmpCtrl->setPosition( 3, 23 );
bmpCtrl->setSizing( GuiControl::horizResizeWidth, GuiControl::vertResizeHeight );
bmpCtrl->setExtent( 341, 181 );
bmpCtrl->registerObject();
winCtrl->addObject( bmpCtrl );
window.bmp[i] = bmpCtrl;
content->addObject( winCtrl );
}
// Make sure we visible.
setVisible( true );
}