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

@ -2,9 +2,9 @@
namespace mt{
Window::Window()
:mWidth(400),
mHeight(300),
mWidget()
:mWidth(400),
mHeight(300),
mWidget()
{
}
@ -14,54 +14,59 @@ Window::~Window()
}
std::vector<VisualLayerPtr> Window::GetLayers()
std::unique_ptr<Window> Window::Create()
{
return mLayers;
return std::make_unique<Window>();
}
void Window::OnMouseEvent(MouseEventPtr event)
std::vector<VisualLayer*> Window::GetLayers()
{
mWidget->OnMouseEvent(event);
return mLayers;
}
void Window::OnPaint(PaintEventPtr event)
void Window::OnMouseEvent(const MouseEvent* event)
{
mLayers.clear();
mWidget->SetSize(mWidth, mHeight);
mWidget->OnPaintEvent(event);
auto layers = mWidget->GetLayers();
mLayers.insert(mLayers.end(), layers.begin(), layers.end());
mWidget->OnMouseEvent(event);
}
std::shared_ptr<Window> Window::Create()
void Window::OnKeyboardEvent(const KeyboardEvent* event)
{
return std::make_shared<Window>();
mWidget->OnKeyboardEvent(event);
}
void Window::AddWidget(WidgetPtr widget)
void Window::OnPaint(const PaintEvent* event)
{
mWidget = widget;
mLayers.clear();
mWidget->SetSize(mWidth, mHeight);
mWidget->OnPaintEvent(event);
auto layers = mWidget->GetLayers();
mLayers.insert(mLayers.end(), layers.begin(), layers.end());
}
WidgetPtr Window::GetWidget()
void Window::AddWidget(WidgetUPtr widget)
{
return mWidget;
mWidget = std::move(widget);
}
unsigned Window::GetWidth()
Widget* Window::GetWidget() const
{
return mWidth;
return mWidget.get();
}
unsigned Window::GetHeight()
unsigned Window::GetWidth() const
{
return mHeight;
return mWidth;
}
unsigned Window::GetHeight() const
{
return mHeight;
}
void Window::SetSize(unsigned width, unsigned height)
{
mWidth = width;
mHeight = height;
mWidth = width;
mHeight = height;
}
}