Use the new CenterOnScreen function to center the window.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33425 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -84,13 +84,7 @@ BatteryInfoView::GetPreferredSize(float* width, float* height)
|
|||||||
void
|
void
|
||||||
BatteryInfoView::AttachedToWindow()
|
BatteryInfoView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BRect rect = BScreen().Frame();
|
Window()->CenterOnScreen();
|
||||||
BRect windowFrame = Window()->Frame();
|
|
||||||
BPoint position;
|
|
||||||
// center window on screen
|
|
||||||
position.x = (rect.Width() - windowFrame.Width()) / 2;
|
|
||||||
position.y = (rect.Height() - windowFrame.Height()) / 2;
|
|
||||||
Window()->MoveTo(position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user