2011-06-14 16:41:30 +02:00
|
|
|
#ifndef MWGUI_MESSAGE_BOX_H
|
|
|
|
#define MWGUI_MESSAGE_BOX_H
|
|
|
|
|
2011-06-14 18:29:55 +02:00
|
|
|
#include <openengine/gui/layout.hpp>
|
|
|
|
#include <MyGUI.h>
|
2011-06-15 22:53:05 +02:00
|
|
|
#include <OgreTimer.h>
|
2011-06-14 16:41:30 +02:00
|
|
|
|
2011-06-14 18:29:55 +02:00
|
|
|
#include "window_base.hpp"
|
2011-06-14 22:11:36 +02:00
|
|
|
#include "window_manager.hpp"
|
2011-06-14 16:41:30 +02:00
|
|
|
|
2011-06-15 22:53:05 +02:00
|
|
|
|
2011-06-14 16:41:30 +02:00
|
|
|
namespace MWGui
|
|
|
|
{
|
2011-06-15 22:53:05 +02:00
|
|
|
|
2011-06-14 18:29:55 +02:00
|
|
|
class MessageBoxManager;
|
|
|
|
class MessageBox;
|
2011-06-14 16:41:30 +02:00
|
|
|
|
2011-06-15 22:53:05 +02:00
|
|
|
struct MessageBoxManagerTimer {
|
|
|
|
float current;
|
|
|
|
float max;
|
|
|
|
MessageBox *messageBox;
|
|
|
|
};
|
|
|
|
|
2011-06-14 16:41:30 +02:00
|
|
|
class MessageBoxManager
|
|
|
|
{
|
|
|
|
public:
|
2011-06-14 22:11:36 +02:00
|
|
|
MessageBoxManager (WindowManager* windowManager);
|
2011-06-15 22:53:05 +02:00
|
|
|
void onFrame (float frameDuration);
|
2011-06-14 16:41:30 +02:00
|
|
|
void createMessageBox (const std::string& message);
|
|
|
|
void createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
|
2011-06-14 22:11:36 +02:00
|
|
|
|
2011-06-15 22:53:05 +02:00
|
|
|
void removeMessageBox (float time, MessageBox *msgbox);
|
|
|
|
void setMessageBoxSpeed (int speed);
|
|
|
|
|
2011-06-14 22:11:36 +02:00
|
|
|
WindowManager *mWindowManager;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<MessageBox*> mMessageBoxes;
|
2011-06-15 22:53:05 +02:00
|
|
|
std::vector<MessageBoxManagerTimer*> mTimers;
|
|
|
|
float mMessageBoxSpeed;
|
2011-06-14 16:41:30 +02:00
|
|
|
};
|
2011-06-14 18:29:55 +02:00
|
|
|
|
|
|
|
class MessageBox : public OEngine::GUI::Layout
|
|
|
|
{
|
|
|
|
public:
|
2011-06-14 22:11:36 +02:00
|
|
|
MessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message);
|
|
|
|
void setMessage (const std::string& message);
|
2011-06-15 13:58:57 +02:00
|
|
|
int getHeight ();
|
|
|
|
void update (int height);
|
2011-06-14 22:11:36 +02:00
|
|
|
|
2011-06-14 18:29:55 +02:00
|
|
|
protected:
|
|
|
|
MessageBoxManager& mMessageBoxManager;
|
2011-06-15 13:58:57 +02:00
|
|
|
int mHeight;
|
2011-06-15 19:42:20 +02:00
|
|
|
const std::string& cMessage;
|
|
|
|
MyGUI::EditPtr mMessageWidget;
|
|
|
|
int mFixedWidth;
|
|
|
|
int mBottomPadding;
|
2011-06-15 19:53:32 +02:00
|
|
|
int mNextBoxPadding;
|
2011-06-14 18:29:55 +02:00
|
|
|
};
|
|
|
|
|
2011-06-14 16:41:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|