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 #include "../mwrender/characterpreview.hpp"
9 
10 namespace osg
11 {
12  class Group;
13 }
14 
15 namespace Resource
16 {
17  class ResourceSystem;
18 }
19 
20 namespace MWGui
21 {
22  namespace Widgets
23  {
24  class MWDynamicStat;
25  }
26 
27  class ItemView;
28  class SortFilterItemModel;
29  class TradeItemModel;
30  class DragAndDrop;
31  class ItemModel;
32 
34  {
35  public:
36  InventoryWindow(DragAndDrop* dragAndDrop, osg::Group* parent, Resource::ResourceSystem* resourceSystem);
37 
38  virtual void onOpen();
39 
41  void setTrading(bool trading);
42 
43  void onFrame(float dt);
44 
45  void pickUpObject (MWWorld::Ptr object);
46 
47  MWWorld::Ptr getAvatarSelectedItem(int x, int y);
48 
49  void rebuildAvatar();
50 
54 
55  void updateItemView();
56 
57  void updatePlayer();
58 
59  void clear();
60 
61  void useItem(const MWWorld::Ptr& ptr, bool force=false);
62 
63  void setGuiMode(GuiMode mode);
64 
66  void cycle(bool next);
67 
68  private:
70 
72 
74 
78 
79  MyGUI::Widget* mAvatar;
80  MyGUI::ImageBox* mAvatarImage;
81  MyGUI::TextBox* mArmorRating;
83 
84  MyGUI::Widget* mLeftPane;
85  MyGUI::Widget* mRightPane;
86 
87  MyGUI::Button* mFilterAll;
88  MyGUI::Button* mFilterWeapon;
89  MyGUI::Button* mFilterApparel;
90  MyGUI::Button* mFilterMagic;
91  MyGUI::Button* mFilterMisc;
92 
94 
96 
99 
100  std::unique_ptr<MyGUI::ITexture> mPreviewTexture;
101  std::unique_ptr<MWRender::InventoryPreview> mPreview;
102 
103  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:33
void onPinToggled()
Definition: inventorywindow.cpp:470
TradeItemModel * getTradeModel()
Definition: inventorywindow.cpp:210
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:30
MyGUI::Button * mFilterApparel
Definition: inventorywindow.hpp:89
void updateItemView()
Definition: inventorywindow.cpp:369
void onItemSelectedFromSourceModel(int index)
Definition: inventorywindow.cpp:231
The base class that all item models should derive from.
Definition: itemmodel.hpp:43
float mUpdateTimer
Definition: inventorywindow.hpp:105
void updatePreviewSize()
Definition: inventorywindow.cpp:435
Definition: itemview.hpp:11
void clear()
Clear any state specific to the running game.
Definition: inventorywindow.cpp:157
An item model that allows 'borrowing' items from another item model. Used for previewing barter offer...
Definition: tradeitemmodel.hpp:13
std::unique_ptr< MyGUI::ITexture > mPreviewTexture
Definition: inventorywindow.hpp:100
void cycle(bool next)
Cycle to previous/next weapon.
Definition: inventorywindow.cpp:734
void useItem(const MWWorld::Ptr &ptr, bool force=false)
Definition: inventorywindow.cpp:483
float mScaleFactor
Definition: inventorywindow.hpp:104
MyGUI::Button * mFilterMagic
Definition: inventorywindow.hpp:90
MyGUI::TextBox * mArmorRating
Definition: inventorywindow.hpp:81
bool mTrading
Definition: inventorywindow.hpp:103
void updateArmorRating()
Definition: inventorywindow.cpp:427
InventoryWindow(DragAndDrop *dragAndDrop, osg::Group *parent, Resource::ResourceSystem *resourceSystem)
Definition: inventorywindow.cpp:59
MyGUI::Button * mFilterAll
Definition: inventorywindow.hpp:87
Definition: draganddrop.hpp:17
void setGuiMode(GuiMode mode)
Definition: inventorywindow.cpp:165
void updatePlayer()
Definition: inventorywindow.cpp:126
void adjustPanes()
Definition: inventorywindow.cpp:115
void dragItem(MyGUI::Widget *sender, int count)
Definition: inventorywindow.cpp:338
GuiMode mGuiMode
Definition: inventorywindow.hpp:95
MyGUI::Button * mFilterMisc
Definition: inventorywindow.hpp:91
int mLastXSize
Definition: inventorywindow.hpp:97
Definition: windowpinnablebase.hpp:10
SortFilterItemModel * getSortFilterModel()
Definition: inventorywindow.cpp:205
MyGUI::Widget * mLeftPane
Definition: inventorywindow.hpp:84
void onAvatarClicked(MyGUI::Widget *_sender)
Definition: inventorywindow.cpp:548
virtual void onOpen()
Notify that window has been made visible.
Definition: inventorywindow.cpp:378
void onTitleDoubleClicked()
Definition: inventorywindow.cpp:477
Definition: sortfilteritemmodel.hpp:9
void onFilterChanged(MyGUI::Widget *_sender)
Definition: inventorywindow.cpp:446
void notifyContentChanged()
Definition: inventorywindow.cpp:665
int mLastYSize
Definition: inventorywindow.hpp:98
MWGui::ItemView * mItemView
Definition: inventorywindow.hpp:75
void dirtyPreview()
Definition: inventorywindow.cpp:658
MWWorld::Ptr mPtr
Definition: inventorywindow.hpp:73
int mSelectedItem
Definition: inventorywindow.hpp:71
void onItemSelected(int index)
Definition: inventorywindow.cpp:226
MyGUI::Widget * mAvatar
Definition: inventorywindow.hpp:79
MyGUI::Widget * mRightPane
Definition: inventorywindow.hpp:85
void updateEncumbranceBar()
Definition: inventorywindow.cpp:622
MWWorld::Ptr getAvatarSelectedItem(int x, int y)
Definition: inventorywindow.cpp:596
MWWorld::Ptr mSkippedToEquip
Definition: inventorywindow.hpp:93
void ensureSelectedItemUnequipped(int count)
Unequips count items from mSelectedItem, if it is equipped, and then updates mSelectedItem in case th...
Definition: inventorywindow.cpp:305
GuiMode
Definition: mode.hpp:6
Widgets::MWDynamicStat * mEncumbranceBar
Definition: inventorywindow.hpp:82
void setTrading(bool trading)
start trading, disables item drag&drop
Definition: inventorywindow.cpp:653
Definition: widgets.hpp:277
MyGUI::Button * mFilterWeapon
Definition: inventorywindow.hpp:88
TradeItemModel * mTradeModel
Definition: inventorywindow.hpp:77
void rebuildAvatar()
Definition: inventorywindow.cpp:794
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
void onBackgroundSelected()
Definition: inventorywindow.cpp:220
SortFilterItemModel * mSortModel
Definition: inventorywindow.hpp:76
ItemModel * getModel()
Definition: inventorywindow.cpp:215
DragAndDrop * mDragAndDrop
Definition: inventorywindow.hpp:69
void sellItem(MyGUI::Widget *sender, int count)
Definition: inventorywindow.cpp:345
void pickUpObject(MWWorld::Ptr object)
Definition: inventorywindow.cpp:676
std::unique_ptr< MWRender::InventoryPreview > mPreview
Definition: inventorywindow.hpp:101
void onFrame(float dt)
Called every frame if the window is in an active GUI mode.
Definition: inventorywindow.cpp:632
void onWindowResize(MyGUI::Window *_sender)
Definition: inventorywindow.cpp:389
MyGUI::ImageBox * mAvatarImage
Definition: inventorywindow.hpp:80