2011-06-14 14:41:30 +00:00
|
|
|
#ifndef MWGUI_MESSAGE_BOX_H
|
|
|
|
#define MWGUI_MESSAGE_BOX_H
|
|
|
|
|
2011-06-14 16:29:55 +00:00
|
|
|
#include <openengine/gui/layout.hpp>
|
|
|
|
#include <MyGUI.h>
|
2011-06-14 14:41:30 +00:00
|
|
|
|
2011-06-14 16:29:55 +00:00
|
|
|
#include "window_base.hpp"
|
2011-06-14 20:11:36 +00:00
|
|
|
#include "window_manager.hpp"
|
2011-06-14 14:41:30 +00:00
|
|
|
|
2012-03-26 22:36:53 +00:00
|
|
|
#undef MessageBox
|
2011-06-15 20:53:05 +00:00
|
|
|
|
2011-06-14 14:41:30 +00:00
|
|
|
namespace MWGui
|
|
|
|
{
|
2011-06-15 20:53:05 +00:00
|
|
|
|
2011-06-18 13:50:41 +00:00
|
|
|
class InteractiveMessageBox;
|
2011-06-14 16:29:55 +00:00
|
|
|
class MessageBoxManager;
|
|
|
|
class MessageBox;
|
2011-06-14 14:41:30 +00:00
|
|
|
|
2011-06-15 20:53:05 +00:00
|
|
|
struct MessageBoxManagerTimer {
|
|
|
|
float current;
|
|
|
|
float max;
|
|
|
|
MessageBox *messageBox;
|
|
|
|
};
|
|
|
|
|
2011-06-14 14:41:30 +00:00
|
|
|
class MessageBoxManager
|
|
|
|
{
|
|
|
|
public:
|
2011-06-19 17:41:42 +00:00
|
|
|
MessageBoxManager (WindowManager* windowManager);
|
2011-06-15 20:53:05 +00:00
|
|
|
void onFrame (float frameDuration);
|
2011-06-14 14:41:30 +00:00
|
|
|
void createMessageBox (const std::string& message);
|
2011-06-19 17:10:44 +00:00
|
|
|
bool createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
|
|
|
|
bool isInteractiveMessageBox ();
|
2011-06-14 20:11:36 +00:00
|
|
|
|
2011-06-15 20:53:05 +00:00
|
|
|
void removeMessageBox (float time, MessageBox *msgbox);
|
2011-06-16 11:02:49 +00:00
|
|
|
bool removeMessageBox (MessageBox *msgbox);
|
2011-06-15 20:53:05 +00:00
|
|
|
void setMessageBoxSpeed (int speed);
|
|
|
|
|
2011-07-12 18:05:04 +00:00
|
|
|
int readPressedButton ();
|
|
|
|
|
2011-06-14 20:11:36 +00:00
|
|
|
WindowManager *mWindowManager;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<MessageBox*> mMessageBoxes;
|
2011-06-19 17:10:44 +00:00
|
|
|
InteractiveMessageBox* mInterMessageBoxe;
|
2011-06-16 10:12:50 +00:00
|
|
|
std::vector<MessageBoxManagerTimer> mTimers;
|
2011-06-15 20:53:05 +00:00
|
|
|
float mMessageBoxSpeed;
|
2011-06-14 14:41:30 +00:00
|
|
|
};
|
2011-06-14 16:29:55 +00:00
|
|
|
|
|
|
|
class MessageBox : public OEngine::GUI::Layout
|
|
|
|
{
|
|
|
|
public:
|
2011-06-14 20:11:36 +00:00
|
|
|
MessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message);
|
|
|
|
void setMessage (const std::string& message);
|
2011-06-15 11:58:57 +00:00
|
|
|
int getHeight ();
|
|
|
|
void update (int height);
|
2011-06-14 20:11:36 +00:00
|
|
|
|
2011-06-16 15:11:50 +00:00
|
|
|
bool mMarkedToDelete;
|
|
|
|
|
2011-06-14 16:29:55 +00:00
|
|
|
protected:
|
|
|
|
MessageBoxManager& mMessageBoxManager;
|
2011-06-15 11:58:57 +00:00
|
|
|
int mHeight;
|
2011-06-15 17:42:20 +00:00
|
|
|
const std::string& cMessage;
|
|
|
|
MyGUI::EditPtr mMessageWidget;
|
|
|
|
int mFixedWidth;
|
|
|
|
int mBottomPadding;
|
2011-06-15 17:53:32 +00:00
|
|
|
int mNextBoxPadding;
|
2011-06-14 16:29:55 +00:00
|
|
|
};
|
2011-06-18 13:50:41 +00:00
|
|
|
|
|
|
|
class InteractiveMessageBox : public OEngine::GUI::Layout
|
|
|
|
{
|
|
|
|
public:
|
2011-06-19 17:41:42 +00:00
|
|
|
InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons);
|
2011-07-12 18:05:04 +00:00
|
|
|
void mousePressed (MyGUI::Widget* _widget);
|
|
|
|
int readPressedButton ();
|
|
|
|
|
|
|
|
bool mMarkedToDelete;
|
2011-06-18 13:50:41 +00:00
|
|
|
|
2011-06-19 17:41:42 +00:00
|
|
|
private:
|
2011-06-18 13:50:41 +00:00
|
|
|
MessageBoxManager& mMessageBoxManager;
|
|
|
|
MyGUI::EditPtr mMessageWidget;
|
|
|
|
MyGUI::WidgetPtr mButtonsWidget;
|
2011-06-19 17:41:42 +00:00
|
|
|
std::vector<MyGUI::ButtonPtr> mButtons;
|
2011-07-12 15:57:16 +00:00
|
|
|
|
|
|
|
int mTextButtonPadding;
|
2011-07-12 18:05:04 +00:00
|
|
|
int mButtonPressed;
|
2011-06-18 13:50:41 +00:00
|
|
|
};
|
2011-06-14 16:29:55 +00:00
|
|
|
|
2011-06-14 14:41:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|