MW_Dialog set ro right propertys

actorid
Sebastian Wick 14 years ago
parent aab07f379e
commit fc25ccef4e

@ -2,6 +2,11 @@
using namespace MWGui;
MessageBoxManager::MessageBoxManager (WindowManager *windowManager)
{
mWindowManager = windowManager;
}
void MessageBoxManager::createMessageBox (const std::string& message)
{
std::cout << "create non-interactive message box" << std::endl;
@ -20,4 +25,24 @@ MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::strin
, mMessageBoxManager(parMessageBoxManager)
{
setText("message", message);
MyGUI::WidgetPtr messageWidget;
getWidget(messageWidget, "message");
MyGUI::IntSize size = messageWidget->_getTextSize();
size.width += 20;
size.height += 20;
MyGUI::IntSize gameWindowSize = mMessageBoxManager.mWindowManager->getGui()->getViewSize();
MyGUI::IntCoord coord;
coord.left = (gameWindowSize.width - size.width)/2;
coord.top = (gameWindowSize.height - size.height);
std::cout << "Setting MainWidget to position (" << coord.left << "|" << coord.top
<< ") and size to (" << size.width << "|" << size.height << ")" << std::endl;
mMainWidget->setCoord(coord);
mMainWidget->setSize(size);
}

@ -5,6 +5,7 @@
#include <MyGUI.h>
#include "window_base.hpp"
#include "window_manager.hpp"
namespace MWGui
{
@ -14,18 +15,23 @@ namespace MWGui
class MessageBoxManager
{
private:
std::vector<MessageBox*> mMessageBoxes;
public:
MessageBoxManager (WindowManager* windowManager);
void createMessageBox (const std::string& message);
void createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
WindowManager *mWindowManager;
private:
std::vector<MessageBox*> mMessageBoxes;
};
class MessageBox : public OEngine::GUI::Layout
{
public:
MessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message);
void setMessage(const std::string& message);
MessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message);
void setMessage (const std::string& message);
protected:
MessageBoxManager& mMessageBoxManager;
};

@ -61,7 +61,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
inventory = new InventoryWindow ();
#endif
console = new Console(w,h, environment, extensions);
mMessageBoxManager = new MessageBoxManager();
mMessageBoxManager = new MessageBoxManager(this);
// The HUD is always on
hud->setVisible(true);

@ -2,9 +2,6 @@
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 491 302" name="_Main">
<Widget type="StaticText" skin="HeaderText" position="0 0 162 18" name="message" align="ALIGN_LEFT ALIGN_TOP">
<Property key="Widget_Caption" value="Test:"/>
<Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_TOP"/>
</Widget>
<Widget type="StaticText" skin="NormalText" position="4 4 70 18" name="message"/>
</Widget>
</MyGUI>

Loading…
Cancel
Save