1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00
OpenMW/apps/openmw/mwgui/container.hpp
2022-10-06 00:26:43 +02:00

68 lines
1.7 KiB
C++

#ifndef MGUI_CONTAINER_H
#define MGUI_CONTAINER_H
#include "referenceinterface.hpp"
#include "windowbase.hpp"
#include "itemmodel.hpp"
namespace MyGUI
{
class Gui;
class Widget;
}
namespace MWGui
{
class ContainerWindow;
class ItemView;
class SortFilterItemModel;
}
namespace MWGui
{
class ContainerWindow : public WindowBase, public ReferenceInterface
{
public:
ContainerWindow(DragAndDrop* dragAndDrop);
void setPtr(const MWWorld::Ptr& container) override;
void onClose() override;
void clear() override { resetReference(); }
void onFrame(float dt) override { checkReferenceAvailable(); }
void resetReference() override;
void onDeleteCustomData(const MWWorld::Ptr& ptr) override;
void treatNextOpenAsLoot() { mTreatNextOpenAsLoot = true; }
private:
DragAndDrop* mDragAndDrop;
MWGui::ItemView* mItemView;
SortFilterItemModel* mSortModel;
ItemModel* mModel;
int mSelectedItem;
bool mTreatNextOpenAsLoot;
MyGUI::Button* mDisposeCorpseButton;
MyGUI::Button* mTakeButton;
MyGUI::Button* mCloseButton;
void onItemSelected(int index);
void onBackgroundSelected();
void dragItem(MyGUI::Widget* sender, int count);
void dropItem();
void onCloseButtonClicked(MyGUI::Widget* _sender);
void onTakeAllButtonClicked(MyGUI::Widget* _sender);
void onDisposeCorpseButtonClicked(MyGUI::Widget* sender);
/// @return is taking the item allowed?
bool onTakeItem(const ItemStack& item, int count);
void onReferenceUnavailable() override;
};
}
#endif // CONTAINER_H