adding widget MWEnchantment

actorid
scrawl 13 years ago
parent d568b27b92
commit c7381d4491

@ -264,6 +264,50 @@ MWSpell::~MWSpell()
{
}
/* MWEnchantment */
MWEnchantment::MWEnchantment()
: mWindowManager(nullptr)
{
}
void MWEnchantment::setEnchantmentId(const std::string &enchantId)
{
id = enchantId;
updateWidgets();
}
void MWEnchantment::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord)
{
const ESMS::ESMStore &store = mWindowManager->getStore();
const ESM::Enchantment *enchant = store.enchants.search(id);
MYGUI_ASSERT(enchant, "enchantment with id '" << id << "' not found");
MWSpellEffectPtr effect = nullptr;
std::vector<ESM::ENAMstruct>::const_iterator end = enchant->effects.list.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = enchant->effects.list.begin(); it != end; ++it)
{
effect = creator->createWidget<MWSpellEffect>("MW_EffectImage", coord, MyGUI::Align::Default);
effect->setWindowManager(mWindowManager);
effect->setSpellEffect(*it);
effects.push_back(effect);
coord.top += effect->getHeight();
}
}
void MWEnchantment::updateWidgets()
{
}
void MWEnchantment::initialiseOverride()
{
Base::initialiseOverride();
}
MWEnchantment::~MWEnchantment()
{
}
/* MWSpellEffect */
MWSpellEffect::MWSpellEffect()

@ -126,7 +126,7 @@ namespace MWGui
protected:
virtual ~MWSpell();
virtual void initialiseOverride();
virtual void initialiseOverride();
private:
void updateWidgets();
@ -137,6 +137,33 @@ namespace MWGui
};
typedef MWSpell* MWSpellPtr;
class MYGUI_EXPORT MWEnchantment : public Widget
{
MYGUI_RTTI_DERIVED( MWEnchantment );
public:
MWEnchantment();
typedef MWMechanics::Stat<int> EnchantmentValue;
void setWindowManager(WindowManager* parWindowManager) { mWindowManager = parWindowManager; }
void setEnchantmentId(const std::string &enchantId);
void createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord);
const std::string &getSpellId() const { return id; }
protected:
virtual ~MWEnchantment();
virtual void initialiseOverride();
private:
void updateWidgets();
WindowManager* mWindowManager;
std::string id;
};
typedef MWEnchantment* MWEnchantmentPtr;
class MYGUI_EXPORT MWSpellEffect : public Widget
{
MYGUI_RTTI_DERIVED( MWSpellEffect );

Loading…
Cancel
Save