2 * Copyright 2006-2010 Stephan Aßmus <superstippi@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT License.
5 #ifndef TRANSPORT_CONTROL_GROUP_H
6 #define TRANSPORT_CONTROL_GROUP_H
9 // NOTE: Based on my code in the BeOS interface for the VLC media player
10 // that I did during the VLC 0.4.3 - 0.4.6 times. Code not written by me
11 // removed. -Stephan Aßmus
14 #include <GroupView.h>
20 class PlayPauseButton
;
21 class PositionToolTip
;
27 SKIP_BACK_ENABLED
= 1 << 0,
28 SEEK_BACK_ENABLED
= 1 << 1,
29 PLAYBACK_ENABLED
= 1 << 2,
30 SEEK_FORWARD_ENABLED
= 1 << 3,
31 SKIP_FORWARD_ENABLED
= 1 << 4,
32 VOLUME_ENABLED
= 1 << 5,
33 SEEK_ENABLED
= 1 << 6,
37 class TransportControlGroup
: public BGroupView
{
39 TransportControlGroup(BRect frame
,
40 bool useSkipButtons
, bool usePeakView
,
42 virtual ~TransportControlGroup();
45 virtual void AttachedToWindow();
46 virtual void GetPreferredSize(float* width
, float* height
);
47 virtual void MessageReceived(BMessage
* message
);
49 // TransportControlGroup
50 virtual uint32
EnabledButtons();
51 virtual void TogglePlaying();
53 virtual void Rewind();
54 virtual void Forward();
55 virtual void SkipBackward();
56 virtual void SkipForward();
57 virtual void VolumeChanged(float value
);
58 virtual void ToggleMute();
59 virtual void PositionChanged(float value
);
61 void SetEnabled(uint32 whichButtons
);
63 void SetPlaybackState(uint32 state
);
64 void SetSkippable(bool backward
, bool forward
);
66 void SetAudioEnabled(bool enable
);
67 void SetMuted(bool mute
);
69 void SetVolume(float value
);
70 void SetAudioChannelCount(int32 count
);
71 void SetPosition(float value
, bigtime_t position
,
73 float Position() const;
75 PeakView
* GetPeakView() const
78 void SetDisabledString(const char* string
);
79 void SetSymbolScale(float scale
);
82 void _TogglePlaying();
90 void _UpdatePosition();
92 float _LinearToExponential(float db
);
93 float _ExponentialToLinear(float db
);
94 float _DbToGain(float db
);
95 float _GainToDb(float gain
);
97 BShape
* _CreateSkipBackwardsShape(float height
) const;
98 BShape
* _CreateSkipForwardShape(float height
) const;
99 BShape
* _CreateRewindShape(float height
) const;
100 BShape
* _CreateForwardShape(float height
) const;
101 BShape
* _CreatePlayShape(float height
) const;
102 BShape
* _CreatePauseShape(float height
) const;
103 BShape
* _CreateStopShape(float height
) const;
104 BShape
* _CreateSpeakerShape(float height
) const;
107 SeekSlider
* fSeekSlider
;
108 DurationView
* fDurationView
;
109 PositionToolTip
* fPositionToolTip
;
111 VolumeSlider
* fVolumeSlider
;
113 SymbolButton
* fSkipBack
;
114 SymbolButton
* fSkipForward
;
115 SymbolButton
* fRewind
;
116 SymbolButton
* fForward
;
117 PlayPauseButton
* fPlayPause
;
121 BGroupLayout
* fSeekLayout
;
122 BGroupLayout
* fControlLayout
;
125 uint32 fLastEnabledButtons
;
128 #endif // TRANSPORT_CONTROL_GROUP_H