@@ -11,6 +11,6 @@
|
|||||||
|
|
||||||
extern const char* kSignature;
|
extern const char* kSignature;
|
||||||
extern const char* kDeskbarItemName;
|
extern const char* kDeskbarItemName;
|
||||||
|
extern const char* kDeskbarSignature;
|
||||||
|
|
||||||
#endif // POWER_STATUS_H
|
#endif // POWER_STATUS_H
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
#include <Resources.h>
|
#include <Resources.h>
|
||||||
|
#include <Roster.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
|
|
||||||
@@ -76,8 +77,14 @@ PowerStatusView::PowerStatusView(PowerStatusDriverInterface* interface,
|
|||||||
|
|
||||||
|
|
||||||
PowerStatusView::PowerStatusView(BMessage* archive)
|
PowerStatusView::PowerStatusView(BMessage* archive)
|
||||||
: BView(archive)
|
:
|
||||||
|
BView(archive),
|
||||||
|
fInDeskbar(false)
|
||||||
{
|
{
|
||||||
|
app_info info;
|
||||||
|
if (be_app->GetAppInfo(&info) == B_OK
|
||||||
|
&& !strcasecmp(info.signature, kDeskbarSignature))
|
||||||
|
fInDeskbar = true;
|
||||||
_Init();
|
_Init();
|
||||||
FromMessage(archive);
|
FromMessage(archive);
|
||||||
}
|
}
|
||||||
@@ -102,8 +109,6 @@ PowerStatusView::Archive(BMessage* archive, bool deep) const
|
|||||||
void
|
void
|
||||||
PowerStatusView::_Init()
|
PowerStatusView::_Init()
|
||||||
{
|
{
|
||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
|
||||||
|
|
||||||
fShowLabel = true;
|
fShowLabel = true;
|
||||||
fShowTime = false;
|
fShowTime = false;
|
||||||
fShowStatusIcon = true;
|
fShowStatusIcon = true;
|
||||||
@@ -118,15 +123,18 @@ void
|
|||||||
PowerStatusView::AttachedToWindow()
|
PowerStatusView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
AdoptParentColors();
|
if (Parent() != NULL) {
|
||||||
|
if ((Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0)
|
||||||
float tint = B_NO_TINT;
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
color_which which = ViewUIColor(&tint);
|
|
||||||
|
|
||||||
if (which == B_NO_COLOR)
|
|
||||||
SetLowUIColor(B_PANEL_BACKGROUND_COLOR);
|
|
||||||
else
|
else
|
||||||
SetLowUIColor(which, tint);
|
AdoptParentColors();
|
||||||
|
} else
|
||||||
|
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||||
|
|
||||||
|
if (ViewUIColor() != B_NO_COLOR)
|
||||||
|
SetLowUIColor(ViewUIColor());
|
||||||
|
else
|
||||||
|
SetLowColor(ViewColor());
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
@@ -263,8 +271,6 @@ PowerStatusView::Draw(BRect updateRect)
|
|||||||
{
|
{
|
||||||
bool drawBackground = Parent() == NULL
|
bool drawBackground = Parent() == NULL
|
||||||
|| (Parent()->Flags() & B_DRAW_ON_CHILDREN) == 0;
|
|| (Parent()->Flags() & B_DRAW_ON_CHILDREN) == 0;
|
||||||
if (drawBackground)
|
|
||||||
FillRect(updateRect, B_SOLID_LOW);
|
|
||||||
|
|
||||||
float aspect = Bounds().Width() / Bounds().Height();
|
float aspect = Bounds().Width() / Bounds().Height();
|
||||||
bool below = aspect <= 1.0f;
|
bool below = aspect <= 1.0f;
|
||||||
@@ -371,7 +377,6 @@ PowerStatusView::Update(bool force)
|
|||||||
time_t previousTimeLeft = fTimeLeft;
|
time_t previousTimeLeft = fTimeLeft;
|
||||||
bool wasOnline = fOnline;
|
bool wasOnline = fOnline;
|
||||||
bool hadBattery = fHasBattery;
|
bool hadBattery = fHasBattery;
|
||||||
|
|
||||||
_GetBatteryInfo(fBatteryID, &fBatteryInfo);
|
_GetBatteryInfo(fBatteryID, &fBatteryInfo);
|
||||||
fHasBattery = fBatteryInfo.full_capacity > 0;
|
fHasBattery = fBatteryInfo.full_capacity > 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user