29 #define YUILogComponent "ui"
32 #include "YUISymbols.h"
33 #include "YBarGraph.h"
37 #define CHECK_INDEX(index) \
41 (index) >= (int) priv->segments.size() ) \
43 YUI_THROW( YUIIndexOutOfRangeException( \
46 (int) priv->segments.size() - 1 ) ); \
55 : updatesPending(
false )
56 , postponeUpdates(
false )
59 std::vector<YBarGraphSegment> segments;
71 YUI_CHECK_NEW( priv );
83 YBarGraph::updateDisplay()
85 priv->updatesPending =
true;
87 if ( ! priv->postponeUpdates )
90 priv->updatesPending =
false;
98 priv->segments.push_back( segment );
106 priv->segments.clear();
114 CHECK_INDEX( segmentIndex );
116 return priv->segments[ segmentIndex ];
123 return (
int) priv->segments.size();
130 CHECK_INDEX( segmentIndex );
132 priv->segments[ segmentIndex ].setValue( newValue );
140 CHECK_INDEX( segmentIndex );
142 priv->segments[ segmentIndex ].setLabel( newLabel );
150 CHECK_INDEX( segmentIndex );
155 priv->segments[ segmentIndex ].setSegmentColor( color );
163 CHECK_INDEX( segmentIndex );
168 priv->segments[ segmentIndex ].setTextColor( color );
185 propSet.
add(
YProperty( YUIProperty_Values, YOtherProperty ) );
186 propSet.
add(
YProperty( YUIProperty_Labels, YOtherProperty ) );
199 if ( propertyName == YUIProperty_Values )
return false;
200 else if ( propertyName == YUIProperty_Labels )
return false;
215 if ( propertyName == YUIProperty_Values )
return YPropertyValue( YOtherProperty );
216 else if ( propertyName == YUIProperty_Labels )
return YPropertyValue( YOtherProperty );
227 : _barGraph ( barGraph )
229 YUI_CHECK_PTR( barGraph );
231 _barGraph->priv->postponeUpdates =
true;
237 _barGraph->priv->postponeUpdates =
false;
239 if ( _barGraph->priv->updatesPending )
240 _barGraph->updateDisplay();
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
virtual YPropertyValue getProperty(const std::string &propertyName)
void check(const std::string &propertyName) const
void add(const YProperty &prop)
virtual const YPropertySet & propertySet()
void setLabel(int segmentIndex, const std::string &newLabel)
void setSegmentColor(int segmentIndex, const YColor &color)
void setTextColor(int segmentIndex, const YColor &color)
const YBarGraphSegment & segment(int segmentIndex) const
void setValue(int segmentIndex, int newValue)
YBarGraph(YWidget *parent)
void addSegment(const YBarGraphSegment &segment)
YPropertyType type() const
virtual void doUpdate()=0
YBarGraphMultiUpdate(YBarGraph *barGraph)