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 void MessageReceived(BMessage* message); 21 virtual BSize MinSize(); 22 virtual BSize MaxSize(); 23 24 // DurationView 25 void Update(bigtime_t position, bigtime_t duration); 26 27 enum { 28 kTimeElapsed = 0, 29 kTimeToFinish, 30 kDuration, 31 32 kLastMode 33 }; 34 35 void SetMode(uint32 mode); Mode()36 uint32 Mode() const 37 { return fMode; } 38 39 void SetSymbolScale(float scale); 40 41 private: 42 void _Update(); 43 void _UpdateTextColor(); 44 void _GenerateString(bigtime_t duration); 45 46 private: 47 uint32 fMode; 48 bigtime_t fPosition; 49 bigtime_t fDuration; 50 bigtime_t fDisplayDuration; 51 }; 52 53 54 #endif // DURATION_VIEW_H 55