Add workaround for ScrollView messing up canvas size (Fixes #1700)

TODO: Create fixed ScrollView widget?
deque
scrawl 11 years ago
parent 16b089cdc8
commit 31d058b98c

@ -115,7 +115,13 @@ void ItemView::update()
} }
x += 42; x += 42;
MyGUI::IntSize size = MyGUI::IntSize(std::max(mScrollView->getSize().width, x), mScrollView->getSize().height); MyGUI::IntSize size = MyGUI::IntSize(std::max(mScrollView->getSize().width, x), mScrollView->getSize().height);
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mScrollView->setVisibleVScroll(false);
mScrollView->setVisibleHScroll(false);
mScrollView->setCanvasSize(size); mScrollView->setCanvasSize(size);
mScrollView->setVisibleVScroll(true);
mScrollView->setVisibleHScroll(true);
dragArea->setSize(size); dragArea->setSize(size);
} }

@ -400,7 +400,10 @@ namespace
getPage (pageId)->showPage (book, 0); getPage (pageId)->showPage (book, 0);
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
getWidget <MyGUI::ScrollView> (listId)->setVisibleVScroll(false);
getWidget <MyGUI::ScrollView> (listId)->setCanvasSize (size.first, size.second); getWidget <MyGUI::ScrollView> (listId)->setCanvasSize (size.first, size.second);
getWidget <MyGUI::ScrollView> (listId)->setVisibleVScroll(true);
} }
void notifyIndexLinkClicked (MWGui::TypesetBook::InteractiveId character) void notifyIndexLinkClicked (MWGui::TypesetBook::InteractiveId character)

@ -93,7 +93,11 @@ namespace MWGui
} }
++i; ++i;
} }
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mScrollView->setVisibleVScroll(false);
mScrollView->setCanvasSize(mClient->getSize().width, std::max(mItemHeight, mClient->getSize().height)); mScrollView->setCanvasSize(mClient->getSize().width, std::max(mItemHeight, mClient->getSize().height));
mScrollView->setVisibleVScroll(true);
if (!scrollbarShown && mItemHeight > mClient->getSize().height) if (!scrollbarShown && mItemHeight > mClient->getSize().height)
redraw(true); redraw(true);

@ -91,7 +91,10 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onRepairButtonClick); button->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onRepairButtonClick);
} }
} }
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mList->setVisibleVScroll(false);
mList->setCanvasSize (MyGUI::IntSize(mList->getWidth(), std::max(mList->getHeight(), currentY))); mList->setCanvasSize (MyGUI::IntSize(mList->getWidth(), std::max(mList->getHeight(), currentY)));
mList->setVisibleVScroll(true);
mGoldLabel->setCaptionWithReplacing("#{sGold}: " mGoldLabel->setCaptionWithReplacing("#{sGold}: "
+ boost::lexical_cast<std::string>(playerGold)); + boost::lexical_cast<std::string>(playerGold));

@ -654,9 +654,10 @@ namespace MWGui
mHeight += spellHeight; mHeight += spellHeight;
} }
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mMagicList->setVisibleVScroll(false);
mMagicList->setCanvasSize (mWidth, std::max(mMagicList->getHeight(), mHeight)); mMagicList->setCanvasSize (mWidth, std::max(mMagicList->getHeight(), mHeight));
mMagicList->setVisibleVScroll(true);
} }
void MagicSelectionDialog::addGroup(const std::string &label, const std::string& label2) void MagicSelectionDialog::addGroup(const std::string &label, const std::string& label2)

@ -119,7 +119,11 @@ void Recharge::updateView()
currentY += 32 + 4; currentY += 32 + 4;
} }
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mView->setVisibleVScroll(false);
mView->setCanvasSize (MyGUI::IntSize(mView->getWidth(), std::max(mView->getHeight(), currentY))); mView->setCanvasSize (MyGUI::IntSize(mView->getWidth(), std::max(mView->getHeight(), currentY)));
mView->setVisibleVScroll(true);
} }
void Recharge::onCancel(MyGUI::Widget *sender) void Recharge::onCancel(MyGUI::Widget *sender)

@ -126,7 +126,10 @@ void Repair::updateRepairView()
currentY += 32 + 4; currentY += 32 + 4;
} }
} }
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mRepairView->setVisibleVScroll(false);
mRepairView->setCanvasSize (MyGUI::IntSize(mRepairView->getWidth(), std::max(mRepairView->getHeight(), currentY))); mRepairView->setCanvasSize (MyGUI::IntSize(mRepairView->getWidth(), std::max(mRepairView->getHeight(), currentY)));
mRepairView->setVisibleVScroll(true);
} }
void Repair::onCancel(MyGUI::Widget *sender) void Repair::onCancel(MyGUI::Widget *sender)

@ -320,7 +320,10 @@ namespace MWGui
if (!mMiscSkills.empty()) if (!mMiscSkills.empty())
addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2); addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mSkillView->setVisibleVScroll(false);
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top)); mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top));
mSkillView->setVisibleVScroll(true);
} }
// widget controls // widget controls

@ -57,10 +57,13 @@ namespace MWGui
BookTextParser parser; BookTextParser parser;
MyGUI::IntSize size = parser.parseScroll(ref->mBase->mText, mTextView, 390); MyGUI::IntSize size = parser.parseScroll(ref->mBase->mText, mTextView, 390);
// 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) if (size.height > mTextView->getSize().height)
mTextView->setCanvasSize(MyGUI::IntSize(410, size.height)); mTextView->setCanvasSize(MyGUI::IntSize(410, size.height));
else else
mTextView->setCanvasSize(410, mTextView->getSize().height); mTextView->setCanvasSize(410, mTextView->getSize().height);
mTextView->setVisibleVScroll(true);
mTextView->setViewOffset(MyGUI::IntPoint(0,0)); mTextView->setViewOffset(MyGUI::IntPoint(0,0));

@ -473,7 +473,10 @@ namespace MWGui
curH += h; curH += h;
} }
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mControlsBox->setVisibleVScroll(false);
mControlsBox->setCanvasSize (mControlsBox->getWidth(), std::max(curH, mControlsBox->getHeight())); mControlsBox->setCanvasSize (mControlsBox->getWidth(), std::max(curH, mControlsBox->getHeight()));
mControlsBox->setVisibleVScroll(true);
} }
void SettingsWindow::onRebindAction(MyGUI::Widget* _sender) void SettingsWindow::onRebindAction(MyGUI::Widget* _sender)

@ -50,6 +50,8 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
// TODO: refactor to use MyGUI::ListBox
MyGUI::Button* toAdd = MyGUI::Button* toAdd =
mSpellsView->createWidget<MyGUI::Button>( mSpellsView->createWidget<MyGUI::Button>(
"SandTextButton", "SandTextButton",
@ -106,7 +108,10 @@ namespace MWGui
updateLabels(); updateLabels();
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mSpellsView->setVisibleVScroll(false);
mSpellsView->setCanvasSize (MyGUI::IntSize(mSpellsView->getWidth(), std::max(mSpellsView->getHeight(), mCurrentY))); mSpellsView->setCanvasSize (MyGUI::IntSize(mSpellsView->getWidth(), std::max(mSpellsView->getHeight(), mCurrentY)));
mSpellsView->setVisibleVScroll(true);
} }
bool SpellBuyingWindow::playerHasSpell(const std::string &id) bool SpellBuyingWindow::playerHasSpell(const std::string &id)

@ -637,7 +637,10 @@ namespace MWGui
++i; ++i;
} }
// Canvas size must be expressed with HScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mUsedEffectsView->setVisibleHScroll(false);
mUsedEffectsView->setCanvasSize(size); mUsedEffectsView->setCanvasSize(size);
mUsedEffectsView->setVisibleHScroll(true);
notifyEffectsChanged(); notifyEffectsChanged();
} }

@ -261,7 +261,10 @@ namespace MWGui
mHeight += spellHeight; mHeight += spellHeight;
} }
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mSpellView->setVisibleVScroll(false);
mSpellView->setCanvasSize(mSpellView->getWidth(), std::max(mSpellView->getHeight(), mHeight)); mSpellView->setCanvasSize(mSpellView->getWidth(), std::max(mSpellView->getHeight(), mHeight));
mSpellView->setVisibleVScroll(true);
} }
void SpellWindow::addGroup(const std::string &label, const std::string& label2) void SpellWindow::addGroup(const std::string &label, const std::string& label2)

@ -82,7 +82,10 @@ namespace MWGui
{ {
mLeftPane->setCoord( MyGUI::IntCoord(0, 0, 0.44*window->getSize().width, window->getSize().height) ); mLeftPane->setCoord( MyGUI::IntCoord(0, 0, 0.44*window->getSize().width, window->getSize().height) );
mRightPane->setCoord( MyGUI::IntCoord(0.44*window->getSize().width, 0, 0.56*window->getSize().width, window->getSize().height) ); mRightPane->setCoord( MyGUI::IntCoord(0.44*window->getSize().width, 0, 0.56*window->getSize().width, window->getSize().height) );
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mSkillView->setVisibleVScroll(false);
mSkillView->setCanvasSize (mSkillView->getWidth(), mSkillView->getCanvasSize().height); mSkillView->setCanvasSize (mSkillView->getWidth(), mSkillView->getCanvasSize().height);
mSkillView->setVisibleVScroll(true);
} }
void StatsWindow::setBar(const std::string& name, const std::string& tname, int val, int max) void StatsWindow::setBar(const std::string& name, const std::string& tname, int val, int max)
@ -578,7 +581,10 @@ namespace MWGui
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sCrimeHelp}"); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sCrimeHelp}");
} }
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mSkillView->setVisibleVScroll(false);
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top)); mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top));
mSkillView->setVisibleVScroll(true);
} }
void StatsWindow::onPinToggled() void StatsWindow::onPinToggled()

@ -126,7 +126,10 @@ namespace MWGui
} }
updateLabels(); updateLabels();
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mDestinationsView->setVisibleVScroll(false);
mDestinationsView->setCanvasSize (MyGUI::IntSize(mDestinationsView->getWidth(), std::max(mDestinationsView->getHeight(), mCurrentY))); mDestinationsView->setCanvasSize (MyGUI::IntSize(mDestinationsView->getWidth(), std::max(mDestinationsView->getHeight(), mCurrentY)));
mDestinationsView->setVisibleVScroll(true);
} }
void TravelWindow::onTravelButtonClick(MyGUI::Widget* _sender) void TravelWindow::onTravelButtonClick(MyGUI::Widget* _sender)

Loading…
Cancel
Save