Implemented CalcFrame() and used it to limit the menu frame's size (actually, only the width for now). This shows that TruncateLabel() works.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13229 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2005-06-23 08:41:55 +00:00
parent cab8c0900c
commit 557dfeeb12
+11 -1
View File
@@ -1359,7 +1359,10 @@ BMenu::ItemLocInRect(BRect frame) const
BRect
BMenu::CalcFrame(BPoint where, bool *scrollOn)
{
return BRect();
// TODO: Improve me
BRect frame = BScreen(MenuWindow()).Frame();
frame.left += where.x + 2;
return frame;
}
@@ -1664,6 +1667,13 @@ void
BMenu::UpdateWindowViewSize(bool upWind)
{
ASSERT(fCachedMenuWindow != NULL);
// TODO: Improve this, we already resize the menu
// in "LayoutItems()"
bool scroll;
BRect maxFrame = CalcFrame(ScreenLocation(), &scroll);
float width = min_c(Frame().Width(), maxFrame.Width());
ResizeTo(width, Frame().Height());
if (fCachedMenuWindow != NULL) {
fCachedMenuWindow->ResizeTo(Bounds().Width() + 2, Bounds().Height() + 2);
fCachedMenuWindow->MoveTo(ScreenLocation());