1 /* 2 * Copyright 2003-2009, Haiku, Inc. 3 * Distributed under the terms of the MIT license. 4 * 5 * Authors: 6 * Jérôme Duval 7 * François Revol 8 * Axel Dörfler, axeld@pinc-software.de. 9 */ 10 #ifndef VOLUME_SLIDER_H 11 #define VOLUME_SLIDER_H 12 13 14 #include <Slider.h> 15 16 class MixerControl; 17 18 19 class VolumeControl : public BSlider { 20 public: 21 VolumeControl(int32 volumeWhich, bool beep, 22 BMessage* message); 23 VolumeControl(BMessage* archive); 24 virtual ~VolumeControl(); 25 26 static VolumeControl* Instantiate(BMessage* archive); 27 virtual status_t Archive(BMessage* archive, bool deep = true) const; 28 29 protected: 30 virtual void AttachedToWindow(); 31 virtual void DetachedFromWindow(); 32 33 virtual void MouseDown(BPoint where); 34 virtual void MouseUp(BPoint where); 35 virtual void MouseMoved(BPoint where, uint32 transit, 36 const BMessage* dragMessage); 37 38 virtual void MessageReceived(BMessage* message); 39 virtual status_t Invoke(BMessage* message = NULL); 40 41 virtual void DrawBar(); 42 virtual const char* UpdateText() const; 43 44 private: 45 void _DisconnectVolume(); 46 void _ConnectVolume(); 47 bool _IsReplicant() const; 48 float _PointForValue(int32 value) const; 49 50 mutable char fText[64]; 51 MixerControl* fMixerControl; 52 int32 fOriginalValue; 53 bool fBeep; 54 55 bool fSnapping; 56 float fMinSnap; 57 float fMaxSnap; 58 59 int32 fConnectRetries; 60 bool fMediaServerRunning; 61 bool fAddOnServerRunning; 62 }; 63 64 #endif // VOLUME_SLIDER_H 65