Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

MediaControlView.h

00001 /*****************************************************************************
00002  * MediaControlView.h: beos interface
00003  *****************************************************************************
00004  * Copyright (C) 1999, 2000, 2001 the VideoLAN team
00005  * $Id: MediaControlView.h 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Tony Castley <[email protected]>
00008  *          Stephan Aßmus <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef BEOS_MEDIA_CONTROL_VIEW_H
00026 #define BEOS_MEDIA_CONTROL_VIEW_H
00027 
00028 #include <Box.h>
00029 #include <Control.h>
00030 
00031 class BBitmap;
00032 class PlayPauseButton;
00033 class PositionInfoView;
00034 class SeekSlider;
00035 class TransportButton;
00036 class VolumeSlider;
00037 
00038 class MediaControlView : public BBox
00039 {
00040  public:
00041                                                                 MediaControlView( intf_thread_t * p_intf, BRect frame );
00042         virtual                                         ~MediaControlView();
00043 
00044                                                                 // BBox
00045         virtual void                            AttachedToWindow();
00046         virtual void                            FrameResized(float width, float height);
00047         virtual void                            GetPreferredSize(float* width, float* height);
00048         virtual void                            MessageReceived(BMessage* message);
00049         virtual void                            Pulse(); // detect stopped stream
00050 
00051                                                                 // MediaControlView
00052                         void                            SetProgress( float position );
00053 
00054                         void                            SetStatus(int status, int rate); 
00055                         void                            SetEnabled(bool enable);
00056                         void                            SetAudioEnabled(bool enable);
00057                         uint32                          GetVolume() const;
00058                         void                            SetSkippable(bool backward,
00059                                                                                          bool forward);
00060                         void                            SetMuted(bool mute);
00061     
00062  private:
00063                         void                            _LayoutControls(BRect frame) const;
00064                         BRect                           _MinFrame() const;
00065                         void                            _LayoutControl(BView* view,
00066                                                                                            BRect frame,
00067                                                                                            bool resizeWidth = false,
00068                                                                                            bool resizeHeight = false) const;
00069 
00070                         intf_thread_t *     p_intf;
00071 
00072                         VolumeSlider*           fVolumeSlider;
00073                         SeekSlider*                     fSeekSlider;
00074                         TransportButton*        fSkipBack;
00075                         TransportButton*        fSkipForward;
00076                         TransportButton*        fRewind;
00077                         TransportButton*        fForward;
00078                         PlayPauseButton*        fPlayPause;
00079                         TransportButton*        fStop;
00080                         TransportButton*        fMute;
00081                         PositionInfoView*   fPositionInfo;
00082 
00083                         int                                     fCurrentRate;
00084                         int                                     fCurrentStatus;
00085                         float                           fBottomControlHeight;
00086                         BRect                           fOldBounds;
00087                         bool                fIsEnabled;
00088                         
00089 };
00090 
00091 class SeekSlider : public BControl
00092 {
00093  public:
00094                                                                 SeekSlider(intf_thread_t * p_intf,
00095                                                                            BRect frame,
00096                                                                                    const char* name,
00097                                                                                    MediaControlView* owner );
00098 
00099         virtual                                         ~SeekSlider();
00100 
00101                                                                 // BControl
00102         virtual void                            AttachedToWindow();
00103         virtual void                            Draw(BRect updateRect);
00104         virtual void                            MouseDown(BPoint where);
00105         virtual void                            MouseMoved(BPoint where, uint32 transit,
00106                                                                                    const BMessage* dragMessage);
00107         virtual void                            MouseUp(BPoint where);
00108         virtual void                            ResizeToPreferred();
00109 
00110                                                                 // SeekSlider
00111                         void                            SetPosition(float position);
00112 
00113 private:
00114                         int32                           _ValueFor(float x) const;
00115                         void                            _StrokeFrame(BRect frame,
00116                                                                                          rgb_color left,
00117                                                                                          rgb_color top,
00118                                                                                          rgb_color right,
00119                                                                                          rgb_color bottom);
00120 
00121             intf_thread_t     * p_intf;
00122                         MediaControlView*       fOwner; 
00123                         bool                            fTracking;
00124 };
00125 
00126 class VolumeSlider : public BControl
00127 {
00128  public:
00129                                                                 VolumeSlider(BRect frame,
00130                                                                                          const char* name,
00131                                                                                          int32 minValue,
00132                                                                                          int32 maxValue,
00133                                                                                          BMessage* message = NULL,
00134                                                                                          BHandler* target = NULL);
00135 
00136         virtual                                         ~VolumeSlider();
00137 
00138                                                                 // BControl
00139         virtual void                            AttachedToWindow();
00140         virtual void                            SetValue(int32 value);
00141         virtual void                            SetEnabled(bool enable);
00142         virtual void                            Draw(BRect updateRect);
00143         virtual void                            MouseDown(BPoint where);
00144         virtual void                            MouseMoved(BPoint where, uint32 transit,
00145                                                                                    const BMessage* dragMessage);
00146         virtual void                            MouseUp(BPoint where);
00147 
00148                                                                 // VolumeSlider
00149                         bool                            IsValid() const;
00150                         void                            SetMuted(bool mute);
00151 
00152  private:
00153                         void                            _MakeBitmaps();
00154                         void                            _DimBitmap(BBitmap* bitmap);
00155                         int32                           _ValueFor(float xPos) const;
00156 
00157                         BBitmap*                        fLeftSideBits;
00158                         BBitmap*                        fRightSideBits;
00159                         BBitmap*                        fKnobBits;
00160                         bool                            fTracking;
00161                         bool                            fMuted;
00162                         int32                           fMinValue;
00163                         int32                           fMaxValue;
00164 };
00165 
00166 class PositionInfoView : public BView
00167 {
00168  public:
00169                                                                 PositionInfoView( BRect frame,
00170                                                                                                   const char* name,
00171                                                                                                   intf_thread_t *p_intf );
00172         virtual                                         ~PositionInfoView();
00173 
00174                                                                 // BView
00175         virtual void                            Draw( BRect updateRect );
00176         virtual void                            ResizeToPreferred();
00177         virtual void                            GetPreferredSize( float* width,
00178                                                                                                   float* height );
00179         virtual void                            Pulse();
00180 
00181                                                                 // PositionInfoView
00182         enum
00183         {
00184                 MODE_SMALL,
00185                 MODE_BIG,
00186         };
00187 
00188                         void                            SetMode( uint32 mode );
00189                         void                            GetBigPreferredSize( float* width,
00190                                                                                                          float* height );
00191 
00192                         void                            SetFile( int32 index, int32 size );
00193                         void                            SetTitle( int32 index, int32 size );
00194                         void                            SetChapter( int32 index, int32 size );
00195                         void                            SetTime( int32 seconds );
00196                         void                            SetTime( const char* string );
00197  private:
00198                         void                            _InvalidateContents( uint32 which = 0 );
00199                         void                            _MakeString( BString& into,
00200                                                                                          int32 index,
00201                                                                                          int32 maxIndex ) const;
00202 //                      void                            _DrawAlignedString( const char* string,
00203 //                                                                                                      BRect frame,
00204 //                                                                                                      alignment mode = B_ALIGN_LEFT );
00205 
00206                         uint32                          fMode;
00207                         int32                           fCurrentFileIndex;
00208                         int32                           fCurrentFileSize;
00209                         int32                           fCurrentTitleIndex;
00210                         int32                           fCurrentTitleSize;
00211                         int32                           fCurrentChapterIndex;
00212                         int32                           fCurrentChapterSize;
00213 
00214                         int32                           fSeconds;
00215                         BString                         fTimeString;
00216                         bigtime_t                       fLastPulseUpdate;
00217                         float                           fStackedWidthCache;
00218                         float                           fStackedHeightCache;
00219                         
00220                         intf_thread_t *     p_intf;
00221                         
00222 };
00223 
00224 #endif  // BEOS_MEDIA_CONTROL_VIEW_H

Generated on Tue Dec 20 10:14:37 2005 for vlc-0.8.4a by  doxygen 1.4.2