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 */ 96aed176cSClemens Zeidler 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örfler class BatteryInfoView : public BView { 266aed176cSClemens Zeidler public: 27e391ec67SClemens Zeidler BatteryInfoView(); 28e391ec67SClemens Zeidler ~BatteryInfoView(); 296aed176cSClemens Zeidler 306aed176cSClemens Zeidler virtual void Update(battery_info& info, 316aed176cSClemens Zeidler acpi_extended_battery_info& extInfo); 328b24b02fSClemens Zeidler virtual void AttachedToWindow(); 336aed176cSClemens Zeidler 346aed176cSClemens Zeidler private: 35d1929affSKacper Kasper BString _GetTextForLine(size_t line); 36e391ec67SClemens Zeidler 376aed176cSClemens Zeidler battery_info fBatteryInfo; 386aed176cSClemens Zeidler acpi_extended_battery_info fBatteryExtendedInfo; 39e391ec67SClemens Zeidler 40d1929affSKacper Kasper BObjectList<BStringView> fStringList; 416aed176cSClemens Zeidler }; 426aed176cSClemens Zeidler 436aed176cSClemens Zeidler 446aed176cSClemens Zeidler class ExtendedInfoWindow; 45830758adSKacper Kasper class BatteryTabView; 466aed176cSClemens Zeidler 47bd767f5aSAxel Dörfler class ExtPowerStatusView : public PowerStatusView { 486aed176cSClemens Zeidler public: 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); 556aed176cSClemens Zeidler 566aed176cSClemens Zeidler virtual void Select(bool select = true); 576aed176cSClemens Zeidler 58bd767f5aSAxel Dörfler // return true if it battery is in a critical state 59bd767f5aSAxel Dörfler virtual bool IsCritical(); 606aed176cSClemens Zeidler 616aed176cSClemens Zeidler protected: 62*10074df1SPawan Wadhwani virtual void Update(bool force = false, bool notify = true); 636aed176cSClemens Zeidler 646aed176cSClemens Zeidler private: 656aed176cSClemens Zeidler ExtendedInfoWindow* fExtendedInfoWindow; 666aed176cSClemens Zeidler BatteryInfoView* fBatteryInfoView; 67830758adSKacper Kasper BatteryTabView* fBatteryTabView; 686aed176cSClemens Zeidler 696aed176cSClemens Zeidler bool fSelected; 706aed176cSClemens Zeidler }; 716aed176cSClemens Zeidler 726aed176cSClemens Zeidler 73830758adSKacper Kasper class BatteryTab : public BTab { 74830758adSKacper Kasper public: 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 Kasper private: 84830758adSKacper Kasper ExtPowerStatusView* fBatteryView; 85830758adSKacper Kasper }; 86830758adSKacper Kasper 87830758adSKacper Kasper 88830758adSKacper Kasper class BatteryTabView : public BTabView { 89830758adSKacper Kasper public: 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 Zeidler class ExtendedInfoWindow : public BWindow 986aed176cSClemens Zeidler { 996aed176cSClemens Zeidler public: 1006aed176cSClemens Zeidler ExtendedInfoWindow(PowerStatusDriverInterface* interface); 1016aed176cSClemens Zeidler ~ExtendedInfoWindow(); 1026aed176cSClemens Zeidler 103830758adSKacper Kasper BatteryTabView* GetBatteryTabView(); 1046aed176cSClemens Zeidler 1056aed176cSClemens Zeidler private: 1066aed176cSClemens Zeidler PowerStatusDriverInterface* fDriverInterface; 1076aed176cSClemens Zeidler BObjectList<ExtPowerStatusView> fBatteryViewList; 1086aed176cSClemens Zeidler 109830758adSKacper Kasper BatteryTabView* fBatteryTabView; 1106aed176cSClemens Zeidler 1116aed176cSClemens Zeidler ExtPowerStatusView* fSelectedView; 1126aed176cSClemens Zeidler }; 1136aed176cSClemens Zeidler 1146aed176cSClemens Zeidler 1156aed176cSClemens Zeidler #endif 116