Create a base class for dialog windows
parent
1ff81354eb
commit
6bf10c93c8
@ -0,0 +1,25 @@
|
||||
#include "window_base.hpp"
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
WindowBase::WindowBase(const std::string& parLayout, MWWorld::Environment& parEnvironment)
|
||||
: Layout(parLayout)
|
||||
, environment(parEnvironment)
|
||||
{
|
||||
}
|
||||
|
||||
void WindowBase::open()
|
||||
{
|
||||
}
|
||||
|
||||
void WindowBase::center()
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
#ifndef MWGUI_WINDOW_BASE_H
|
||||
#define MWGUI_WINDOW_BASE_H
|
||||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Environment;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowBase: public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
WindowBase(const std::string& parLayout, MWWorld::Environment& parEnvironment);
|
||||
|
||||
virtual void open();
|
||||
void center();
|
||||
|
||||
protected:
|
||||
MWWorld::Environment& environment;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue