2012-04-15 15:52:39 +00:00
|
|
|
#ifndef MGUI_CONTAINER_H
|
|
|
|
#define MGUI_CONTAINER_H
|
|
|
|
|
2013-04-10 04:32:05 +00:00
|
|
|
#include "windowbase.hpp"
|
2012-05-26 23:14:33 +00:00
|
|
|
#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;
|
2012-05-15 19:44:57 +00:00
|
|
|
int mDraggedCount;
|
2012-05-12 11:12:37 +00:00
|
|
|
|
2014-08-01 15:14:35 +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);
|
2012-05-15 10:51:51 +00:00
|
|
|
|
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:
|
2013-04-10 18:46:21 +00:00
|
|
|
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);
|
2014-01-07 02:01:33 +00:00
|
|
|
virtual void close();
|
2013-05-11 16:38:27 +00:00
|
|
|
|
2014-07-07 21:37:59 +00:00
|
|
|
virtual void resetReference();
|
|
|
|
|
2014-05-27 03:13:37 +00:00
|
|
|
virtual void exit();
|
|
|
|
|
2013-05-11 16:38:27 +00:00
|
|
|
private:
|
|
|
|
DragAndDrop* mDragAndDrop;
|
2012-04-15 15:52:39 +00:00
|
|
|
|
2014-01-07 02:01:33 +00:00
|
|
|
bool mPickpocketDetected;
|
|
|
|
|
2013-05-11 16:38:27 +00:00
|
|
|
MWGui::ItemView* mItemView;
|
|
|
|
SortFilterItemModel* mSortModel;
|
|
|
|
ItemModel* mModel;
|
2014-05-15 01:12:52 +00:00
|
|
|
int mSelectedItem;
|
2012-05-12 20:44:12 +00:00
|
|
|
|
2013-03-07 13:00:13 +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);
|
2013-03-07 13:00:13 +00:00
|
|
|
void onDisposeCorpseButtonClicked(MyGUI::Widget* sender);
|
2014-01-10 23:24:21 +00:00
|
|
|
void onKeyPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char);
|
2012-05-26 23:14:33 +00:00
|
|
|
|
2014-01-07 02:01:33 +00:00
|
|
|
/// @return is taking the item allowed?
|
|
|
|
bool onTakeItem(const ItemStack& item, int count);
|
|
|
|
|
2012-05-26 23:14:33 +00:00
|
|
|
virtual void onReferenceUnavailable();
|
2012-04-15 15:52:39 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // CONTAINER_H
|