1 /* 2 * Copyright 2006, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler, axeld@pinc-software.de 7 */ 8 #ifndef POWER_STATUS_VIEW_H 9 #define POWER_STATUS_VIEW_H 10 11 12 #include <View.h> 13 14 class BMessageRunner; 15 16 17 class PowerStatusView : public BView { 18 public: 19 PowerStatusView(BRect frame, int32 resizingMode, bool inDeskbar = false); 20 PowerStatusView(BMessage* archive); 21 virtual ~PowerStatusView(); 22 23 static PowerStatusView* Instantiate(BMessage* archive); 24 virtual status_t Archive(BMessage* archive, bool deep = true) const; 25 26 virtual void AttachedToWindow(); 27 virtual void DetachedFromWindow(); 28 29 virtual void MessageReceived(BMessage* message); 30 virtual void MouseDown(BPoint where); 31 virtual void Draw(BRect updateRect); 32 33 private: 34 void _AboutRequested(); 35 void _Quit(); 36 void _Init(); 37 void _SetLabel(char* buffer, size_t bufferLength); 38 void _Update(bool force = false); 39 void _DrawBattery(BRect rect); 40 41 BMessageRunner* fMessageRunner; 42 bool fInDeskbar; 43 bool fShowLabel; 44 bool fShowTime; 45 bool fShowStatusIcon; 46 47 int32 fPercent; 48 time_t fTimeLeft; 49 bool fOnline; 50 51 #ifndef HAIKU_TARGET_PLATFORM_HAIKU 52 int fDevice; 53 #endif 54 }; 55 56 #endif // POWER_STATUS_VIEW_H 57