1 //**************************************************************************************** 2 // 3 // File: CPUButton.h 4 // 5 // Written by: Daniel Switkin 6 // 7 // Copyright 1999, Be Incorporated 8 // 9 //**************************************************************************************** 10 11 #ifndef CPUBUTTON_H 12 #define CPUBUTTON_H 13 14 #include <interface/Control.h> 15 #include <app/MessageRunner.h> 16 17 class CPUButton : public BControl { 18 public: 19 CPUButton(BRect rect, const char *name, const char *label, BMessage *message); 20 CPUButton(BMessage *message); 21 virtual ~CPUButton(); 22 23 virtual void Draw(BRect rect); 24 virtual void MouseDown(BPoint point); 25 virtual void MouseUp(BPoint point); 26 virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message); 27 28 virtual void MessageReceived(BMessage *message); 29 virtual void AttachedToWindow(); 30 virtual void DetachedFromWindow(); 31 32 status_t Invoke(BMessage *message = NULL); 33 static CPUButton *Instantiate(BMessage *data); 34 status_t Archive(BMessage *data, bool deep = true) const; 35 36 void UpdateColors(int32 color); 37 38 private: 39 void _InitData(); 40 void _AddDragger(); 41 42 rgb_color fOnColor, fOffColor; 43 bool fReplicant; 44 int32 fCPU; 45 BMessageRunner *fPulseRunner; 46 bool fReplicantInDeskbar; 47 }; 48 49 #endif // CPUBUTTON_H 50