Added DecoratorFrame() method, which returns the outer frame of the window
on screen (ie including the decorator border and tab). Plus the necessary refactoring as well as some TODO notes about windows with the tab on the left side. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29820 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8d8da849c8
commit
f247113640
@ -186,6 +186,7 @@ public:
|
||||
|
||||
BRect Bounds() const;
|
||||
BRect Frame() const;
|
||||
BRect DecoratorFrame() const;
|
||||
const char* Title() const;
|
||||
void SetTitle(const char* title);
|
||||
bool IsFront() const;
|
||||
@ -331,6 +332,9 @@ private:
|
||||
bool _HandleKeyDown(BMessage* event);
|
||||
void _KeyboardNavigation();
|
||||
|
||||
void _GetDecoratorSize(float* _borderWidth,
|
||||
float* _tabHeight) const;
|
||||
|
||||
private:
|
||||
char* fTitle;
|
||||
int32 _unused0;
|
||||
|
@ -1532,16 +1532,9 @@ BWindow::Zoom()
|
||||
the smallest of three rectangles:
|
||||
*/
|
||||
|
||||
// fallback in case retrieving the decorator settings fails (highly unlikely)
|
||||
float borderWidth = 5.0;
|
||||
float tabHeight = 21.0;
|
||||
BMessage settings;
|
||||
if (GetDecoratorSettings(&settings) == B_OK) {
|
||||
BRect tabRect;
|
||||
if (settings.FindRect("tab frame", &tabRect) == B_OK)
|
||||
tabHeight = tabRect.Height();
|
||||
settings.FindFloat("border width", &borderWidth);
|
||||
}
|
||||
float borderWidth;
|
||||
float tabHeight;
|
||||
_GetDecoratorSize(&borderWidth, &tabHeight);
|
||||
|
||||
// 1) the rectangle defined by SetZoomLimits(),
|
||||
float zoomedWidth = fMaxZoomWidth;
|
||||
@ -1555,6 +1548,7 @@ BWindow::Zoom()
|
||||
|
||||
// 3) the screen rectangle
|
||||
BScreen screen(this);
|
||||
// TODO: Broken for tab on left side windows...
|
||||
float screenWidth = screen.Frame().Width() - 2 * borderWidth;
|
||||
float screenHeight = screen.Frame().Height() - (2 * borderWidth + tabHeight);
|
||||
if (screenWidth < zoomedWidth)
|
||||
@ -1562,7 +1556,8 @@ BWindow::Zoom()
|
||||
if (screenHeight < zoomedHeight)
|
||||
zoomedHeight = screenHeight;
|
||||
|
||||
BPoint zoomedLeftTop = screen.Frame().LeftTop() + BPoint(borderWidth, tabHeight + borderWidth);
|
||||
BPoint zoomedLeftTop = screen.Frame().LeftTop() + BPoint(borderWidth,
|
||||
tabHeight + borderWidth);
|
||||
|
||||
// UN-ZOOM:
|
||||
if (fPreviousFrame.IsValid()
|
||||
@ -1914,6 +1909,22 @@ BWindow::Frame() const
|
||||
}
|
||||
|
||||
|
||||
BRect
|
||||
BWindow::DecoratorFrame() const
|
||||
{
|
||||
BRect decortatorFrame(Frame());
|
||||
float borderWidth;
|
||||
float tabHeight;
|
||||
_GetDecoratorSize(&borderWidth, &tabHeight);
|
||||
// TODO: Broken for tab on left window side windows...
|
||||
decortatorFrame.top -= tabHeight;
|
||||
decortatorFrame.left -= borderWidth;
|
||||
decortatorFrame.right += borderWidth;
|
||||
decortatorFrame.bottom += borderWidth;
|
||||
return decortatorFrame;
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
BWindow::Title() const
|
||||
{
|
||||
@ -3686,6 +3697,36 @@ BWindow::IsFilePanel() const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BWindow::_GetDecoratorSize(float* _borderWidth, float* _tabHeight) const
|
||||
{
|
||||
// fallback in case retrieving the decorator settings fails
|
||||
// (highly unlikely)
|
||||
float borderWidth = 5.0;
|
||||
float tabHeight = 21.0;
|
||||
|
||||
BMessage settings;
|
||||
if (GetDecoratorSettings(&settings) == B_OK) {
|
||||
BRect tabRect;
|
||||
if (settings.FindRect("tab frame", &tabRect) == B_OK)
|
||||
tabHeight = tabRect.Height();
|
||||
settings.FindFloat("border width", &borderWidth);
|
||||
} else {
|
||||
// probably no-border window look
|
||||
if (fLook == B_NO_BORDER_WINDOW_LOOK) {
|
||||
borderWidth = 0.0;
|
||||
tabHeight = 0.0;
|
||||
}
|
||||
// else use fall-back values from above
|
||||
}
|
||||
|
||||
if (_borderWidth != NULL)
|
||||
*_borderWidth = borderWidth;
|
||||
if (_tabHeight != NULL)
|
||||
*_tabHeight = tabHeight;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - C++ binary compatibility kludge
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user