mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 17:29:55 +00:00
MW_Dialog set ro right propertys
This commit is contained in:
parent
aab07f379e
commit
fc25ccef4e
4 changed files with 37 additions and 9 deletions
|
@ -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…
Reference in a new issue