OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
spellcreationdialog.hpp
Go to the documentation of this file.
1 #ifndef MWGUI_SPELLCREATION_H
2 #define MWGUI_SPELLCREATION_H
3 
6 
7 #include "windowbase.hpp"
8 #include "referenceinterface.hpp"
9 
10 namespace Gui
11 {
12  class MWList;
13 }
14 
15 namespace MWGui
16 {
17 
18  class SelectSkillDialog;
19  class SelectAttributeDialog;
20 
22  {
23  public:
25 
26  virtual void onOpen();
27  virtual bool exit();
28 
29  void setConstantEffect(bool constant);
30 
31  void setSkill(int skill);
32  void setAttribute(int attribute);
33 
34  void newEffect (const ESM::MagicEffect* effect);
35  void editEffect (ESM::ENAMstruct effect);
36  typedef MyGUI::delegates::CMultiDelegate1<ESM::ENAMstruct> EventHandle_Effect;
37 
41 
42  protected:
43  MyGUI::Button* mCancelButton;
44  MyGUI::Button* mOkButton;
45  MyGUI::Button* mDeleteButton;
46 
47  MyGUI::Button* mRangeButton;
48 
49  MyGUI::Widget* mDurationBox;
50  MyGUI::Widget* mMagnitudeBox;
51  MyGUI::Widget* mAreaBox;
52 
53  MyGUI::TextBox* mMagnitudeMinValue;
54  MyGUI::TextBox* mMagnitudeMaxValue;
55  MyGUI::TextBox* mDurationValue;
56  MyGUI::TextBox* mAreaValue;
57 
58  MyGUI::ScrollBar* mMagnitudeMinSlider;
59  MyGUI::ScrollBar* mMagnitudeMaxSlider;
60  MyGUI::ScrollBar* mDurationSlider;
61  MyGUI::ScrollBar* mAreaSlider;
62 
63  MyGUI::TextBox* mAreaText;
64 
65  MyGUI::ImageBox* mEffectImage;
66  MyGUI::TextBox* mEffectName;
67 
68  bool mEditing;
69 
70  protected:
71  void onRangeButtonClicked (MyGUI::Widget* sender);
72  void onDeleteButtonClicked (MyGUI::Widget* sender);
73  void onOkButtonClicked (MyGUI::Widget* sender);
74  void onCancelButtonClicked (MyGUI::Widget* sender);
75 
76  void onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos);
77  void onMagnitudeMaxChanged (MyGUI::ScrollBar* sender, size_t pos);
78  void onDurationChanged (MyGUI::ScrollBar* sender, size_t pos);
79  void onAreaChanged (MyGUI::ScrollBar* sender, size_t pos);
80  void setMagicEffect(const ESM::MagicEffect* effect);
81 
82  void updateBoxes();
83 
84  protected:
87 
89 
91  };
92 
93 
95  {
96  public:
97  enum Type
98  {
101  };
102 
103  EffectEditorBase(Type type);
104  virtual ~EffectEditorBase();
105 
106  void setConstantEffect(bool constant);
107 
108  protected:
109  std::map<int, short> mButtonMapping; // maps button ID to effect ID
110 
112  MyGUI::ScrollView* mUsedEffectsView;
113 
117 
120 
122 
123  std::vector<ESM::ENAMstruct> mEffects;
124 
125  void onEffectAdded(ESM::ENAMstruct effect);
126  void onEffectModified(ESM::ENAMstruct effect);
127  void onEffectRemoved(ESM::ENAMstruct effect);
128 
129  void onAvailableEffectClicked (MyGUI::Widget* sender);
130 
132  void onSelectAttribute();
133  void onSelectSkill();
134 
135  void onEditEffect(MyGUI::Widget* sender);
136 
137  void updateEffectsView();
138 
139  void startEditing();
140  void setWidgets (Gui::MWList* availableEffectsList, MyGUI::ScrollView* usedEffectsView);
141 
142  virtual void notifyEffectsChanged () {}
143 
144  private:
146  };
147 
149  {
150  public:
152 
153  virtual void onOpen();
154  void clear() { resetReference(); }
155 
156  void onFrame(float dt) { checkReferenceAvailable(); }
157 
158  void setPtr(const MWWorld::Ptr& actor);
159 
160  protected:
161  virtual void onReferenceUnavailable ();
162 
163  void onCancelButtonClicked (MyGUI::Widget* sender);
164  void onBuyButtonClicked (MyGUI::Widget* sender);
165  void onAccept(MyGUI::EditBox* sender);
166 
167  virtual void notifyEffectsChanged ();
168 
169  MyGUI::EditBox* mNameEdit;
170  MyGUI::TextBox* mMagickaCost;
171  MyGUI::TextBox* mSuccessChance;
172  MyGUI::Button* mBuyButton;
173  MyGUI::Button* mCancelButton;
174  MyGUI::TextBox* mPriceLabel;
175 
177 
178  };
179 
180 }
181 
182 #endif
MyGUI::TextBox * mMagickaCost
Definition: spellcreationdialog.hpp:170
void updateEffectsView()
Definition: spellcreationdialog.cpp:675
short mSelectedKnownEffectId
Definition: spellcreationdialog.hpp:119
Definition: spellcreationdialog.hpp:148
MyGUI::TextBox * mMagnitudeMinValue
Definition: spellcreationdialog.hpp:53
void newEffect(const ESM::MagicEffect *effect)
Definition: spellcreationdialog.cpp:114
void onEffectModified(ESM::ENAMstruct effect)
Definition: spellcreationdialog.cpp:662
MyGUI::Button * mCancelButton
Definition: spellcreationdialog.hpp:173
virtual void onReferenceUnavailable()
called when reference has become unavailable
Definition: spellcreationdialog.cpp:437
void onCancelButtonClicked(MyGUI::Widget *sender)
Definition: spellcreationdialog.cpp:278
virtual void notifyEffectsChanged()
Definition: spellcreationdialog.hpp:142
void onEditEffect(MyGUI::Widget *sender)
Definition: spellcreationdialog.cpp:730
ESM::ENAMstruct mOldEffect
Definition: spellcreationdialog.hpp:86
MyGUI::EditBox * mNameEdit
Definition: spellcreationdialog.hpp:169
void setPtr(const MWWorld::Ptr &actor)
Open this object in the GUI, for windows that support it.
Definition: spellcreationdialog.cpp:360
void onOkButtonClicked(MyGUI::Widget *sender)
Definition: spellcreationdialog.cpp:273
std::map< int, short > mButtonMapping
Definition: spellcreationdialog.hpp:109
const ESM::MagicEffect * mMagicEffect
Definition: spellcreationdialog.hpp:88
MyGUI::ImageBox * mEffectImage
Definition: spellcreationdialog.hpp:65
MyGUI::TextBox * mAreaText
Definition: spellcreationdialog.hpp:63
Definition: loadspel.hpp:14
EditEffectDialog mAddEffectDialog
Definition: spellcreationdialog.hpp:114
MyGUI::ScrollBar * mDurationSlider
Definition: spellcreationdialog.hpp:60
a very simple list widget that supports word-wrapping entries
Definition: list.hpp:12
void setWidgets(Gui::MWList *availableEffectsList, MyGUI::ScrollView *usedEffectsView)
Definition: spellcreationdialog.cpp:576
void onAvailableEffectClicked(MyGUI::Widget *sender)
Definition: spellcreationdialog.cpp:617
void onDurationChanged(MyGUI::ScrollBar *sender, size_t pos)
Definition: spellcreationdialog.cpp:324
MyGUI::Button * mBuyButton
Definition: spellcreationdialog.hpp:172
void onSelectAttribute()
Definition: spellcreationdialog.cpp:584
MyGUI::Widget * mAreaBox
Definition: spellcreationdialog.hpp:51
MyGUI::Widget * mMagnitudeBox
Definition: spellcreationdialog.hpp:50
MyGUI::TextBox * mDurationValue
Definition: spellcreationdialog.hpp:55
void onMagnitudeMinChanged(MyGUI::ScrollBar *sender, size_t pos)
Definition: spellcreationdialog.cpp:296
void editEffect(ESM::ENAMstruct effect)
Definition: spellcreationdialog.cpp:158
EventHandle_Effect eventEffectModified
Definition: spellcreationdialog.hpp:39
MyGUI::ScrollBar * mAreaSlider
Definition: spellcreationdialog.hpp:61
void onAreaChanged(MyGUI::ScrollBar *sender, size_t pos)
Definition: spellcreationdialog.cpp:331
MyGUI::TextBox * mAreaValue
Definition: spellcreationdialog.hpp:56
void setConstantEffect(bool constant)
Definition: spellcreationdialog.cpp:94
Definition: effectlist.hpp:17
void onCancelButtonClicked(MyGUI::Widget *sender)
Definition: spellcreationdialog.cpp:368
bool mConstantEffect
Definition: spellcreationdialog.hpp:90
MyGUI::TextBox * mMagnitudeMaxValue
Definition: spellcreationdialog.hpp:54
virtual ~EffectEditorBase()
Definition: spellcreationdialog.cpp:511
void onDeleteButtonClicked(MyGUI::Widget *sender)
Definition: spellcreationdialog.cpp:266
MyGUI::delegates::CMultiDelegate1< ESM::ENAMstruct > EventHandle_Effect
Definition: spellcreationdialog.hpp:36
EventHandle_Effect eventEffectRemoved
Definition: spellcreationdialog.hpp:40
void onSelectSkill()
Definition: spellcreationdialog.cpp:595
Definition: class.hpp:178
Definition: spellcreationdialog.hpp:21
void setMagicEffect(const ESM::MagicEffect *effect)
Definition: spellcreationdialog.cpp:191
virtual bool exit()
Gracefully exits the window.
Definition: spellcreationdialog.cpp:105
Type mType
Definition: spellcreationdialog.hpp:145
virtual void onOpen()
Notify that window has been made visible.
Definition: spellcreationdialog.cpp:431
MyGUI::Button * mDeleteButton
Definition: spellcreationdialog.hpp:45
MyGUI::ScrollBar * mMagnitudeMaxSlider
Definition: spellcreationdialog.hpp:59
Definition: spellcreationdialog.hpp:99
MyGUI::Widget * mDurationBox
Definition: spellcreationdialog.hpp:49
MyGUI::TextBox * mEffectName
Definition: spellcreationdialog.hpp:66
MyGUI::Button * mRangeButton
Definition: spellcreationdialog.hpp:47
SelectSkillDialog * mSelectSkillDialog
Definition: spellcreationdialog.hpp:116
MyGUI::TextBox * mPriceLabel
Definition: spellcreationdialog.hpp:174
Definition: spellcreationdialog.hpp:100
void startEditing()
Definition: spellcreationdialog.cpp:515
void onEffectRemoved(ESM::ENAMstruct effect)
Definition: spellcreationdialog.cpp:669
void updateBoxes()
Definition: spellcreationdialog.cpp:204
std::vector< ESM::ENAMstruct > mEffects
Definition: spellcreationdialog.hpp:123
Definition: loadmgef.hpp:13
EditEffectDialog()
Definition: spellcreationdialog.cpp:55
void setConstantEffect(bool constant)
Definition: spellcreationdialog.cpp:740
Definition: class.hpp:209
Gui::MWList * mAvailableEffectsList
Definition: spellcreationdialog.hpp:111
int mSelectedEffect
Definition: spellcreationdialog.hpp:118
MyGUI::Button * mOkButton
Definition: spellcreationdialog.hpp:44
void checkReferenceAvailable()
closes the window, if the MW-reference has become unavailable
Definition: referenceinterface.cpp:13
Definition: windowbase.hpp:21
bool mEditing
Definition: spellcreationdialog.hpp:68
Type
Definition: spellcreationdialog.hpp:97
void onRangeButtonClicked(MyGUI::Widget *sender)
Definition: spellcreationdialog.cpp:233
this class is intended for GUI interfaces that access an MW-Reference for example dialogue window acc...
Definition: referenceinterface.hpp:12
MyGUI::TextBox * mSuccessChance
Definition: spellcreationdialog.hpp:171
void clear()
Clear any state specific to the running game.
Definition: spellcreationdialog.hpp:154
void onMagnitudeMaxChanged(MyGUI::ScrollBar *sender, size_t pos)
Definition: spellcreationdialog.cpp:306
EffectEditorBase(Type type)
Definition: spellcreationdialog.cpp:493
ESM::Spell mSpell
Definition: spellcreationdialog.hpp:176
void onAccept(MyGUI::EditBox *sender)
Definition: spellcreationdialog.cpp:423
MyGUI::ScrollView * mUsedEffectsView
Definition: spellcreationdialog.hpp:112
void onBuyButtonClicked(MyGUI::Widget *sender)
Definition: spellcreationdialog.cpp:373
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
ESM::ENAMstruct mEffect
Definition: spellcreationdialog.hpp:85
void onFrame(float dt)
Called every frame if the window is in an active GUI mode.
Definition: spellcreationdialog.hpp:156
EventHandle_Effect eventEffectAdded
Definition: spellcreationdialog.hpp:38
MyGUI::Button * mCancelButton
Definition: spellcreationdialog.hpp:43
void onEffectAdded(ESM::ENAMstruct effect)
Definition: spellcreationdialog.cpp:722
void setAttribute(int attribute)
Definition: spellcreationdialog.cpp:290
void setSkill(int skill)
Definition: spellcreationdialog.cpp:284
Definition: spellcreationdialog.hpp:94
MyGUI::ScrollBar * mMagnitudeMinSlider
Definition: spellcreationdialog.hpp:58
bool mConstantEffect
Definition: spellcreationdialog.hpp:121
SelectAttributeDialog * mSelectAttributeDialog
Definition: spellcreationdialog.hpp:115
virtual void onOpen()
Notify that window has been made visible.
Definition: spellcreationdialog.cpp:99
virtual void resetReference()
Definition: referenceinterface.hpp:20
virtual void notifyEffectsChanged()
Definition: spellcreationdialog.cpp:443
Definition: windowbase.hpp:61
void onAttributeOrSkillCancel()
Definition: spellcreationdialog.cpp:606
SpellCreationDialog()
Definition: spellcreationdialog.cpp:340