void Slider::setValue(Int32 n) { if(getSnapToTicks()) { //Determine the closest tickmark to the value we are trying to set Int32 Div, Mod; Div = (n-getMinimum())/getMinorTickSpacing(); Mod = (n-getMinimum())%getMinorTickSpacing(); if(Mod <= getMajorTickSpacing()/2) { getRangeModel()->setValue(getMinorTickSpacing() * Div + getMinimum()); } else { getRangeModel()->setValue(getMinorTickSpacing() * (Div + 1) + getMinimum()); } } else { getRangeModel()->setValue(n); } }
void ProgressBar::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 & SizeFieldMask)) { setupProgressBar(); } if(whichField & RangeModelFieldMask) { _ProgressStateChangedConnection.disconnect(); if(getRangeModel() != NULL) { _ProgressStateChangedConnection = getRangeModel()->connectStateChanged(boost::bind(&ProgressBar::handleProgressStateChanged, this, _1)); } } }
void Slider::updateSliderTrack(void) { Pnt2f BorderTopLeft, BorderBottomRight; getInsideInsetsBounds(BorderTopLeft, BorderBottomRight); UInt16 MajorAxis, MinorAxis; if(getOrientation() == VERTICAL_ORIENTATION) { MajorAxis = 1; } else { MajorAxis = 0; } MinorAxis = (MajorAxis+1)%2; //Update the Knob position if(getKnobButton() != NULL && getRangeModel() != NULL) { Vec2f Size; Size[MinorAxis] = getKnobButton()->getPreferredSize().x(); Size[MajorAxis] = getKnobButton()->getPreferredSize().y(); Pnt2f AlignedPosition; //Size[MajorAxis] = getSize()[MajorAxis] - 2; Vec2f Alignment(0.5,0.5); Alignment[MajorAxis] = static_cast<Real32>(getValue() - getMinimum())/static_cast<Real32>(getMaximum() - getMinimum()); AlignedPosition = calculateSliderAlignment(getSliderTrackTopLeft(), getSliderTrackSize(), getKnobButton()->getPreferredSize(), Alignment.y(), Alignment.x()); getKnobButton()->setPosition(AlignedPosition); getKnobButton()->setSize(Size); } }
void ScrollBar::setMajorAxisScrollBarPosition(const Pnt2f& Pos) { UInt16 MajorAxis, MinorAxis; if(getOrientation() == ScrollBar::VERTICAL_ORIENTATION) { MajorAxis = 1; } else { MajorAxis = 0; } MinorAxis = (MajorAxis+1)%2; //Calculate the Value Based on the Bar Position //Int32 ScrollValue( static_cast<Real32>(Pos - editScrollField()->getPosition()[MajorAxis])/static_cast<Real32>(editScrollField()->getSize()[MajorAxis]) * (getMaximum() - getMinimum()) + getMinimum()); Int32 ScrollValue(calculateValueFromPosition(Pos)); if(ScrollValue < getMinimum()) { ScrollValue = getMinimum(); } else if(ScrollValue + getExtent() > getMaximum()) { ScrollValue = getMaximum() - getExtent(); } getRangeModel()->setValue(ScrollValue); }
void ScrollBar::updateScrollBarLayout(void) { if(getRangeModel() != NULL && editScrollBar() != NULL) { editScrollBar()->setSize(calculateScrollBarSize()); editScrollBar()->setPosition(calculateScrollBarPosition()); } }
void ProgressBar::setupProgressBar(void) { Pnt2f TopLeft, BottomRight; getInsideBorderBounds(TopLeft, BottomRight); if(getIndeterminate()) { Real32 Pos; if(_IndeterminateBarPosition > 1.0) { Pos = 2.0 - _IndeterminateBarPosition; } else { Pos = _IndeterminateBarPosition; } switch(getOrientation()) { case ProgressBar::HORIZONTAL_ORIENTATION: _ProgressBarPosition.setValues((BottomRight.x() - TopLeft.x())*Pos*(1.0-getIndeterminateBarSize()), TopLeft.y()); _ProgressBarSize.setValues( (BottomRight.x() - TopLeft.x())*getIndeterminateBarSize(),BottomRight.y() - TopLeft.y()); break; case ProgressBar::VERTICAL_ORIENTATION: default: _ProgressBarPosition.setValues( Pos*(BottomRight.x() - TopLeft.x())*(1.0-getIndeterminateBarSize()), TopLeft.y()); _ProgressBarSize.setValues( TopLeft.x(), Pos*(BottomRight.y() - TopLeft.y())*(1.0-getIndeterminateBarSize())); break; } } else { if(getRangeModel() == NULL) {return;} Real32 Percent(getPercentComplete()); _ProgressBarPosition = TopLeft; switch(getOrientation()) { case ProgressBar::HORIZONTAL_ORIENTATION: _ProgressBarSize.setValues( (BottomRight.x() - TopLeft.x())*Percent,BottomRight.y() - TopLeft.y()); break; case ProgressBar::VERTICAL_ORIENTATION: default: _ProgressBarSize.setValues( BottomRight.x() - TopLeft.x(),(BottomRight.y() - TopLeft.y())*Percent); break; } } }
void ScrollBar::updateScrollBarLayout(void) { if(getRangeModel() != NULL && getScrollBar() != NULL) { Vec2f Size(calculateScrollBarSize()); if(getScrollBar()->getSize() != Size) { getScrollBar()->setSize(Size); } Pnt2f Pos(calculateScrollBarPosition()); if(getScrollBar()->getPosition() != Pos) { getScrollBar()->setPosition(Pos); } } }
EventConnection Slider::addChangeListener(ChangeListenerPtr l) { return getRangeModel()->addChangeListener(l); }
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; } } } }
void Slider::updateLayout(void) { UInt16 MajorAxis, MinorAxis; if(getOrientation() == VERTICAL_ORIENTATION) { MajorAxis = 1; } else { MajorAxis = 0; } MinorAxis = (MajorAxis+1)%2; updateSliderTrack(); //Update the Track if(getDrawTrack() && getTrackDrawObject() != NULL) { Pnt2f BorderTopLeft, BorderBottomRight; getInsideInsetsBounds(BorderTopLeft, BorderBottomRight); Vec2f Size(getTrackDrawObject()->getPreferredSize()); Pnt2f AlignedPosition; Size[MajorAxis] = getTrackLength(); if(getOrientation() == VERTICAL_ORIENTATION) { AlignedPosition = calculateAlignment(BorderTopLeft, (BorderBottomRight-BorderTopLeft), Size, 0.5, getAlignment()); } else { AlignedPosition = calculateAlignment(BorderTopLeft, (BorderBottomRight-BorderTopLeft), Size, getAlignment(), 0.5); } getTrackDrawObject()->setPosition(AlignedPosition); getTrackDrawObject()->setSize(Size); } //Update the MinorTickMarks if(getDrawMinorTicks() && getRangeModel() != NULL) { Pnt2f MinorTickTopLeft, MinorTickBottomRight; getDrawObjectBounds(*editMFMinorTickDrawObjects(), MinorTickTopLeft, MinorTickBottomRight); Vec2f Alignment; Real32 MaxLength(0.0); for(UInt32 i(0) ; i<getMFMinorTickDrawObjects()->size() ; ++i) { Pnt2f DrawObjectTopLeft, DrawObjectBottomRight; getMinorTickDrawObjects(i)->getBounds(DrawObjectTopLeft, DrawObjectBottomRight); MaxLength = osgMax(MaxLength, DrawObjectBottomRight.x()-DrawObjectTopLeft.x()); } editMFMinorTickPositions()->clear(); for(UInt32 i(0) ; i< osgAbs<Int32>(getMaximum() - getMinimum())/getMinorTickSpacing() ; ++i) { if( (i * getMinorTickSpacing())%getMajorTickSpacing() != 0 ) { Alignment[MajorAxis] = static_cast<Real32>(i * getMinorTickSpacing())/static_cast<Real32>(getMaximum() - getMinimum()); editMFMinorTickPositions()->push_back( calculateSliderAlignment(getSliderTrackTopLeft(), getSliderTrackSize(), (MinorTickBottomRight - MinorTickTopLeft), Alignment.y(), Alignment.x())); if(getTicksOnRightBottom()) { editMFMinorTickPositions()->back()[MinorAxis] = getTrackDrawObject()->getPosition()[MinorAxis] + getTrackDrawObject()->getSize()[MinorAxis] + getTrackToTickOffset(); } else { editMFMinorTickPositions()->back()[MinorAxis] = getTrackDrawObject()->getPosition()[MinorAxis] - getTrackToTickOffset() - MaxLength; } } } } //Update the MajorTickMarks if(getDrawMajorTicks() && getRangeModel() != NULL) { Pnt2f MajorTickTopLeft, MajorTickBottomRight; getDrawObjectBounds(*editMFMajorTickDrawObjects(), MajorTickTopLeft, MajorTickBottomRight); Vec2f Alignment; Real32 MaxLength(0.0); for(UInt32 i(0) ; i<getMFMajorTickDrawObjects()->size() ; ++i) { Pnt2f DrawObjectTopLeft, DrawObjectBottomRight; getMajorTickDrawObjects(i)->getBounds(DrawObjectTopLeft, DrawObjectBottomRight); MaxLength = osgMax(MaxLength, DrawObjectBottomRight.x()-DrawObjectTopLeft.x()); } editMFMajorTickPositions()->clear(); for(UInt32 i(0) ; i<= osgAbs<Int32>(getMaximum() - getMinimum())/getMajorTickSpacing() ; ++i) { Alignment[MajorAxis] = static_cast<Real32>(i * getMajorTickSpacing())/static_cast<Real32>(getMaximum() - getMinimum()); editMFMajorTickPositions()->push_back( calculateSliderAlignment(getSliderTrackTopLeft(), getSliderTrackSize(), (MajorTickBottomRight - MajorTickTopLeft), Alignment.y(), Alignment.x())); if(getTicksOnRightBottom()) { editMFMajorTickPositions()->back()[MinorAxis] = getTrackDrawObject()->getPosition()[MinorAxis] + getTrackDrawObject()->getSize()[MinorAxis] + getTrackToTickOffset(); } else { editMFMajorTickPositions()->back()[MinorAxis] = getTrackDrawObject()->getPosition()[MinorAxis] - getTrackToTickOffset() - MaxLength; } } } //Update the Labels if(getDrawLabels() && getRangeModel() != NULL) { Vec2f Alignment; Pnt2f Pos; FieldContainerMap::const_iterator Itor; for(Itor = getLabelMap().begin() ; Itor != getLabelMap().end() ; ++Itor) { Alignment[MajorAxis] = static_cast<Real32>((*Itor).first - getMinimum())/static_cast<Real32>(getMaximum() - getMinimum()); Pos = calculateSliderAlignment(getSliderTrackTopLeft(), getSliderTrackSize(), dynamic_pointer_cast<Component>((*Itor).second)->getPreferredSize(), Alignment.y(), Alignment.x()); if(getTicksOnRightBottom()) { Pos[MinorAxis] = getTrackDrawObject()->getPosition()[MinorAxis] + getTrackDrawObject()->getSize()[MinorAxis] + getTrackToLabelOffset(); } else { Pos[MinorAxis] = getTrackDrawObject()->getPosition()[MinorAxis] - getTrackToLabelOffset() - dynamic_pointer_cast<Component>((*Itor).second)->getPreferredSize()[MinorAxis]; } dynamic_pointer_cast<Component>((*Itor).second)->setPosition(Pos); dynamic_pointer_cast<Component>((*Itor).second)->setSize(dynamic_pointer_cast<Component>((*Itor).second)->getPreferredSize()); } } }
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); } } }
void ScrollBar::scrollBlock(const Int32 Blocks) { if(Blocks>0) { if(getRangeModel()->getValue() + getRangeModel()->getExtent() + Blocks * getBlockIncrement() > getRangeModel()->getMaximum()) { getRangeModel()->setValue(getRangeModel()->getMaximum() - getRangeModel()->getExtent()); } else { getRangeModel()->setValue(getRangeModel()->getValue() + Blocks * getBlockIncrement()); } } else if(Blocks < 0) { if(getRangeModel()->getValue() + Blocks * getBlockIncrement() < getRangeModel()->getMinimum()) { getRangeModel()->setValue(getRangeModel()->getMinimum()); } else { getRangeModel()->setValue(getRangeModel()->getValue() + Blocks * getBlockIncrement()); } } }
void ScrollBar::scrollUnit(const Int32 Units) { if(Units>0) { if(getRangeModel()->getValue() + getRangeModel()->getExtent() + Units * getUnitIncrement() > getRangeModel()->getMaximum()) { getRangeModel()->setValue(getRangeModel()->getMaximum() - getRangeModel()->getExtent()); } else { getRangeModel()->setValue(getRangeModel()->getValue() + Units * getUnitIncrement()); } } else if(Units < 0) { if(getRangeModel()->getValue() + Units * static_cast<Int32>(getUnitIncrement()) < getRangeModel()->getMinimum()) { getRangeModel()->setValue(getRangeModel()->getMinimum()); } else { getRangeModel()->setValue(getRangeModel()->getValue() + Units * getUnitIncrement()); } } }
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)); } } }