From c73d4b3dc21ef6fb52f17c174d55fba92b54f3e9 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sat, 18 Aug 2012 16:22:23 -0400 Subject: [PATCH] Move AboutPosition() method up. --- headers/private/shared/AboutWindow.h | 3 +- src/kits/shared/AboutWindow.cpp | 48 ++++++++++++++-------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/headers/private/shared/AboutWindow.h b/headers/private/shared/AboutWindow.h index 57e79e7392..1d03fb1226 100644 --- a/headers/private/shared/AboutWindow.h +++ b/headers/private/shared/AboutWindow.h @@ -23,6 +23,7 @@ class BAboutWindow : public BWindow { virtual bool QuitRequested(); + BPoint AboutPosition(float width, float height); void AddDescription(const char* description); void AddCopyright(int32 firstCopyrightYear, const char* copyrightHolder, @@ -32,8 +33,6 @@ class BAboutWindow : public BWindow { void AddVersionHistory(const char** history); void AddExtraInfo(const char* extraInfo); - BPoint AboutPosition(float width, float height); - private: AboutView* fAboutView; BHandler* fCaller; diff --git a/src/kits/shared/AboutWindow.cpp b/src/kits/shared/AboutWindow.cpp index cf513a9d39..cb30ee8ee5 100644 --- a/src/kits/shared/AboutWindow.cpp +++ b/src/kits/shared/AboutWindow.cpp @@ -295,6 +295,30 @@ BAboutWindow::QuitRequested() // #pragma mark - +BPoint +BAboutWindow::AboutPosition(float width, float height) +{ + BPoint result(100, 100); + + BWindow* window = + dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); + + BScreen screen(window); + BRect screenFrame(0, 0, 640, 480); + if (screen.IsValid()) + screenFrame = screen.Frame(); + + // Horizontally, we're smack in the middle + result.x = screenFrame.left + (screenFrame.Width() / 2.0) - (width / 2.0); + + // This is probably sooo wrong, but it looks right on 1024 x 768 + result.y = screenFrame.top + (screenFrame.Height() / 4.0) + - ceil(height / 3.0); + + return result; +} + + void BAboutWindow::AddDescription(const char* description) { @@ -441,27 +465,3 @@ BAboutWindow::AddExtraInfo(const char* extraInfo) fAboutView->InfoView()->Insert(extra.String()); } - - -BPoint -BAboutWindow::AboutPosition(float width, float height) -{ - BPoint result(100, 100); - - BWindow* window = - dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); - - BScreen screen(window); - BRect screenFrame(0, 0, 640, 480); - if (screen.IsValid()) - screenFrame = screen.Frame(); - - // Horizontally, we're smack in the middle - result.x = screenFrame.left + (screenFrame.Width() / 2.0) - (width / 2.0); - - // This is probably sooo wrong, but it looks right on 1024 x 768 - result.y = screenFrame.top + (screenFrame.Height() / 4.0) - - ceil(height / 3.0); - - return result; -}