Widgets: Add SimpleLabelWidget
A simpler alternative to LabelWidget
This commit is contained in:
50
include/Nazara/Widgets/SimpleLabelWidget.hpp
Normal file
50
include/Nazara/Widgets/SimpleLabelWidget.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" 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_SIMPLELABELWIDGET_HPP
|
||||
#define NAZARA_WIDGETS_SIMPLELABELWIDGET_HPP
|
||||
|
||||
#include <Nazara/Utility/SimpleTextDrawer.hpp>
|
||||
#include <Nazara/Widgets/AbstractLabelWidget.hpp>
|
||||
#include <NazaraUtils/FunctionRef.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_WIDGETS_API SimpleLabelWidget final : public AbstractLabelWidget
|
||||
{
|
||||
public:
|
||||
using AbstractLabelWidget::AbstractLabelWidget;
|
||||
SimpleLabelWidget(const SimpleLabelWidget&) = delete;
|
||||
SimpleLabelWidget(SimpleLabelWidget&&) = delete;
|
||||
~SimpleLabelWidget() = default;
|
||||
|
||||
inline void AppendText(std::string_view str);
|
||||
|
||||
inline unsigned int GetCharacterSize() const;
|
||||
inline const SimpleTextDrawer& GetDrawer() const;
|
||||
inline const std::string& GetText() const;
|
||||
inline const Color& GetTextColor() const;
|
||||
|
||||
inline void SetCharacterSize(unsigned int characterSize);
|
||||
inline void SetText(std::string text);
|
||||
inline void SetTextColor(const Color& color);
|
||||
|
||||
template<typename F> void UpdateDrawer(F&& callback);
|
||||
|
||||
SimpleLabelWidget& operator=(const SimpleLabelWidget&) = delete;
|
||||
SimpleLabelWidget& operator=(SimpleLabelWidget&&) = delete;
|
||||
|
||||
private:
|
||||
void UpdateText();
|
||||
void UpdateTextAndSize();
|
||||
|
||||
SimpleTextDrawer m_drawer;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Widgets/SimpleLabelWidget.inl>
|
||||
|
||||
#endif // NAZARA_WIDGETS_SIMPLELABELWIDGET_HPP
|
||||
Reference in New Issue
Block a user