Add cairo interface.

This commit is contained in:
jmsgrogan 2021-04-17 13:57:14 +01:00
parent a03eb9599f
commit 9bcc0ae88e
63 changed files with 1247 additions and 450 deletions

View file

@ -1,6 +1,14 @@
#include "Window.h"
namespace mt{
#include "IPlatformWindow.h"
#include "PaintEvent.h"
#include "MouseEvent.h"
#include "VisualLayer.h"
#include "KeyboardEvent.h"
namespace mt
{
Window::Window()
:mWidth(400),
mHeight(300),
@ -21,7 +29,7 @@ std::unique_ptr<Window> Window::Create()
std::vector<VisualLayer*> Window::GetLayers()
{
return mLayers;
return mWidget->GetLayers();
}
void Window::OnMouseEvent(const MouseEvent* event)
@ -36,12 +44,8 @@ void Window::OnKeyboardEvent(const KeyboardEvent* event)
void Window::OnPaint(const PaintEvent* event)
{
mLayers.clear();
mWidget->SetBounds(mWidth, mHeight);
mWidget->OnPaintEvent(event);
auto layers = mWidget->GetLayers();
mLayers.insert(mLayers.end(), layers.begin(), layers.end());
}
void Window::AddWidget(WidgetUPtr widget)
@ -69,4 +73,19 @@ void Window::SetSize(unsigned width, unsigned height)
mWidth = width;
mHeight = height;
}
IPlatformWindow* Window::GetPlatformWindow() const
{
if (mPlatformWindow)
{
return mPlatformWindow.get();
}
return nullptr;
}
void Window::SetPlatformWindow(IPlatformWindowPtr window)
{
mPlatformWindow = std::move(window);
}
}