PowerStatus: show when the battery is charging.

This commit is contained in:
Adrien Destugues
2015-08-22 15:11:39 +02:00
parent 6b6288a6de
commit 4b26da642b
+21
View File
@@ -11,6 +11,7 @@
#include "PowerStatusView.h"
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -222,6 +223,26 @@ PowerStatusView::_DrawBattery(BRect rect)
}
}
if (fOnline) {
// When charging, draw a lightning symbol over the battery.
SetHighColor(255, 255, 0, 180);
SetDrawingMode(B_OP_ALPHA);
SetScale(std::min(Bounds().Width(), Bounds().Height()) / 16);
static const BPoint points[] = {
BPoint(2,13),
BPoint(9,5),
BPoint(9,7),
BPoint(16,2),
BPoint(8,11),
BPoint(8,9)
};
FillPolygon(points,6);
SetScale(1);
SetDrawingMode(B_OP_OVER);
}
SetHighColor(0, 0, 0);
}