Move windows to uptr. Add simple text editing.

This commit is contained in:
jmsgrogan 2020-06-20 16:34:10 +01:00
parent 2bcc7b3d83
commit b99708e7d3
55 changed files with 1257 additions and 994 deletions

View file

@ -1,9 +1,9 @@
#include "WindowManager.h"
WindowManager::WindowManager()
: mWindows()
: mWindows()
{
AddWindow(mt::Window::Create());
AddWindow(mt::Window::Create());
}
WindowManager::~WindowManager()
@ -11,27 +11,39 @@ WindowManager::~WindowManager()
}
void WindowManager::OnPaintEvent(PaintEventPtr event)
std::unique_ptr<WindowManager> WindowManager::Create()
{
GetMainWindow()->OnPaint(event);
return std::make_unique<WindowManager>();
}
void WindowManager::OnMouseEvent(MouseEventPtr event)
void WindowManager::OnPaintEvent(const PaintEvent* event)
{
GetMainWindow()->OnMouseEvent(event);
GetMainWindow()->OnPaint(event);
}
void WindowManager::AddWindow(WindowPtr window)
void WindowManager::OnMouseEvent(const MouseEvent* event)
{
mWindows.push_back(window);
GetMainWindow()->OnMouseEvent(event);
}
std::shared_ptr<WindowManager> WindowManager::Create()
void WindowManager::OnKeyboardEvent(const KeyboardEvent* event)
{
return std::make_shared<WindowManager>();
GetMainWindow()->OnKeyboardEvent(event);
}
WindowPtr WindowManager::GetMainWindow()
void WindowManager::AddWindow(WindowUPtr window)
{
return mWindows[0];
mWindows.push_back(std::move(window));
}
mt::Window* WindowManager::GetMainWindow() const
{
if(mWindows.size()>0)
{
return mWindows[0].get();
}
else
{
return nullptr;
}
}