|
|
|
@ -47,6 +47,9 @@ namespace MWGui
|
|
|
|
|
adjustButton(mCloseButton);
|
|
|
|
|
adjustButton(mTakeButton);
|
|
|
|
|
|
|
|
|
|
mCloseButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &ScrollWindow::onKeyButtonPressed);
|
|
|
|
|
mTakeButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &ScrollWindow::onKeyButtonPressed);
|
|
|
|
|
|
|
|
|
|
center();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -66,14 +69,28 @@ namespace MWGui
|
|
|
|
|
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
|
|
|
|
|
mTextView->setVisibleVScroll(false);
|
|
|
|
|
if (size.height > mTextView->getSize().height)
|
|
|
|
|
mTextView->setCanvasSize(MyGUI::IntSize(410, size.height));
|
|
|
|
|
mTextView->setCanvasSize(mTextView->getWidth(), size.height);
|
|
|
|
|
else
|
|
|
|
|
mTextView->setCanvasSize(410, mTextView->getSize().height);
|
|
|
|
|
mTextView->setCanvasSize(mTextView->getWidth(), mTextView->getSize().height);
|
|
|
|
|
mTextView->setVisibleVScroll(true);
|
|
|
|
|
|
|
|
|
|
mTextView->setViewOffset(MyGUI::IntPoint(0,0));
|
|
|
|
|
|
|
|
|
|
setTakeButtonShow(showTakeButton);
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mCloseButton);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScrollWindow::onKeyButtonPressed(MyGUI::Widget *sender, MyGUI::KeyCode key, MyGUI::Char character)
|
|
|
|
|
{
|
|
|
|
|
int scroll = 0;
|
|
|
|
|
if (key == MyGUI::KeyCode::ArrowUp)
|
|
|
|
|
scroll = 40;
|
|
|
|
|
else if (key == MyGUI::KeyCode::ArrowDown)
|
|
|
|
|
scroll = -40;
|
|
|
|
|
|
|
|
|
|
if (scroll != 0)
|
|
|
|
|
mTextView->setViewOffset(mTextView->getViewOffset() + MyGUI::IntPoint(0, scroll));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScrollWindow::setTakeButtonShow(bool show)
|
|
|
|
|