xref: /haiku/src/apps/processcontroller/ProcessController.h (revision 17889a8c70dbb3d59c1412f6431968753c767bab)
1 /*
2  * Copyright 2000, Georges-Edouard Berenger. All rights reserved.
3  * Copyright 2006-2018, Haiku, Inc. All rights reserved.
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef _PCVIEW_H_
7 #define _PCVIEW_H_
8 
9 
10 #include "AutoIcon.h"
11 
12 #include <View.h>
13 
14 
15 class BMessageRunner;
16 class ThreadBarMenu;
17 
18 
19 class ProcessController : public BView {
20 	public:
21 						ProcessController(BRect frame, bool temp = false);
22 						ProcessController(BMessage *data);
23 						ProcessController(float width, float height);
24 		virtual			~ProcessController();
25 
26 		virtual	void	MessageReceived(BMessage *message);
27 		virtual	void	AttachedToWindow();
28 		virtual	void	MouseDown(BPoint where);
29 		virtual	void	Draw(BRect updateRect);
30 				void	DoDraw (bool force);
31 		static	ProcessController* Instantiate(BMessage* data);
32 		virtual	status_t Archive(BMessage *data, bool deep = true) const;
33 
34 		void			AboutRequested();
35 		void			Update();
36 		void			DefaultColors();
37 
38 		// TODO: move those into private, and have getter methods
39 		AutoIcon		fProcessControllerIcon;
40 		AutoIcon		fProcessorIcon;
41 		AutoIcon		fTrackerIcon;
42 		AutoIcon		fDeskbarIcon;
43 		AutoIcon		fTerminalIcon;
44 
45 	private:
46 		void			Init();
47 		void			_HandleDebugRequest(team_id team, thread_id thread);
48 
49 		const int32		kCPUCount;
50 		bool			fTemp;
51 		float			fMemoryUsage;
52 		float*			fLastBarHeight;
53 		float			fLastMemoryHeight;
54 		double*			fCPUTimes;
55 		bigtime_t*		fPrevActive;
56 		bigtime_t		fPrevTime;
57 		BMessageRunner*	fMessageRunner;
58 		rgb_color		frame_color, active_color, idle_color, memory_color, swap_color;
59 };
60 
61 extern	ProcessController*	gPCView;
62 extern	uint32				gCPUcount;
63 extern	rgb_color			gIdleColor;
64 extern	rgb_color			gIdleColorSelected;
65 extern	rgb_color			gKernelColor;
66 extern	rgb_color			gKernelColorSelected;
67 extern	rgb_color			gUserColor;
68 extern	rgb_color			gUserColorSelected;
69 extern	rgb_color			gFrameColor;
70 extern	rgb_color			gFrameColorSelected;
71 extern	rgb_color			gMenuBackColor;
72 extern	rgb_color			gMenuBackColorSelected;
73 extern	rgb_color			gWhiteSelected;
74 extern	ThreadBarMenu*		gCurrentThreadBarMenu;
75 extern	thread_id			gPopupThreadID;
76 extern	const char*			kDeskbarItemName;
77 extern	bool				gInDeskbar;
78 
79 #define kBarWidth 100
80 #define kMargin	12
81 
82 #endif // _PCVIEW_H_
83