Time: properly center the window.

* The previous code was broken, and did not take the actual window
  size into account; it's now using BWindow::MoveOnScreen().
* Also, make the width of the time zone list relative to the font size.
This commit is contained in:
Axel Dörfler
2015-09-14 20:46:02 +02:00
parent 8d46a99fe9
commit 64ee9242db
2 changed files with 4 additions and 13 deletions
+2 -12
View File
@@ -149,18 +149,8 @@ TTimeWindow::_InitWindow()
void
TTimeWindow::_AlignWindow()
{
BPoint pt = TimeSettings().LeftTop();
MoveTo(pt);
BRect frame = Frame();
BRect screen = BScreen().Frame();
if (!frame.Intersects(screen.InsetByCopy(50.0, 50.0))) {
BRect bounds(Bounds());
BPoint leftTop((screen.Width() - bounds.Width()) / 2.0,
(screen.Height() - bounds.Height()) / 2.0);
MoveTo(leftTop);
}
MoveTo(TimeSettings().LeftTop());
MoveOnScreen();
}
+2 -1
View File
@@ -213,7 +213,8 @@ TimeZoneView::_InitView()
_BuildZoneMenu();
BScrollView* scrollList = new BScrollView("scrollList", fZoneList,
B_FRAME_EVENTS | B_WILL_DRAW, false, true);
scrollList->SetExplicitMinSize(BSize(200, 0));
scrollList->SetExplicitMinSize(
BSize(200 * be_plain_font->Size() / 12.0f, 0));
fCurrent = new TTZDisplay("currentTime", B_TRANSLATE("Current time:"));
fPreview = new TTZDisplay("previewTime", B_TRANSLATE("Preview time:"));