1 /*****************************************************************************
2 * MediaControlView.h: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: MediaControlView.h,v 1.5 2003/01/25 01:03:44 titer Exp $
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., 59 Temple Place - Suite 330, Boston, MA 02111, 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( BRect frame, intf_thread_t *p_intf );
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 GetSeekTo() const;
58 uint32 GetVolume() const;
59 void SetSkippable(bool backward,
61 void SetMuted(bool mute);
66 void _LayoutControls(BRect frame) const;
67 BRect _MinFrame() const;
68 void _LayoutControl(BView* view,
70 bool resizeWidth = false,
71 bool resizeHeight = false) const;
74 VolumeSlider* fVolumeSlider;
75 SeekSlider* fSeekSlider;
76 TransportButton* fSkipBack;
77 TransportButton* fSkipForward;
78 TransportButton* fRewind;
79 TransportButton* fForward;
80 PlayPauseButton* fPlayPause;
81 TransportButton* fStop;
82 TransportButton* fMute;
83 PositionInfoView* fPositionInfo;
87 float fBottomControlHeight;
91 intf_thread_t * p_intf;
94 class SeekSlider : public BControl
97 SeekSlider(BRect frame,
99 MediaControlView* owner,
103 virtual ~SeekSlider();
106 virtual void AttachedToWindow();
107 virtual void Draw(BRect updateRect);
108 virtual void MouseDown(BPoint where);
109 virtual void MouseMoved(BPoint where, uint32 transit,
110 const BMessage* dragMessage);
111 virtual void MouseUp(BPoint where);
112 virtual void ResizeToPreferred();
115 void SetPosition(float position);
118 int32 _ValueFor(float x) const;
119 void _StrokeFrame(BRect frame,
128 MediaControlView* fOwner;
134 class VolumeSlider : public BControl
137 VolumeSlider(BRect frame,
141 BMessage* message = NULL,
142 BHandler* target = NULL);
144 virtual ~VolumeSlider();
147 virtual void AttachedToWindow();
148 virtual void SetValue(int32 value);
149 virtual void SetEnabled(bool enable);
150 virtual void Draw(BRect updateRect);
151 virtual void MouseDown(BPoint where);
152 virtual void MouseMoved(BPoint where, uint32 transit,
153 const BMessage* dragMessage);
154 virtual void MouseUp(BPoint where);
157 bool IsValid() const;
158 void SetMuted(bool mute);
162 void _DimBitmap(BBitmap* bitmap);
163 int32 _ValueFor(float xPos) const;
165 BBitmap* fLeftSideBits;
166 BBitmap* fRightSideBits;
174 class PositionInfoView : public BView
177 PositionInfoView( BRect frame,
179 intf_thread_t *p_intf );
180 virtual ~PositionInfoView();
183 virtual void Draw( BRect updateRect );
184 virtual void ResizeToPreferred();
185 virtual void GetPreferredSize( float* width,
187 virtual void Pulse();
196 void SetMode( uint32 mode );
197 void GetBigPreferredSize( float* width,
200 void SetFile( int32 index, int32 size );
201 void SetTitle( int32 index, int32 size );
202 void SetChapter( int32 index, int32 size );
203 void SetTime( int32 seconds );
204 void SetTime( const char* string );
206 void _InvalidateContents( uint32 which = 0 );
207 void _MakeString( BString& into,
209 int32 maxIndex ) const;
210 // void _DrawAlignedString( const char* string,
212 // alignment mode = B_ALIGN_LEFT );
215 int32 fCurrentFileIndex;
216 int32 fCurrentFileSize;
217 int32 fCurrentTitleIndex;
218 int32 fCurrentTitleSize;
219 int32 fCurrentChapterIndex;
220 int32 fCurrentChapterSize;
224 bigtime_t fLastPulseUpdate;
225 float fStackedWidthCache;
226 float fStackedHeightCache;
228 intf_thread_t * p_intf;
232 #endif // BEOS_MEDIA_CONTROL_VIEW_H