OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
spellbuyingwindow.hpp
Go to the documentation of this file.
1 #ifndef MWGUI_SpellBuyingWINDOW_H
2 #define MWGUI_SpellBuyingWINDOW_H
3 
4 #include "windowbase.hpp"
5 #include "referenceinterface.hpp"
6 
7 #include "../mwworld/esmstore.hpp"
8 
9 namespace MyGUI
10 {
11  class Gui;
12  class Widget;
13 }
14 
15 namespace MWGui
16 {
17  class WindowManager;
18 }
19 
20 
21 namespace MWGui
22 {
24  {
25  public:
27 
28  void setPtr(const MWWorld::Ptr& actor);
29  void setPtr(const MWWorld::Ptr& actor, int startOffset);
30 
31  void onFrame(float dt) { checkReferenceAvailable(); }
32  void clear() { resetReference(); }
33 
34  void onResChange(int, int) { center(); }
35 
36  protected:
37  MyGUI::Button* mCancelButton;
38  MyGUI::TextBox* mPlayerGold;
39 
40  MyGUI::ScrollView* mSpellsView;
41 
42  std::map<MyGUI::Widget*, std::string> mSpellsWidgetMap;
43 
44  void onCancelButtonClicked(MyGUI::Widget* _sender);
45  void onSpellButtonClick(MyGUI::Widget* _sender);
46  void onMouseWheel(MyGUI::Widget* _sender, int _rel);
47  void addSpell(const ESM::Spell& spell);
48  void clearSpells();
49  int mCurrentY;
50 
51  void updateLabels();
52 
53  virtual void onReferenceUnavailable();
54 
55  bool playerHasSpell (const std::string& id);
56 
57  private:
58  static bool sortSpells (const ESM::Spell* left, const ESM::Spell* right);
59  };
60 }
61 
62 #endif
void clearSpells()
Definition: spellbuyingwindow.cpp:77
MyGUI::TextBox * mPlayerGold
Definition: spellbuyingwindow.hpp:38
std::map< MyGUI::Widget *, std::string > mSpellsWidgetMap
Definition: spellbuyingwindow.hpp:42
MyGUI::ScrollView * mSpellsView
Definition: spellbuyingwindow.hpp:40
void updateLabels()
Definition: spellbuyingwindow.cpp:174
Definition: loadspel.hpp:14
void onSpellButtonClick(MyGUI::Widget *_sender)
Definition: spellbuyingwindow.cpp:147
void clear()
Clear any state specific to the running game.
Definition: spellbuyingwindow.hpp:32
void setPtr(const MWWorld::Ptr &actor)
Open this object in the GUI, for windows that support it.
Definition: spellbuyingwindow.cpp:86
SpellBuyingWindow()
Definition: spellbuyingwindow.cpp:21
bool playerHasSpell(const std::string &id)
Definition: spellbuyingwindow.cpp:141
void center()
Definition: windowbase.cpp:49
MyGUI::Button * mCancelButton
Definition: spellbuyingwindow.hpp:37
void onMouseWheel(MyGUI::Widget *_sender, int _rel)
Definition: spellbuyingwindow.cpp:193
void checkReferenceAvailable()
closes the window, if the MW-reference has become unavailable
Definition: referenceinterface.cpp:13
Definition: windowbase.hpp:21
void onCancelButtonClicked(MyGUI::Widget *_sender)
Definition: spellbuyingwindow.cpp:169
int mCurrentY
Definition: spellbuyingwindow.hpp:49
this class is intended for GUI interfaces that access an MW-Reference for example dialogue window acc...
Definition: referenceinterface.hpp:12
static bool sortSpells(const ESM::Spell *left, const ESM::Spell *right)
Definition: spellbuyingwindow.cpp:32
void onFrame(float dt)
Called every frame if the window is in an active GUI mode.
Definition: spellbuyingwindow.hpp:31
void addSpell(const ESM::Spell &spell)
Definition: spellbuyingwindow.cpp:40
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
virtual void onReferenceUnavailable()
called when reference has become unavailable
Definition: spellbuyingwindow.cpp:186
Definition: spellbuyingwindow.hpp:23
virtual void resetReference()
Definition: referenceinterface.hpp:20
void onResChange(int, int)
Called when GUI viewport changes size.
Definition: spellbuyingwindow.hpp:34