Widgets: Improve theme

- move simple styles classes ton their own file
- add button hovered texture
- add button hovered/pressed texture
- add label style
This commit is contained in:
Jérôme Leclercq
2021-11-30 12:42:05 +01:00
parent b20897a2fb
commit 461a06ab8c
10 changed files with 343 additions and 134 deletions

View File

@@ -3,6 +3,8 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Widgets/WidgetTheme.hpp>
#include <Nazara/Graphics/Components/GraphicsComponent.hpp>
#include <Nazara/Utility/Components/NodeComponent.hpp>
#include <Nazara/Widgets/Canvas.hpp>
#include <Nazara/Widgets/Debug.hpp>
@@ -12,11 +14,23 @@ namespace Nz
BaseWidgetStyle::~BaseWidgetStyle() = default;
entt::entity BaseWidgetStyle::CreateGraphicsEntity()
{
auto& registry = GetRegistry();
entt::entity entity = CreateEntity();
registry.emplace<GraphicsComponent>(entity, m_widgetOwner->IsVisible());
registry.emplace<NodeComponent>(entity).SetParent(m_widgetOwner);
return entity;
}
UInt32 BaseWidgetStyle::GetRenderMask() const
{
return m_widgetOwner->GetCanvas()->GetRenderMask();
}
void ButtonWidgetStyle::OnHoverBegin()
{
}
@@ -32,4 +46,13 @@ namespace Nz
void ButtonWidgetStyle::OnRelease()
{
}
void LabelWidgetStyle::OnHoverBegin()
{
}
void LabelWidgetStyle::OnHoverEnd()
{
}
}