1 /*****************************************************************************
2 * MediaControlView.h: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 the VideoLAN team
7 * Authors: Tony Castley <tony@castley.net>
8 * Stephan Aßmus <stippi@yellowbites.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifndef BEOS_MEDIA_CONTROL_VIEW_H
26 #define BEOS_MEDIA_CONTROL_VIEW_H
32 class PlayPauseButton;
33 class PositionInfoView;
35 class TransportButton;
38 class MediaControlView : public BBox
41 MediaControlView( intf_thread_t * p_intf, BRect frame );
42 virtual ~MediaControlView();
45 virtual void AttachedToWindow();
46 virtual void FrameResized(float width, float height);
47 virtual void GetPreferredSize(float* width, float* height);
48 virtual void MessageReceived(BMessage* message);
49 virtual void Pulse(); // detect stopped stream
52 void SetProgress( float position );
54 void SetStatus(int status, int rate);
55 void SetEnabled(bool enable);
56 void SetAudioEnabled(bool enable);
57 uint32 GetVolume() const;
58 void SetSkippable(bool backward,
60 void SetMuted(bool mute);
63 void _LayoutControls(BRect frame) const;
64 BRect _MinFrame() const;
65 void _LayoutControl(BView* view,
67 bool resizeWidth = false,
68 bool resizeHeight = false) const;
70 intf_thread_t * p_intf;
72 VolumeSlider* fVolumeSlider;
73 SeekSlider* fSeekSlider;
74 TransportButton* fSkipBack;
75 TransportButton* fSkipForward;
76 TransportButton* fRewind;
77 TransportButton* fForward;
78 PlayPauseButton* fPlayPause;
79 TransportButton* fStop;
80 TransportButton* fMute;
81 PositionInfoView* fPositionInfo;
85 float fBottomControlHeight;
91 class SeekSlider : public BControl
94 SeekSlider(intf_thread_t * p_intf,
97 MediaControlView* owner );
99 virtual ~SeekSlider();
102 virtual void AttachedToWindow();
103 virtual void Draw(BRect updateRect);
104 virtual void MouseDown(BPoint where);
105 virtual void MouseMoved(BPoint where, uint32 transit,
106 const BMessage* dragMessage);
107 virtual void MouseUp(BPoint where);
108 virtual void ResizeToPreferred();
111 void SetPosition(float position);
114 int32 _ValueFor(float x) const;
115 void _StrokeFrame(BRect frame,
121 intf_thread_t * p_intf;
122 MediaControlView* fOwner;
126 class VolumeSlider : public BControl
129 VolumeSlider(BRect frame,
133 BMessage* message = NULL,
134 BHandler* target = NULL);
136 virtual ~VolumeSlider();
139 virtual void AttachedToWindow();
140 virtual void SetValue(int32 value);
141 virtual void SetEnabled(bool enable);
142 virtual void Draw(BRect updateRect);
143 virtual void MouseDown(BPoint where);
144 virtual void MouseMoved(BPoint where, uint32 transit,
145 const BMessage* dragMessage);
146 virtual void MouseUp(BPoint where);
149 bool IsValid() const;
150 void SetMuted(bool mute);
154 void _DimBitmap(BBitmap* bitmap);
155 int32 _ValueFor(float xPos) const;
157 BBitmap* fLeftSideBits;
158 BBitmap* fRightSideBits;
166 class PositionInfoView : public BView
169 PositionInfoView( BRect frame,
171 intf_thread_t *p_intf );
172 virtual ~PositionInfoView();
175 virtual void Draw( BRect updateRect );
176 virtual void ResizeToPreferred();
177 virtual void GetPreferredSize( float* width,
179 virtual void Pulse();
188 void SetMode( uint32 mode );
189 void GetBigPreferredSize( float* width,
192 void SetFile( int32 index, int32 size );
193 void SetTitle( int32 index, int32 size );
194 void SetChapter( int32 index, int32 size );
195 void SetTime( int32 seconds );
196 void SetTime( const char* string );
198 void _InvalidateContents( uint32 which = 0 );
199 void _MakeString( BString& into,
201 int32 maxIndex ) const;
202 // void _DrawAlignedString( const char* string,
204 // alignment mode = B_ALIGN_LEFT );
207 int32 fCurrentFileIndex;
208 int32 fCurrentFileSize;
209 int32 fCurrentTitleIndex;
210 int32 fCurrentTitleSize;
211 int32 fCurrentChapterIndex;
212 int32 fCurrentChapterSize;
216 bigtime_t fLastPulseUpdate;
217 float fStackedWidthCache;
218 float fStackedHeightCache;
220 intf_thread_t * p_intf;
224 #endif // BEOS_MEDIA_CONTROL_VIEW_H