1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00
OpenMW/apps/openmw/mwgui/container.hpp

92 lines
2.1 KiB
C++
Raw Normal View History

2012-04-15 15:52:39 +00:00
#ifndef MGUI_CONTAINER_H
#define MGUI_CONTAINER_H
#include "windowbase.hpp"
#include "referenceinterface.hpp"
2013-05-11 16:38:27 +00:00
#include "itemmodel.hpp"
2012-04-15 15:52:39 +00:00
namespace MWWorld
{
class Environment;
}
namespace MyGUI
{
2012-04-30 11:01:18 +00:00
class Gui;
class Widget;
2012-04-15 15:52:39 +00:00
}
namespace MWGui
{
class WindowManager;
2012-04-30 11:01:18 +00:00
class ContainerWindow;
2013-05-11 16:38:27 +00:00
class ItemView;
class SortFilterItemModel;
2012-04-15 15:52:39 +00:00
}
namespace MWGui
{
2012-04-30 11:01:18 +00:00
class DragAndDrop
{
public:
bool mIsOnDragAndDrop;
MyGUI::Widget* mDraggedWidget;
2013-05-11 16:38:27 +00:00
ItemModel* mSourceModel;
ItemView* mSourceView;
SortFilterItemModel* mSourceSortModel;
ItemStack mItem;
int mDraggedCount;
2012-05-12 11:12:37 +00:00
DragAndDrop();
2013-05-11 16:38:27 +00:00
void startDrag (int index, SortFilterItemModel* sortModel, ItemModel* sourceModel, ItemView* sourceView, int count);
void drop (ItemModel* targetModel, ItemView* targetView);
2013-05-11 16:38:27 +00:00
void finish();
2012-05-12 11:12:37 +00:00
};
2013-05-11 16:38:27 +00:00
class ContainerWindow : public WindowBase, public ReferenceInterface
2012-05-12 11:12:37 +00:00
{
public:
ContainerWindow(DragAndDrop* dragAndDrop);
2012-05-12 11:12:37 +00:00
2013-05-11 16:38:27 +00:00
void open(const MWWorld::Ptr& container, bool loot=false);
virtual void close();
2013-05-11 16:38:27 +00:00
virtual void resetReference();
virtual void exit();
2013-05-11 16:38:27 +00:00
private:
DragAndDrop* mDragAndDrop;
2012-04-15 15:52:39 +00:00
bool mPickpocketDetected;
2013-05-11 16:38:27 +00:00
MWGui::ItemView* mItemView;
SortFilterItemModel* mSortModel;
ItemModel* mModel;
int mSelectedItem;
2012-05-12 20:44:12 +00:00
MyGUI::Button* mDisposeCorpseButton;
2012-05-12 11:12:37 +00:00
MyGUI::Button* mTakeButton;
MyGUI::Button* mCloseButton;
2012-04-15 15:52:39 +00:00
2013-05-11 16:38:27 +00:00
void onItemSelected(int index);
void onBackgroundSelected();
void dragItem(MyGUI::Widget* sender, int count);
void dropItem();
2012-05-11 14:34:36 +00:00
void onCloseButtonClicked(MyGUI::Widget* _sender);
2012-05-11 14:58:07 +00:00
void onTakeAllButtonClicked(MyGUI::Widget* _sender);
void onDisposeCorpseButtonClicked(MyGUI::Widget* sender);
2014-01-10 23:24:21 +00:00
void onKeyPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char);
/// @return is taking the item allowed?
bool onTakeItem(const ItemStack& item, int count);
virtual void onReferenceUnavailable();
2012-04-15 15:52:39 +00:00
};
}
#endif // CONTAINER_H