16aed176cSClemens Zeidler/*
2830758adSKacper Kasper * Copyright 2009-2017, Haiku, Inc. All Rights Reserved.
36aed176cSClemens Zeidler * Distributed under the terms of the MIT License.
46aed176cSClemens Zeidler *
56aed176cSClemens Zeidler * Authors:
66aed176cSClemens Zeidler *		Clemens Zeidler, haiku@Clemens-Zeidler.de
7830758adSKacper Kasper *		Kacper Kasper, kacperkasper@gmail.com
86aed176cSClemens Zeidler */
9bd767f5aSAxel Dörfler
106aed176cSClemens Zeidler#ifndef EXTENDED_INFO_WINDOW_H
116aed176cSClemens Zeidler#define EXTENDED_INFO_WINDOW_H
126aed176cSClemens Zeidler
13bd767f5aSAxel Dörfler
146aed176cSClemens Zeidler#include <ObjectList.h>
15e391ec67SClemens Zeidler#include <String.h>
16d1929affSKacper Kasper#include <StringView.h>
17830758adSKacper Kasper#include <TabView.h>
186aed176cSClemens Zeidler#include <View.h>
196aed176cSClemens Zeidler#include <Window.h>
206aed176cSClemens Zeidler
216aed176cSClemens Zeidler#include "DriverInterface.h"
226aed176cSClemens Zeidler#include "PowerStatusView.h"
236aed176cSClemens Zeidler
246aed176cSClemens Zeidler
25bd767f5aSAxel Dörflerclass BatteryInfoView : public BView {
26bd767f5aSAxel Dörflerpublic:
27bd767f5aSAxel Dörfler							BatteryInfoView();
28bd767f5aSAxel Dörfler							~BatteryInfoView();
29bd767f5aSAxel Dörfler
30bd767f5aSAxel Dörfler	virtual void			Update(battery_info& info,
31bd767f5aSAxel Dörfler								acpi_extended_battery_info& extInfo);
32bd767f5aSAxel Dörfler	virtual void			AttachedToWindow();
33bd767f5aSAxel Dörfler
34bd767f5aSAxel Dörflerprivate:
35d1929affSKacper Kasper			BString			_GetTextForLine(size_t line);
36bd767f5aSAxel Dörfler
37bd767f5aSAxel Dörfler			battery_info				fBatteryInfo;
38bd767f5aSAxel Dörfler			acpi_extended_battery_info	fBatteryExtendedInfo;
39bd767f5aSAxel Dörfler
40d1929affSKacper Kasper			BObjectList<BStringView>	fStringList;
416aed176cSClemens Zeidler};
426aed176cSClemens Zeidler
436aed176cSClemens Zeidler
446aed176cSClemens Zeidlerclass ExtendedInfoWindow;
45830758adSKacper Kasperclass BatteryTabView;
466aed176cSClemens Zeidler
47bd767f5aSAxel Dörflerclass ExtPowerStatusView : public PowerStatusView {
48bd767f5aSAxel Dörflerpublic:
49bd767f5aSAxel Dörfler								ExtPowerStatusView(
50bd767f5aSAxel Dörfler									PowerStatusDriverInterface* interface,
51bd767f5aSAxel Dörfler									BRect frame, int32 resizingMode,
52830758adSKacper Kasper									int batteryID,
53830758adSKacper Kasper									BatteryInfoView* batteryInfoView,
54830758adSKacper Kasper									ExtendedInfoWindow* window);
55bd767f5aSAxel Dörfler
56bd767f5aSAxel Dörfler	virtual void				Select(bool select = true);
57bd767f5aSAxel Dörfler
58bd767f5aSAxel Dörfler	// return true if it battery is in a critical state
59bd767f5aSAxel Dörfler	virtual	bool				IsCritical();
60bd767f5aSAxel Dörfler
61bd767f5aSAxel Dörflerprotected:
62bd767f5aSAxel Dörfler	virtual void				Update(bool force = false);
63bd767f5aSAxel Dörfler
64bd767f5aSAxel Dörflerprivate:
65bd767f5aSAxel Dörfler			ExtendedInfoWindow*	fExtendedInfoWindow;
66bd767f5aSAxel Dörfler			BatteryInfoView*	fBatteryInfoView;
67830758adSKacper Kasper			BatteryTabView*		fBatteryTabView;
68bd767f5aSAxel Dörfler
69bd767f5aSAxel Dörfler			bool				fSelected;
706aed176cSClemens Zeidler};
716aed176cSClemens Zeidler
726aed176cSClemens Zeidler
73830758adSKacper Kasperclass BatteryTab : public BTab {
74830758adSKacper Kasperpublic:
75830758adSKacper Kasper						BatteryTab(BatteryInfoView* target,
76830758adSKacper Kasper							ExtPowerStatusView* view);
77830758adSKacper Kasper						~BatteryTab();
78830758adSKacper Kasper
79830758adSKacper Kasper	virtual	void		Select(BView* owner);
80830758adSKacper Kasper
81830758adSKacper Kasper	virtual	void		DrawFocusMark(BView* owner, BRect frame);
82830758adSKacper Kasper	virtual	void		DrawLabel(BView* owner, BRect frame);
83830758adSKacper Kasperprivate:
84830758adSKacper Kasper	ExtPowerStatusView*	fBatteryView;
85830758adSKacper Kasper};
86830758adSKacper Kasper
87830758adSKacper Kasper
88830758adSKacper Kasperclass BatteryTabView : public BTabView {
89830758adSKacper Kasperpublic:
90830758adSKacper Kasper					BatteryTabView(const char* name);
91830758adSKacper Kasper					~BatteryTabView();
92830758adSKacper Kasper
93830758adSKacper Kasper	virtual	BRect	TabFrame(int32 index) const;
94830758adSKacper Kasper};
95830758adSKacper Kasper
96830758adSKacper Kasper
976aed176cSClemens Zeidlerclass ExtendedInfoWindow : public BWindow
986aed176cSClemens Zeidler{
996aed176cSClemens Zeidlerpublic:
1006aed176cSClemens Zeidler		ExtendedInfoWindow(PowerStatusDriverInterface* interface);
1016aed176cSClemens Zeidler		~ExtendedInfoWindow();
102bd767f5aSAxel Dörfler
103830758adSKacper Kasper	BatteryTabView*				GetBatteryTabView();
1046aed176cSClemens Zeidler
1056aed176cSClemens Zeidlerprivate:
1066aed176cSClemens Zeidler	PowerStatusDriverInterface* 		fDriverInterface;
1076aed176cSClemens Zeidler	BObjectList<ExtPowerStatusView>		fBatteryViewList;
108bd767f5aSAxel Dörfler
109830758adSKacper Kasper	BatteryTabView*						fBatteryTabView;
110bd767f5aSAxel Dörfler
1116aed176cSClemens Zeidler	ExtPowerStatusView*					fSelectedView;
1126aed176cSClemens Zeidler};
1136aed176cSClemens Zeidler
1146aed176cSClemens Zeidler
1156aed176cSClemens Zeidler#endif
116