16aed176cSClemens Zeidler /* 26aed176cSClemens Zeidler * Copyright 2006, 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 76aed176cSClemens Zeidler */ 86aed176cSClemens Zeidler 96aed176cSClemens Zeidler #ifndef EXTENDED_INFO_WINDOW_H 106aed176cSClemens Zeidler #define EXTENDED_INFO_WINDOW_H 116aed176cSClemens Zeidler 126aed176cSClemens Zeidler #include <ObjectList.h> 13*e391ec67SClemens Zeidler #include <String.h> 146aed176cSClemens Zeidler #include <View.h> 156aed176cSClemens Zeidler #include <Window.h> 166aed176cSClemens Zeidler 176aed176cSClemens Zeidler #include "DriverInterface.h" 186aed176cSClemens Zeidler #include "PowerStatusView.h" 196aed176cSClemens Zeidler 206aed176cSClemens Zeidler 21*e391ec67SClemens Zeidler class FontString 22*e391ec67SClemens Zeidler { 23*e391ec67SClemens Zeidler public: 24*e391ec67SClemens Zeidler FontString(); 25*e391ec67SClemens Zeidler 26*e391ec67SClemens Zeidler const BFont* font; 27*e391ec67SClemens Zeidler BString string; 28*e391ec67SClemens Zeidler }; 29*e391ec67SClemens Zeidler 30*e391ec67SClemens Zeidler 316aed176cSClemens Zeidler class BatteryInfoView : public BView 326aed176cSClemens Zeidler { 336aed176cSClemens Zeidler public: 34*e391ec67SClemens Zeidler BatteryInfoView(); 35*e391ec67SClemens Zeidler ~BatteryInfoView(); 366aed176cSClemens Zeidler 376aed176cSClemens Zeidler virtual void Update(battery_info& info, 386aed176cSClemens Zeidler acpi_extended_battery_info& extInfo); 396aed176cSClemens Zeidler virtual void Draw(BRect updateRect); 40*e391ec67SClemens Zeidler virtual void GetPreferredSize(float *width, float *height); 416aed176cSClemens Zeidler 426aed176cSClemens Zeidler private: 43*e391ec67SClemens Zeidler BSize _MeasureString(const BString& string); 44*e391ec67SClemens Zeidler void _FillStringList(); 45*e391ec67SClemens Zeidler void _AddToStringList(FontString* fontString); 46*e391ec67SClemens Zeidler void _ClearStringList(); 47*e391ec67SClemens Zeidler 486aed176cSClemens Zeidler battery_info fBatteryInfo; 496aed176cSClemens Zeidler acpi_extended_battery_info fBatteryExtendedInfo; 50*e391ec67SClemens Zeidler 51*e391ec67SClemens Zeidler BSize fPreferredSize; 52*e391ec67SClemens Zeidler 53*e391ec67SClemens Zeidler BObjectList<FontString> fStringList; 54*e391ec67SClemens Zeidler BSize fMaxStringSize; 556aed176cSClemens Zeidler }; 566aed176cSClemens Zeidler 576aed176cSClemens Zeidler 586aed176cSClemens Zeidler class ExtendedInfoWindow; 596aed176cSClemens Zeidler 606aed176cSClemens Zeidler class ExtPowerStatusView : public PowerStatusView 616aed176cSClemens Zeidler { 626aed176cSClemens Zeidler public: 636aed176cSClemens Zeidler ExtPowerStatusView(PowerStatusDriverInterface* interface, 646aed176cSClemens Zeidler BRect frame, int32 resizingMode, int batteryId, 656aed176cSClemens Zeidler ExtendedInfoWindow* window); 666aed176cSClemens Zeidler 676aed176cSClemens Zeidler virtual void Draw(BRect updateRect); 686aed176cSClemens Zeidler virtual void MouseDown(BPoint where); 696aed176cSClemens Zeidler 706aed176cSClemens Zeidler virtual void Select(bool select = true); 716aed176cSClemens Zeidler 726aed176cSClemens Zeidler // return true if it battery is in a none critical state 736aed176cSClemens Zeidler virtual bool IsValid(); 746aed176cSClemens Zeidler 756aed176cSClemens Zeidler protected: 766aed176cSClemens Zeidler virtual void _Update(bool force = false); 776aed176cSClemens Zeidler 786aed176cSClemens Zeidler private: 796aed176cSClemens Zeidler ExtendedInfoWindow* fExtendedInfoWindow; 806aed176cSClemens Zeidler BatteryInfoView* fBatteryInfoView; 816aed176cSClemens Zeidler 826aed176cSClemens Zeidler bool fSelected; 836aed176cSClemens Zeidler }; 846aed176cSClemens Zeidler 856aed176cSClemens Zeidler 866aed176cSClemens Zeidler class ExtendedInfoWindow : public BWindow 876aed176cSClemens Zeidler { 886aed176cSClemens Zeidler public: 896aed176cSClemens Zeidler ExtendedInfoWindow(PowerStatusDriverInterface* interface); 906aed176cSClemens Zeidler ~ExtendedInfoWindow(); 916aed176cSClemens Zeidler 926aed176cSClemens Zeidler BatteryInfoView* GetExtendedBatteryInfoView(); 936aed176cSClemens Zeidler 946aed176cSClemens Zeidler void BatterySelected(ExtPowerStatusView* view); 956aed176cSClemens Zeidler 966aed176cSClemens Zeidler private: 976aed176cSClemens Zeidler PowerStatusDriverInterface* fDriverInterface; 986aed176cSClemens Zeidler BObjectList<ExtPowerStatusView> fBatteryViewList; 996aed176cSClemens Zeidler 1006aed176cSClemens Zeidler BatteryInfoView* fBatteryInfoView; 1016aed176cSClemens Zeidler 1026aed176cSClemens Zeidler ExtPowerStatusView* fSelectedView; 1036aed176cSClemens Zeidler }; 1046aed176cSClemens Zeidler 1056aed176cSClemens Zeidler 1066aed176cSClemens Zeidler #endif 107