2012-05-26 23:14:33 +00:00
|
|
|
#ifndef MWGUI_REFERENCEINTERFACE_H
|
|
|
|
#define MWGUI_REFERENCEINTERFACE_H
|
|
|
|
|
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
/// \brief this class is intended for GUI interfaces that access an MW-Reference
|
|
|
|
/// for example dialogue window accesses an NPC, or Container window accesses a Container
|
|
|
|
/// these classes have to be automatically closed if the reference becomes unavailable
|
|
|
|
/// make sure that checkReferenceAvailable() is called every frame and that onReferenceUnavailable() has been overridden
|
|
|
|
class ReferenceInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ReferenceInterface();
|
2012-07-06 23:14:18 +00:00
|
|
|
virtual ~ReferenceInterface();
|
2012-05-26 23:14:33 +00:00
|
|
|
|
|
|
|
void checkReferenceAvailable(); ///< closes the window, if the MW-reference has become unavailable
|
|
|
|
|
2014-06-12 19:46:23 +00:00
|
|
|
virtual void resetReference() { mPtr = MWWorld::Ptr(); mCurrentPlayerCell = NULL; }
|
2014-05-02 09:20:43 +00:00
|
|
|
|
2012-05-26 23:14:33 +00:00
|
|
|
protected:
|
|
|
|
virtual void onReferenceUnavailable() = 0; ///< called when reference has become unavailable
|
|
|
|
|
|
|
|
MWWorld::Ptr mPtr;
|
|
|
|
|
|
|
|
private:
|
2012-07-03 11:55:53 +00:00
|
|
|
MWWorld::CellStore* mCurrentPlayerCell;
|
2012-05-26 23:14:33 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|