00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _MODALDIALOG_
00019 #define _MODALDIALOG_
00020
00021 #include <string>
00022
00023 #include <boost/shared_ptr.hpp>
00024
00025 #include "input/InputListener.h"
00026
00027 #include "ui/AbstractButtonListener.h"
00028 #include "ui/AbstractDialogListener.h"
00029 #include "ui/CompositeScreenElement.h"
00030 #include "ui/ModalDialogType.h"
00031
00032 #include "util/Rect.h"
00033 #include "util/LineVertex.h"
00034
00035 class Button;
00036 class Engine;
00037
00038 class ModalDialog : public CompositeScreenElement,
00039 public AbstractMouseListener,
00040 public AbstractKeyListener
00041 {
00042 friend class DialogButtonListener;
00043 private:
00044 Engine* m_pEngine;
00045 std::wstring m_title;
00046 AbstractButtonListenerPtr m_pButtonListener;
00047 AbstractDialogListenerPtr m_pDialogListener;
00048 std::map<Button*, int> m_options;
00049 std::vector<Button*> m_optionVector;
00050 Rect m_area;
00051 LineVertex* m_pBorderVertices;
00052 bool m_bBorder;
00053 public:
00054 ModalDialog(Engine* pEngine, const std::wstring& title, const Rect & rect, bool bBorder);
00055 virtual ~ModalDialog();
00056
00057 virtual void Update(const int nDelta);
00058 virtual void Render(AbstractRenderer* pRenderer, const int nDelta);
00059 virtual void OnMouseMove(const MouseEvent& e);
00060 virtual void OnMouseButtonPressed(const MouseEvent& e);
00061 virtual void OnMouseButtonReleased(const MouseEvent& e) { }
00062 virtual void OnKeyPressed(const KeyEvent& e) { }
00063 virtual void OnKeyReleased(const KeyEvent& e) { }
00064
00065 void AddOption(const std::wstring& label, const int nValue);
00066 void SetDialogListener(AbstractDialogListenerPtr pListener) { m_pDialogListener = pListener; }
00067 };
00068
00069 typedef boost::shared_ptr<ModalDialog> ModalDialogPtr;
00070
00071 #endif