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 15class VolumeSlider : public BControl 16{ 17public: 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); 25private: 26 void _UpdateVolume(BPoint point); 27 28 BBitmap fLeftBitmap, fRightBitmap, fButtonBitmap; 29 float fRight; 30 float fVolume; 31 BSoundPlayer *fSoundPlayer; 32}; 33 34class SpeakerView : public BBox 35{ 36public: 37 SpeakerView(BRect rect, uint32 resizeFlags); 38 ~SpeakerView(); 39 void Draw(BRect updateRect); 40 41private: 42 BBitmap fSpeakerBitmap; 43}; 44 45#endif 46