mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-28 20:36:42 +00:00
Create a base class for dialog windows
This commit is contained in:
parent
1ff81354eb
commit
6bf10c93c8
3 changed files with 54 additions and 0 deletions
|
@ -45,6 +45,7 @@ set(GAMEGUI_HEADER
|
||||||
mwgui/console.hpp
|
mwgui/console.hpp
|
||||||
mwgui/dialogue.hpp
|
mwgui/dialogue.hpp
|
||||||
mwgui/dialogue_history.hpp
|
mwgui/dialogue_history.hpp
|
||||||
|
mwgui/window_base.hpp
|
||||||
)
|
)
|
||||||
set(GAMEGUI
|
set(GAMEGUI
|
||||||
mwgui/window_manager.cpp
|
mwgui/window_manager.cpp
|
||||||
|
@ -58,6 +59,7 @@ set(GAMEGUI
|
||||||
mwgui/review.cpp
|
mwgui/review.cpp
|
||||||
mwgui/dialogue.cpp
|
mwgui/dialogue.cpp
|
||||||
mwgui/dialogue_history.cpp
|
mwgui/dialogue_history.cpp
|
||||||
|
mwgui/window_base.cpp
|
||||||
)
|
)
|
||||||
source_group(apps\\openmw\\mwgui FILES ${GAMEGUI_HEADER} ${GAMEGUI})
|
source_group(apps\\openmw\\mwgui FILES ${GAMEGUI_HEADER} ${GAMEGUI})
|
||||||
|
|
||||||
|
|
25
apps/openmw/mwgui/window_base.cpp
Normal file
25
apps/openmw/mwgui/window_base.cpp
Normal file
|
@ -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);
|
||||||
|
}
|
27
apps/openmw/mwgui/window_base.hpp
Normal file
27
apps/openmw/mwgui/window_base.hpp
Normal file
|
@ -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 a new issue