1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 09:55:35 +00:00
OpenMW/apps/openmw/mwgui/spellcreationdialog.hpp

169 lines
4.4 KiB
C++
Raw Normal View History

2012-09-22 22:36:20 +00:00
#ifndef MWGUI_SPELLCREATION_H
#define MWGUI_SPELLCREATION_H
#include "windowbase.hpp"
2012-09-22 22:36:20 +00:00
#include "referenceinterface.hpp"
#include "list.hpp"
2012-10-03 13:06:54 +00:00
#include "widgets.hpp"
2012-09-22 22:36:20 +00:00
namespace MWGui
{
class SelectSkillDialog;
class SelectAttributeDialog;
2012-09-24 06:09:16 +00:00
class EditEffectDialog : public WindowModal
{
public:
EditEffectDialog();
2012-09-24 06:09:16 +00:00
virtual void open();
virtual void exit();
2012-09-24 06:09:16 +00:00
2012-10-03 13:06:54 +00:00
void setSkill(int skill);
void setAttribute(int attribute);
void newEffect (const ESM::MagicEffect* effect);
void editEffect (ESM::ENAMstruct effect);
2013-03-28 16:41:00 +00:00
bool constantEffect;
2012-10-03 13:06:54 +00:00
typedef MyGUI::delegates::CMultiDelegate1<ESM::ENAMstruct> EventHandle_Effect;
EventHandle_Effect eventEffectAdded;
EventHandle_Effect eventEffectModified;
EventHandle_Effect eventEffectRemoved;
2012-09-24 06:09:16 +00:00
protected:
MyGUI::Button* mCancelButton;
MyGUI::Button* mOkButton;
MyGUI::Button* mDeleteButton;
MyGUI::Button* mRangeButton;
2012-10-11 16:26:29 +00:00
MyGUI::Widget* mDurationBox;
MyGUI::Widget* mMagnitudeBox;
MyGUI::Widget* mAreaBox;
2012-09-24 06:09:16 +00:00
MyGUI::TextBox* mMagnitudeMinValue;
MyGUI::TextBox* mMagnitudeMaxValue;
MyGUI::TextBox* mDurationValue;
MyGUI::TextBox* mAreaValue;
MyGUI::ScrollBar* mMagnitudeMinSlider;
MyGUI::ScrollBar* mMagnitudeMaxSlider;
MyGUI::ScrollBar* mDurationSlider;
MyGUI::ScrollBar* mAreaSlider;
MyGUI::TextBox* mAreaText;
2012-09-24 06:09:16 +00:00
MyGUI::ImageBox* mEffectImage;
MyGUI::TextBox* mEffectName;
2012-10-03 13:06:54 +00:00
bool mEditing;
2012-09-24 06:09:16 +00:00
protected:
void onRangeButtonClicked (MyGUI::Widget* sender);
void onDeleteButtonClicked (MyGUI::Widget* sender);
void onOkButtonClicked (MyGUI::Widget* sender);
void onCancelButtonClicked (MyGUI::Widget* sender);
2012-10-11 16:26:29 +00:00
void onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos);
void onMagnitudeMaxChanged (MyGUI::ScrollBar* sender, size_t pos);
void onDurationChanged (MyGUI::ScrollBar* sender, size_t pos);
void onAreaChanged (MyGUI::ScrollBar* sender, size_t pos);
2012-10-03 13:06:54 +00:00
void setMagicEffect(const ESM::MagicEffect* effect);
2012-10-11 16:26:29 +00:00
void updateBoxes();
2012-09-24 06:09:16 +00:00
protected:
ESM::ENAMstruct mEffect;
ESM::ENAMstruct mOldEffect;
2012-10-11 16:26:29 +00:00
const ESM::MagicEffect* mMagicEffect;
2012-09-24 06:09:16 +00:00
};
class EffectEditorBase
2012-09-22 22:36:20 +00:00
{
public:
enum Type
{
Spellmaking,
Enchanting
};
EffectEditorBase(Type type);
virtual ~EffectEditorBase();
2012-09-22 22:36:20 +00:00
protected:
2013-03-28 16:41:00 +00:00
std::map<int, short> mButtonMapping; // maps button ID to effect ID
Widgets::MWList* mAvailableEffectsList;
MyGUI::ScrollView* mUsedEffectsView;
EditEffectDialog mAddEffectDialog;
SelectAttributeDialog* mSelectAttributeDialog;
SelectSkillDialog* mSelectSkillDialog;
int mSelectedEffect;
short mSelectedKnownEffectId;
std::vector<ESM::ENAMstruct> mEffects;
void onEffectAdded(ESM::ENAMstruct effect);
void onEffectModified(ESM::ENAMstruct effect);
void onEffectRemoved(ESM::ENAMstruct effect);
2012-09-22 22:36:20 +00:00
2012-09-24 06:09:16 +00:00
void onAvailableEffectClicked (MyGUI::Widget* sender);
2012-09-22 22:36:20 +00:00
2012-10-03 13:06:54 +00:00
void onAttributeOrSkillCancel();
void onSelectAttribute();
void onSelectSkill();
void onEditEffect(MyGUI::Widget* sender);
2012-10-03 13:06:54 +00:00
void updateEffectsView();
void startEditing();
void setWidgets (Widgets::MWList* availableEffectsList, MyGUI::ScrollView* usedEffectsView);
2012-10-23 09:42:38 +00:00
virtual void notifyEffectsChanged () {}
private:
Type mType;
};
class SpellCreationDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
{
public:
SpellCreationDialog();
virtual void open();
virtual void exit();
void startSpellMaking(MWWorld::Ptr actor);
protected:
virtual void onReferenceUnavailable ();
void onCancelButtonClicked (MyGUI::Widget* sender);
void onBuyButtonClicked (MyGUI::Widget* sender);
2012-10-23 09:42:38 +00:00
virtual void notifyEffectsChanged ();
2012-09-22 22:36:20 +00:00
MyGUI::EditBox* mNameEdit;
MyGUI::TextBox* mMagickaCost;
MyGUI::TextBox* mSuccessChance;
MyGUI::Button* mBuyButton;
MyGUI::Button* mCancelButton;
MyGUI::TextBox* mPriceLabel;
2012-10-03 13:06:54 +00:00
Widgets::MWEffectList* mUsedEffectsList;
2012-10-23 09:42:38 +00:00
ESM::Spell mSpell;
2012-09-22 22:36:20 +00:00
};
}
#endif