1 /*****************************************************************************
2 * MediaControlView.h: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: MediaControlView.h,v 1.4 2003/01/12 02:08:39 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;
90 intf_thread_t * p_intf;
93 class SeekSlider : public BControl
96 SeekSlider(BRect frame,
98 MediaControlView* owner,
102 virtual ~SeekSlider();
105 virtual void AttachedToWindow();
106 virtual void Draw(BRect updateRect);
107 virtual void MouseDown(BPoint where);
108 virtual void MouseMoved(BPoint where, uint32 transit,
109 const BMessage* dragMessage);
110 virtual void MouseUp(BPoint where);
111 virtual void ResizeToPreferred();
114 void SetPosition(float position);
117 int32 _ValueFor(float x) const;
118 void _StrokeFrame(BRect frame,
127 MediaControlView* fOwner;
133 class VolumeSlider : public BControl
136 VolumeSlider(BRect frame,
140 BMessage* message = NULL,
141 BHandler* target = NULL);
143 virtual ~VolumeSlider();
146 virtual void AttachedToWindow();
147 virtual void SetValue(int32 value);
148 virtual void SetEnabled(bool enable);
149 virtual void Draw(BRect updateRect);
150 virtual void MouseDown(BPoint where);
151 virtual void MouseMoved(BPoint where, uint32 transit,
152 const BMessage* dragMessage);
153 virtual void MouseUp(BPoint where);
156 bool IsValid() const;
157 void SetMuted(bool mute);
161 void _DimBitmap(BBitmap* bitmap);
162 int32 _ValueFor(float xPos) const;
164 BBitmap* fLeftSideBits;
165 BBitmap* fRightSideBits;
173 class PositionInfoView : public BView
176 PositionInfoView( BRect frame,
178 intf_thread_t *p_intf );
179 virtual ~PositionInfoView();
182 virtual void Draw( BRect updateRect );
183 virtual void ResizeToPreferred();
184 virtual void GetPreferredSize( float* width,
186 virtual void Pulse();
195 void SetMode( uint32 mode );
196 void GetBigPreferredSize( float* width,
199 void SetFile( int32 index, int32 size );
200 void SetTitle( int32 index, int32 size );
201 void SetChapter( int32 index, int32 size );
202 void SetTime( int32 seconds );
203 void SetTime( const char* string );
205 void _InvalidateContents( uint32 which = 0 );
206 void _MakeString( BString& into,
208 int32 maxIndex ) const;
209 // void _DrawAlignedString( const char* string,
211 // alignment mode = B_ALIGN_LEFT );
214 int32 fCurrentFileIndex;
215 int32 fCurrentFileSize;
216 int32 fCurrentTitleIndex;
217 int32 fCurrentTitleSize;
218 int32 fCurrentChapterIndex;
219 int32 fCurrentChapterSize;
223 bigtime_t fLastPulseUpdate;
224 float fStackedWidthCache;
225 float fStackedHeightCache;
227 intf_thread_t * p_intf;
231 #endif // BEOS_MEDIA_CONTROL_VIEW_H