1 /* 2 ProcessController © 2000, Georges-Edouard Berenger, All Rights Reserved. 3 Copyright (C) 2004 beunited.org 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 #ifndef _PCVIEW_H_ 20 #define _PCVIEW_H_ 21 22 23 #include "AutoIcon.h" 24 25 #include <View.h> 26 27 28 class BMessageRunner; 29 class ThreadBarMenu; 30 31 32 class ProcessController : public BView { 33 public: 34 ProcessController(BRect frame, bool temp = false); 35 ProcessController(BMessage *data); 36 ProcessController(); 37 virtual ~ProcessController(); 38 39 virtual void MessageReceived(BMessage *message); 40 virtual void AttachedToWindow(); 41 virtual void MouseDown(BPoint where); 42 virtual void Draw(BRect updateRect); 43 void DoDraw (bool force); 44 static ProcessController* Instantiate(BMessage* data); 45 virtual status_t Archive(BMessage *data, bool deep = true) const; 46 47 void AboutRequested(); 48 void Update(); 49 void DefaultColors(); 50 51 // TODO: move those into private, and have getter methods 52 AutoIcon fProcessControllerIcon; 53 AutoIcon fProcessorIcon; 54 AutoIcon fTrackerIcon; 55 AutoIcon fDeskbarIcon; 56 AutoIcon fTerminalIcon; 57 58 private: 59 void Init(); 60 61 bool fTemp; 62 float fMemoryUsage; 63 float fLastBarHeight[B_MAX_CPU_COUNT]; 64 float fLastMemoryHeight; 65 double fCPUTimes[B_MAX_CPU_COUNT]; 66 bigtime_t fPrevActive[B_MAX_CPU_COUNT]; 67 bigtime_t fPrevTime; 68 BMessageRunner* fMessageRunner; 69 rgb_color frame_color, active_color, idle_color, memory_color, swap_color; 70 }; 71 72 extern ProcessController* gPCView; 73 extern int32 gCPUcount; 74 extern rgb_color gIdleColor; 75 extern rgb_color gIdleColorSelected; 76 extern rgb_color gKernelColor; 77 extern rgb_color gKernelColorSelected; 78 extern rgb_color gUserColor; 79 extern rgb_color gUserColorSelected; 80 extern rgb_color gFrameColor; 81 extern rgb_color gFrameColorSelected; 82 extern rgb_color gMenuBackColor; 83 extern rgb_color gMenuBackColorSelected; 84 extern rgb_color gWhiteSelected; 85 extern ThreadBarMenu* gCurrentThreadBarMenu; 86 extern thread_id gPopupThreadID; 87 extern const char* kDeskbarItemName; 88 extern bool gInDeskbar; 89 90 #define kBarWidth 100 91 #define kMargin 12 92 93 #endif // _PCVIEW_H_ 94