Beispiel #1
0
void Node::performRemove()
{
    for (auto child = children.begin(); child != children.end();)
    {
        if ((*child)->toBeRemoved)
        {
            auto tmp = *child;
            child = children.erase(child);
            tmp->clearChildren();
            delete tmp;
            tmp = nullptr;
        }
        else
        {
            (*child)->performRemove();
            ++child;
        }
    }
}
Beispiel #2
0
void
CatchupWork::onReset()
{
    auto toLedger = mCatchupConfiguration.toLedger() == 0
                        ? "CURRENT"
                        : std::to_string(mCatchupConfiguration.toLedger());
    CLOG(INFO, "History") << "Starting catchup with configuration:\n"
                          << "  lastClosedLedger: "
                          << mApp.getLedgerManager().getLastClosedLedgerNum()
                          << "\n"
                          << "  toLedger: " << toLedger << "\n"
                          << "  count: " << mCatchupConfiguration.count();

    auto toCheckpoint =
        mCatchupConfiguration.toLedger() == CatchupConfiguration::CURRENT
            ? CatchupConfiguration::CURRENT
            : mApp.getHistoryManager().nextCheckpointLedger(
                  mCatchupConfiguration.toLedger() + 1) -
                  1;
    CLOG(INFO, "History")
        << "Catchup downloading history archive state at checkpoint "
        << toCheckpoint;

    clearChildren();
    mBucketsAppliedEmitted = false;
    BucketDownloadWork::onReset();
    mGetHistoryArchiveStateWork.reset();
    mDownloadLedgersWork.reset();
    mVerifyLedgersWork.reset();
    mGetBucketsHistoryArchiveStateWork.reset();
    mDownloadBucketsWork.reset();
    mApplyBucketsWork.reset();
    mDownloadTransactionsWork.reset();
    mApplyTransactionsWork.reset();

    mLastClosedLedgerAtReset = mApp.getLedgerManager().getLastClosedLedgerNum();
    mGetHistoryArchiveStateWork = addWork<GetHistoryArchiveStateWork>(
        "get-history-archive-state", mRemoteState, toCheckpoint);
}
void ListGeneratedPopupMenu::updateMenuItems(void)
{
    clearChildren();

    if(getModel() != NULL)// && )
    {
        MenuItemRefPtr Item;
        for(Int32 i(0) ; i<getModel()->getSize() ; ++i)
        {
            if(getCellGenerator() != NULL)
            {
                Item = ComponentMenuItem::create();
                ComponentRefPtr TheComponent = getCellGenerator()->getComponent(ListGeneratedPopupMenuRefPtr(this), getModel()->getElementAt(i), i, 0, false, false);

                TheComponent->setBackgrounds(NULL);


                dynamic_pointer_cast<ComponentMenuItem>(Item)->setComponent(TheComponent);
            }
            else
            {
                //Generate the Menu Item
                Item = MenuItem::create();
                std::string TheText;
                try
                {
                    TheText = lexical_cast(getModel()->getElementAt(i));
                }
                catch (boost::bad_lexical_cast &)
                {
                    //Could not convert to a string
                }
                dynamic_pointer_cast<MenuItem>(Item)->setText(TheText);
            }
            pushToChildren(Item);
        }
    }
    producePopupMenuContentsChanged(PopupMenuEvent::create(PopupMenuRefPtr(this), getSystemTime()));
}
void NodeGraphDisplay::reset()
{
	clearChildren();

	//Clear other variables
	draggedNode = nullptr;
	draggedConnector = 0;
	connectionIndex = -1;

	//Delete node controls
	for(auto nc : nodeControls)
		AU::safeDelete(nc);
	nodeControls.clear();
	selectedControls.clear();

	//Delete connections
	for(auto c : connections)
		AU::safeDelete(c);
	connections.clear();

	//Re-init graph
	initGraph();
}
GetAndUnzipRemoteFileWork::~GetAndUnzipRemoteFileWork()
{
    clearChildren();
}
Beispiel #6
0
CRenderNode::~CRenderNode()
{
	clearChildren();
}
Beispiel #7
0
/** Destroys a PartitionTable object, destroying all children */
PartitionTable::~PartitionTable()
{
    clearChildren();
}
void DesktopNode::updateChildrenByFolder()
{
    clearChildren();
    scan(absolutePath(), children_);
}
void
BucketDownloadWork::onReset()
{
    clearChildren();
    mBuckets.clear();
}
void Robot::refreshRobot(){
	
	clearChildren();
	//setup
	if(isPartOn[0]){
        model = bipodM;
	}
	else if (isPartOn[1]){
        model = tracksM;
	}
	else if (isPartOn[2]){
        model = antiGravM;
	}

	Model* temp = NULL;
	Model* tempChild = NULL;
	bool childExists = false;
	bool grandChildExists = false;
	for(int i = 7; i > 2; i--){
		if(isPartOn[i]){
			if(childExists){
				grandChildExists = true;
			}
			childExists = true;
			tempChild = temp;
			switch(i){
				case 3:
					temp = cannonM;
					break;
				case 4:
					temp = missileM;
					break;
				case 5:
					temp = phaserM;
					break;
				case 6:
					temp = nuclearM;
					break;
				case 7:
					temp = electronicsM;
					break;
				default:
					break;
			}
			if(grandChildExists){
				temp->setNextChild(tempChild);
			}
		}
	}
	if(childExists){
		model->setNextChild(temp);
	}
	calculateHeight();
	if(hasBox){
		if(robotLife > 0){
			box->resize(box->size.x,height,box->size.z);
		}
		else{
			box->resize(box->size.x,0.01f,box->size.z);
		}
	}
	notifyCamera();
}
Beispiel #11
0
void Slider::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    if((whichField & LabelMapFieldMask))
    {
        _UsingDefaultLabels = (getLabelMap().size() == 0);
    }

    if( ((whichField & DrawLabelsFieldMask) ||
         (whichField & LabelPrototypeFieldMask) ||
         (whichField & MajorTickSpacingFieldMask))&&
        getDrawLabels() &&
        getRangeModel() != NULL &&
        _UsingDefaultLabels)
    {
        setLabelMap(createStandardLabels(getMajorTickSpacing()));
        _UsingDefaultLabels = true;
    }

    if((whichField & KnobButtonFieldMask) ||
       (whichField & TrackDrawObjectFieldMask) ||
       (whichField & MinTrackDrawObjectFieldMask) ||
       (whichField & MaxTrackDrawObjectFieldMask) ||
       (whichField & DrawTrackFieldMask) ||
       (whichField & DrawLabelsFieldMask) ||
       (whichField & LabelMapFieldMask) ||
       (whichField & LabelPrototypeFieldMask))
    {
        clearChildren();
        if(getDrawTrack())
        {
            if(getTrackDrawObject() != NULL)
            {
                pushToChildren(getTrackDrawObject());
            }
            if(getMinTrackDrawObject() != NULL)
            {
                pushToChildren(getMinTrackDrawObject());
            }
            if(getMaxTrackDrawObject() != NULL)
            {
                pushToChildren(getMaxTrackDrawObject());
            }
        }
        if(getKnobButton() != NULL)
        {
            pushToChildren(getKnobButton());
        }

        if(getDrawLabels())
        {
            FieldContainerMap::const_iterator Itor;
            for(Itor = getLabelMap().begin() ; Itor != getLabelMap().end() ; ++Itor)
            {
                pushToChildren(dynamic_pointer_cast<Component>((*Itor).second));
            }
        }
    }

    if((whichField & KnobButtonFieldMask) ||
       (whichField & TrackDrawObjectFieldMask) ||
       (whichField & MinTrackDrawObjectFieldMask) ||
       (whichField & MaxTrackDrawObjectFieldMask) ||
       (whichField & InvertedFieldMask) ||
       (whichField & DrawLabelsFieldMask) ||
       (whichField & DrawTrackFieldMask) ||
       (whichField & OrientationFieldMask) ||
       (whichField & MinorTickSpacingFieldMask) ||
       (whichField & MajorTickSpacingFieldMask) ||
       (whichField & LabelMapFieldMask) ||
       (whichField & LabelPrototypeFieldMask) ||
       (whichField & AlignmentFieldMask) ||
       (whichField & TicksOnRightBottomFieldMask))
    {
        updateLayout();
    }

    if(whichField & KnobButtonFieldMask &&
       getKnobButton() != NULL)
    {
        getKnobButton()->addMouseListener(&_KnobDraggedListener);
    }
    if(whichField & RangeModelFieldMask)
    {
        _RangeModelConnection.disconnect();
        if(getRangeModel() != NULL)
        {
            _RangeModelConnection = getRangeModel()->addChangeListener(&_BoundedRangeModelChangeListener);
            if( getDrawLabels() &&
                _UsingDefaultLabels)
            {
                setLabelMap(createStandardLabels(getMajorTickSpacing()));
                _UsingDefaultLabels = true;
            }
        }
    }
}
KateCodeFoldingNode::~KateCodeFoldingNode()
{
  // delete all child nodes
  clearChildren ();
}
Beispiel #13
0
void MetavoxelNode::setAttributeValue(const AttributeValue& attributeValue) {
    attributeValue.getAttribute()->destroy(_attributeValue);
    _attributeValue = attributeValue.copy();
    clearChildren(attributeValue.getAttribute());
}
Beispiel #14
0
void ComboBox::changed(ConstFieldMaskArg whichField, 
                       UInt32            origin,
                       BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    //Do not respond to changes that have a Sync origin
    if(origin & ChangedOrigin::Sync)
    {
        return;
    }

    if( (whichField & EditableFieldMask))
    {
        updateComponentGeneratorSelectedItem();
    }

    if((whichField & ExpandButtonFieldMask) &&
       getExpandButton() != NULL)
    {
        _ExpandButtonSelectedConnection = getExpandButton()->connectButtonSelected(boost::bind(&ComboBox::handleExpandButtonSelected, this, _1));
        _ExpandButtonDeselectedConnection = getExpandButton()->connectButtonDeselected(boost::bind(&ComboBox::handleExpandButtonDeselected, this, _1));
        
        _ExpandPopupMenuCanceledConnection = getComboListPopupMenu()->connectPopupMenuCanceled(boost::bind(&ComboBox::handleExpandPopupMenuCanceled, this, _1));
        _ExpandPopupMenuWillBecomeInvisibleConnection = getComboListPopupMenu()->connectPopupMenuWillBecomeInvisible(boost::bind(&ComboBox::handleExpandPopupMenuWillBecomeInvisible, this, _1));
        _ExpandPopupMenuWillBecomeVisibleConnection = getComboListPopupMenu()->connectPopupMenuWillBecomeVisible(boost::bind(&ComboBox::handleExpandPopupMenuWillBecomeVisible, this, _1));
        _ExpandPopupMenuContentsChangedConnection = getComboListPopupMenu()->connectPopupMenuContentsChanged(boost::bind(&ComboBox::handleExpandPopupMenuContentsChanged, this, _1));
    }

    if( (whichField & ExpandButtonFieldMask) ||
        (whichField & EditorFieldMask) ||
        (whichField & EditableFieldMask) ||
        (whichField & ComponentGeneratorSelectedItemFieldMask))
    {
        clearChildren();
        if(getExpandButton() != NULL)
        {
            getExpandButton()->setEnabled(getEnabled());
            pushToChildren(getExpandButton());
        }
        if(getEditable() && getEditor() != NULL && getEditor()->getEditorComponent() != NULL)
        {
            getEditor()->getEditorComponent()->setEnabled(getEnabled());
            pushToChildren(getEditor()->getEditorComponent());
        }
        if(!getEditable() && getComponentGeneratorSelectedItem() != NULL)
        {
            getComponentGeneratorSelectedItem()->setEnabled(getEnabled());
            pushToChildren(getComponentGeneratorSelectedItem());
        }
    }

    if( (whichField & EditorFieldMask) && getEditor() != NULL)
    {
        _EditorActionConnection = getEditor()->connectActionPerformed(boost::bind(&ComboBox::handleEditorAction, this, _1));
    }

    if(whichField & ModelFieldMask)
    {
        if(getModel() != NULL)
        {
            getComboListPopupMenu()->setModel(getModel());

            _ContentsChangedConnection = getModel()->connectListDataContentsChanged(boost::bind(&ComboBox::handleContentsChanged, this, _1));
            _ContentsIntervalAddedConnection = getModel()->connectListDataIntervalAdded(boost::bind(&ComboBox::handleContentsIntervalAdded, this, _1));
            _ContentsIntervalRemovedConnection = getModel()->connectListDataIntervalRemoved(boost::bind(&ComboBox::handleContentsIntervalRemoved, this, _1));
            _SelectionChangedConnection = getModel()->connectSelectionChanged(boost::bind(&ComboBox::handleSelectionChanged, this, _1));
            updateListFromModel();
        }
    }

    if(((whichField & CellGeneratorFieldMask) ||
        (whichField & ComboListPopupMenuFieldMask)) &&
       getCellGenerator() != NULL)
    {
        getComboListPopupMenu()->setCellGenerator(getCellGenerator());
    }
}
SearchResultTreeItem::~SearchResultTreeItem()
{
    clearChildren();
}
Beispiel #16
0
ILayoutBox::~ILayoutBox()
{
    clearChildren();
}
void ScrollBar::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    //Do not respond to changes that have a Sync origin
    if(origin & ChangedOrigin::Sync)
    {
        return;
    }

    if( (whichField & VerticalMinButtonFieldMask) ||
        (whichField & VerticalMaxButtonFieldMask) ||
        (whichField & VerticalScrollBarFieldMask) ||
        (whichField & VerticalScrollFieldFieldMask)||
        (whichField & HorizontalMinButtonFieldMask) ||
        (whichField & HorizontalMaxButtonFieldMask) ||
        (whichField & HorizontalScrollBarFieldMask) ||
        (whichField & HorizontalScrollFieldFieldMask) ||
        (whichField & OrientationFieldMask) )
    {
            clearChildren();
            if(getOrientation() == ScrollBar::VERTICAL_ORIENTATION)
            {
                if(getVerticalScrollField() != NULL) {pushToChildren(getVerticalScrollField());}
                if(getVerticalScrollBar() != NULL) {pushToChildren(getVerticalScrollBar());}
                if(getVerticalMinButton() != NULL) {pushToChildren(getVerticalMinButton());}
                if(getVerticalMaxButton() != NULL) {pushToChildren(getVerticalMaxButton());}
            }
            else
            {
                if(getHorizontalScrollField() != NULL) {pushToChildren(getHorizontalScrollField());}
                if(getHorizontalScrollBar() != NULL) {pushToChildren(getHorizontalScrollBar());}
                if(getHorizontalMinButton() != NULL) {pushToChildren(getHorizontalMinButton());}
                if(getHorizontalMaxButton() != NULL) {pushToChildren(getHorizontalMaxButton());}
            }
    }

    if(getOrientation() == ScrollBar::VERTICAL_ORIENTATION)
    {
        if(whichField & VerticalMinButtonFieldMask)
        {
            _MinActionConnection.disconnect();
            if(getVerticalMinButton() != NULL)
            {
                _MinActionConnection = getVerticalMinButton()->connectMousePressedActionPerformed(boost::bind(&ScrollBar::handleMinButtonAction, this, _1));
            }
        }

        if(whichField & VerticalMaxButtonFieldMask)
        {
            _MaxActionConnection.disconnect();
            if(getVerticalMaxButton() != NULL)
            {
                _MaxActionConnection = getVerticalMaxButton()->connectMousePressedActionPerformed(boost::bind(&ScrollBar::handleMaxButtonAction, this, _1));
            }
        }
        
        if(whichField & VerticalScrollBarFieldMask)
        {
            _ScrollBarMousePressedConnection.disconnect();
            if(getVerticalScrollBar() != NULL)
            {
                _ScrollBarMousePressedConnection = getVerticalScrollBar()->connectMousePressed(boost::bind(&ScrollBar::handleScrollBarMousePressed, this, _1));
            }
        }
        
        if(whichField & VerticalScrollFieldFieldMask)
        {
            _ScrollFieldActionConnection.disconnect();
            if(getVerticalScrollField() != NULL)
            {
                _ScrollFieldActionConnection = getVerticalScrollField()->connectActionPerformed(boost::bind(&ScrollBar::handleScrollFieldAction, this, _1));
            }
        }
    }
    else
    {
        if(whichField & HorizontalMinButtonFieldMask)
        {
            _MinActionConnection.disconnect();
            if(getHorizontalMinButton() != NULL)
            {
                _MinActionConnection = getHorizontalMinButton()->connectMousePressedActionPerformed(boost::bind(&ScrollBar::handleMinButtonAction, this, _1));
            }
        }

        if(whichField & HorizontalMaxButtonFieldMask)
        {
            _MaxActionConnection.disconnect();
            if(getHorizontalMaxButton() != NULL)
            {
                _MaxActionConnection = getHorizontalMaxButton()->connectMousePressedActionPerformed(boost::bind(&ScrollBar::handleMaxButtonAction, this, _1));
            }
        }
        
        if(whichField & HorizontalScrollBarFieldMask)
        {
            _ScrollBarMousePressedConnection.disconnect();
            if(getHorizontalScrollBar() != NULL)
            {
                _ScrollBarMousePressedConnection = getHorizontalScrollBar()->connectMousePressed(boost::bind(&ScrollBar::handleScrollBarMousePressed, this, _1));
            }
        }
        
        if(whichField & HorizontalScrollFieldFieldMask)
        {
            _ScrollFieldActionConnection.disconnect();
            if(getHorizontalScrollField() != NULL)
            {
                _ScrollFieldActionConnection = getHorizontalScrollField()->connectActionPerformed(boost::bind(&ScrollBar::handleScrollFieldAction, this, _1));
            }
        }
    }

	if(whichField & EnabledFieldMask)
	{
		if(getVerticalMinButton() != NULL)
		{
				getVerticalMinButton()->setEnabled(getEnabled());
		}
		if(getVerticalMaxButton() != NULL)
		{
				getVerticalMaxButton()->setEnabled(getEnabled());
		}
		if(getVerticalScrollBar() != NULL)
		{
				getVerticalScrollBar()->setEnabled(getEnabled());
		}
		if(getVerticalScrollField() != NULL)
		{
				getVerticalScrollField()->setEnabled(getEnabled());
		}
		if(getHorizontalMinButton() != NULL)
		{
				getHorizontalMinButton()->setEnabled(getEnabled());
		}
		if(getHorizontalMaxButton() != NULL)
		{
				getHorizontalMaxButton()->setEnabled(getEnabled());
		}
		if(getHorizontalScrollBar() != NULL)
		{
				getHorizontalScrollBar()->setEnabled(getEnabled());
		}
		if(getHorizontalScrollField() != NULL)
		{
				getHorizontalScrollField()->setEnabled(getEnabled());
		}
	}
    if(whichField & RangeModelFieldMask)
    {
        _RangeModelConnection.disconnect();
        if(getRangeModel() != NULL)
        {
            _RangeModelConnection = getRangeModel()->connectStateChanged(boost::bind(&ScrollBar::handleRangeModelStateChanged, this, _1));
        }
    }
}
 CompositeNode::~CompositeNode()
 {
     clearChildren();
 }
Beispiel #19
0
void ScrollBar::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    if( (whichField & VerticalMinButtonFieldMask) ||
        (whichField & VerticalMaxButtonFieldMask) ||
        (whichField & VerticalScrollBarFieldMask) ||
        (whichField & VerticalScrollFieldFieldMask)||
        (whichField & HorizontalMinButtonFieldMask) ||
        (whichField & HorizontalMaxButtonFieldMask) ||
        (whichField & HorizontalScrollBarFieldMask) ||
        (whichField & HorizontalScrollFieldFieldMask) ||
        (whichField & OrientationFieldMask) )
    {
            clearChildren();
            if(getOrientation() == ScrollBar::VERTICAL_ORIENTATION)
            {
                if(getVerticalScrollField() != NULL) {pushToChildren(getVerticalScrollField());}
                if(getVerticalScrollBar() != NULL) {pushToChildren(getVerticalScrollBar());}
                if(getVerticalMinButton() != NULL) {pushToChildren(getVerticalMinButton());}
                if(getVerticalMaxButton() != NULL) {pushToChildren(getVerticalMaxButton());}
            }
            else
            {
                if(getHorizontalScrollField() != NULL) {pushToChildren(getHorizontalScrollField());}
                if(getHorizontalScrollBar() != NULL) {pushToChildren(getHorizontalScrollBar());}
                if(getHorizontalMinButton() != NULL) {pushToChildren(getHorizontalMinButton());}
                if(getHorizontalMaxButton() != NULL) {pushToChildren(getHorizontalMaxButton());}
            }
    }

    if((whichField & VerticalMinButtonFieldMask) &&
        getVerticalMinButton() != NULL)
    {
        getVerticalMinButton()->addMousePressedActionListener(&_MinButtonActionListener);
    }

    if((whichField & VerticalMaxButtonFieldMask) &&
        getVerticalMaxButton() != NULL)
    {
        getVerticalMaxButton()->addMousePressedActionListener(&_MaxButtonActionListener);
    }
    
    if((whichField & VerticalScrollBarFieldMask) &&
        getVerticalScrollBar() != NULL)
    {
        getVerticalScrollBar()->addMouseListener(&_ScrollBarListener);
    }
    
    if((whichField & VerticalScrollFieldFieldMask) &&
        getVerticalScrollField() != NULL)
    {
        getVerticalScrollField()->addMousePressedActionListener(&_ScrollFieldListener);
    }
    
    if((whichField & HorizontalMinButtonFieldMask) &&
        getHorizontalMinButton() != NULL)
    {
        getHorizontalMinButton()->addMousePressedActionListener(&_MinButtonActionListener);
    }

    if((whichField & HorizontalMaxButtonFieldMask) &&
        getHorizontalMaxButton() != NULL)
    {
        getHorizontalMaxButton()->addMousePressedActionListener(&_MaxButtonActionListener);
    }
    
    if((whichField & HorizontalScrollBarFieldMask) &&
        getHorizontalScrollBar() != NULL)
    {
        getHorizontalScrollBar()->addMouseListener(&_ScrollBarListener);
    }
    
    if((whichField & HorizontalScrollFieldFieldMask) &&
        getHorizontalScrollField() != NULL)
    {
        getHorizontalScrollField()->addMousePressedActionListener(&_ScrollFieldListener);
    }

	if(whichField & EnabledFieldMask)
	{
		if(getVerticalMinButton() != NULL)
		{
				getVerticalMinButton()->setEnabled(getEnabled());
		}
		if(getVerticalMaxButton() != NULL)
		{
				getVerticalMaxButton()->setEnabled(getEnabled());
		}
		if(getVerticalScrollBar() != NULL)
		{
				getVerticalScrollBar()->setEnabled(getEnabled());
		}
		if(getVerticalScrollField() != NULL)
		{
				getVerticalScrollField()->setEnabled(getEnabled());
		}
		if(getHorizontalMinButton() != NULL)
		{
				getHorizontalMinButton()->setEnabled(getEnabled());
		}
		if(getHorizontalMaxButton() != NULL)
		{
				getHorizontalMaxButton()->setEnabled(getEnabled());
		}
		if(getHorizontalScrollBar() != NULL)
		{
				getHorizontalScrollBar()->setEnabled(getEnabled());
		}
		if(getHorizontalScrollField() != NULL)
		{
				getHorizontalScrollField()->setEnabled(getEnabled());
		}
	}
    if(whichField & RangeModelFieldMask)
    {
        if(getRangeModel() != NULL)
        {
            _RangeModelConnection = getRangeModel()->addChangeListener(&_BoundedRangeModelChangeListener);
        }
    }
}
Beispiel #20
0
void TcJSONObject::clear()
{
    clearChildren();
    init();
}
Beispiel #21
0
void TabPanel::removeAllTabs(void)
{
    clearChildren();
    clearTabs();
    clearTabContents();
}
Beispiel #22
0
XProcessItem::~XProcessItem()
{
    resetColumns();
    clearChildren();
}
Beispiel #23
0
Node::~Node()
{
    clearChildren();
}
void RotatedComponent::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    //Do not respond to changes that have a Sync origin
    if(origin & ChangedOrigin::Sync)
    {
        return;
    }

    if(whichField & InternalComponentFieldMask)
    {
            clearChildren();
            if(getInternalComponent() != NULL)
            {
                pushToChildren(getInternalComponent());
            }
    }
        
    if((whichField & InternalComponentFieldMask) ||
       (whichField & AngleFieldMask) || 
       (whichField & ResizePolicyFieldMask))
    {
        if(getInternalComponent() != NULL)
        {
            Vec2f Size;
            switch (static_cast<ResizePolicy>(getResizePolicy()))
            {
            case RESIZE_TO_MIN:
                {
                    //Treat TopLeft as 0,0
                    //Get the Rotated Bounds of the Internal Component
                    Pnt2f p1,p2,p3,p4;

                    Pnt2f ComponentCenter(static_cast<Real32>(getInternalComponent()->getSize().x())/2.0, static_cast<Real32>(getInternalComponent()->getSize().y())/2.0);

                    p1 = -ComponentCenter;
                    p2.setValues(ComponentCenter.x(),-ComponentCenter.y());
                    p3 = ComponentCenter;
                    p4.setValues(-ComponentCenter.x(),ComponentCenter.y());

                    //Rotate them
                    p1 = Rotate(p1, -getAngle());
                    p2 = Rotate(p2, -getAngle());
                    p3 = Rotate(p3, -getAngle());
                    p4 = Rotate(p4, -getAngle());

                    //Get their min and max
                    Pnt2f Min(osgMin(osgMin(osgMin(p1.x(),p2.x()),p3.x()),p4.x()),
                              osgMin(osgMin(osgMin(p1.y(),p2.y()),p3.y()),p4.y()));
                    Pnt2f Max(osgMax(osgMax(osgMax(p1.x(),p2.x()),p3.x()),p4.x()),
                              osgMax(osgMax(osgMax(p1.y(),p2.y()),p3.y()),p4.y()));
                    
	                Pnt2f BorderTopLeft, BorderBottomRight;
	                getInsideInsetsBounds(BorderTopLeft, BorderBottomRight);
	                Pnt2f TopLeft, BottomRight;
	                getBounds(TopLeft, BottomRight);
                    
                        setPreferredSize(Vec2f(Max.x() - Min.x() + (BorderTopLeft.x() - TopLeft.x()) + (BottomRight.x() - BorderBottomRight.x()),
                                               Max.y() - Min.y() + (BorderTopLeft.y() - TopLeft.y()) + (BottomRight.y() - BorderBottomRight.y())));
                    break;
                }
            case RESIZE_TO_MAX:
                {
                    //Get the Internal Components Center
                    Pnt2f ComponentCenter(static_cast<Real32>(getInternalComponent()->getSize().x())/2.0, static_cast<Real32>(getInternalComponent()->getSize().y())/2.0);
                    //Get the distance from the Center to one of the TopLeft Corner
                    Real32 Length = 2*ComponentCenter.dist(Pnt2f(0,0));
                    
                        setPreferredSize(Vec2f(Length,Length));
                    break;
                }
            case NO_RESIZING:
            default:
                break;
            }
            getInternalComponent()->updateClipBounds();

			//Check the Mouse
			if( getParentWindow() != NULL &&
				getParentWindow()->getParentDrawingSurface() != NULL &&
				getParentWindow()->getParentDrawingSurface()->getEventProducer() != NULL)
			{
				Pnt2f MouseLoc(getParentWindow()->getParentDrawingSurface()->getEventProducer()->getMousePosition());
				MouseEventDetailsUnrecPtr e = MouseEventDetails::create(getParentWindow()->getParentDrawingSurface()->getEventProducer(),getSystemTime(),MouseEventDetails::NO_BUTTON,0,MouseLoc, NULL);
				checkMouseEnterExit(e,e->getLocation(),getInternalComponent(),getInternalComponent()->isContained(MouseLoc, true),e->getViewport());
			}
        }
    }
}
Beispiel #25
0
Work::~Work()
{
    clearChildren();
}
ApplyLedgerChainWork::~ApplyLedgerChainWork()
{
    clearChildren();
}
Beispiel #27
0
void ossimXmlNode::setChildren(ossimXmlNode::ChildListType& children)
{
    clearChildren();
    addChildren(children);
}
void RGBColorChooserPanel::buildChooser(void)
{
    //Bounded Range Models
    _RedModel->setMinimum(0);
    _RedModel->setMaximum(255);

    _GreenModel->setMinimum(0);
    _GreenModel->setMaximum(255);

    _BlueModel->setMinimum(0);
    _BlueModel->setMaximum(255);

    _AlphaModel->setMinimum(0);
    _AlphaModel->setMaximum(255);


    //Spinners
    _RedSpinner = Spinner::create();
    _RedSpinner->setModel(_RedModel->getSpinnerModel());

    _GreenSpinner = Spinner::create();
    _GreenSpinner->setModel(_GreenModel->getSpinnerModel());

    _BlueSpinner = Spinner::create();
    _BlueSpinner->setModel(_BlueModel->getSpinnerModel());

    if(getIncludeAlpha())
    {
        _AlphaSpinner = Spinner::create();
        _AlphaSpinner->setModel(_AlphaModel->getSpinnerModel());
    }

    //Sliders
    _RedSliderTrackBackground = GradientLayer::create();
    _RedSliderTrackBackground->setStartPosition(Vec2f(0.0f,0.0f));
    _RedSliderTrackBackground->setEndPosition(Vec2f(1.0f,0.0f));

    UIDrawObjectCanvasRefPtr RedSliderTrackCanvas = UIDrawObjectCanvas::create();
    RedSliderTrackCanvas->setPreferredSize(Vec2f(15.0f,15.0f));
    RedSliderTrackCanvas->setBorders(NULL);
    RedSliderTrackCanvas->setBackgrounds(_RedSliderTrackBackground);

    _RedSlider = Slider::create();
    _RedSlider->setDrawLabels(false);
    _RedSlider->setDrawMajorTicks(false);
    _RedSlider->setDrawMinorTicks(false);
    _RedSlider->setOrientation(Slider::HORIZONTAL_ORIENTATION);
    _RedSlider->setTrackDrawObject(RedSliderTrackCanvas);
    _RedSlider->setRangeModel(_RedModel->getBoundedRangeModel());

    //Green
    _GreenSliderTrackBackground = GradientLayer::create();
    _GreenSliderTrackBackground->setStartPosition(Vec2f(0.0f,0.0f));
    _GreenSliderTrackBackground->setEndPosition(Vec2f(1.0f,0.0f));

    UIDrawObjectCanvasRefPtr GreenSliderTrackCanvas = UIDrawObjectCanvas::create();
    GreenSliderTrackCanvas->setPreferredSize(Vec2f(15.0f,15.0f));
    GreenSliderTrackCanvas->setBorders(NULL);
    GreenSliderTrackCanvas->setBackgrounds(_GreenSliderTrackBackground);

    _GreenSlider = Slider::create();
    _GreenSlider->setDrawLabels(false);
    _GreenSlider->setDrawMajorTicks(false);
    _GreenSlider->setDrawMinorTicks(false);
    _GreenSlider->setOrientation(Slider::HORIZONTAL_ORIENTATION);;
    _GreenSlider->setTrackDrawObject(GreenSliderTrackCanvas);
    _GreenSlider->setRangeModel(_GreenModel->getBoundedRangeModel());

    //Blue
    _BlueSliderTrackBackground = GradientLayer::create();
    _BlueSliderTrackBackground->setStartPosition(Vec2f(0.0f,0.0f));
    _BlueSliderTrackBackground->setEndPosition(Vec2f(1.0f,0.0f));

    UIDrawObjectCanvasRefPtr BlueSliderTrackCanvas = UIDrawObjectCanvas::create();
    BlueSliderTrackCanvas->setPreferredSize(Vec2f(15.0f,15.0f));
    BlueSliderTrackCanvas->setBorders(NULL);
    BlueSliderTrackCanvas->setBackgrounds(_BlueSliderTrackBackground);

    _BlueSlider = Slider::create();
    _BlueSlider->setDrawLabels(false);
    _BlueSlider->setDrawMajorTicks(false);
    _BlueSlider->setDrawMinorTicks(false);
    _BlueSlider->setOrientation(Slider::HORIZONTAL_ORIENTATION);;
    _BlueSlider->setTrackDrawObject(BlueSliderTrackCanvas);
    _BlueSlider->setRangeModel(_BlueModel->getBoundedRangeModel());

    if(getIncludeAlpha())
    {
        _AlphaSliderTrackBackground = GradientLayer::create();
        _AlphaSliderTrackBackground->setStartPosition(Vec2f(0.0f,0.0f));
        _AlphaSliderTrackBackground->setEndPosition(Vec2f(1.0f,0.0f));

        UIDrawObjectCanvasRefPtr AlphaSliderTrackCanvas = UIDrawObjectCanvas::create();
        AlphaSliderTrackCanvas->setPreferredSize(Vec2f(15.0f,15.0f));
        AlphaSliderTrackCanvas->setBorders(NULL);
        AlphaSliderTrackCanvas->setBackgrounds(_AlphaSliderTrackBackground);

        _AlphaSlider = Slider::create();
        _AlphaSlider->setDrawLabels(false);
        _AlphaSlider->setDrawMajorTicks(false);
        _AlphaSlider->setDrawMinorTicks(false);
        _AlphaSlider->setOrientation(Slider::HORIZONTAL_ORIENTATION);;
        _AlphaSlider->setTrackDrawObject(AlphaSliderTrackCanvas);
        _AlphaSlider->setRangeModel(_AlphaModel->getBoundedRangeModel());
    }

    //Labels
    LabelRefPtr RedLabel = Label::create();
    RedLabel->setText("Red");
    RedLabel->setPreferredSize(Vec2f(50.0f, RedLabel->getPreferredSize().y()));
    RedLabel->setBackgrounds(NULL);
    RedLabel->setBorders(NULL);

    LabelRefPtr GreenLabel = Label::create();
    GreenLabel->setText("Green");
    GreenLabel->setPreferredSize(Vec2f(50.0f, GreenLabel->getPreferredSize().y()));
    GreenLabel->setBackgrounds(NULL);
    GreenLabel->setBorders(NULL);

    LabelRefPtr BlueLabel = Label::create();
    BlueLabel->setText("Blue");
    BlueLabel->setPreferredSize(Vec2f(50.0f, BlueLabel->getPreferredSize().y()));
    BlueLabel->setBackgrounds(NULL);
    BlueLabel->setBorders(NULL);

    LabelRefPtr AlphaLabel = Label::create();
    if(getIncludeAlpha())
    {
        AlphaLabel->setText("Alpha");
        AlphaLabel->setPreferredSize(Vec2f(50.0f, AlphaLabel->getPreferredSize().y()));
        AlphaLabel->setBackgrounds(NULL);
        AlphaLabel->setBorders(NULL);
    }

    //Layout
    SpringLayoutRefPtr RGBPanelLayout = SpringLayout::create();

    //Red
    //Label
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, RedLabel, 5.0f, SpringLayoutConstraints::WEST_EDGE, this);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, RedLabel, 5.0f, SpringLayoutConstraints::NORTH_EDGE, this);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, RedLabel, LayoutSpringUnrecPtr(LayoutSpring::width(RedLabel)));
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, RedLabel, LayoutSpringUnrecPtr(LayoutSpring::height(RedLabel)));

    //Slider
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _RedSlider, 5.0f, SpringLayoutConstraints::EAST_EDGE, RedLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _RedSlider, -5.0f, SpringLayoutConstraints::WEST_EDGE, _RedSpinner);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _RedSlider, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, RedLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _RedSlider, LayoutSpringUnrecPtr(LayoutSpring::height(_RedSlider)));

    //Spinner
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _RedSpinner, -5.0f, SpringLayoutConstraints::EAST_EDGE, this);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _RedSpinner, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, RedLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, _RedSpinner, LayoutSpringUnrecPtr(LayoutSpring::width(_RedSpinner)));
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _RedSpinner, LayoutSpringUnrecPtr(LayoutSpring::height(_RedSpinner)));

    //Green
    //Label
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, GreenLabel, 5.0f, SpringLayoutConstraints::WEST_EDGE, this);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, GreenLabel, 5.0f, SpringLayoutConstraints::SOUTH_EDGE, RedLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, GreenLabel, LayoutSpringUnrecPtr(LayoutSpring::width(GreenLabel)));
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, GreenLabel, LayoutSpringUnrecPtr(LayoutSpring::height(GreenLabel)));

    //Slider
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _GreenSlider, 5.0f, SpringLayoutConstraints::EAST_EDGE, GreenLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _GreenSlider, -5.0f, SpringLayoutConstraints::WEST_EDGE, _GreenSpinner);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _GreenSlider, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, GreenLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _GreenSlider, LayoutSpringUnrecPtr(LayoutSpring::height(_GreenSlider)));

    //Spinner
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _GreenSpinner, -5.0f, SpringLayoutConstraints::EAST_EDGE, this);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _GreenSpinner, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, GreenLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, _GreenSpinner, LayoutSpringUnrecPtr(LayoutSpring::width(_GreenSpinner)));
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _GreenSpinner, LayoutSpringUnrecPtr(LayoutSpring::height(_GreenSpinner)));

    //Blue
    //Label
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, BlueLabel, 5.0f, SpringLayoutConstraints::WEST_EDGE, this);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, BlueLabel, 5.0f, SpringLayoutConstraints::SOUTH_EDGE, GreenLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, BlueLabel, LayoutSpringUnrecPtr(LayoutSpring::width(BlueLabel)));
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, BlueLabel, LayoutSpringUnrecPtr(LayoutSpring::height(BlueLabel)));

    //Slider
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _BlueSlider, 5.0f, SpringLayoutConstraints::EAST_EDGE, BlueLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _BlueSlider, -5.0f, SpringLayoutConstraints::WEST_EDGE, _BlueSpinner);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _BlueSlider, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, BlueLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _BlueSlider, LayoutSpringUnrecPtr(LayoutSpring::height(_BlueSlider)));

    //Spinner
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _BlueSpinner, -5.0f, SpringLayoutConstraints::EAST_EDGE, this);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _BlueSpinner, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, BlueLabel);
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, _BlueSpinner, LayoutSpringUnrecPtr(LayoutSpring::width(_BlueSpinner)));
    RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _BlueSpinner, LayoutSpringUnrecPtr(LayoutSpring::height(_BlueSpinner)));

    if(getIncludeAlpha())
    {
        //Alpha
        //Label
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, AlphaLabel, 5.0f, SpringLayoutConstraints::WEST_EDGE, this);
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, AlphaLabel, 5.0f, SpringLayoutConstraints::SOUTH_EDGE, BlueLabel);
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, AlphaLabel, LayoutSpringUnrecPtr(LayoutSpring::width(AlphaLabel)));
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, AlphaLabel, LayoutSpringUnrecPtr(LayoutSpring::height(AlphaLabel)));

        //Slider
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _AlphaSlider, 5.0f, SpringLayoutConstraints::EAST_EDGE, AlphaLabel);
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _AlphaSlider, -5.0f, SpringLayoutConstraints::WEST_EDGE, _AlphaSpinner);
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _AlphaSlider, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, AlphaLabel);
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _AlphaSlider, LayoutSpringUnrecPtr(LayoutSpring::height(_AlphaSlider)));

        //Spinner
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _AlphaSpinner, -5, SpringLayoutConstraints::EAST_EDGE, this);
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _AlphaSpinner, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, AlphaLabel);
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, _AlphaSpinner, LayoutSpringUnrecPtr(LayoutSpring::width(_AlphaSpinner)));
        RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _AlphaSpinner, LayoutSpringUnrecPtr(LayoutSpring::height(_AlphaSpinner)));
    }

    clearChildren();
    pushToChildren(RedLabel);
    pushToChildren(_RedSlider);
    pushToChildren(_RedSpinner);
    pushToChildren(GreenLabel);
    pushToChildren(_GreenSlider);
    pushToChildren(_GreenSpinner);
    pushToChildren(BlueLabel);
    pushToChildren(_BlueSlider);
    pushToChildren(_BlueSpinner);
    if(getIncludeAlpha())
    {
        pushToChildren(AlphaLabel);
        pushToChildren(_AlphaSlider);
        pushToChildren(_AlphaSpinner);
    }
    setLayout(RGBPanelLayout);
}
ApplyBucketsWork::~ApplyBucketsWork()
{
    clearChildren();
}
BucketDownloadWork::~BucketDownloadWork()
{
    clearChildren();
}