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  int mCount; // Only for Type_EnchantedItem
24  bool mSelected; // Is this the currently selected spell/item (only one can be selected at a time)
25  bool mActive; // (Items only) is the item equipped?
26 
28  : mType(Type_Spell)
29  , mCount(0)
30  , mSelected(false)
31  , mActive(false)
32  {
33  }
34  };
35 
37  class SpellModel
38  {
39  public:
40  SpellModel(const MWWorld::Ptr& actor, const std::string& filter);
41  SpellModel(const MWWorld::Ptr& actor);
42 
43  typedef int ModelIndex;
44 
45  void update();
46 
47  Spell getItem (ModelIndex index) const;
49 
50  size_t getItemCount() const;
51 
52  private:
54 
55  std::vector<Spell> mSpells;
56 
57  std::string mFilter;
58  };
59 
60 }
61 
62 #endif
Spell getItem(ModelIndex index) const
throws for invalid index
Definition: spellmodel.cpp:151
MWWorld::Ptr mActor
Definition: spellmodel.hpp:53
std::string mFilter
Definition: spellmodel.hpp:57
Type
Definition: spellmodel.hpp:11
SpellModel(const MWWorld::Ptr &actor, const std::string &filter)
Definition: spellmodel.cpp:35
std::string mId
Definition: spellmodel.hpp:21
std::string mName
Definition: spellmodel.hpp:19
bool mActive
Definition: spellmodel.hpp:25
Definition: spellmodel.hpp:9
MWWorld::Ptr mItem
Definition: spellmodel.hpp:22
bool mSelected
Definition: spellmodel.hpp:24
Model that lists all usable powers, spells and enchanted items for an actor.
Definition: spellmodel.hpp:37
int ModelIndex
Definition: spellmodel.hpp:43
Spell()
Definition: spellmodel.hpp:27
Definition: spellmodel.hpp:15
size_t getItemCount() const
Definition: spellmodel.cpp:146
Definition: spellmodel.hpp:13
Type mType
Definition: spellmodel.hpp:18
std::vector< Spell > mSpells
Definition: spellmodel.hpp:55
void update()
Definition: spellmodel.cpp:45
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
int mCount
Definition: spellmodel.hpp:23
std::string mCostColumn
Definition: spellmodel.hpp:20
Definition: spellmodel.hpp:14