OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
inventorywindow.hpp
Go to the documentation of this file.
1 #ifndef MGUI_Inventory_H
2 #define MGUI_Inventory_H
3 
4 #include "windowpinnablebase.hpp"
5 #include "mode.hpp"
6 
7 #include "../mwworld/ptr.hpp"
8 
9 namespace osg
10 {
11  class Group;
12 }
13 
14 namespace Resource
15 {
16  class ResourceSystem;
17 }
18 
19 namespace MWRender
20 {
21  class InventoryPreview;
22 }
23 
24 namespace MWGui
25 {
26  namespace Widgets
27  {
28  class MWDynamicStat;
29  }
30 
31  class ItemView;
32  class SortFilterItemModel;
33  class TradeItemModel;
34  class DragAndDrop;
35  class ItemModel;
36 
38  {
39  public:
40  InventoryWindow(DragAndDrop* dragAndDrop, osg::Group* parent, Resource::ResourceSystem* resourceSystem);
41 
42  virtual void open();
43 
45  void setTrading(bool trading);
46 
47  void onFrame();
48 
49  void pickUpObject (MWWorld::Ptr object);
50 
51  MWWorld::Ptr getAvatarSelectedItem(int x, int y);
52 
53  void rebuildAvatar();
54 
58 
59  void updateItemView();
60 
61  void updatePlayer();
62 
63  void useItem(const MWWorld::Ptr& ptr);
64 
65  void setGuiMode(GuiMode mode);
66 
68  void cycle(bool next);
69 
70  private:
72 
74 
76 
80 
81  MyGUI::Widget* mAvatar;
82  MyGUI::ImageBox* mAvatarImage;
83  MyGUI::TextBox* mArmorRating;
85 
86  MyGUI::Widget* mLeftPane;
87  MyGUI::Widget* mRightPane;
88 
89  MyGUI::Button* mFilterAll;
90  MyGUI::Button* mFilterWeapon;
91  MyGUI::Button* mFilterApparel;
92  MyGUI::Button* mFilterMagic;
93  MyGUI::Button* mFilterMisc;
94 
96 
98 
101 
102  std::auto_ptr<MyGUI::ITexture> mPreviewTexture;
103  std::auto_ptr<MWRender::InventoryPreview> mPreview;
104 
105  bool mTrading;
106 
107  void onItemSelected(int index);
108  void onItemSelectedFromSourceModel(int index);
109 
110  void onBackgroundSelected();
111 
112  void sellItem(MyGUI::Widget* sender, int count);
113  void dragItem(MyGUI::Widget* sender, int count);
114 
115  void onWindowResize(MyGUI::Window* _sender);
116  void onFilterChanged(MyGUI::Widget* _sender);
117  void onAvatarClicked(MyGUI::Widget* _sender);
118  void onPinToggled();
119  void onTitleDoubleClicked();
120 
121  void updateEncumbranceBar();
122  void notifyContentChanged();
123  void dirtyPreview();
124  void updatePreviewSize();
125  void updateArmorRating();
126 
127  void adjustPanes();
128 
130  void ensureSelectedItemUnequipped(int count);
131  };
132 }
133 
134 #endif // Inventory_H
Definition: inventorywindow.hpp:37
void onPinToggled()
Definition: inventorywindow.cpp:434
TradeItemModel * getTradeModel()
Definition: inventorywindow.cpp:186
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:24
MyGUI::Button * mFilterApparel
Definition: inventorywindow.hpp:91
void updateItemView()
Definition: inventorywindow.cpp:332
void onItemSelectedFromSourceModel(int index)
Definition: inventorywindow.cpp:207
The base class that all item models should derive from.
Definition: itemmodel.hpp:43
void updatePreviewSize()
Definition: inventorywindow.cpp:399
Definition: itemview.hpp:11
An item model that allows 'borrowing' items from another item model. Used for previewing barter offer...
Definition: tradeitemmodel.hpp:13
void cycle(bool next)
Cycle to previous/next weapon.
Definition: inventorywindow.cpp:649
MyGUI::Button * mFilterMagic
Definition: inventorywindow.hpp:92
void onFrame()
Definition: inventorywindow.cpp:566
MyGUI::TextBox * mArmorRating
Definition: inventorywindow.hpp:83
bool mTrading
Definition: inventorywindow.hpp:105
void updateArmorRating()
Definition: inventorywindow.cpp:391
InventoryWindow(DragAndDrop *dragAndDrop, osg::Group *parent, Resource::ResourceSystem *resourceSystem)
Definition: inventorywindow.cpp:59
MyGUI::Button * mFilterAll
Definition: inventorywindow.hpp:89
Definition: draganddrop.hpp:17
void setGuiMode(GuiMode mode)
Definition: inventorywindow.cpp:141
void updatePlayer()
Definition: inventorywindow.cpp:120
void adjustPanes()
Definition: inventorywindow.cpp:109
std::auto_ptr< MyGUI::ITexture > mPreviewTexture
Definition: inventorywindow.hpp:102
void dragItem(MyGUI::Widget *sender, int count)
Definition: inventorywindow.cpp:301
GuiMode mGuiMode
Definition: inventorywindow.hpp:97
MyGUI::Button * mFilterMisc
Definition: inventorywindow.hpp:93
int mLastXSize
Definition: inventorywindow.hpp:99
std::auto_ptr< MWRender::InventoryPreview > mPreview
Definition: inventorywindow.hpp:103
Definition: windowpinnablebase.hpp:10
SortFilterItemModel * getSortFilterModel()
Definition: inventorywindow.cpp:181
MyGUI::Widget * mLeftPane
Definition: inventorywindow.hpp:86
void onAvatarClicked(MyGUI::Widget *_sender)
Definition: inventorywindow.cpp:500
void onTitleDoubleClicked()
Definition: inventorywindow.cpp:439
Definition: sortfilteritemmodel.hpp:9
void onFilterChanged(MyGUI::Widget *_sender)
Definition: inventorywindow.cpp:410
void notifyContentChanged()
Definition: inventorywindow.cpp:586
int mLastYSize
Definition: inventorywindow.hpp:100
MWGui::ItemView * mItemView
Definition: inventorywindow.hpp:77
void dirtyPreview()
Definition: inventorywindow.cpp:579
MWWorld::Ptr mPtr
Definition: inventorywindow.hpp:75
int mSelectedItem
Definition: inventorywindow.hpp:73
void onItemSelected(int index)
Definition: inventorywindow.cpp:202
MyGUI::Widget * mAvatar
Definition: inventorywindow.hpp:81
MyGUI::Widget * mRightPane
Definition: inventorywindow.hpp:87
void updateEncumbranceBar()
Definition: inventorywindow.cpp:556
MWWorld::Ptr getAvatarSelectedItem(int x, int y)
Definition: inventorywindow.cpp:535
MWWorld::Ptr mSkippedToEquip
Definition: inventorywindow.hpp:95
void ensureSelectedItemUnequipped(int count)
Unequips count items from mSelectedItem, if it is equipped, and then updates mSelectedItem in case th...
Definition: inventorywindow.cpp:268
GuiMode
Definition: mode.hpp:6
Widgets::MWDynamicStat * mEncumbranceBar
Definition: inventorywindow.hpp:84
void setTrading(bool trading)
start trading, disables item drag&drop
Definition: inventorywindow.cpp:574
Definition: widgets.hpp:277
MyGUI::Button * mFilterWeapon
Definition: inventorywindow.hpp:90
TradeItemModel * mTradeModel
Definition: inventorywindow.hpp:79
void rebuildAvatar()
Definition: inventorywindow.cpp:698
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
void onBackgroundSelected()
Definition: inventorywindow.cpp:196
SortFilterItemModel * mSortModel
Definition: inventorywindow.hpp:78
ItemModel * getModel()
Definition: inventorywindow.cpp:191
DragAndDrop * mDragAndDrop
Definition: inventorywindow.hpp:71
void sellItem(MyGUI::Widget *sender, int count)
Definition: inventorywindow.cpp:308
void pickUpObject(MWWorld::Ptr object)
Definition: inventorywindow.cpp:597
virtual void open()
Notify that window has been made visible.
Definition: inventorywindow.cpp:341
void onWindowResize(MyGUI::Window *_sender)
Definition: inventorywindow.cpp:353
MyGUI::ImageBox * mAvatarImage
Definition: inventorywindow.hpp:82
void useItem(const MWWorld::Ptr &ptr)
Definition: inventorywindow.cpp:445