Center the ExtendedInfoWindow on the screen.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31990 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include <GroupLayout.h>
|
#include <GroupLayout.h>
|
||||||
#include <GroupView.h>
|
#include <GroupView.h>
|
||||||
#include <SpaceLayoutItem.h>
|
#include <SpaceLayoutItem.h>
|
||||||
|
#include <Screen.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -77,6 +78,19 @@ BatteryInfoView::GetPreferredSize(float *width, float *height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BatteryInfoView::AttachedToWindow()
|
||||||
|
{
|
||||||
|
BRect rect = BScreen().Frame();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BSize
|
BSize
|
||||||
BatteryInfoView::_MeasureString(const BString& string)
|
BatteryInfoView::_MeasureString(const BString& string)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class BatteryInfoView : public BView
|
|||||||
acpi_extended_battery_info& extInfo);
|
acpi_extended_battery_info& extInfo);
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void GetPreferredSize(float *width, float *height);
|
virtual void GetPreferredSize(float *width, float *height);
|
||||||
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BSize _MeasureString(const BString& string);
|
BSize _MeasureString(const BString& string);
|
||||||
|
|||||||
Reference in New Issue
Block a user