Widgets: Add widget theme (WIP)
This commit is contained in:
parent
8299a5a4bd
commit
f7b69e11c2
|
|
@ -34,11 +34,13 @@
|
||||||
#include <Nazara/Widgets/ButtonWidget.hpp>
|
#include <Nazara/Widgets/ButtonWidget.hpp>
|
||||||
#include <Nazara/Widgets/Canvas.hpp>
|
#include <Nazara/Widgets/Canvas.hpp>
|
||||||
#include <Nazara/Widgets/Config.hpp>
|
#include <Nazara/Widgets/Config.hpp>
|
||||||
|
#include <Nazara/Widgets/DefaultWidgetTheme.hpp>
|
||||||
#include <Nazara/Widgets/Enums.hpp>
|
#include <Nazara/Widgets/Enums.hpp>
|
||||||
#include <Nazara/Widgets/ImageWidget.hpp>
|
#include <Nazara/Widgets/ImageWidget.hpp>
|
||||||
#include <Nazara/Widgets/LabelWidget.hpp>
|
#include <Nazara/Widgets/LabelWidget.hpp>
|
||||||
#include <Nazara/Widgets/RichTextAreaWidget.hpp>
|
#include <Nazara/Widgets/RichTextAreaWidget.hpp>
|
||||||
#include <Nazara/Widgets/TextAreaWidget.hpp>
|
#include <Nazara/Widgets/TextAreaWidget.hpp>
|
||||||
#include <Nazara/Widgets/Widgets.hpp>
|
#include <Nazara/Widgets/Widgets.hpp>
|
||||||
|
#include <Nazara/Widgets/WidgetTheme.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_GLOBAL_WIDGETS_HPP
|
#endif // NAZARA_GLOBAL_WIDGETS_HPP
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,13 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
class BaseWidgetStyle;
|
||||||
class Canvas;
|
class Canvas;
|
||||||
|
class WidgetTheme;
|
||||||
|
|
||||||
class NAZARA_WIDGETS_API BaseWidget : public Nz::Node
|
class NAZARA_WIDGETS_API BaseWidget : public Node
|
||||||
{
|
{
|
||||||
|
friend BaseWidgetStyle;
|
||||||
friend Canvas;
|
friend Canvas;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -70,6 +73,7 @@ namespace Nz
|
||||||
inline const Rectf& GetRenderingRect() const;
|
inline const Rectf& GetRenderingRect() const;
|
||||||
|
|
||||||
inline Vector2f GetSize() const;
|
inline Vector2f GetSize() const;
|
||||||
|
const std::shared_ptr<WidgetTheme>& GetTheme() const;
|
||||||
inline float GetWidth() const;
|
inline float GetWidth() const;
|
||||||
inline std::size_t GetWidgetChildCount() const;
|
inline std::size_t GetWidgetChildCount() const;
|
||||||
|
|
||||||
|
|
@ -118,6 +122,7 @@ namespace Nz
|
||||||
Rectf GetScissorRect() const;
|
Rectf GetScissorRect() const;
|
||||||
|
|
||||||
virtual bool IsFocusable() const;
|
virtual bool IsFocusable() const;
|
||||||
|
inline bool IsInside(float x, float y) const;
|
||||||
virtual void OnFocusLost();
|
virtual void OnFocusLost();
|
||||||
virtual void OnFocusReceived();
|
virtual void OnFocusReceived();
|
||||||
virtual bool OnKeyPressed(const WindowEvent::KeyEvent& key);
|
virtual bool OnKeyPressed(const WindowEvent::KeyEvent& key);
|
||||||
|
|
@ -137,7 +142,7 @@ namespace Nz
|
||||||
virtual void ShowChildren(bool show);
|
virtual void ShowChildren(bool show);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline BaseWidget();
|
inline BaseWidget(std::shared_ptr<WidgetTheme> theme);
|
||||||
|
|
||||||
void DestroyChild(BaseWidget* widget);
|
void DestroyChild(BaseWidget* widget);
|
||||||
void DestroyChildren();
|
void DestroyChildren();
|
||||||
|
|
@ -158,6 +163,7 @@ namespace Nz
|
||||||
std::optional<entt::entity> m_backgroundEntity;
|
std::optional<entt::entity> m_backgroundEntity;
|
||||||
std::size_t m_canvasIndex;
|
std::size_t m_canvasIndex;
|
||||||
std::shared_ptr<Sprite> m_backgroundSprite;
|
std::shared_ptr<Sprite> m_backgroundSprite;
|
||||||
|
std::shared_ptr<WidgetTheme> m_theme;
|
||||||
std::vector<WidgetEntity> m_entities;
|
std::vector<WidgetEntity> m_entities;
|
||||||
std::vector<std::unique_ptr<BaseWidget>> m_children;
|
std::vector<std::unique_ptr<BaseWidget>> m_children;
|
||||||
entt::registry* m_registry;
|
entt::registry* m_registry;
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline BaseWidget::BaseWidget() :
|
inline BaseWidget::BaseWidget(std::shared_ptr<WidgetTheme> theme) :
|
||||||
m_canvasIndex(InvalidCanvasIndex),
|
m_canvasIndex(InvalidCanvasIndex),
|
||||||
|
m_theme(std::move(theme)),
|
||||||
m_registry(nullptr),
|
m_registry(nullptr),
|
||||||
m_canvas(nullptr),
|
m_canvas(nullptr),
|
||||||
m_backgroundColor(Color(230, 230, 230, 255)),
|
m_backgroundColor(Color(230, 230, 230, 255)),
|
||||||
|
|
@ -164,6 +165,11 @@ namespace Nz
|
||||||
return Vector2f(GetWidth(), GetHeight());
|
return Vector2f(GetWidth(), GetHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const std::shared_ptr<WidgetTheme>& BaseWidget::GetTheme() const
|
||||||
|
{
|
||||||
|
return m_theme;
|
||||||
|
}
|
||||||
|
|
||||||
inline float BaseWidget::GetWidth() const
|
inline float BaseWidget::GetWidth() const
|
||||||
{
|
{
|
||||||
return m_size.x;
|
return m_size.x;
|
||||||
|
|
@ -179,6 +185,12 @@ namespace Nz
|
||||||
return Show(false);
|
return Show(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool BaseWidget::IsInside(float x, float y) const
|
||||||
|
{
|
||||||
|
Rectf rect(0.f, 0.f, m_size.x, m_size.y);
|
||||||
|
return rect.Contains(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
inline bool BaseWidget::IsVisible() const
|
inline bool BaseWidget::IsVisible() const
|
||||||
{
|
{
|
||||||
return m_visible;
|
return m_visible;
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,10 @@
|
||||||
#define NAZARA_WIDGETS_BUTTONWIDGET_HPP
|
#define NAZARA_WIDGETS_BUTTONWIDGET_HPP
|
||||||
|
|
||||||
#include <Nazara/Core/Color.hpp>
|
#include <Nazara/Core/Color.hpp>
|
||||||
#include <Nazara/Graphics/Sprite.hpp>
|
#include <Nazara/Graphics/SlicedSprite.hpp>
|
||||||
#include <Nazara/Graphics/TextSprite.hpp>
|
#include <Nazara/Graphics/TextSprite.hpp>
|
||||||
#include <Nazara/Widgets/BaseWidget.hpp>
|
#include <Nazara/Widgets/BaseWidget.hpp>
|
||||||
|
#include <Nazara/Widgets/WidgetTheme.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
|
@ -25,18 +26,7 @@ namespace Nz
|
||||||
ButtonWidget(ButtonWidget&&) = default;
|
ButtonWidget(ButtonWidget&&) = default;
|
||||||
~ButtonWidget() = default;
|
~ButtonWidget() = default;
|
||||||
|
|
||||||
inline const Color& GetColor() const;
|
void UpdateText(const AbstractTextDrawer& drawer);
|
||||||
inline const Color& GetCornerColor() const;
|
|
||||||
inline const Color& GetHoverColor() const;
|
|
||||||
inline const Color& GetHoverCornerColor() const;
|
|
||||||
inline const Color& GetPressColor() const;
|
|
||||||
inline const Color& GetPressCornerColor() const;
|
|
||||||
|
|
||||||
inline void SetColor(const Color& color, const Color& cornerColor);
|
|
||||||
inline void SetHoverColor(const Color& color, const Color& cornerColor);
|
|
||||||
inline void SetPressColor(const Color& color, const Color& cornerColor);
|
|
||||||
|
|
||||||
inline void UpdateText(const AbstractTextDrawer& drawer);
|
|
||||||
|
|
||||||
ButtonWidget& operator=(const ButtonWidget&) = delete;
|
ButtonWidget& operator=(const ButtonWidget&) = delete;
|
||||||
ButtonWidget& operator=(ButtonWidget&&) = default;
|
ButtonWidget& operator=(ButtonWidget&&) = default;
|
||||||
|
|
@ -51,17 +41,7 @@ namespace Nz
|
||||||
void OnMouseButtonRelease(int x, int y, Mouse::Button button) override;
|
void OnMouseButtonRelease(int x, int y, Mouse::Button button) override;
|
||||||
void OnMouseExit() override;
|
void OnMouseExit() override;
|
||||||
|
|
||||||
std::shared_ptr<MaterialPass> m_gradientMaterialPass;
|
std::unique_ptr<ButtonWidgetStyle> m_style;
|
||||||
std::shared_ptr<Sprite> m_gradientSprite;
|
|
||||||
std::shared_ptr<TextSprite> m_textSprite;
|
|
||||||
entt::entity m_textEntity;
|
|
||||||
entt::entity m_gradientEntity;
|
|
||||||
Color m_color;
|
|
||||||
Color m_cornerColor;
|
|
||||||
Color m_hoverColor;
|
|
||||||
Color m_hoverCornerColor;
|
|
||||||
Color m_pressColor;
|
|
||||||
Color m_pressCornerColor;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,68 +7,6 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline const Color& ButtonWidget::GetColor() const
|
|
||||||
{
|
|
||||||
return m_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const Color& ButtonWidget::GetCornerColor() const
|
|
||||||
{
|
|
||||||
return m_cornerColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const Color& ButtonWidget::GetHoverColor() const
|
|
||||||
{
|
|
||||||
return m_hoverColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const Color& ButtonWidget::GetHoverCornerColor() const
|
|
||||||
{
|
|
||||||
return m_hoverCornerColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const Color& ButtonWidget::GetPressColor() const
|
|
||||||
{
|
|
||||||
return m_pressColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const Color& ButtonWidget::GetPressCornerColor() const
|
|
||||||
{
|
|
||||||
return m_pressCornerColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ButtonWidget::SetColor(const Color& color, const Color& cornerColor)
|
|
||||||
{
|
|
||||||
m_color = color;
|
|
||||||
m_cornerColor = cornerColor;
|
|
||||||
|
|
||||||
m_gradientSprite->SetColor(m_color);
|
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::LeftBottom, m_cornerColor);
|
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::RightBottom, m_cornerColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ButtonWidget::SetHoverColor(const Color& color, const Color& cornerColor)
|
|
||||||
{
|
|
||||||
m_hoverColor = color;
|
|
||||||
m_hoverCornerColor = cornerColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ButtonWidget::SetPressColor(const Color& color, const Color& cornerColor)
|
|
||||||
{
|
|
||||||
m_pressColor = color;
|
|
||||||
m_pressCornerColor = cornerColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ButtonWidget::UpdateText(const AbstractTextDrawer& drawer)
|
|
||||||
{
|
|
||||||
m_textSprite->Update(drawer);
|
|
||||||
|
|
||||||
Vector2f textSize = Vector2f(m_textSprite->GetAABB().GetLengths());
|
|
||||||
SetMinimumSize(textSize);
|
|
||||||
SetPreferredSize(textSize + Vector2f(20.f, 10.f));
|
|
||||||
|
|
||||||
Layout();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Nazara/Widgets/DebugOff.hpp>
|
#include <Nazara/Widgets/DebugOff.hpp>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Nz
|
||||||
friend BaseWidget;
|
friend BaseWidget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline Canvas(entt::registry& registry, EventHandler& eventHandler, CursorControllerHandle cursorController, UInt32 renderMask);
|
Canvas(entt::registry& registry, EventHandler& eventHandler, CursorControllerHandle cursorController, UInt32 renderMask);
|
||||||
Canvas(const Canvas&) = delete;
|
Canvas(const Canvas&) = delete;
|
||||||
Canvas(Canvas&&) = delete;
|
Canvas(Canvas&&) = delete;
|
||||||
inline ~Canvas();
|
inline ~Canvas();
|
||||||
|
|
|
||||||
|
|
@ -8,33 +8,6 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline Canvas::Canvas(entt::registry& registry, Nz::EventHandler& eventHandler, Nz::CursorControllerHandle cursorController, UInt32 renderMask) :
|
|
||||||
m_renderMask(renderMask),
|
|
||||||
m_keyboardOwner(InvalidCanvasIndex),
|
|
||||||
m_hoveredWidget(InvalidCanvasIndex),
|
|
||||||
m_mouseOwner(InvalidCanvasIndex),
|
|
||||||
m_registry(registry),
|
|
||||||
m_cursorController(cursorController)
|
|
||||||
{
|
|
||||||
m_canvas = this;
|
|
||||||
m_widgetParent = nullptr;
|
|
||||||
|
|
||||||
// Register ourselves as a widget to handle cursor change
|
|
||||||
RegisterToCanvas();
|
|
||||||
|
|
||||||
// Connect to every meaningful event
|
|
||||||
m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, this, &Canvas::OnEventKeyPressed);
|
|
||||||
m_keyReleasedSlot.Connect(eventHandler.OnKeyReleased, this, &Canvas::OnEventKeyReleased);
|
|
||||||
m_mouseButtonPressedSlot.Connect(eventHandler.OnMouseButtonPressed, this, &Canvas::OnEventMouseButtonPressed);
|
|
||||||
m_mouseButtonReleasedSlot.Connect(eventHandler.OnMouseButtonReleased, this, &Canvas::OnEventMouseButtonRelease);
|
|
||||||
m_mouseEnteredSlot.Connect(eventHandler.OnMouseEntered, this, &Canvas::OnEventMouseEntered);
|
|
||||||
m_mouseLeftSlot.Connect(eventHandler.OnMouseLeft, this, &Canvas::OnEventMouseLeft);
|
|
||||||
m_mouseMovedSlot.Connect(eventHandler.OnMouseMoved, this, &Canvas::OnEventMouseMoved);
|
|
||||||
m_mouseWheelMovedSlot.Connect(eventHandler.OnMouseWheelMoved, this, &Canvas::OnEventMouseWheelMoved);
|
|
||||||
m_textEnteredSlot.Connect(eventHandler.OnTextEntered, this, &Canvas::OnEventTextEntered);
|
|
||||||
m_textEditedSlot.Connect(eventHandler.OnTextEdited, this, &Canvas::OnEventTextEdited);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Canvas::~Canvas()
|
inline Canvas::~Canvas()
|
||||||
{
|
{
|
||||||
// Destroy children explicitly because they signal us when getting destroyed, and that can't happen after our own destruction
|
// Destroy children explicitly because they signal us when getting destroyed, and that can't happen after our own destruction
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
// Copyright (C) 2021 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Widgets module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_WIDGETS_DEFAULTWIDGETTHEME_HPP
|
||||||
|
#define NAZARA_WIDGETS_DEFAULTWIDGETTHEME_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Graphics/SlicedSprite.hpp>
|
||||||
|
#include <Nazara/Graphics/TextSprite.hpp>
|
||||||
|
#include <Nazara/Widgets/WidgetTheme.hpp>
|
||||||
|
#include <entt/entt.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
class DefaultDefaultButtonWidgetStyle;
|
||||||
|
|
||||||
|
class NAZARA_WIDGETS_API DefaultWidgetTheme : public WidgetTheme
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DefaultWidgetTheme();
|
||||||
|
DefaultWidgetTheme(const DefaultWidgetTheme&) = delete;
|
||||||
|
DefaultWidgetTheme(DefaultWidgetTheme&&) = default;
|
||||||
|
~DefaultWidgetTheme() = default;
|
||||||
|
|
||||||
|
std::unique_ptr<ButtonWidgetStyle> CreateStyle(ButtonWidget* buttonWidget) const override;
|
||||||
|
|
||||||
|
DefaultWidgetTheme& operator=(const DefaultWidgetTheme&) = delete;
|
||||||
|
DefaultWidgetTheme& operator=(DefaultWidgetTheme&&) = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<Material> m_buttonMaterial;
|
||||||
|
std::shared_ptr<Material> m_pressedButtonMaterial;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NAZARA_WIDGETS_API DefaultButtonWidgetStyle : public ButtonWidgetStyle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DefaultButtonWidgetStyle(ButtonWidget* buttonWidget, std::shared_ptr<Material> defaultMaterial, std::shared_ptr<Material> pressedMaterial);
|
||||||
|
DefaultButtonWidgetStyle(const DefaultButtonWidgetStyle&) = delete;
|
||||||
|
DefaultButtonWidgetStyle(DefaultButtonWidgetStyle&&) = default;
|
||||||
|
~DefaultButtonWidgetStyle() = default;
|
||||||
|
|
||||||
|
void Layout(const Vector2f& size) override;
|
||||||
|
|
||||||
|
void OnHoverBegin() override;
|
||||||
|
void OnHoverEnd() override;
|
||||||
|
void OnPress() override;
|
||||||
|
void OnRelease() override;
|
||||||
|
|
||||||
|
void UpdateText(const AbstractTextDrawer& drawer) override;
|
||||||
|
|
||||||
|
DefaultButtonWidgetStyle& operator=(const DefaultButtonWidgetStyle&) = delete;
|
||||||
|
DefaultButtonWidgetStyle& operator=(DefaultButtonWidgetStyle&&) = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<Material> m_defaultMaterial;
|
||||||
|
std::shared_ptr<Material> m_pressedMaterial;
|
||||||
|
std::shared_ptr<SlicedSprite> m_sprite;
|
||||||
|
std::shared_ptr<TextSprite> m_textSprite;
|
||||||
|
entt::entity m_textEntity;
|
||||||
|
entt::entity m_gradientEntity;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Widgets/DefaultWidgetTheme.inl>
|
||||||
|
|
||||||
|
#endif // NAZARA_WIDGETS_DEFAULTWIDGETTHEME_HPP
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright (C) 2021 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Widgets module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Widgets/DefaultWidgetTheme.hpp>
|
||||||
|
#include <Nazara/Widgets/WidgetTheme.hpp>
|
||||||
|
#include <Nazara/Widgets/Debug.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Widgets/DebugOff.hpp>
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
// Copyright (C) 2021 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Widgets module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_WIDGETS_WIDGETTHEME_HPP
|
||||||
|
#define NAZARA_WIDGETS_WIDGETTHEME_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Graphics/Sprite.hpp>
|
||||||
|
#include <Nazara/Math/Vector2.hpp>
|
||||||
|
#include <Nazara/Renderer/Texture.hpp>
|
||||||
|
#include <Nazara/Widgets/BaseWidget.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
class AbstractTextDrawer;
|
||||||
|
class ButtonWidget;
|
||||||
|
class ButtonWidgetStyle;
|
||||||
|
|
||||||
|
class NAZARA_WIDGETS_API WidgetTheme
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WidgetTheme() = default;
|
||||||
|
WidgetTheme(const WidgetTheme&) = delete;
|
||||||
|
WidgetTheme(WidgetTheme&&) = default;
|
||||||
|
virtual ~WidgetTheme();
|
||||||
|
|
||||||
|
virtual std::unique_ptr<ButtonWidgetStyle> CreateStyle(ButtonWidget* buttonWidget) const = 0;
|
||||||
|
|
||||||
|
WidgetTheme& operator=(const WidgetTheme&) = delete;
|
||||||
|
WidgetTheme& operator=(WidgetTheme&&) = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
class NAZARA_WIDGETS_API BaseWidgetStyle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline BaseWidgetStyle(BaseWidget* widget);
|
||||||
|
BaseWidgetStyle(const BaseWidgetStyle&) = delete;
|
||||||
|
BaseWidgetStyle(BaseWidgetStyle&&) = default;
|
||||||
|
virtual ~BaseWidgetStyle();
|
||||||
|
|
||||||
|
inline entt::entity CreateEntity();
|
||||||
|
inline void DestroyEntity(entt::entity entity);
|
||||||
|
|
||||||
|
inline entt::registry& GetRegistry();
|
||||||
|
inline const entt::registry& GetRegistry() const;
|
||||||
|
UInt32 GetRenderMask() const;
|
||||||
|
|
||||||
|
BaseWidgetStyle& operator=(const BaseWidgetStyle&) = delete;
|
||||||
|
BaseWidgetStyle& operator=(BaseWidgetStyle&&) = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BaseWidget* m_widgetOwner;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NAZARA_WIDGETS_API ButtonWidgetStyle : public BaseWidgetStyle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using BaseWidgetStyle::BaseWidgetStyle;
|
||||||
|
ButtonWidgetStyle(const ButtonWidgetStyle&) = delete;
|
||||||
|
ButtonWidgetStyle(ButtonWidgetStyle&&) = default;
|
||||||
|
~ButtonWidgetStyle() = default;
|
||||||
|
|
||||||
|
virtual void Layout(const Vector2f& size) = 0;
|
||||||
|
|
||||||
|
virtual void OnHoverBegin();
|
||||||
|
virtual void OnHoverEnd();
|
||||||
|
virtual void OnPress();
|
||||||
|
virtual void OnRelease();
|
||||||
|
|
||||||
|
virtual void UpdateText(const AbstractTextDrawer& drawer) = 0;
|
||||||
|
|
||||||
|
ButtonWidgetStyle& operator=(const ButtonWidgetStyle&) = delete;
|
||||||
|
ButtonWidgetStyle& operator=(ButtonWidgetStyle&&) = default;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Widgets/WidgetTheme.inl>
|
||||||
|
|
||||||
|
#endif // NAZARA_WIDGETS_WIDGETTHEME_HPP
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright (C) 2021 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Widgets module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Widgets/WidgetTheme.hpp>
|
||||||
|
#include <Nazara/Widgets/Debug.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
inline BaseWidgetStyle::BaseWidgetStyle(BaseWidget* widget) :
|
||||||
|
m_widgetOwner(widget)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline entt::entity BaseWidgetStyle::CreateEntity()
|
||||||
|
{
|
||||||
|
return m_widgetOwner->CreateEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void BaseWidgetStyle::DestroyEntity(entt::entity entity)
|
||||||
|
{
|
||||||
|
m_widgetOwner->DestroyEntity(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline entt::registry& BaseWidgetStyle::GetRegistry()
|
||||||
|
{
|
||||||
|
return m_widgetOwner->GetRegistry();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const entt::registry& BaseWidgetStyle::GetRegistry() const
|
||||||
|
{
|
||||||
|
return m_widgetOwner->GetRegistry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Widgets/DebugOff.hpp>
|
||||||
|
|
@ -29,7 +29,7 @@ namespace Nz
|
||||||
* This will also register the widget to the canvas owning the top-most widget.
|
* This will also register the widget to the canvas owning the top-most widget.
|
||||||
*/
|
*/
|
||||||
BaseWidget::BaseWidget(BaseWidget* parent) :
|
BaseWidget::BaseWidget(BaseWidget* parent) :
|
||||||
BaseWidget()
|
BaseWidget(parent->GetTheme())
|
||||||
{
|
{
|
||||||
NazaraAssert(parent, "Invalid parent");
|
NazaraAssert(parent, "Invalid parent");
|
||||||
NazaraAssert(parent->GetCanvas(), "Parent has no canvas");
|
NazaraAssert(parent->GetCanvas(), "Parent has no canvas");
|
||||||
|
|
@ -46,6 +46,15 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
BaseWidget::~BaseWidget()
|
BaseWidget::~BaseWidget()
|
||||||
{
|
{
|
||||||
|
if (m_registry)
|
||||||
|
{
|
||||||
|
for (WidgetEntity& entity : m_entities)
|
||||||
|
{
|
||||||
|
if (m_registry->valid(entity.handle))
|
||||||
|
m_registry->destroy(entity.handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UnregisterFromCanvas();
|
UnregisterFromCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@
|
||||||
#include <Nazara/Graphics/BasicMaterial.hpp>
|
#include <Nazara/Graphics/BasicMaterial.hpp>
|
||||||
#include <Nazara/Graphics/Material.hpp>
|
#include <Nazara/Graphics/Material.hpp>
|
||||||
#include <Nazara/Graphics/MaterialPass.hpp>
|
#include <Nazara/Graphics/MaterialPass.hpp>
|
||||||
|
#include <Nazara/Graphics/SlicedSprite.hpp>
|
||||||
#include <Nazara/Graphics/Components/GraphicsComponent.hpp>
|
#include <Nazara/Graphics/Components/GraphicsComponent.hpp>
|
||||||
|
#include <Nazara/Utility/AbstractTextDrawer.hpp>
|
||||||
#include <Nazara/Utility/Components/NodeComponent.hpp>
|
#include <Nazara/Utility/Components/NodeComponent.hpp>
|
||||||
#include <Nazara/Widgets/Canvas.hpp>
|
#include <Nazara/Widgets/Canvas.hpp>
|
||||||
#include <Nazara/Widgets/Widgets.hpp>
|
#include <Nazara/Widgets/Widgets.hpp>
|
||||||
|
|
@ -15,31 +17,20 @@
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
ButtonWidget::ButtonWidget(BaseWidget* parent) :
|
ButtonWidget::ButtonWidget(BaseWidget* parent) :
|
||||||
BaseWidget(parent),
|
BaseWidget(parent)
|
||||||
m_color { 74, 74, 74 },
|
|
||||||
m_cornerColor { 180, 180, 180 },
|
|
||||||
m_hoverColor { 128, 128, 128 },
|
|
||||||
m_hoverCornerColor { 180, 180, 180 },
|
|
||||||
m_pressColor { 180, 180, 180 },
|
|
||||||
m_pressCornerColor { 74, 74, 74 }
|
|
||||||
{
|
{
|
||||||
entt::registry& registry = GetRegistry();
|
m_style = GetTheme()->CreateStyle(this);
|
||||||
UInt32 renderMask = GetCanvas()->GetRenderMask();
|
|
||||||
|
|
||||||
m_gradientSprite = std::make_shared<Sprite>(Widgets::Instance()->GetOpaqueMaterial());
|
Layout();
|
||||||
m_gradientSprite->SetColor(m_color);
|
}
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::LeftBottom, m_cornerColor);
|
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::RightBottom, m_cornerColor);
|
|
||||||
|
|
||||||
m_gradientEntity = CreateEntity();
|
void ButtonWidget::UpdateText(const AbstractTextDrawer& drawer)
|
||||||
registry.emplace<NodeComponent>(m_gradientEntity).SetParent(this);
|
{
|
||||||
registry.emplace<GraphicsComponent>(m_gradientEntity).AttachRenderable(m_gradientSprite, renderMask);
|
m_style->UpdateText(drawer);
|
||||||
|
|
||||||
m_textSprite = std::make_shared<TextSprite>(Widgets::Instance()->GetTransparentMaterial());
|
Vector2f size(drawer.GetBounds().GetLengths());
|
||||||
|
SetMinimumSize(size);
|
||||||
m_textEntity = CreateEntity();
|
SetPreferredSize(size + Vector2f(20.f, 10.f));
|
||||||
registry.emplace<NodeComponent>(m_textEntity).SetParent(this);
|
|
||||||
registry.emplace<GraphicsComponent>(m_textEntity).AttachRenderable(m_textSprite, renderMask);
|
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
@ -47,49 +38,35 @@ namespace Nz
|
||||||
void ButtonWidget::Layout()
|
void ButtonWidget::Layout()
|
||||||
{
|
{
|
||||||
BaseWidget::Layout();
|
BaseWidget::Layout();
|
||||||
|
m_style->Layout(GetSize());
|
||||||
Vector2f size = GetSize();
|
|
||||||
m_gradientSprite->SetSize(size);
|
|
||||||
|
|
||||||
entt::registry& registry = GetRegistry();
|
|
||||||
|
|
||||||
Boxf textBox = m_textSprite->GetAABB();
|
|
||||||
registry.get<NodeComponent>(m_textEntity).SetPosition(size.x / 2.f - textBox.width / 2.f, size.y / 2.f - textBox.height / 2.f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonWidget::OnMouseButtonPress(int /*x*/, int /*y*/, Mouse::Button button)
|
void ButtonWidget::OnMouseButtonPress(int /*x*/, int /*y*/, Mouse::Button button)
|
||||||
{
|
{
|
||||||
if (button == Mouse::Left)
|
if (button == Mouse::Left)
|
||||||
{
|
m_style->OnPress();
|
||||||
m_gradientSprite->SetColor(m_pressColor);
|
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::LeftBottom, m_pressCornerColor);
|
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::RightBottom, m_pressCornerColor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonWidget::OnMouseButtonRelease(int /*x*/, int /*y*/, Mouse::Button button)
|
void ButtonWidget::OnMouseButtonRelease(int x, int y, Mouse::Button button)
|
||||||
{
|
{
|
||||||
if (button == Mouse::Left)
|
if (button == Mouse::Left)
|
||||||
{
|
{
|
||||||
m_gradientSprite->SetColor(m_hoverColor);
|
m_style->OnRelease();
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::LeftBottom, m_hoverCornerColor);
|
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::RightBottom, m_hoverCornerColor);
|
|
||||||
|
|
||||||
OnButtonTrigger(this);
|
// If user clicks inside button and holds it outside, a release mouse button event will be triggered outside of the widget
|
||||||
|
// we don't want this to trigger the button, so double-check
|
||||||
|
if (IsInside(x, y))
|
||||||
|
OnButtonTrigger(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonWidget::OnMouseEnter()
|
void ButtonWidget::OnMouseEnter()
|
||||||
{
|
{
|
||||||
m_gradientSprite->SetColor(m_hoverColor);
|
m_style->OnHoverBegin();
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::LeftBottom, m_hoverCornerColor);
|
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::RightBottom, m_hoverCornerColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonWidget::OnMouseExit()
|
void ButtonWidget::OnMouseExit()
|
||||||
{
|
{
|
||||||
m_gradientSprite->SetColor(m_color);
|
m_style->OnHoverEnd();
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::LeftBottom, m_cornerColor);
|
|
||||||
m_gradientSprite->SetCornerColor(RectCorner::RightBottom, m_cornerColor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,40 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Widgets/Canvas.hpp>
|
#include <Nazara/Widgets/Canvas.hpp>
|
||||||
|
#include <Nazara/Widgets/DefaultWidgetTheme.hpp>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <Nazara/Widgets/Debug.hpp>
|
#include <Nazara/Widgets/Debug.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
Canvas::Canvas(entt::registry& registry, Nz::EventHandler& eventHandler, Nz::CursorControllerHandle cursorController, UInt32 renderMask) :
|
||||||
|
BaseWidget(std::make_shared<DefaultWidgetTheme>()),
|
||||||
|
m_renderMask(renderMask),
|
||||||
|
m_keyboardOwner(InvalidCanvasIndex),
|
||||||
|
m_hoveredWidget(InvalidCanvasIndex),
|
||||||
|
m_mouseOwner(InvalidCanvasIndex),
|
||||||
|
m_registry(registry),
|
||||||
|
m_cursorController(cursorController)
|
||||||
|
{
|
||||||
|
m_canvas = this;
|
||||||
|
m_widgetParent = nullptr;
|
||||||
|
|
||||||
|
// Register ourselves as a widget to handle cursor change
|
||||||
|
RegisterToCanvas();
|
||||||
|
|
||||||
|
// Connect to every meaningful event
|
||||||
|
m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, this, &Canvas::OnEventKeyPressed);
|
||||||
|
m_keyReleasedSlot.Connect(eventHandler.OnKeyReleased, this, &Canvas::OnEventKeyReleased);
|
||||||
|
m_mouseButtonPressedSlot.Connect(eventHandler.OnMouseButtonPressed, this, &Canvas::OnEventMouseButtonPressed);
|
||||||
|
m_mouseButtonReleasedSlot.Connect(eventHandler.OnMouseButtonReleased, this, &Canvas::OnEventMouseButtonRelease);
|
||||||
|
m_mouseEnteredSlot.Connect(eventHandler.OnMouseEntered, this, &Canvas::OnEventMouseEntered);
|
||||||
|
m_mouseLeftSlot.Connect(eventHandler.OnMouseLeft, this, &Canvas::OnEventMouseLeft);
|
||||||
|
m_mouseMovedSlot.Connect(eventHandler.OnMouseMoved, this, &Canvas::OnEventMouseMoved);
|
||||||
|
m_mouseWheelMovedSlot.Connect(eventHandler.OnMouseWheelMoved, this, &Canvas::OnEventMouseWheelMoved);
|
||||||
|
m_textEnteredSlot.Connect(eventHandler.OnTextEntered, this, &Canvas::OnEventTextEntered);
|
||||||
|
m_textEditedSlot.Connect(eventHandler.OnTextEdited, this, &Canvas::OnEventTextEdited);
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t Canvas::RegisterWidget(BaseWidget* widget)
|
std::size_t Canvas::RegisterWidget(BaseWidget* widget)
|
||||||
{
|
{
|
||||||
WidgetEntry box;
|
WidgetEntry box;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
// Copyright (C) 2021 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Widgets module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Widgets/DefaultWidgetTheme.hpp>
|
||||||
|
#include <Nazara/Graphics/BasicMaterial.hpp>
|
||||||
|
#include <Nazara/Graphics/Material.hpp>
|
||||||
|
#include <Nazara/Graphics/MaterialPass.hpp>
|
||||||
|
#include <Nazara/Graphics/Components/GraphicsComponent.hpp>
|
||||||
|
#include <Nazara/Utility/Components/NodeComponent.hpp>
|
||||||
|
#include <Nazara/Widgets/ButtonWidget.hpp>
|
||||||
|
#include <Nazara/Widgets/Canvas.hpp>
|
||||||
|
#include <Nazara/Widgets/Widgets.hpp>
|
||||||
|
#include <Nazara/Widgets/Debug.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const UInt8 ButtonImage[] = {
|
||||||
|
#include <Nazara/Widgets/Resources/DefaultStyle/Button.png.h>
|
||||||
|
};
|
||||||
|
|
||||||
|
const UInt8 ButtonPressedImage[] = {
|
||||||
|
#include <Nazara/Widgets/Resources/DefaultStyle/ButtonPressed.png.h>
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultWidgetTheme::DefaultWidgetTheme()
|
||||||
|
{
|
||||||
|
TextureParams texParams;
|
||||||
|
texParams.renderDevice = Graphics::Instance()->GetRenderDevice();
|
||||||
|
texParams.loadFormat = PixelFormat::RGBA8_SRGB;
|
||||||
|
|
||||||
|
// Button material
|
||||||
|
{
|
||||||
|
std::shared_ptr<MaterialPass> buttonMaterialPass = std::make_shared<MaterialPass>(BasicMaterial::GetSettings());
|
||||||
|
buttonMaterialPass->EnableDepthBuffer(true);
|
||||||
|
buttonMaterialPass->EnableDepthWrite(false);
|
||||||
|
|
||||||
|
m_buttonMaterial = std::make_shared<Material>();
|
||||||
|
m_buttonMaterial->AddPass("ForwardPass", buttonMaterialPass);
|
||||||
|
|
||||||
|
BasicMaterial buttonBasicMat(*buttonMaterialPass);
|
||||||
|
buttonBasicMat.SetDiffuseMap(Texture::LoadFromMemory(ButtonImage, sizeof(ButtonImage), texParams));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Button (pressed) material
|
||||||
|
{
|
||||||
|
std::shared_ptr<MaterialPass> buttonMaterialPass = std::make_shared<MaterialPass>(BasicMaterial::GetSettings());
|
||||||
|
buttonMaterialPass->EnableDepthBuffer(true);
|
||||||
|
buttonMaterialPass->EnableDepthWrite(false);
|
||||||
|
|
||||||
|
m_pressedButtonMaterial = std::make_shared<Material>();
|
||||||
|
m_pressedButtonMaterial->AddPass("ForwardPass", buttonMaterialPass);
|
||||||
|
|
||||||
|
BasicMaterial buttonBasicMat(*buttonMaterialPass);
|
||||||
|
buttonBasicMat.SetDiffuseMap(Texture::LoadFromMemory(ButtonPressedImage, sizeof(ButtonPressedImage), texParams));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ButtonWidgetStyle> DefaultWidgetTheme::CreateStyle(ButtonWidget* buttonWidget) const
|
||||||
|
{
|
||||||
|
return std::make_unique<DefaultButtonWidgetStyle>(buttonWidget, m_buttonMaterial, m_pressedButtonMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultButtonWidgetStyle::DefaultButtonWidgetStyle(ButtonWidget* buttonWidget, std::shared_ptr<Material> defaultMaterial, std::shared_ptr<Material> pressedMaterial) :
|
||||||
|
ButtonWidgetStyle(buttonWidget),
|
||||||
|
m_defaultMaterial(std::move(defaultMaterial)),
|
||||||
|
m_pressedMaterial(std::move(pressedMaterial))
|
||||||
|
{
|
||||||
|
auto& registry = GetRegistry();
|
||||||
|
UInt32 renderMask = GetRenderMask();
|
||||||
|
|
||||||
|
m_sprite = std::make_shared<SlicedSprite>(m_defaultMaterial);
|
||||||
|
|
||||||
|
m_gradientEntity = CreateEntity();
|
||||||
|
registry.emplace<NodeComponent>(m_gradientEntity).SetParent(buttonWidget);
|
||||||
|
registry.emplace<GraphicsComponent>(m_gradientEntity).AttachRenderable(m_sprite, renderMask);
|
||||||
|
|
||||||
|
m_textSprite = std::make_shared<TextSprite>(Widgets::Instance()->GetTransparentMaterial());
|
||||||
|
|
||||||
|
m_textEntity = CreateEntity();
|
||||||
|
registry.emplace<NodeComponent>(m_textEntity).SetParent(buttonWidget);
|
||||||
|
registry.emplace<GraphicsComponent>(m_textEntity).AttachRenderable(m_textSprite, renderMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultButtonWidgetStyle::Layout(const Vector2f& size)
|
||||||
|
{
|
||||||
|
m_sprite->SetSize(size);
|
||||||
|
|
||||||
|
entt::registry& registry = GetRegistry();
|
||||||
|
|
||||||
|
Boxf textBox = m_textSprite->GetAABB();
|
||||||
|
registry.get<NodeComponent>(m_textEntity).SetPosition(size.x / 2.f - textBox.width / 2.f, size.y / 2.f - textBox.height / 2.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultButtonWidgetStyle::OnHoverBegin()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultButtonWidgetStyle::OnHoverEnd()
|
||||||
|
{
|
||||||
|
m_sprite->SetMaterial(m_defaultMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultButtonWidgetStyle::OnPress()
|
||||||
|
{
|
||||||
|
m_sprite->SetMaterial(m_pressedMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultButtonWidgetStyle::OnRelease()
|
||||||
|
{
|
||||||
|
m_sprite->SetMaterial(m_defaultMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultButtonWidgetStyle::UpdateText(const AbstractTextDrawer& drawer)
|
||||||
|
{
|
||||||
|
m_textSprite->Update(drawer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
// Copyright (C) 2021 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Widgets module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Widgets/WidgetTheme.hpp>
|
||||||
|
#include <Nazara/Widgets/Canvas.hpp>
|
||||||
|
#include <Nazara/Widgets/Debug.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
WidgetTheme::~WidgetTheme() = default;
|
||||||
|
|
||||||
|
BaseWidgetStyle::~BaseWidgetStyle() = default;
|
||||||
|
|
||||||
|
UInt32 BaseWidgetStyle::GetRenderMask() const
|
||||||
|
{
|
||||||
|
return m_widgetOwner->GetCanvas()->GetRenderMask();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ButtonWidgetStyle::OnHoverBegin()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ButtonWidgetStyle::OnHoverEnd()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ButtonWidgetStyle::OnPress()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ButtonWidgetStyle::OnRelease()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue