mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-18 13:12:50 +00:00
Scrollbars don't save their positions between openings
This commit is contained in:
parent
67f04e0ba1
commit
c40987338d
@ -130,6 +130,7 @@ namespace MWGui
|
||||
mSortModel = new SortFilterItemModel(model);
|
||||
mSortModel->setFilter(SortFilterItemModel::Filter_OnlyIngredients);
|
||||
mItemView->setModel (mSortModel);
|
||||
mItemView->resetScrollBars();
|
||||
|
||||
mNameEdit->setCaption("");
|
||||
|
||||
|
@ -114,6 +114,7 @@ void CompanionWindow::open(const MWWorld::Ptr& npc)
|
||||
mModel = new CompanionItemModel(npc);
|
||||
mSortModel = new SortFilterItemModel(mModel);
|
||||
mItemView->setModel(mSortModel);
|
||||
mItemView->resetScrollBars();
|
||||
|
||||
setTitle(npc.getClass().getName(npc));
|
||||
}
|
||||
|
@ -151,6 +151,7 @@ namespace MWGui
|
||||
mSortModel = new SortFilterItemModel(mModel);
|
||||
|
||||
mItemView->setModel (mSortModel);
|
||||
mItemView->resetScrollBars();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mCloseButton);
|
||||
|
||||
|
@ -39,6 +39,7 @@ namespace MWGui
|
||||
mModel = new InventoryItemModel(container);
|
||||
mSortModel = new SortFilterItemModel(mModel);
|
||||
mItemView->setModel(mSortModel);
|
||||
mItemView->resetScrollBars();
|
||||
}
|
||||
|
||||
void ItemSelectionDialog::setCategory(int category)
|
||||
|
@ -128,6 +128,11 @@ void ItemView::update()
|
||||
layoutWidgets();
|
||||
}
|
||||
|
||||
void ItemView::resetScrollBars()
|
||||
{
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
}
|
||||
|
||||
void ItemView::onSelectedItem(MyGUI::Widget *sender)
|
||||
{
|
||||
ItemModel::ModelIndex index = (*sender->getUserData<std::pair<ItemModel::ModelIndex, ItemModel*> >()).first;
|
||||
|
@ -30,6 +30,8 @@ namespace MWGui
|
||||
|
||||
void update();
|
||||
|
||||
void resetScrollBars();
|
||||
|
||||
private:
|
||||
virtual void initialiseOverride();
|
||||
|
||||
|
@ -114,6 +114,8 @@ void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
void MerchantRepair::open()
|
||||
{
|
||||
center();
|
||||
// Reset scrollbars
|
||||
mList->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
}
|
||||
|
||||
void MerchantRepair::exit()
|
||||
|
@ -548,6 +548,7 @@ namespace MWGui
|
||||
WindowModal::open();
|
||||
|
||||
mMagicList->setModel(new SpellModel(MWBase::Environment::get().getWorld()->getPlayerPtr()));
|
||||
mMagicList->resetScrollbars();
|
||||
}
|
||||
|
||||
void MagicSelectionDialog::onModelIndexSelected(SpellModel::ModelIndex index)
|
||||
|
@ -44,6 +44,8 @@ Recharge::Recharge()
|
||||
void Recharge::open()
|
||||
{
|
||||
center();
|
||||
// Reset scrollbars
|
||||
mView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
}
|
||||
|
||||
void Recharge::exit()
|
||||
|
@ -36,6 +36,8 @@ Repair::Repair()
|
||||
void Repair::open()
|
||||
{
|
||||
center();
|
||||
// Reset scrollbars
|
||||
mRepairView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
}
|
||||
|
||||
void Repair::exit()
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <MyGUI_ListBox.h>
|
||||
#include <MyGUI_ScrollView.h>
|
||||
#include <MyGUI_Gui.h>
|
||||
#include <MyGUI_TabControl.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/math/common_factor_rt.hpp>
|
||||
@ -170,6 +171,7 @@ namespace MWGui
|
||||
|
||||
setTitle("#{sOptions}");
|
||||
|
||||
getWidget(mSettingsTab, "SettingsTab");
|
||||
getWidget(mOkButton, "OkButton");
|
||||
getWidget(mResolutionList, "ResolutionList");
|
||||
getWidget(mFullscreenButton, "FullscreenButton");
|
||||
@ -208,6 +210,7 @@ namespace MWGui
|
||||
|
||||
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &SettingsWindow::onWindowResize);
|
||||
|
||||
mSettingsTab->eventTabChangeSelect += MyGUI::newDelegate(this, &SettingsWindow::onTabChanged);
|
||||
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked);
|
||||
mShaderModeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onShaderModeToggled);
|
||||
mTextureFilteringButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureFilteringChanged);
|
||||
@ -275,6 +278,11 @@ namespace MWGui
|
||||
mControllerSwitch->setStateSelected(false);
|
||||
}
|
||||
|
||||
void SettingsWindow::onTabChanged(MyGUI::TabControl* /*_sender*/, size_t /*index*/)
|
||||
{
|
||||
resetScrollbars();
|
||||
}
|
||||
|
||||
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
exit();
|
||||
@ -480,6 +488,7 @@ namespace MWGui
|
||||
mKeyboardSwitch->setStateSelected(true);
|
||||
mControllerSwitch->setStateSelected(false);
|
||||
updateControlsBox();
|
||||
resetScrollbars();
|
||||
}
|
||||
|
||||
void SettingsWindow::onControllerSwitchClicked(MyGUI::Widget* _sender)
|
||||
@ -490,6 +499,7 @@ namespace MWGui
|
||||
mKeyboardSwitch->setStateSelected(false);
|
||||
mControllerSwitch->setStateSelected(true);
|
||||
updateControlsBox();
|
||||
resetScrollbars();
|
||||
}
|
||||
|
||||
void SettingsWindow::updateControlsBox()
|
||||
@ -584,6 +594,7 @@ namespace MWGui
|
||||
void SettingsWindow::open()
|
||||
{
|
||||
updateControlsBox ();
|
||||
resetScrollbars();
|
||||
}
|
||||
|
||||
void SettingsWindow::exit()
|
||||
@ -595,4 +606,10 @@ namespace MWGui
|
||||
{
|
||||
updateControlsBox();
|
||||
}
|
||||
|
||||
void SettingsWindow::resetScrollbars()
|
||||
{
|
||||
mResolutionList->setScrollPosition(0);
|
||||
mControlsBox->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ namespace MWGui
|
||||
void updateControlsBox();
|
||||
|
||||
protected:
|
||||
MyGUI::TabControl* mSettingsTab;
|
||||
MyGUI::Button* mOkButton;
|
||||
|
||||
// graphics
|
||||
@ -50,6 +51,7 @@ namespace MWGui
|
||||
MyGUI::Button* mControllerSwitch;
|
||||
bool mKeyboardMode; //if true, setting up the keyboard. Otherwise, it's controller
|
||||
|
||||
void onTabChanged(MyGUI::TabControl* _sender, size_t index);
|
||||
void onOkButtonClicked(MyGUI::Widget* _sender);
|
||||
void onFpsToggled(MyGUI::Widget* _sender);
|
||||
void onTextureFilteringChanged(MyGUI::ComboBox* _sender, size_t pos);
|
||||
@ -74,6 +76,9 @@ namespace MWGui
|
||||
void apply();
|
||||
|
||||
void configureWidgets(MyGUI::Widget* widget);
|
||||
|
||||
private:
|
||||
void resetScrollbars();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -551,6 +551,7 @@ namespace MWGui
|
||||
++i;
|
||||
}
|
||||
mAvailableEffectsList->adjustSize ();
|
||||
mAvailableEffectsList->scrollToTop();
|
||||
|
||||
for (std::vector<short>::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it)
|
||||
{
|
||||
|
@ -311,4 +311,8 @@ namespace MWGui
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mScrollView->getViewOffset().top + _rel*0.3f)));
|
||||
}
|
||||
|
||||
void SpellView::resetScrollbars()
|
||||
{
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ namespace MWGui
|
||||
virtual void setSize(const MyGUI::IntSize& _value);
|
||||
virtual void setCoord(const MyGUI::IntCoord& _value);
|
||||
|
||||
void resetScrollbars();
|
||||
|
||||
private:
|
||||
MyGUI::ScrollView* mScrollView;
|
||||
|
||||
|
@ -136,6 +136,7 @@ namespace MWGui
|
||||
mTradeModel = new TradeItemModel(new ContainerItemModel(itemSources, worldItems), mPtr);
|
||||
mSortModel = new SortFilterItemModel(mTradeModel);
|
||||
mItemView->setModel (mSortModel);
|
||||
mItemView->resetScrollBars();
|
||||
|
||||
updateLabels();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user