don't freak out if BMenuWindow::AttachScrollers() is called more than once (happens when a menu window has scrollers already, and we call BMenu::AddItem().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24094 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a6ca2bfcec
commit
60e1cfbfbb
@ -280,21 +280,27 @@ BMenuWindow::DetachMenu()
|
||||
void
|
||||
BMenuWindow::AttachScrollers()
|
||||
{
|
||||
// We want to attach a scroller only if there's a menu frame already
|
||||
// existing.
|
||||
// We want to attach a scroller only if there's a
|
||||
// menu frame already existing.
|
||||
if (!fMenu || !fMenuFrame)
|
||||
return;
|
||||
|
||||
if (fUpperScroller || fLowerScroller)
|
||||
debugger("Scrollers are already attached!");
|
||||
|
||||
|
||||
fMenu->MakeFocus(true);
|
||||
|
||||
BRect frame = Bounds();
|
||||
fUpperScroller = new UpperScroller(BRect(0, 0, frame.right, kScrollerHeight));
|
||||
AddChild(fUpperScroller);
|
||||
fLowerScroller = new LowerScroller(BRect(0, frame.bottom - kScrollerHeight, frame.right, frame.bottom));
|
||||
AddChild(fLowerScroller);
|
||||
|
||||
if (fUpperScroller == NULL) {
|
||||
fUpperScroller = new UpperScroller(
|
||||
BRect(0, 0, frame.right, kScrollerHeight));
|
||||
AddChild(fUpperScroller);
|
||||
}
|
||||
|
||||
if (fLowerScroller == NULL) {
|
||||
fLowerScroller = new LowerScroller(
|
||||
BRect(0, frame.bottom - kScrollerHeight,
|
||||
frame.right, frame.bottom));
|
||||
AddChild(fLowerScroller);
|
||||
}
|
||||
|
||||
fUpperScroller->SetEnabled(false);
|
||||
fLowerScroller->SetEnabled(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user