* Exchange the round knob for a standard block thumb again,
albeit a smaller one. Makes the interface look even more standard Haiku-like. * Make sure the volume slider has a reasonable minimum width. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38765 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define KNOB_EMBEDDED 0
|
#define KNOB_EMBEDDED 0
|
||||||
|
#define ROUND_KNOB 0
|
||||||
|
|
||||||
static const rgb_color kGreen = (rgb_color){ 116, 224, 0, 255 };
|
static const rgb_color kGreen = (rgb_color){ 116, 224, 0, 255 };
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@ VolumeSlider::VolumeSlider(const char* name, int32 minValue, int32 maxValue,
|
|||||||
int32 snapValue, BMessage* message)
|
int32 snapValue, BMessage* message)
|
||||||
:
|
:
|
||||||
BSlider(name, NULL, NULL, minValue, maxValue, B_HORIZONTAL,
|
BSlider(name, NULL, NULL, minValue, maxValue, B_HORIZONTAL,
|
||||||
B_TRIANGLE_THUMB),
|
B_BLOCK_THUMB),
|
||||||
fMuted(false),
|
fMuted(false),
|
||||||
fSnapValue(snapValue),
|
fSnapValue(snapValue),
|
||||||
fSnapping(false)
|
fSnapping(false)
|
||||||
@@ -95,17 +96,24 @@ VolumeSlider::MouseMoved(BPoint where, uint32 transit,
|
|||||||
BRect
|
BRect
|
||||||
VolumeSlider::ThumbFrame() const
|
VolumeSlider::ThumbFrame() const
|
||||||
{
|
{
|
||||||
|
#if !ROUND_KNOB
|
||||||
|
BRect rect = BSlider::ThumbFrame();
|
||||||
|
rect.InsetBy(2, 2);
|
||||||
|
rect.bottom += 1;
|
||||||
|
#else
|
||||||
BRect rect(BarFrame());
|
BRect rect(BarFrame());
|
||||||
#if KNOB_EMBEDDED
|
# if KNOB_EMBEDDED
|
||||||
// Knob embedded in bar frame
|
// Knob embedded in bar frame
|
||||||
rect.InsetBy(0, 1);
|
rect.InsetBy(0, 1);
|
||||||
#else
|
# else
|
||||||
// Knob extends outside the bar frame
|
// Knob extends outside the bar frame
|
||||||
rect.InsetBy(0, -1);
|
rect.InsetBy(0, -1);
|
||||||
#endif
|
# endif
|
||||||
rect.InsetBy(rect.Height() / 2, 0);
|
rect.InsetBy(rect.Height() / 2, 0);
|
||||||
rect.left = rect.left + rect.Width() * Position() - rect.Height() / 2;
|
rect.left = rect.left + rect.Width() * Position() - rect.Height() / 2;
|
||||||
rect.right = rect.left + rect.Height();
|
rect.right = rect.left + rect.Height();
|
||||||
|
#endif
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +121,7 @@ VolumeSlider::ThumbFrame() const
|
|||||||
void
|
void
|
||||||
VolumeSlider::DrawThumb()
|
VolumeSlider::DrawThumb()
|
||||||
{
|
{
|
||||||
|
#if ROUND_KNOB
|
||||||
// Draw a round thumb
|
// Draw a round thumb
|
||||||
BRect rect(ThumbFrame());
|
BRect rect(ThumbFrame());
|
||||||
|
|
||||||
@@ -196,6 +205,18 @@ VolumeSlider::DrawThumb()
|
|||||||
gradient.SetStart(rect.LeftTop());
|
gradient.SetStart(rect.LeftTop());
|
||||||
gradient.SetEnd(rect.LeftBottom());
|
gradient.SetEnd(rect.LeftBottom());
|
||||||
FillEllipse(rect, gradient);
|
FillEllipse(rect, gradient);
|
||||||
|
#else
|
||||||
|
BSlider::DrawThumb();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BSize
|
||||||
|
VolumeSlider::MinSize()
|
||||||
|
{
|
||||||
|
BSize size = BSlider::MinSize();
|
||||||
|
size.width *= 2;
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ public:
|
|||||||
virtual BRect ThumbFrame() const;
|
virtual BRect ThumbFrame() const;
|
||||||
virtual void DrawThumb();
|
virtual void DrawThumb();
|
||||||
|
|
||||||
|
virtual BSize MinSize();
|
||||||
|
|
||||||
// VolumeSlider
|
// VolumeSlider
|
||||||
void SetMuted(bool mute);
|
void SetMuted(bool mute);
|
||||||
bool IsMuted() const
|
bool IsMuted() const
|
||||||
|
|||||||
Reference in New Issue
Block a user