1/*
2 * Copyright 2009-2017, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Clemens Zeidler, haiku@Clemens-Zeidler.de
7 *		Kacper Kasper, kacperkasper@gmail.com
8 */
9
10#ifndef EXTENDED_INFO_WINDOW_H
11#define EXTENDED_INFO_WINDOW_H
12
13
14#include <ObjectList.h>
15#include <String.h>
16#include <StringView.h>
17#include <TabView.h>
18#include <View.h>
19#include <Window.h>
20
21#include "DriverInterface.h"
22#include "PowerStatusView.h"
23
24
25class BatteryInfoView : public BView {
26public:
27							BatteryInfoView();
28							~BatteryInfoView();
29
30	virtual void			Update(battery_info& info,
31								acpi_extended_battery_info& extInfo);
32	virtual void			AttachedToWindow();
33
34private:
35			BString			_GetTextForLine(size_t line);
36
37			battery_info				fBatteryInfo;
38			acpi_extended_battery_info	fBatteryExtendedInfo;
39
40			BObjectList<BStringView>	fStringList;
41};
42
43
44class ExtendedInfoWindow;
45class BatteryTabView;
46
47class ExtPowerStatusView : public PowerStatusView {
48public:
49								ExtPowerStatusView(
50									PowerStatusDriverInterface* interface,
51									BRect frame, int32 resizingMode,
52									int batteryID,
53									BatteryInfoView* batteryInfoView,
54									ExtendedInfoWindow* window);
55
56	virtual void				Select(bool select = true);
57
58	// return true if it battery is in a critical state
59	virtual	bool				IsCritical();
60
61protected:
62	virtual void				Update(bool force = false);
63
64private:
65			ExtendedInfoWindow*	fExtendedInfoWindow;
66			BatteryInfoView*	fBatteryInfoView;
67			BatteryTabView*		fBatteryTabView;
68
69			bool				fSelected;
70};
71
72
73class BatteryTab : public BTab {
74public:
75						BatteryTab(BatteryInfoView* target,
76							ExtPowerStatusView* view);
77						~BatteryTab();
78
79	virtual	void		Select(BView* owner);
80
81	virtual	void		DrawFocusMark(BView* owner, BRect frame);
82	virtual	void		DrawLabel(BView* owner, BRect frame);
83private:
84	ExtPowerStatusView*	fBatteryView;
85};
86
87
88class BatteryTabView : public BTabView {
89public:
90					BatteryTabView(const char* name);
91					~BatteryTabView();
92
93	virtual	BRect	TabFrame(int32 index) const;
94};
95
96
97class ExtendedInfoWindow : public BWindow
98{
99public:
100		ExtendedInfoWindow(PowerStatusDriverInterface* interface);
101		~ExtendedInfoWindow();
102
103	BatteryTabView*				GetBatteryTabView();
104
105private:
106	PowerStatusDriverInterface* 		fDriverInterface;
107	BObjectList<ExtPowerStatusView>		fBatteryViewList;
108
109	BatteryTabView*						fBatteryTabView;
110
111	ExtPowerStatusView*					fSelectedView;
112};
113
114
115#endif
116