xref: /haiku/src/apps/powerstatus/ExtendedInfoWindow.h (revision 6aed176c0988537d716a89e11130b4253179f607)
1*6aed176cSClemens Zeidler /*
2*6aed176cSClemens Zeidler  * Copyright 2006, Haiku, Inc. All Rights Reserved.
3*6aed176cSClemens Zeidler  * Distributed under the terms of the MIT License.
4*6aed176cSClemens Zeidler  *
5*6aed176cSClemens Zeidler  * Authors:
6*6aed176cSClemens Zeidler  *		Clemens Zeidler, haiku@Clemens-Zeidler.de
7*6aed176cSClemens Zeidler  */
8*6aed176cSClemens Zeidler 
9*6aed176cSClemens Zeidler #ifndef EXTENDED_INFO_WINDOW_H
10*6aed176cSClemens Zeidler #define EXTENDED_INFO_WINDOW_H
11*6aed176cSClemens Zeidler 
12*6aed176cSClemens Zeidler #include <ObjectList.h>
13*6aed176cSClemens Zeidler #include <StringView.h>
14*6aed176cSClemens Zeidler #include <View.h>
15*6aed176cSClemens Zeidler #include <Window.h>
16*6aed176cSClemens Zeidler 
17*6aed176cSClemens Zeidler #include "DriverInterface.h"
18*6aed176cSClemens Zeidler #include "PowerStatusView.h"
19*6aed176cSClemens Zeidler 
20*6aed176cSClemens Zeidler 
21*6aed176cSClemens Zeidler class BatteryInfoView : public BView
22*6aed176cSClemens Zeidler {
23*6aed176cSClemens Zeidler 	public:
24*6aed176cSClemens Zeidler 						BatteryInfoView(BRect frame, int32 resizingMode);
25*6aed176cSClemens Zeidler 
26*6aed176cSClemens Zeidler 		virtual void	Update(battery_info& info,
27*6aed176cSClemens Zeidler 							acpi_extended_battery_info& extInfo);
28*6aed176cSClemens Zeidler 		virtual	void	Draw(BRect updateRect);
29*6aed176cSClemens Zeidler 
30*6aed176cSClemens Zeidler 	private:
31*6aed176cSClemens Zeidler 		battery_info	fBatteryInfo;
32*6aed176cSClemens Zeidler 		acpi_extended_battery_info fBatteryExtendedInfo;
33*6aed176cSClemens Zeidler };
34*6aed176cSClemens Zeidler 
35*6aed176cSClemens Zeidler 
36*6aed176cSClemens Zeidler class ExtendedInfoWindow;
37*6aed176cSClemens Zeidler 
38*6aed176cSClemens Zeidler class ExtPowerStatusView : public PowerStatusView
39*6aed176cSClemens Zeidler {
40*6aed176cSClemens Zeidler 	public:
41*6aed176cSClemens Zeidler 		ExtPowerStatusView(PowerStatusDriverInterface* interface,
42*6aed176cSClemens Zeidler 			BRect frame, int32 resizingMode, int batteryId,
43*6aed176cSClemens Zeidler 			ExtendedInfoWindow* window);
44*6aed176cSClemens Zeidler 
45*6aed176cSClemens Zeidler 		virtual	void	Draw(BRect updateRect);
46*6aed176cSClemens Zeidler 		virtual	void	MouseDown(BPoint where);
47*6aed176cSClemens Zeidler 
48*6aed176cSClemens Zeidler 		virtual void	Select(bool select = true);
49*6aed176cSClemens Zeidler 
50*6aed176cSClemens Zeidler 		// return true if it battery is in a none critical state
51*6aed176cSClemens Zeidler 		virtual bool	IsValid();
52*6aed176cSClemens Zeidler 
53*6aed176cSClemens Zeidler 	protected:
54*6aed176cSClemens Zeidler 		virtual void	_Update(bool force = false);
55*6aed176cSClemens Zeidler 
56*6aed176cSClemens Zeidler 	private:
57*6aed176cSClemens Zeidler 		ExtendedInfoWindow*	fExtendedInfoWindow;
58*6aed176cSClemens Zeidler 		BatteryInfoView*	fBatteryInfoView;
59*6aed176cSClemens Zeidler 
60*6aed176cSClemens Zeidler 		bool				fSelected;
61*6aed176cSClemens Zeidler };
62*6aed176cSClemens Zeidler 
63*6aed176cSClemens Zeidler 
64*6aed176cSClemens Zeidler class ExtendedInfoWindow : public BWindow
65*6aed176cSClemens Zeidler {
66*6aed176cSClemens Zeidler public:
67*6aed176cSClemens Zeidler 		ExtendedInfoWindow(PowerStatusDriverInterface* interface);
68*6aed176cSClemens Zeidler 		~ExtendedInfoWindow();
69*6aed176cSClemens Zeidler 
70*6aed176cSClemens Zeidler 	BatteryInfoView*			GetExtendedBatteryInfoView();
71*6aed176cSClemens Zeidler 
72*6aed176cSClemens Zeidler 	void						BatterySelected(ExtPowerStatusView* view);
73*6aed176cSClemens Zeidler 
74*6aed176cSClemens Zeidler private:
75*6aed176cSClemens Zeidler 	PowerStatusDriverInterface* 		fDriverInterface;
76*6aed176cSClemens Zeidler 	BObjectList<ExtPowerStatusView>		fBatteryViewList;
77*6aed176cSClemens Zeidler 
78*6aed176cSClemens Zeidler 	BatteryInfoView*					fBatteryInfoView;
79*6aed176cSClemens Zeidler 
80*6aed176cSClemens Zeidler 	ExtPowerStatusView*					fSelectedView;
81*6aed176cSClemens Zeidler };
82*6aed176cSClemens Zeidler 
83*6aed176cSClemens Zeidler 
84*6aed176cSClemens Zeidler #endif
85