forked from teamnwah/openmw-tes3coop
now, realy deleted needless code.
This commit is contained in:
parent
84c19a90ad
commit
56dc9ffcf3
4 changed files with 41 additions and 10 deletions
|
@ -1,11 +1,12 @@
|
||||||
#include "messagebox.hpp"
|
#include "messagebox.hpp"
|
||||||
//#include "window_manager.hpp"
|
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
void MessageBoxManager::createMessageBox (const std::string& message)
|
void MessageBoxManager::createMessageBox (const std::string& message)
|
||||||
{
|
{
|
||||||
std::cout << "create non-interactive message box" << std::endl;
|
std::cout << "create non-interactive message box" << std::endl;
|
||||||
|
MessageBox *box = new MessageBox(*this, message);
|
||||||
|
mMessageBoxes.push_back(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageBoxManager::createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons)
|
void MessageBoxManager::createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons)
|
||||||
|
@ -13,3 +14,10 @@ void MessageBoxManager::createInteractiveMessageBox (const std::string& message,
|
||||||
std::cout << "create interactive message box" << std::endl;
|
std::cout << "create interactive message box" << std::endl;
|
||||||
std::copy (buttons.begin(), buttons.end(), std::ostream_iterator<std::string> (std::cout, ", "));
|
std::copy (buttons.begin(), buttons.end(), std::ostream_iterator<std::string> (std::cout, ", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message)
|
||||||
|
: Layout("openmw_messagebox_layout.xml")
|
||||||
|
, mMessageBoxManager(parMessageBoxManager)
|
||||||
|
{
|
||||||
|
setText("message", message);
|
||||||
|
}
|
||||||
|
|
|
@ -1,25 +1,35 @@
|
||||||
#ifndef MWGUI_MESSAGE_BOX_H
|
#ifndef MWGUI_MESSAGE_BOX_H
|
||||||
#define MWGUI_MESSAGE_BOX_H
|
#define MWGUI_MESSAGE_BOX_H
|
||||||
|
|
||||||
|
#include <openengine/gui/layout.hpp>
|
||||||
|
#include <MyGUI.h>
|
||||||
|
|
||||||
#include "window_base.hpp"
|
#include "window_base.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class WindowManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWGui
|
class MessageBoxManager;
|
||||||
{
|
class MessageBox;
|
||||||
using namespace MyGUI;
|
|
||||||
|
|
||||||
class WindowManager;
|
|
||||||
|
|
||||||
class MessageBoxManager
|
class MessageBoxManager
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
std::vector<MessageBox*> mMessageBoxes;
|
||||||
public:
|
public:
|
||||||
void createMessageBox (const std::string& message);
|
void createMessageBox (const std::string& message);
|
||||||
void createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
|
void createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MessageBox : public OEngine::GUI::Layout
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message);
|
||||||
|
void setMessage(const std::string& message);
|
||||||
|
protected:
|
||||||
|
MessageBoxManager& mMessageBoxManager;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "dialogue.hpp"
|
#include "dialogue.hpp"
|
||||||
#include "dialogue_history.hpp"
|
#include "dialogue_history.hpp"
|
||||||
#include "stats_window.hpp"
|
#include "stats_window.hpp"
|
||||||
|
#include "messagebox.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
#include "../mwinput/inputmanager.hpp"
|
#include "../mwinput/inputmanager.hpp"
|
||||||
|
@ -60,6 +61,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
||||||
inventory = new InventoryWindow ();
|
inventory = new InventoryWindow ();
|
||||||
#endif
|
#endif
|
||||||
console = new Console(w,h, environment, extensions);
|
console = new Console(w,h, environment, extensions);
|
||||||
|
mMessageBoxManager = new MessageBoxManager();
|
||||||
|
|
||||||
// The HUD is always on
|
// The HUD is always on
|
||||||
hud->setVisible(true);
|
hud->setVisible(true);
|
||||||
|
@ -82,6 +84,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
||||||
WindowManager::~WindowManager()
|
WindowManager::~WindowManager()
|
||||||
{
|
{
|
||||||
delete console;
|
delete console;
|
||||||
|
delete mMessageBoxManager;
|
||||||
delete hud;
|
delete hud;
|
||||||
delete map;
|
delete map;
|
||||||
delete menu;
|
delete menu;
|
||||||
|
@ -446,13 +449,21 @@ void WindowManager::removeDialog(OEngine::GUI::Layout*dialog)
|
||||||
|
|
||||||
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
|
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
|
||||||
{
|
{
|
||||||
std::cout << "message box: " << message << std::endl;
|
/*std::cout << "message box: " << message << std::endl;
|
||||||
|
|
||||||
if (!buttons.empty())
|
if (!buttons.empty())
|
||||||
{
|
{
|
||||||
std::cout << "buttons: ";
|
std::cout << "buttons: ";
|
||||||
std::copy (buttons.begin(), buttons.end(), std::ostream_iterator<std::string> (std::cout, ", "));
|
std::copy (buttons.begin(), buttons.end(), std::ostream_iterator<std::string> (std::cout, ", "));
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
}*/
|
||||||
|
if (buttons.empty())
|
||||||
|
{
|
||||||
|
mMessageBoxManager->createMessageBox(message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mMessageBoxManager->createInteractiveMessageBox(message, buttons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace MWGui
|
||||||
class CreateClassDialog;
|
class CreateClassDialog;
|
||||||
class BirthDialog;
|
class BirthDialog;
|
||||||
class ReviewDialog;
|
class ReviewDialog;
|
||||||
|
class MessageBoxManager;
|
||||||
|
|
||||||
struct ClassPoint
|
struct ClassPoint
|
||||||
{
|
{
|
||||||
|
@ -84,6 +85,7 @@ namespace MWGui
|
||||||
MapWindow *map;
|
MapWindow *map;
|
||||||
MainMenu *menu;
|
MainMenu *menu;
|
||||||
StatsWindow *stats;
|
StatsWindow *stats;
|
||||||
|
MessageBoxManager *mMessageBoxManager;
|
||||||
#if 0
|
#if 0
|
||||||
InventoryWindow *inventory;
|
InventoryWindow *inventory;
|
||||||
#endif
|
#endif
|
||||||
|
@ -245,7 +247,7 @@ namespace MWGui
|
||||||
|
|
||||||
void removeDialog(OEngine::GUI::Layout* dialog);
|
void removeDialog(OEngine::GUI::Layout* dialog);
|
||||||
///< Hides dialog and schedules dialog to be deleted.
|
///< Hides dialog and schedules dialog to be deleted.
|
||||||
|
|
||||||
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue