1 /* 2 * Copyright 2010, Stephan Aßmus <superstippi@gmx.de>. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef DURATION_VIEW_H 6 #define DURATION_VIEW_H 7 8 9 #include <String.h> 10 #include <StringView.h> 11 12 13 class DurationView : public BStringView { 14 public: 15 DurationView(const char* name); 16 17 // BStringView interface 18 virtual void AttachedToWindow(); 19 virtual void MouseDown(BPoint where); 20 virtual BSize MinSize(); 21 virtual BSize MaxSize(); 22 23 // DurationView 24 void Update(bigtime_t position, bigtime_t duration); 25 26 enum { 27 kTimeElapsed = 0, 28 kTimeToFinish, 29 kDuration, 30 31 kLastMode 32 }; 33 34 void SetMode(uint32 mode); 35 uint32 Mode() const 36 { return fMode; } 37 38 void SetSymbolScale(float scale); 39 40 private: 41 void _Update(); 42 void _GenerateString(bigtime_t duration); 43 44 private: 45 uint32 fMode; 46 bigtime_t fPosition; 47 bigtime_t fDuration; 48 bigtime_t fDisplayDuration; 49 }; 50 51 52 #endif // DURATION_VIEW_H 53