diff --git a/headers/os/interface/ChannelSlider.h b/headers/os/interface/ChannelSlider.h index 5151ef14b1..23de9a239d 100644 --- a/headers/os/interface/ChannelSlider.h +++ b/headers/os/interface/ChannelSlider.h @@ -84,6 +84,8 @@ public: virtual float ThumbDeltaFor(int32 channel); virtual float ThumbRangeFor(int32 channel); + virtual void UpdateToolTip(int32 currentValue); + private: // FBC padding BChannelSlider(const BChannelSlider&); @@ -97,7 +99,6 @@ private: virtual void _Reserved_BChannelSlider_4(void*, ...); virtual void _Reserved_BChannelSlider_5(void*, ...); virtual void _Reserved_BChannelSlider_6(void*, ...); - virtual void _Reserved_BChannelSlider_7(void*, ...); private: void _InitData(); diff --git a/src/kits/interface/ChannelSlider.cpp b/src/kits/interface/ChannelSlider.cpp index ef17bbb376..b73ffbf481 100644 --- a/src/kits/interface/ChannelSlider.cpp +++ b/src/kits/interface/ChannelSlider.cpp @@ -701,6 +701,15 @@ BChannelSlider::ThumbRangeFor(int32 channel) } +void +BChannelSlider::UpdateToolTip(int32 currentValue) +{ + BString valueString; + valueString.SetToFormat("%" B_PRId32, currentValue); + SetToolTip(valueString); +} + + // #pragma mark - @@ -821,10 +830,7 @@ BChannelSlider::_DrawThumbs() // draw some kind of current value tool tip if (fCurrentChannel != -1 && fMinPoint != 0) { - char valueString[32]; - snprintf(valueString, 32, "%" B_PRId32, - ValueFor(fCurrentChannel)); - SetToolTip(valueString); + UpdateToolTip(ValueFor(fCurrentChannel)); ShowToolTip(ToolTip()); } else { HideToolTip(); @@ -900,4 +906,3 @@ void BChannelSlider::_Reserved_BChannelSlider_3(void*, ...) {} void BChannelSlider::_Reserved_BChannelSlider_4(void*, ...) {} void BChannelSlider::_Reserved_BChannelSlider_5(void*, ...) {} void BChannelSlider::_Reserved_BChannelSlider_6(void*, ...) {} -void BChannelSlider::_Reserved_BChannelSlider_7(void*, ...) {} diff --git a/src/kits/media/DefaultMediaTheme.cpp b/src/kits/media/DefaultMediaTheme.cpp index 8ea04bc459..799ae8763b 100644 --- a/src/kits/media/DefaultMediaTheme.cpp +++ b/src/kits/media/DefaultMediaTheme.cpp @@ -104,6 +104,7 @@ class ChannelSlider : public BChannelSlider { virtual void AttachedToWindow(); virtual void DetachedFromWindow(); + virtual void UpdateToolTip(int32 currentValue); private: BContinuousParameter &fParameter; }; @@ -432,6 +433,15 @@ ChannelSlider::DetachedFromWindow() } +void +ChannelSlider::UpdateToolTip(int32 currentValue) +{ + BString valueString; + valueString.SetToFormat("%.1f", currentValue / 1000.0); + SetToolTip(valueString); +} + + TextControl::TextControl(const char* name, const char* label, BTextParameter ¶meter) : BTextControl(name, label, "", NULL),