PowerStatus: make tab size dependent on font size.

This commit is contained in:
Kacper Kasper 2017-11-24 15:27:33 +01:00
parent 8ddec194c6
commit 546065592d
2 changed files with 5 additions and 3 deletions

View File

@ -343,15 +343,17 @@ ExtendedInfoWindow::ExtendedInfoWindow(PowerStatusDriverInterface* interface)
{
fDriverInterface->AcquireReference();
float scale = be_plain_font->Size() / 12.0f;
float tabHeight = 70.0f * scale;
BRect batteryRect(0, 0, 50 * scale, 50 * scale);
fBatteryTabView = new BatteryTabView("tabview");
fBatteryTabView->SetBorder(B_NO_BORDER);
fBatteryTabView->SetTabHeight(70.0f);
fBatteryTabView->SetTabHeight(tabHeight);
fBatteryTabView->SetTabSide(BTabView::kLeftSide);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING, 0)
.Add(fBatteryTabView);
BRect batteryRect(0, 0, 50, 30);
for (int i = 0; i < interface->GetBatteryCount(); i++) {
BatteryInfoView* batteryInfoView = new BatteryInfoView();
ExtPowerStatusView* view = new ExtPowerStatusView(interface,

View File

@ -277,7 +277,7 @@ PowerStatusView::Draw(BRect updateRect)
void
PowerStatusView::DrawTo(BView* view, BRect rect)
{
bool inside = rect.Width() >= 50.0f && rect.Height() >= 40.0f;
bool inside = rect.Width() >= 40.0f && rect.Height() >= 40.0f;
font_height fontHeight;
view->GetFontHeight(&fontHeight);