OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
spellmodel.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_GUI_SPELLMODEL_H
2 #define OPENMW_GUI_SPELLMODEL_H
3 
4 #include "../mwworld/ptr.hpp"
5 
6 namespace MWGui
7 {
8 
9  struct Spell
10  {
11  enum Type
12  {
16  };
17 
19  std::string mName;
20  std::string mCostColumn; // Cost/chance or Cost/charge
21  std::string mId; // Item ID or spell ID
22  MWWorld::Ptr mItem; // Only for Type_EnchantedItem
23  bool mSelected; // Is this the currently selected spell/item (only one can be selected at a time)
24  bool mActive; // (Items only) is the item equipped?
25 
27  : mType(Type_Spell)
28  , mSelected(false)
29  , mActive(false)
30  {
31  }
32  };
33 
35  class SpellModel
36  {
37  public:
38  SpellModel(const MWWorld::Ptr& actor);
39 
40  typedef int ModelIndex;
41 
42  void update();
43 
44  Spell getItem (ModelIndex index) const;
46 
47  size_t getItemCount() const;
48 
49  private:
51 
52  std::vector<Spell> mSpells;
53  };
54 
55 }
56 
57 #endif
Spell getItem(ModelIndex index) const
throws for invalid index
Definition: spellmodel.cpp:135
MWWorld::Ptr mActor
Definition: spellmodel.hpp:50
Type
Definition: spellmodel.hpp:11
std::string mId
Definition: spellmodel.hpp:21
std::string mName
Definition: spellmodel.hpp:19
bool mActive
Definition: spellmodel.hpp:24
Definition: spellmodel.hpp:9
MWWorld::Ptr mItem
Definition: spellmodel.hpp:22
bool mSelected
Definition: spellmodel.hpp:23
Model that lists all usable powers, spells and enchanted items for an actor.
Definition: spellmodel.hpp:35
int ModelIndex
Definition: spellmodel.hpp:40
Spell()
Definition: spellmodel.hpp:26
Definition: spellmodel.hpp:15
size_t getItemCount() const
Definition: spellmodel.cpp:130
Definition: spellmodel.hpp:13
Type mType
Definition: spellmodel.hpp:18
SpellModel(const MWWorld::Ptr &actor)
Definition: spellmodel.cpp:37
std::vector< Spell > mSpells
Definition: spellmodel.hpp:52
void update()
Definition: spellmodel.cpp:43
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
std::string mCostColumn
Definition: spellmodel.hpp:20
Definition: spellmodel.hpp:14