1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 06:49:55 +00:00
openmw-tes3mp/apps/openmw/mwgui/messagebox.hpp

101 lines
2.7 KiB
C++
Raw Normal View History

#ifndef MWGUI_MESSAGE_BOX_H
#define MWGUI_MESSAGE_BOX_H
2011-06-14 16:29:55 +00:00
#include <openengine/gui/layout.hpp>
2011-06-14 16:29:55 +00:00
#include "window_base.hpp"
#include "../mwbase/windowmanager.hpp"
#undef MessageBox
namespace MyGUI
{
class Widget;
class Button;
class EditBox;
}
namespace MWGui
{
2011-06-18 13:50:41 +00:00
class InteractiveMessageBox;
2011-06-14 16:29:55 +00:00
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);
2011-06-19 17:10:44 +00:00
bool createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
bool isInteractiveMessageBox ();
void removeMessageBox (float time, MessageBox *msgbox);
bool removeMessageBox (MessageBox *msgbox);
void setMessageBoxSpeed (int speed);
void enterPressed();
int readPressedButton ();
MWBase::WindowManager *mWindowManager;
2011-06-14 20:11:36 +00:00
private:
std::vector<MessageBox*> mMessageBoxes;
2011-06-19 17:10:44 +00:00
InteractiveMessageBox* mInterMessageBoxe;
std::vector<MessageBoxManagerTimer> mTimers;
float mMessageBoxSpeed;
};
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);
int getHeight ();
void update (int height);
bool mMarkedToDelete;
2011-06-14 16:29:55 +00:00
protected:
MessageBoxManager& mMessageBoxManager;
int mHeight;
const std::string& mMessage;
MyGUI::EditBox* mMessageWidget;
2011-06-15 17:42:20 +00:00
int mFixedWidth;
int mBottomPadding;
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);
void enterPressed ();
void mousePressed (MyGUI::Widget* _widget);
int readPressedButton ();
bool mMarkedToDelete;
2011-06-19 17:41:42 +00:00
private:
void buttonActivated (MyGUI::Widget* _widget);
2011-06-18 13:50:41 +00:00
MessageBoxManager& mMessageBoxManager;
MyGUI::EditBox* mMessageWidget;
MyGUI::Widget* mButtonsWidget;
std::vector<MyGUI::Button*> mButtons;
int mTextButtonPadding;
int mButtonPressed;
2011-06-18 13:50:41 +00:00
};
2011-06-14 16:29:55 +00:00
}
#endif