1 // Copyright 1999, Be Incorporated. All Rights Reserved. 2 // Copyright 2000-2004, Jun Suzuki. All Rights Reserved. 3 // Copyright 2007, Stephan Aßmus. All Rights Reserved. 4 // This file may be used under the terms of the Be Sample Code License. 5 #ifndef MEDIA_FILE_INFO_VIEW_H 6 #define MEDIA_FILE_INFO_VIEW_H 7 8 9 #include <Entry.h> 10 #include <View.h> 11 12 #include "MediaFileInfo.h" 13 14 15 class BMediaFile; 16 class BString; 17 18 class MediaFileInfoView : public BView { 19 public: 20 MediaFileInfoView(); 21 virtual ~MediaFileInfoView(); 22 23 virtual BSize MinSize(); 24 virtual BSize MaxSize(); 25 virtual BSize PreferredSize(); 26 virtual BAlignment LayoutAlignment(); 27 virtual void InvalidateLayout(bool children = false); 28 29 virtual void SetFont(const BFont* font, 30 uint32 mask = B_FONT_ALL); 31 32 protected: 33 virtual void Draw(BRect updateRect); 34 virtual void AttachedToWindow(); 35 36 public: 37 void Update(BMediaFile* file, entry_ref* ref); 38 bigtime_t Duration() const 39 { return fInfo.useconds; } 40 41 private: 42 void _ValidateMinMax(); 43 float _MaxLineWidth(BString* strings, 44 int32 stringCount, const BFont& font); 45 float _LineHeight(); 46 void _SetFontFace(uint16 face); 47 48 bool fMinMaxValid; 49 BSize fMinSize; 50 float fMaxLabelWidth; 51 float fNoFileLabelWidth; 52 float fLineHeight; 53 entry_ref fRef; 54 BMediaFile* fMediaFile; 55 MediaFileInfo fInfo; 56 }; 57 58 #endif // MEDIA_FILE_INFO_VIEW_H 59