1 /* 2 * Copyright 2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 9 #ifndef VOLUME_SLIDER_H 10 #define VOLUME_SLIDER_H 11 12 #include <Control.h> 13 14 class VolumeSlider : public BControl { 15 public: 16 VolumeSlider(BRect frame, 17 const char* name, 18 int32 minValue, 19 int32 maxValue, 20 BMessage* message = NULL, 21 BHandler* target = NULL); 22 23 virtual ~VolumeSlider(); 24 25 // BControl 26 virtual void AttachedToWindow(); 27 virtual void SetValue(int32 value); 28 void SetValueNoInvoke(int32 value); 29 virtual void SetEnabled(bool enable); 30 virtual void Draw(BRect updateRect); 31 virtual void MouseDown(BPoint where); 32 virtual void MouseMoved(BPoint where, uint32 transit, 33 const BMessage* dragMessage); 34 virtual void MouseUp(BPoint where); 35 36 // VolumeSlider 37 bool IsValid() const; 38 void SetMuted(bool mute); 39 bool IsMuted() const 40 { return fMuted; } 41 42 private: 43 void _MakeBitmaps(); 44 void _DimBitmap(BBitmap* bitmap); 45 int32 _ValueFor(float xPos) const; 46 47 BBitmap* fLeftSideBits; 48 BBitmap* fRightSideBits; 49 BBitmap* fKnobBits; 50 bool fTracking; 51 bool fMuted; 52 int32 fMinValue; 53 int32 fMaxValue; 54 }; 55 56 #endif // VOLUME_SLIDER_H 57