2012-05-29 07:02:22 +00:00
|
|
|
#ifndef MWGUI_SPELLWINDOW_H
|
|
|
|
#define MWGUI_SPELLWINDOW_H
|
|
|
|
|
2013-04-10 04:32:05 +00:00
|
|
|
#include "windowpinnablebase.hpp"
|
2012-05-29 07:02:22 +00:00
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
2013-03-03 11:01:19 +00:00
|
|
|
class SpellIcons;
|
|
|
|
|
2014-03-16 22:38:51 +00:00
|
|
|
bool sortItems(const MWWorld::Ptr& left, const MWWorld::Ptr& right)
|
|
|
|
{
|
|
|
|
int cmp = left.getClass().getName(left).compare(
|
|
|
|
right.getClass().getName(right));
|
|
|
|
return cmp < 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool sortSpells(const std::string& left, const std::string& right)
|
|
|
|
{
|
|
|
|
const MWWorld::Store<ESM::Spell> &spells =
|
|
|
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>();
|
|
|
|
|
|
|
|
const ESM::Spell* a = spells.find(left);
|
|
|
|
const ESM::Spell* b = spells.find(right);
|
|
|
|
|
|
|
|
int cmp = a->mName.compare(b->mName);
|
|
|
|
return cmp < 0;
|
|
|
|
}
|
|
|
|
|
2014-01-26 13:47:01 +00:00
|
|
|
class SpellWindow : public WindowPinnableBase, public NoDrop
|
2012-05-29 07:02:22 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-01-26 13:47:01 +00:00
|
|
|
SpellWindow(DragAndDrop* drag);
|
2013-03-03 11:01:19 +00:00
|
|
|
virtual ~SpellWindow();
|
2012-05-29 07:02:22 +00:00
|
|
|
|
2012-05-29 10:35:03 +00:00
|
|
|
void updateSpells();
|
|
|
|
|
2014-01-26 13:47:01 +00:00
|
|
|
void onFrame(float dt) { NoDrop::onFrame(dt); }
|
|
|
|
|
2012-05-29 07:02:22 +00:00
|
|
|
protected:
|
|
|
|
MyGUI::ScrollView* mSpellView;
|
|
|
|
MyGUI::Widget* mEffectBox;
|
|
|
|
|
2012-05-29 10:35:03 +00:00
|
|
|
int mHeight;
|
|
|
|
int mWidth;
|
|
|
|
|
2012-05-29 13:13:44 +00:00
|
|
|
std::string mSpellToDelete;
|
|
|
|
|
2012-05-29 10:35:03 +00:00
|
|
|
void addGroup(const std::string& label, const std::string& label2);
|
|
|
|
|
|
|
|
int estimateHeight(int numSpells) const;
|
|
|
|
|
|
|
|
void onWindowResize(MyGUI::Window* _sender);
|
|
|
|
void onEnchantedItemSelected(MyGUI::Widget* _sender);
|
|
|
|
void onSpellSelected(MyGUI::Widget* _sender);
|
2012-05-29 13:13:44 +00:00
|
|
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
|
|
|
void onDeleteSpellAccept();
|
|
|
|
|
|
|
|
virtual void onPinToggled();
|
2012-05-29 10:35:03 +00:00
|
|
|
virtual void open();
|
2013-03-03 11:01:19 +00:00
|
|
|
|
|
|
|
SpellIcons* mSpellIcons;
|
2012-05-29 07:02:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|