mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-15 07:17:46 -04:00
also update companion window and tradewindow
This commit is contained in:
parent
0547f09bf0
commit
15ceee4b1a
@ -134,6 +134,8 @@ namespace MWGui
|
||||
mItemView->resetScrollBars();
|
||||
|
||||
setTitle(actor.getClass().getName(actor));
|
||||
|
||||
mPtr.getClass().getContainerStore(mPtr).setContListener(this);
|
||||
}
|
||||
|
||||
void CompanionWindow::onFrame(float dt)
|
||||
@ -202,4 +204,9 @@ namespace MWGui
|
||||
mSortModel = nullptr;
|
||||
}
|
||||
|
||||
void CompanionWindow::updateItemView()
|
||||
{
|
||||
mItemView->update();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "referenceinterface.hpp"
|
||||
#include "windowbase.hpp"
|
||||
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
namespace Widgets
|
||||
@ -17,7 +19,7 @@ namespace MWGui
|
||||
class SortFilterItemModel;
|
||||
class CompanionItemModel;
|
||||
|
||||
class CompanionWindow : public WindowBase, public ReferenceInterface
|
||||
class CompanionWindow : public WindowBase, public ReferenceInterface, public MWWorld::ContainerStoreListener
|
||||
{
|
||||
public:
|
||||
CompanionWindow(DragAndDrop* dragAndDrop, MessageBoxManager* manager);
|
||||
@ -30,6 +32,11 @@ namespace MWGui
|
||||
void onFrame(float dt) override;
|
||||
void clear() override { resetReference(); }
|
||||
|
||||
void updateItemView();
|
||||
|
||||
void itemAdded(const MWWorld::ConstPtr& item, int count) override { updateItemView(); }
|
||||
void itemRemoved(const MWWorld::ConstPtr& item, int count) override { updateItemView(); }
|
||||
|
||||
std::string_view getWindowIdForLua() const override { return "Companion"; }
|
||||
|
||||
private:
|
||||
|
@ -160,12 +160,8 @@ namespace MWGui
|
||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mCloseButton);
|
||||
|
||||
setTitle(container.getClass().getName(container));
|
||||
mPtr.getClass().getContainerStore(mPtr).setContListener(this);
|
||||
}
|
||||
|
||||
void ContainerWindow::updateItemView()
|
||||
{
|
||||
mItemView->update();
|
||||
mPtr.getClass().getContainerStore(mPtr).setContListener(this);
|
||||
}
|
||||
|
||||
void ContainerWindow::resetReference()
|
||||
@ -326,4 +322,9 @@ namespace MWGui
|
||||
if (mModel && mModel->usesContainer(ptr))
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
|
||||
}
|
||||
|
||||
void ContainerWindow::updateItemView()
|
||||
{
|
||||
mItemView->update();
|
||||
}
|
||||
}
|
||||
|
@ -201,6 +201,9 @@ namespace MWGui
|
||||
|
||||
onFilterChanged(mFilterAll);
|
||||
mFilterEdit->setCaption({});
|
||||
|
||||
for (const auto& source : itemSources)
|
||||
source.getClass().getContainerStore(source).setContListener(this);
|
||||
}
|
||||
|
||||
void TradeWindow::onFrame(float dt)
|
||||
@ -643,4 +646,9 @@ namespace MWGui
|
||||
if (mTradeModel && mTradeModel->usesContainer(ptr))
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
|
||||
}
|
||||
|
||||
void TradeWindow::updateItemView()
|
||||
{
|
||||
mItemView->update();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "referenceinterface.hpp"
|
||||
#include "windowbase.hpp"
|
||||
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
class NumericEditBox;
|
||||
@ -20,7 +22,7 @@ namespace MWGui
|
||||
class SortFilterItemModel;
|
||||
class TradeItemModel;
|
||||
|
||||
class TradeWindow : public WindowBase, public ReferenceInterface
|
||||
class TradeWindow : public WindowBase, public ReferenceInterface, public MWWorld::ContainerStoreListener
|
||||
{
|
||||
public:
|
||||
TradeWindow();
|
||||
@ -42,6 +44,11 @@ namespace MWGui
|
||||
|
||||
void onDeleteCustomData(const MWWorld::Ptr& ptr) override;
|
||||
|
||||
void updateItemView();
|
||||
|
||||
void itemAdded(const MWWorld::ConstPtr& item, int count) override { updateItemView(); }
|
||||
void itemRemoved(const MWWorld::ConstPtr& item, int count) override { updateItemView(); }
|
||||
|
||||
typedef MyGUI::delegates::MultiDelegate<> EventHandle_TradeDone;
|
||||
EventHandle_TradeDone eventTradeDone;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user