xref: /haiku/src/apps/soundrecorder/VolumeSlider.h (revision 1e36cfc2721ef13a187c6f7354dc9cbc485e89d3)
1 /*
2  * Copyright 2005, Jérôme Duval. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Inspired by SoundCapture from Be newsletter (Media Kit Basics: Consumers and Producers)
6  */
7 #ifndef VOLUMESLIDER_H
8 #define VOLUMESLIDER_H
9 
10 #include <Control.h>
11 #include <Bitmap.h>
12 #include <Box.h>
13 #include <SoundPlayer.h>
14 
15 class VolumeSlider : public BControl
16 {
17 public:
18 	VolumeSlider(BRect rect, const char* title, uint32 resizeFlags);
19 	~VolumeSlider();
20 	virtual void Draw(BRect);
21 	virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
22 	virtual void MouseUp(BPoint point);
23 	virtual void MouseDown(BPoint point);
24 	void SetSoundPlayer(BSoundPlayer *player);
25 private:
26 	void UpdateVolume(BPoint point);
27 	BBitmap fLeftBitmap, fRightBitmap, fButtonBitmap;
28 	float fRight;
29 	float fVolume;
30 	BSoundPlayer *fSoundPlayer;
31 };
32 
33 class SpeakerView : public BBox
34 {
35 public:
36 	SpeakerView(BRect rect, uint32 resizeFlags);
37 	~SpeakerView();
38 	void Draw(BRect updateRect);
39 
40 private:
41 	BBitmap fSpeakerBitmap;
42 };
43 
44 #endif
45