OpenMW
apps/openmw/mwgui/spellicons.hpp
Go to the documentation of this file.
00001 #ifndef MWGUI_SPELLICONS_H
00002 #define MWGUI_SPELLICONS_H
00003 
00004 #include <string>
00005 #include <vector>
00006 
00007 #include "../mwmechanics/magiceffects.hpp"
00008 
00009 namespace MyGUI
00010 {
00011     class Widget;
00012     class ImageBox;
00013 }
00014 namespace ESM
00015 {
00016     struct ENAMstruct;
00017     struct EffectList;
00018 }
00019 
00020 namespace MWGui
00021 {
00022 
00023     // information about a single magic effect source as required for display in the tooltip
00024     struct MagicEffectInfo
00025     {
00026         MagicEffectInfo()
00027             : mPermanent(false)
00028             , mMagnitude(0)
00029         , mRemainingTime(0)
00030         {}
00031         std::string mSource; // display name for effect source (e.g. potion name)
00032         MWMechanics::EffectKey mKey;
00033         int mMagnitude;
00034         float mRemainingTime;
00035         bool mPermanent; // the effect is permanent
00036     };
00037 
00038     class EffectSourceVisitor : public MWMechanics::EffectSourceVisitor
00039     {
00040     public:
00041         bool mIsPermanent;
00042 
00043         std::map <int, std::vector<MagicEffectInfo> > mEffectSources;
00044 
00045         virtual void visit (MWMechanics::EffectKey key,
00046                                  const std::string& sourceName, float magnitude, float remainingTime = -1);
00047     };
00048 
00049     class SpellIcons
00050     {
00051     public:
00052         void updateWidgets(MyGUI::Widget* parent, bool adjustSize);
00053 
00054     private:
00055 
00056         std::map<int, MyGUI::ImageBox*> mWidgetMap;
00057     };
00058 
00059 }
00060 
00061 #endif