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