SDK: Add RichTextAreaWidget (WIP)

This commit is contained in:
Lynix
2019-09-22 12:56:07 +02:00
committed by Jérôme Leclercq
parent 451b3de69c
commit 8e4df4cadc
19 changed files with 1346 additions and 859 deletions

View File

@@ -0,0 +1,58 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once
#ifndef NDK_WIDGETS_RICHTEXTAREAWIDGET_HPP
#define NDK_WIDGETS_RICHTEXTAREAWIDGET_HPP
#include <Nazara/Utility/RichTextDrawer.hpp>
#include <NDK/Widgets/AbstractTextAreaWidget.hpp>
namespace Ndk
{
class NDK_API RichTextAreaWidget : public AbstractTextAreaWidget
{
public:
RichTextAreaWidget(BaseWidget* parent);
RichTextAreaWidget(const RichTextAreaWidget&) = delete;
RichTextAreaWidget(RichTextAreaWidget&&) = default;
~RichTextAreaWidget() = default;
void AppendText(const Nz::String& text);
void Clear() override;
void Erase(std::size_t firstGlyph, std::size_t lastGlyph) override;
inline unsigned int GetCharacterSize() const;
inline const Nz::Color& GetTextColor() const;
inline Nz::Font* GetTextFont() const;
inline void SetCharacterSize(unsigned int characterSize);
inline void SetTextColor(const Nz::Color& color);
inline void SetTextFont(Nz::FontRef font);
void Write(const Nz::String& text, std::size_t glyphPosition) override;
RichTextAreaWidget& operator=(const RichTextAreaWidget&) = delete;
RichTextAreaWidget& operator=(RichTextAreaWidget&&) = default;
private:
Nz::AbstractTextDrawer& GetTextDrawer() override;
const Nz::AbstractTextDrawer& GetTextDrawer() const override;
void HandleIndentation(bool add) override;
void HandleSelectionIndentation(bool add) override;
void HandleWordCursorMove(bool left) override;
void UpdateDisplayText();
Nz::RichTextDrawer m_drawer;
};
}
#include <NDK/Widgets/RichTextAreaWidget.inl>
#endif // NDK_WIDGETS_TEXTAREAWIDGET_HPP