本文整理汇总了C++中GuiControl类的典型用法代码示例。如果您正苦于以下问题:C++ GuiControl类的具体用法?C++ GuiControl怎么用?C++ GuiControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GuiControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GuiPopUpMenuCtrl
GuiControl* GuiInspectorMountingGroup::buildMenuCtrl()
{
GuiControl* retCtrl = new GuiPopUpMenuCtrl();
// If we couldn't construct the control, bail!
if( retCtrl == NULL )
return retCtrl;
GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);
// Let's make it look pretty.
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiPopUpMenuProfile" );
//GuiInspectorTypeMenuBase::_registerEditControl( retCtrl );
char szName[512];
dSprintf( szName, 512, "IE_%s_%d_%s_Field", retCtrl->getClassName(), mParentInspector->getInspectObject()->getId(), mCaption.c_str());
// Register the object
retCtrl->registerObject( szName );
// Configure it to update our value when the popup is closed
char szBuffer[512];
dSprintf( szBuffer, 512, "%d.apply( %d.getText() );", getId(), menu->getId() );
menu->setField("Command", szBuffer );
return menu;
}
示例2: loadBaseInfo
void GuiContainer::loadFromXml(string file) {
controls.clear();
ofxXmlSettings xml;
res.init(file);
xml.loadFile(file);
loadBaseInfo("view", xml, 0);
x = 0;
y = 0;
load();
//movable = xml.getAttribute("view", "movable", 0, 0);
xml.pushTag("view");
int numControls = xml.getNumTags("control");
for(int i = 0; i < numControls; i++) {
GuiControl *c = instantiator(
xml.getAttribute("control", "type", "", i),
xml.getAttribute("control", "name", "", i),
xml.getAttribute("control", "id", "", i), &res, this);
string valueStr = xml.getAttribute("control", "value", "", i);
if(valueStr!="") {
c->valueFromString(valueStr);
}
c->loadBaseInfo("control", xml, i);
c->load();
c->listeners = listeners;
c->numListeners = numListeners;
c->load(xml, i);
add(c);
}
}
示例3: globalToLocalCoord
void GuiFormCtrl::onMouseDown(const GuiEvent &event)
{
Point2I localClick = globalToLocalCoord(event.mousePoint);
// If we're clicking in the header then resize
if(localClick.y < mThumbSize.y)
{
mouseLock();
mDepressed = true;
mMouseMovingWin = mCanMove;
//update
setUpdate();
}
mOrigBounds = getBounds();
mMouseDownPosition = event.mousePoint;
if (mMouseMovingWin )
{
mouseLock();
}
else
{
GuiControl *ctrl = findHitControl(localClick);
if (ctrl && ctrl != this)
ctrl->onMouseDown(event);
}
}
示例4: calculateHeights
bool GuiRolloutCtrl::resize( const Point2I &newPosition, const Point2I &newExtent )
{
if ( !Parent::resize( newPosition, newExtent ) )
return false;
// Recalculate Heights and resize ourself appropriately.
calculateHeights();
GuiControl *content = dynamic_cast<GuiControl*>( at(0) );
// Size Content Properly?!
if ( mNotifyChildrenResized && content != NULL )
{
S32 barHeight = ( mHideHeader ) ? 0 : 20;
if( !mHideHeader && mHasTexture && mProfile && mProfile->mBitmapArrayRects.size() >= NumBitmaps )
{
barHeight = mProfile->mBitmapArrayRects[ TopLeftHeader ].extent.y;
}
mChildRect.set( mMargin.point.x,
mHeader.extent.y + mMargin.point.y,
getWidth() - ( mMargin.point.x + mMargin.extent.x ),
getHeight() - ( barHeight + ( mMargin.point.y + mMargin.extent.y ) ) );
if ( content->resize( mChildRect.point, mChildRect.extent ) )
return true;
}
// Nothing sized
return false;
}
示例5: getWidth
bool GuiPaneControl::resize(const Point2I &newPosition, const Point2I &newExtent)
{
// CodeReview WTF is going on here that we need to bypass parent sanity?
// Investigate this [7/1/2007 justind]
if( !Parent::resize( newPosition, newExtent ) )
return false;
mOriginalExtents.x = getWidth();
/*
GuiControl *parent = getParent();
if (parent)
parent->childResized(this);
setUpdate();
*/
// Resize the child control if we're not collapsed
if(size() && !mCollapsed)
{
GuiControl *gc = dynamic_cast<GuiControl*>(operator[](0));
if(gc)
{
Point2I offset(0, mThumbSize.y);
gc->resize(offset, newExtent - offset);
}
}
// For now.
return true;
}
示例6: findLastTabable
GuiControl *GuiTabPageCtrl::findPrevTabable(GuiControl *curResponder, bool firstCall)
{
if (firstCall)
{
GuiControl::smPrevResponder = NULL;
}
//if the window does not already contain the first responder, return false
//ie. Can't tab into or out of a window
if (! controlIsChild(curResponder))
{
return NULL;
}
//loop through, checking each child to see if it is the one that follows the firstResponder
GuiControl *tabCtrl = NULL;
iterator i;
for (i = begin(); i != end(); i++)
{
GuiControl *ctrl = static_cast<GuiControl *>(*i);
tabCtrl = ctrl->findPrevTabable(curResponder, false);
if (tabCtrl) break;
}
//to ensure the tab cycles within the current window...
if (! tabCtrl)
{
tabCtrl = findLastTabable();
}
mFirstResponder = tabCtrl;
return tabCtrl;
}
示例7: setCollapsed
void GuiPaneControl::setCollapsed(bool isCollapsed)
{
// Get the child
if(size() == 0 || !mCollapsable) return;
GuiControl *gc = dynamic_cast<GuiControl*>(operator[](0));
if(mCollapsed && !isCollapsed)
{
resize(getPosition(), mOriginalExtents);
mCollapsed = false;
if(gc)
gc->setVisible(true);
}
else if(!mCollapsed && isCollapsed)
{
mCollapsed = true;
mOriginalExtents = getExtent();
resize(getPosition(), Point2I(getExtent().x, mThumbSize.y));
if(gc)
gc->setVisible(false);
}
}
示例8: getParent
bool GuiTextEditSliderCtrl::onMouseWheelDown(const GuiEvent &event)
{
if ( !mActive || !mAwake || !mVisible )
return Parent::onMouseWheelDown(event);
if ( !isFirstResponder() && !mFocusOnMouseWheel )
{
GuiControl *parent = getParent();
if ( parent )
return parent->onMouseWheelUp( event );
return false;
}
mValue -= mIncAmount;
checkRange();
setValue();
setFirstResponder();
mCursorPos = mBlockStart = mBlockEnd = 0;
setUpdate();
return true;
}
示例9: getBounds
void GuiContainer::parentResized(const RectI &oldParentRect, const RectI &newParentRect)
{
//if(!mCanResize)
// return;
// If it's a control that specifies invalid docking, we'll just treat it as an old GuiControl
if( getDocking() & Docking::dockInvalid || getDocking() & Docking::dockNone)
return Parent::parentResized( oldParentRect, newParentRect );
S32 deltaX = newParentRect.extent.x - oldParentRect.extent.x;
S32 deltaY = newParentRect.extent.y - oldParentRect.extent.y;
// Update Self
RectI oldThisRect = getBounds();
anchorControl( this, Point2I( deltaX, deltaY ) );
RectI newThisRect = getBounds();
// Update Deltas to pass on to children
deltaX = newThisRect.extent.x - oldThisRect.extent.x;
deltaY = newThisRect.extent.y - oldThisRect.extent.y;
// Iterate over all children and update their anchors
iterator nI = begin();
for( ; nI != end(); nI++ )
{
// Sanity
GuiControl *control = dynamic_cast<GuiControl*>( (*nI) );
if( control )
control->parentResized( oldThisRect, newThisRect );
}
}
示例10: mouseUnlock
void GuiDecoyCtrl::onMouseUp(const GuiEvent &event)
{
mouseUnlock();
setUpdate();
//this code is pretty hacky. right now there is no way that guiCanvas will allow sending more than
//one signal to one gui control at a time.
if(mIsDecoy == true)
{
mVisible = false;
GuiControl *parent = getParent();
Point2I localPoint = parent->globalToLocalCoord(event.mousePoint);
GuiControl *tempControl = parent->findHitControl(localPoint);
//the decoy control has the responsibility of keeping track of the decoyed controls status
if( mDecoyReference != NULL && tempControl == mDecoyReference)
tempControl->onMouseUp(event);
else if(mDecoyReference != NULL && tempControl != mDecoyReference)
{
//as explained earlier, this control was written in the mindset for buttons.
//nothing bad should ever happen if not a button due to the checks in this function though.
GuiButtonBaseCtrl *unCastCtrl = NULL;
unCastCtrl = dynamic_cast<GuiButtonBaseCtrl *>( mDecoyReference );
if(unCastCtrl != NULL)
unCastCtrl->resetState();
}
mVisible = true;
}
}
示例11: _FindMenuBarCtrl
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 );
}
}
示例12: _getContentControl
void PostEffectVis::clear()
{
GuiControl *content = _getContentControl();
content->clear();
mWindows.clear();
}
示例13: getWidth
void GuiRolloutCtrl::calculateHeights()
{
S32 barHeight = 20;
if ( mHasTexture && mProfile && mProfile->mBitmapArrayRects.size() >= NumBitmaps )
{
// Store Header Rectangle
mHeader.set( 0, 0, getWidth(), mProfile->mBitmapArrayRects[ CollapsedCenter ].extent.y );
// Bottom Bar Max
barHeight = mProfile->mBitmapArrayRects[ TopLeftHeader ].extent.y;
}
else
{
mHeader.set( 0, 0, getWidth(), barHeight );
}
if ( mHideHeader )
{
barHeight = 0;
mHeader.extent.y = 0;
}
GuiControl *content = static_cast<GuiControl*>( at(0) );
if ( content != NULL )
mExpanded.set( 0, 0, getWidth(), barHeight + content->getHeight() + ( mMargin.point.y + mMargin.extent.y ) );
else
mExpanded.set( 0, 0, getWidth(), barHeight + mDefaultHeight );
}
示例14: getParent
void GuiTabPageCtrl::setText(const char *txt)
{
Parent::setText( txt );
GuiControl *parent = getParent();
if( parent )
parent->setUpdate();
};
示例15: worldBounds
void GuiRolloutCtrl::onRender( Point2I offset, const RectI &updateRect )
{
if( !mProfile || mProfile->mFont == NULL )
return;
// Calculate actual world bounds for rendering
RectI worldBounds( offset, getExtent() );
// if opaque, fill the update rect with the fill color
if ( mProfile->mOpaque )
GFX->getDrawUtil()->drawRectFill( worldBounds, mProfile->mFillColor );
if ( mProfile->mBitmapArrayRects.size() >= NumBitmaps )
{
GFX->getDrawUtil()->clearBitmapModulation();
// Draw Rollout From Skin
if ( !mIsExpanded && !mIsAnimating )
renderFixedBitmapBordersFilled( worldBounds, 1, mProfile );
else if ( mHideHeader )
renderSizableBitmapBordersFilledIndex( worldBounds, MidPageLeft, mProfile );
else
renderSizableBitmapBordersFilledIndex( worldBounds, TopLeftHeader, mProfile );
}
if ( !(mIsExpanded && mHideHeader ) )
{
// Draw Caption ( Vertically Centered )
ColorI currColor;
GFX->getDrawUtil()->getBitmapModulation( &currColor );
Point2I textPosition = mHeader.point + offset + mProfile->mTextOffset;
GFX->getDrawUtil()->setBitmapModulation( mProfile->mFontColor );
renderJustifiedText( textPosition, mHeader.extent, mCaption );
GFX->getDrawUtil()->setBitmapModulation( currColor );
}
// If we're collapsed we contain the first child as our content
// thus we don't render it when collapsed. but to support modified
// rollouts with custom header buttons etc we still render our other
// children. -JDD
GuiControl *pChild = dynamic_cast<GuiControl*>( at(0) );
if ( pChild )
{
if ( !mIsExpanded && !mIsAnimating && pChild->isVisible() )
{
pChild->setVisible( false );
}
else if ( (mIsExpanded || mIsAnimating) && !pChild->isVisible() )
{
pChild->setVisible( true );
}
}
renderChildControls( offset, updateRect );
// Render our border should we have it specified in our profile.
renderBorder(worldBounds, mProfile);
}