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
15class BMessageRunner;
16class ThreadBarMenu;
17
18
19class 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
61extern	ProcessController*	gPCView;
62extern	uint32				gCPUcount;
63extern	rgb_color			gIdleColor;
64extern	rgb_color			gIdleColorSelected;
65extern	rgb_color			gKernelColor;
66extern	rgb_color			gKernelColorSelected;
67extern	rgb_color			gUserColor;
68extern	rgb_color			gUserColorSelected;
69extern	rgb_color			gFrameColor;
70extern	rgb_color			gFrameColorSelected;
71extern	rgb_color			gMenuBackColor;
72extern	rgb_color			gMenuBackColorSelected;
73extern	rgb_color			gWhiteSelected;
74extern	ThreadBarMenu*		gCurrentThreadBarMenu;
75extern	thread_id			gPopupThreadID;
76extern	const char*			kDeskbarItemName;
77extern	bool				gInDeskbar;
78
79#define kBarWidth 100
80#define kMargin	12
81
82#endif // _PCVIEW_H_
83