1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-06 18:15:32 +00:00
openmw-tes3mp/apps/openmw/mwgui/container.hpp
David Cernat 7f435ceeac Add OpenMW commits up to 1 Nov 2020
# Conflicts:
#   CMakeLists.txt
#   apps/openmw/main.cpp
#   apps/openmw/mwclass/container.hpp
#   apps/openmw/mwclass/creature.hpp
#   apps/openmw/mwclass/npc.hpp
#   apps/openmw/mwdialogue/dialoguemanagerimp.hpp
#   apps/openmw/mwdialogue/journalimp.hpp
#   apps/openmw/mwgui/container.cpp
#   apps/openmw/mwgui/dialogue.hpp
#   apps/openmw/mwgui/mainmenu.cpp
#   apps/openmw/mwgui/windowmanagerimp.hpp
#   apps/openmw/mwmechanics/aiactivate.hpp
#   apps/openmw/mwmechanics/mechanicsmanagerimp.hpp
#   apps/openmw/mwscript/containerextensions.cpp
#   apps/openmw/mwscript/interpretercontext.hpp
#   components/CMakeLists.txt
2020-11-01 23:17:59 +02:00

93 lines
2.2 KiB
C++

#ifndef MGUI_CONTAINER_H
#define MGUI_CONTAINER_H
#include "windowbase.hpp"
#include "referenceinterface.hpp"
#include "itemmodel.hpp"
namespace MWWorld
{
class Environment;
}
namespace MyGUI
{
class Gui;
class Widget;
}
namespace MWGui
{
class WindowManager;
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;
/*
Start of tes3mp addition
Make it possible to check from elsewhere whether there is currently an
item being dragged in the container window
*/
bool isOnDragAndDrop();
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to drag a specific item Ptr instead of having to rely
on an index that may have changed in the meantime, for drags that
require approval from the server
*/
bool dragItemByPtr(const MWWorld::Ptr& itemPtr, int dragCount);
/*
End of tes3mp addition
*/
private:
DragAndDrop* mDragAndDrop;
MWGui::ItemView* mItemView;
SortFilterItemModel* mSortModel;
ItemModel* mModel;
int mSelectedItem;
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