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:
@@ -1359,7 +1359,10 @@ BMenu::ItemLocInRect(BRect frame) const
|
|||||||
BRect
|
BRect
|
||||||
BMenu::CalcFrame(BPoint where, bool *scrollOn)
|
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)
|
BMenu::UpdateWindowViewSize(bool upWind)
|
||||||
{
|
{
|
||||||
ASSERT(fCachedMenuWindow != NULL);
|
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) {
|
if (fCachedMenuWindow != NULL) {
|
||||||
fCachedMenuWindow->ResizeTo(Bounds().Width() + 2, Bounds().Height() + 2);
|
fCachedMenuWindow->ResizeTo(Bounds().Width() + 2, Bounds().Height() + 2);
|
||||||
fCachedMenuWindow->MoveTo(ScreenLocation());
|
fCachedMenuWindow->MoveTo(ScreenLocation());
|
||||||
|
|||||||
Reference in New Issue
Block a user