#ifndef MWGUI_MESSAGE_BOX_H #define MWGUI_MESSAGE_BOX_H #include #include #include "window_base.hpp" #include "../mwbase/windowmanager.hpp" #undef MessageBox namespace MWGui { class InteractiveMessageBox; class MessageBoxManager; class MessageBox; struct MessageBoxManagerTimer { float current; float max; MessageBox *messageBox; }; class MessageBoxManager { public: MessageBoxManager (MWBase::WindowManager* windowManager); void onFrame (float frameDuration); void createMessageBox (const std::string& message); bool createInteractiveMessageBox (const std::string& message, const std::vector& buttons); bool isInteractiveMessageBox (); void removeMessageBox (float time, MessageBox *msgbox); bool removeMessageBox (MessageBox *msgbox); void setMessageBoxSpeed (int speed); int readPressedButton (); MWBase::WindowManager *mWindowManager; private: std::vector mMessageBoxes; InteractiveMessageBox* mInterMessageBoxe; std::vector mTimers; float mMessageBoxSpeed; }; class MessageBox : public OEngine::GUI::Layout { public: MessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message); void setMessage (const std::string& message); int getHeight (); void update (int height); bool mMarkedToDelete; protected: MessageBoxManager& mMessageBoxManager; int mHeight; const std::string& mMessage; MyGUI::EditPtr mMessageWidget; int mFixedWidth; int mBottomPadding; int mNextBoxPadding; }; class InteractiveMessageBox : public OEngine::GUI::Layout { public: InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector& buttons); void mousePressed (MyGUI::Widget* _widget); int readPressedButton (); bool mMarkedToDelete; private: MessageBoxManager& mMessageBoxManager; MyGUI::EditPtr mMessageWidget; MyGUI::WidgetPtr mButtonsWidget; std::vector mButtons; int mTextButtonPadding; int mButtonPressed; }; } #endif