Example #1
0
	void LoadingBar::deleteOverlayContainerContents(Ogre::OverlayContainer& container) const
	{
		{
			OverlayContainer::ChildContainerIterator I = container.getChildContainerIterator();
			while (I.hasMoreElements()) {
				deleteOverlayContainerContents(*I.getNext());
			}
		}
		OverlayContainer::ChildIterator I = container.getChildIterator();
		while (I.hasMoreElements()) {
			OverlayManager::getSingleton().destroyOverlayElement(I.getNext());
		}
	}
Example #2
0
    //---------------------------------------------------------------------
    OverlayContainer::~OverlayContainer()
    {
        // remove from parent overlay if root
        if (mOverlay && !mParent)
        {
            mOverlay->remove2D(this);
        }

        OverlayContainer::ChildIterator ci = getChildIterator();
        while (ci.hasMoreElements())
        {
            OverlayElement* child = ci.getNext();
            child->_notifyParent(0, 0);
        }
    }
 //-----------------------------------------------------------------------
 void OverlayProfileSessionListener::finializeSession()
 {
     OverlayContainer* container = dynamic_cast<OverlayContainer*>(mProfileGui);
     if (container)
     {
         OverlayContainer::ChildIterator children = container->getChildIterator();
         while (children.hasMoreElements())
         {
             OverlayElement* element = children.getNext();
             OverlayContainer* parent = element->getParent();
             if (parent) parent->removeChild(element->getName());
             OverlayManager::getSingleton().destroyOverlayElement(element);
         }
     }
     if(mProfileGui)
         OverlayManager::getSingleton().destroyOverlayElement(mProfileGui);
     if(mOverlay)
         OverlayManager::getSingleton().destroy(mOverlay);           
         
     mProfileBars.clear();
 }
Example #4
0
    void OverlayContainer::copyFromTemplate(OverlayElement* templateOverlay)
    {
        OverlayElement::copyFromTemplate(templateOverlay);

            if (templateOverlay->isContainer() && isContainer())
            {
             OverlayContainer::ChildIterator it = static_cast<OverlayContainer*>(templateOverlay)->getChildIterator();
             while (it.hasMoreElements())
             {
                 OverlayElement* oldChildElement = it.getNext();
                 if (oldChildElement->isCloneable())
                 {
                     OverlayElement* newChildElement = 
                         OverlayManager::getSingleton().createOverlayElement(
                            oldChildElement->getTypeName(), 
                            mName+"/"+oldChildElement->getName());
                     newChildElement->copyFromTemplate(oldChildElement);
                     addChild(static_cast<OverlayContainer*>(newChildElement));
                 }
             }
        }
    }
    //-----------------------------------------------------------------------
    void Profiler::setEnabled(bool enabled) 
	{
        if (!mInitialized && enabled) 
		{
            // the user wants to enable the Profiler for the first time
            // so we initialize the GUI stuff
            initialize();
            mInitialized = true;
        }
        else
        {
            OverlayContainer* container = dynamic_cast<OverlayContainer*>(mProfileGui);
			if (container)
			{
				OverlayContainer::ChildIterator children = container->getChildIterator();
				while (children.hasMoreElements())
				{
                    OverlayElement* element = children.getNext();
                    OverlayContainer* parent = element->getParent();
                    if (parent) parent->removeChild(element->getName());
                    OverlayManager::getSingleton().destroyOverlayElement(element);
				}
			}
            if(mProfileGui)
                OverlayManager::getSingleton().destroyOverlayElement(mProfileGui);
            if(mOverlay)
                OverlayManager::getSingleton().destroy(mOverlay);			
			
			mProfileBars.clear();
            mInitialized = false;
			mEnabled = false;
        }
        // We store this enable/disable request until the frame ends
        // (don't want to screw up any open profiles!)
        mNewEnableState = enabled;
    }