Widgets: Add [Rich]TextAreaWidget
This commit is contained in:
68
include/Nazara/Widgets/RichTextAreaWidget.hpp
Normal file
68
include/Nazara/Widgets/RichTextAreaWidget.hpp
Normal file
@@ -0,0 +1,68 @@
|
||||
// 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_RICHTEXTAREAWIDGET_HPP
|
||||
#define NAZARA_WIDGETS_RICHTEXTAREAWIDGET_HPP
|
||||
|
||||
#include <Nazara/Utility/RichTextDrawer.hpp>
|
||||
#include <Nazara/Widgets/AbstractTextAreaWidget.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_WIDGETS_API RichTextAreaWidget : public AbstractTextAreaWidget
|
||||
{
|
||||
public:
|
||||
RichTextAreaWidget(BaseWidget* parent);
|
||||
RichTextAreaWidget(const RichTextAreaWidget&) = delete;
|
||||
RichTextAreaWidget(RichTextAreaWidget&&) = default;
|
||||
~RichTextAreaWidget() = default;
|
||||
|
||||
void AppendText(const std::string& text);
|
||||
|
||||
void Clear() override;
|
||||
|
||||
void Erase(std::size_t firstGlyph, std::size_t lastGlyph) override;
|
||||
|
||||
inline unsigned int GetCharacterSize() const;
|
||||
inline float GetCharacterSpacingOffset() const;
|
||||
inline float GetLineSpacingOffset() const;
|
||||
inline const Color& GetTextColor() const;
|
||||
inline const std::shared_ptr<Font>& GetTextFont() const;
|
||||
inline const Color& GetTextOutlineColor() const;
|
||||
inline float GetTextOutlineThickness() const;
|
||||
inline TextStyleFlags GetTextStyle() const;
|
||||
|
||||
inline void SetCharacterSize(unsigned int characterSize);
|
||||
inline void SetCharacterSpacingOffset(float offset);
|
||||
inline void SetLineSpacingOffset(float offset);
|
||||
inline void SetTextColor(const Color& color);
|
||||
inline void SetTextFont(std::shared_ptr<Font> font);
|
||||
inline void SetTextOutlineColor(const Color& color);
|
||||
inline void SetTextOutlineThickness(float thickness);
|
||||
inline void SetTextStyle(TextStyleFlags style);
|
||||
|
||||
void Write(const std::string& text, std::size_t glyphPosition) override;
|
||||
|
||||
RichTextAreaWidget& operator=(const RichTextAreaWidget&) = delete;
|
||||
RichTextAreaWidget& operator=(RichTextAreaWidget&&) = default;
|
||||
|
||||
private:
|
||||
AbstractTextDrawer& GetTextDrawer() override;
|
||||
const AbstractTextDrawer& GetTextDrawer() const override;
|
||||
|
||||
void HandleIndentation(bool add) override;
|
||||
void HandleSelectionIndentation(bool add) override;
|
||||
void HandleWordCursorMove(bool left) override;
|
||||
|
||||
void UpdateDisplayText() override;
|
||||
|
||||
RichTextDrawer m_drawer;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Widgets/RichTextAreaWidget.inl>
|
||||
|
||||
#endif // NAZARA_WIDGETS_RICHTEXTAREAWIDGET_HPP
|
||||
Reference in New Issue
Block a user