37 Base::initialiseOverride();
42 if (
nullptr == mClient)
47 if (
nullptr == mClient)
55 mTrackWidth = utility::parseValue<int>(
getUserString(
"TrackWidth"));
59 mTrackMin = utility::parseValue<int>(
getUserString(
"TrackMin"));
62 mTrackMin = mTrackWidth;
65 mTrackStep = utility::parseValue<int>(
getUserString(
"TrackStep"));
68 mFillTrack = utility::parseValue<bool>(
getUserString(
"TrackFill"));
71 mTrackStep = mTrackWidth;
81 Base::shutdownOverride();
86 if (mAutoTrack)
return;
88 if (mEndPosition > mRange) mEndPosition = mRange;
89 if (mStartPosition > mRange) mStartPosition = mRange;
95 if (mAutoTrack)
return;
97 if (mEndPosition > mRange) mEndPosition = mRange;
103 if (mAutoTrack == _auto)
return;
110 mEndPosition = mStartPosition = 0;
111 mAutoPosition = 0.0f;
116 mRange = mEndPosition = mStartPosition = 0;
121 void ProgressBar::frameEntered(
float _time)
123 if (!mAutoTrack)
return;
125 size_t pos = (size_t)mAutoPosition;
129 if (pos > mRange) mEndPosition = mRange;
130 else mEndPosition = size_t(mAutoPosition);
140 Base::setPosition(_point);
145 Base::setSize(_size);
152 Base::setCoord(_coord);
157 void ProgressBar::updateTrack()
160 if ((0 == mRange) || (0 == mEndPosition))
162 for (VectorWidgetPtr::iterator iter = mVectorTrack.begin(); iter != mVectorTrack.end(); ++iter)
164 (*iter)->setVisible(
false);
172 if (mVectorTrack.empty())
175 mVectorTrack.push_back(widget);
180 VectorWidgetPtr::iterator iter = mVectorTrack.begin();
181 (*iter)->setVisible(
true);
186 for (; iter != mVectorTrack.end(); ++iter)
188 (*iter)->setVisible(
false);
192 Widget* wid = mVectorTrack.front();
195 if ((0 == mStartPosition) && (mRange == mEndPosition))
197 setTrackPosition(wid, 0, 0, getClientWidth(), getClientHeight());
202 int pos = (int)mStartPosition * (getClientWidth() - mTrackMin) / (
int)mRange;
203 setTrackPosition(wid, pos, 0, ((
int)mEndPosition * (getClientWidth() - mTrackMin) / (
int)mRange) - pos + mTrackMin, getClientHeight());
210 int width = getClientWidth() - mTrackWidth + mTrackStep;
211 int count = width / mTrackStep;
212 int ost = (width % mTrackStep);
215 width += mTrackStep - ost;
219 while ((
int)mVectorTrack.size() < count)
222 widget->setVisible(
false);
223 mVectorTrack.push_back(widget);
227 if ((0 == mStartPosition) && (mRange == mEndPosition))
230 for (VectorWidgetPtr::iterator iter = mVectorTrack.begin(); iter != mVectorTrack.end(); ++iter)
233 (*iter)->setVisible(
true);
234 setTrackPosition(*iter, pos * mTrackStep, 0, mTrackWidth, getClientHeight());
242 int hide_pix = (width * (int)mStartPosition / (
int)mRange);
243 int hide_count = hide_pix / mTrackStep;
245 int show_pix = (width * (
int)mEndPosition / (
int)mRange);
246 int show_count = show_pix / mTrackStep;
249 for (
VectorWidgetPtr::iterator iter = mVectorTrack.begin(); iter != mVectorTrack.end(); ++iter)
253 (*iter)->setVisible(
false);
255 else if (0 == show_count)
257 (*iter)->setAlpha((
float)(show_pix % mTrackStep) / (
float)mTrackStep);
258 (*iter)->setVisible(
true);
259 setTrackPosition(*iter, pos * mTrackStep, 0, mTrackWidth, getClientHeight());
265 (*iter)->setVisible(
false);
267 else if (0 == hide_count)
269 (*iter)->setAlpha(1.0f - ((
float)(hide_pix % mTrackStep) / (
float)mTrackStep));
270 (*iter)->setVisible(
true);
271 setTrackPosition(*iter, pos * mTrackStep, 0, mTrackWidth, getClientHeight());
276 (*iter)->setVisible(
true);
277 setTrackPosition(*iter, pos * mTrackStep, 0, mTrackWidth, getClientHeight());
287 void ProgressBar::setTrackPosition(Widget* _widget,
int _left,
int _top,
int _width,
int _height)
295 int ProgressBar::getClientWidth()
300 int ProgressBar::getClientHeight()
307 mFlowDirection = _value;
318 else if (_key ==
"RangePosition")
322 else if (_key ==
"AutoTrack")
326 else if (_key ==
"FlowDirection")
331 Base::setPropertyOverride(_key, _value);
355 return mFlowDirection;