Move AboutPosition() method up.

This commit is contained in:
John Scipione
2012-11-12 23:57:31 -05:00
parent d156f97655
commit c73d4b3dc2
2 changed files with 25 additions and 26 deletions
+1 -2
View File
@@ -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;
+24 -24
View File
@@ -295,6 +295,30 @@ BAboutWindow::QuitRequested()
// #pragma mark -
BPoint
BAboutWindow::AboutPosition(float width, float height)
{
BPoint result(100, 100);
BWindow* window =
dynamic_cast<BWindow*>(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<BWindow*>(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;
}