xref: /haiku/src/bin/desklink/VolumeControl.h (revision 323b65468e5836bb27a5e373b14027d902349437)
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 <String.h>
15 #include <Slider.h>
16 
17 class MixerControl;
18 
19 
20 class VolumeControl : public BSlider {
21 public:
22 							VolumeControl(int32 volumeWhich, bool beep,
23 								BMessage* message);
24 							VolumeControl(BMessage* archive);
25 	virtual					~VolumeControl();
26 
27 	static	VolumeControl*	Instantiate(BMessage* archive);
28 	virtual	status_t		Archive(BMessage* archive, bool deep = true) const;
29 
30 protected:
31 	virtual	void			AttachedToWindow();
32 	virtual	void			DetachedFromWindow();
33 
34 	virtual	void			MouseDown(BPoint where);
35 	virtual	void			MouseUp(BPoint where);
36 	virtual	void			MouseMoved(BPoint where, uint32 transit,
37 								const BMessage* dragMessage);
38 
39 	virtual	void			MessageReceived(BMessage* message);
40 	virtual status_t		Invoke(BMessage* message = NULL);
41 
42 	virtual void			DrawBar();
43 	virtual const char*		UpdateText() const;
44 
45 private:
46 			void			_DisconnectVolume();
47 			void			_ConnectVolume();
48 			bool			_IsReplicant() const;
49 			float			_PointForValue(int32 value) const;
50 
51 			mutable BString	fText;
52 			MixerControl*	fMixerControl;
53 			int32			fOriginalValue;
54 			bool			fBeep;
55 
56 			bool			fSnapping;
57 			float			fMinSnap;
58 			float			fMaxSnap;
59 
60 			int32			fConnectRetries;
61 			bool			fMediaServerRunning;
62 			bool			fAddOnServerRunning;
63 };
64 
65 #endif	// VOLUME_SLIDER_H
66