Finally implemented BWindow::CenterOnScreen, with associated CenterIn(BRect)

methods as well as Size(). To avoid the problem of centering the window before
it has been resized by the layout system, I force the resizing early. If there
is a better way to do this or some way to avoid doing it repeatedly, let me
know. But I figure the Center* methods should not be called that often.

Updated Screenshot and DiskProbe to use this new method as a test. It certainly
cleaned up DiskProbe. I will update other code over the next few days (if
anyone wants to help, please do :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32612 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood
2009-08-22 14:17:29 +00:00
parent f277acc9cd
commit 2ff62714d0
5 changed files with 47 additions and 24 deletions
+6
View File
@@ -14,6 +14,7 @@
#include <List.h>
#include <Looper.h>
#include <Rect.h>
#include <Size.h>
#include <StorageDefs.h>
#include <View.h>
@@ -167,6 +168,10 @@ public:
void ResizeBy(float dx, float dy);
void ResizeTo(float width, float height);
void CenterIn(BRect* rect);
void CenterIn(BRect rect);
void CenterOnScreen();
virtual void Show();
virtual void Hide();
bool IsHidden() const;
@@ -188,6 +193,7 @@ public:
BRect Bounds() const;
BRect Frame() const;
BRect DecoratorFrame() const;
BSize Size() const;
const char* Title() const;
void SetTitle(const char* title);
bool IsFront() const;