示例#1
0
Button* ScrollBar::editMaxButton(void) const
{
    if(getOrientation() == ScrollBar::VERTICAL_ORIENTATION)
    {
        return getVerticalMaxButton();
    }
    else
    {
        return getHorizontalMaxButton();
    }
}
示例#2
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);
        }
    }
}
示例#3
0
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));
        }
    }
}