2 * Copyright 2006-2017, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
7 * Clemens Zeidler, haiku@Clemens-Zeidler.de
9 #ifndef POWER_STATUS_VIEW_H
10 #define POWER_STATUS_VIEW_H
15 #include "DriverInterface.h"
21 class PowerStatusView
: public BView
{
24 PowerStatusDriverInterface
* interface
,
25 BRect frame
, int32 resizingMode
,
26 int batteryID
= -1, bool inDeskbar
= false);
28 virtual ~PowerStatusView();
30 virtual status_t
Archive(BMessage
* archive
, bool deep
= true) const;
32 virtual void AttachedToWindow();
33 virtual void DetachedFromWindow();
35 virtual void MessageReceived(BMessage
* message
);
36 virtual void Draw(BRect updateRect
);
37 void DrawTo(BView
* view
, BRect rect
);
41 PowerStatusView(BMessage
* archive
);
43 virtual void Update(bool force
= false);
45 void FromMessage(const BMessage
* message
);
46 status_t
ToMessage(BMessage
* message
) const;
49 void _GetBatteryInfo(int batteryID
, battery_info
* info
);
51 void _SetLabel(char* buffer
, size_t bufferLength
);
52 void _DrawBattery(BView
* view
, BRect rect
);
53 void _NotifyLowBattery();
56 PowerStatusDriverInterface
* fDriverInterface
;
65 battery_info fBatteryInfo
;
74 class PowerStatusReplicant
: public PowerStatusView
{
76 PowerStatusReplicant(BRect frame
,
77 int32 resizingMode
, bool inDeskbar
= false);
78 PowerStatusReplicant(BMessage
* archive
);
79 virtual ~PowerStatusReplicant();
81 static PowerStatusReplicant
* Instantiate(BMessage
* archive
);
82 virtual status_t
Archive(BMessage
* archive
, bool deep
= true) const;
84 virtual void MessageReceived(BMessage
* message
);
85 virtual void MouseDown(BPoint where
);
88 void _AboutRequested();
92 status_t
_GetSettings(BFile
& file
, int mode
);
96 void _OpenExtendedWindow();
99 BWindow
* fExtendedWindow
;
100 bool fMessengerExist
;
101 BMessenger
* fExtWindowMessenger
;
106 #endif // POWER_STATUS_VIEW_H