1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-17 19:10:24 +00:00
OpenMW/apps/openmw/mwgui/spellmodel.hpp
scrawl 79237d16a7 Refactor spell window to use model/view and remove duplicated code in QuickKeysMenu
This should also improve window resizing performance, the widgets are now just resized instead of recreated.
2014-12-15 13:28:03 +01:00

57 lines
1.2 KiB
C++

#ifndef OPENMW_GUI_SPELLMODEL_H
#define OPENMW_GUI_SPELLMODEL_H
#include "../mwworld/ptr.hpp"
namespace MWGui
{
struct Spell
{
enum Type
{
Type_Power,
Type_Spell,
Type_EnchantedItem
};
Type mType;
std::string mName;
std::string mCostColumn; // Cost/chance or Cost/charge
std::string mId; // Item ID or spell ID
MWWorld::Ptr mItem; // Only for Type_EnchantedItem
bool mSelected; // Is this the currently selected spell/item (only one can be selected at a time)
bool mActive; // (Items only) is the item equipped?
Spell()
: mSelected(false)
, mActive(false)
{
}
};
///@brief Model that lists all usable powers, spells and enchanted items for an actor.
class SpellModel
{
public:
SpellModel(const MWWorld::Ptr& actor);
typedef int ModelIndex;
void update();
Spell getItem (ModelIndex index) const;
///< throws for invalid index
size_t getItemCount() const;
private:
MWWorld::Ptr mActor;
std::vector<Spell> mSpells;
};
}
#endif