Sdk/Widget: Add Canvas system, mouse movement event for widgets (buttons react to hovering)

Former-commit-id: 685295853d1f0edf28c36b2f698eca881da25ea2 [formerly f65f951ed3d2edfd9c12d390837cd13e5691eaa3] [formerly 5e239f37c28bf5e93a71cba29a94f0de680a79a2 [formerly 38346fa5d68c7bf79ddebc1990959e7c56617640]]
Former-commit-id: 92da4ed40fb63fe0b02c7543ea64cebda0575623 [formerly 2db1fe5fca87a1461ceb8314709d764af079a7be]
Former-commit-id: 77d61a99fd5a2bb21701fbe4a4b4451c3655663a
This commit is contained in:
Lynix
2016-09-15 13:16:37 +02:00
parent 136fb65a6d
commit 72206a3ca3
10 changed files with 285 additions and 15 deletions

View File

@@ -8,18 +8,23 @@
namespace Ndk
{
inline BaseWidget::BaseWidget(WorldHandle world, BaseWidget* parent) :
m_world(std::move(world)),
inline BaseWidget::BaseWidget() :
m_backgroundColor(Nz::Color(230, 230, 230, 255)),
m_canvas(nullptr),
m_contentSize(50.f, 50.f),
m_widgetParent(parent)
m_widgetParent(nullptr)
{
SetPadding(5.f, 5.f, 5.f, 5.f);
}
inline void BaseWidget::AddChild(std::unique_ptr<BaseWidget>&& widget)
{
m_children.push_back(widget.release());
m_children.emplace_back(std::move(widget));
}
inline Canvas* BaseWidget::GetCanvas()
{
return m_canvas;
}
inline const BaseWidget::Padding& BaseWidget::GetPadding() const
@@ -53,4 +58,9 @@ namespace Ndk
Layout();
}
inline void BaseWidget::UpdateCanvasIndex(std::size_t index)
{
m_canvasIndex = index;
}
}