2019-08-15 11:22:51 +08:00
|
|
|
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
2020-01-21 10:09:55 +08:00
|
|
|
|
//
|
2019-08-15 11:22:51 +08:00
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
|
// furnished to do so, subject to the following conditions:
|
2020-01-21 10:09:55 +08:00
|
|
|
|
//
|
2019-08-15 11:22:51 +08:00
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
|
|
// all copies or substantial portions of the Software.
|
2020-01-21 10:09:55 +08:00
|
|
|
|
//
|
2019-08-15 11:22:51 +08:00
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
|
// THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-06 16:54:47 +08:00
|
|
|
|
#include <kiwano/math/Math.h>
|
2020-02-16 20:14:01 +08:00
|
|
|
|
#include <kiwano/render/NativeObject.h>
|
2020-01-17 16:55:47 +08:00
|
|
|
|
#include <kiwano/render/TextStyle.hpp>
|
2019-08-15 11:22:51 +08:00
|
|
|
|
|
|
|
|
|
|
namespace kiwano
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
KGE_DECLARE_SMART_PTR(TextLayout);
|
|
|
|
|
|
|
2020-01-21 10:09:55 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* \addtogroup Render
|
|
|
|
|
|
* @{
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-16 20:14:01 +08:00
|
|
|
|
class KGE_API TextLayout : public NativeObject
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
2020-02-16 12:53:18 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-16 12:53:18 +08:00
|
|
|
|
static TextLayoutPtr Create();
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param content <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param style <20>ı<EFBFBD><C4B1><EFBFBD>ʽ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
static TextLayoutPtr Create(const String& content, const TextStyle& style);
|
|
|
|
|
|
|
2020-01-21 10:09:55 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
TextLayout();
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>¾<EFBFBD>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
bool IsDirty() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void Clear();
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
2020-02-17 17:01:12 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param style <20>ı<EFBFBD><C4B1><EFBFBD>ʽ
|
2020-02-17 17:01:12 +08:00
|
|
|
|
void Reset(const TextStyle& style);
|
|
|
|
|
|
|
2020-01-21 10:09:55 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param content <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param style <20>ı<EFBFBD><C4B1><EFBFBD>ʽ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void Reset(const String& content, const TextStyle& style);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
2020-02-17 17:01:12 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-17 17:01:12 +08:00
|
|
|
|
String GetContent() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵij<DDB5><C4B3><EFBFBD>
|
2020-02-17 17:01:12 +08:00
|
|
|
|
uint32_t GetContentLength() const;
|
|
|
|
|
|
|
2020-01-21 10:09:55 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>ִ<EFBFBD>С
|
2020-02-17 12:06:29 +08:00
|
|
|
|
Size GetSize() const;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-17 12:06:29 +08:00
|
|
|
|
uint32_t GetLineCount() const;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡĬ<C8A1><C4AC><EFBFBD><EFBFBD><EFBFBD>仭ˢ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
BrushPtr GetDefaultFillBrush() const;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡĬ<C8A1><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
BrushPtr GetDefaultOutlineBrush() const;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡĬ<C8A1><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
StrokeStylePtr GetDefaultOutlineStrokeStyle() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
struct TextRange
|
|
|
|
|
|
{
|
2020-03-19 14:28:50 +08:00
|
|
|
|
uint32_t start; ///< <20><>ʼλ<CABC><CEBB>
|
|
|
|
|
|
uint32_t length; ///< <20><><EFBFBD><EFBFBD>
|
2020-02-16 12:53:18 +08:00
|
|
|
|
};
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param font <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetFont(FontPtr font, TextRange range);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param family <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-19 12:09:50 +08:00
|
|
|
|
void SetFontFamily(const String& family, TextRange range);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ֺţ<D6BA>Ĭ<EFBFBD><C4AC>ֵΪ 18<31><38>
|
|
|
|
|
|
/// @param size <20>ֺ<EFBFBD>
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetFontSize(float size, TextRange range);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸֵ<CFB8><D6B5>Ĭ<EFBFBD><C4AC>ֵΪ FontWeight::Normal<61><6C>
|
|
|
|
|
|
/// @param weight <20><>ϸֵ
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetFontWeight(uint32_t weight, TextRange range);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>壨Ĭ<E5A3A8><C4AC>ֵΪ false<73><65>
|
|
|
|
|
|
/// @param italic <20>Ƿ<EFBFBD><C7B7><EFBFBD>б<EFBFBD><D0B1>
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetItalic(bool italic, TextRange range);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD><C2BB><EFBFBD>
|
|
|
|
|
|
/// @param enable <20>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD>»<EFBFBD><C2BB><EFBFBD>
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetUnderline(bool enable, TextRange range);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param enable <20>Ƿ<EFBFBD><C7B7><EFBFBD>ʾɾ<CABE><C9BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetStrikethrough(bool enable, TextRange range);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仭ˢ<E4BBAD><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD>
|
|
|
|
|
|
/// @param brush <20><>ˢ
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetFillBrush(BrushPtr brush, TextRange range);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ
|
|
|
|
|
|
/// @param brush <20><>ˢ
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetOutlineBrush(BrushPtr brush, TextRange range);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
|
/// @param stroke <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
|
/// @param range <20><><EFBFBD>ַ<EFBFBD>Χ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetOutlineStrokeStyle(StrokeStylePtr stroke, TextRange range);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD>ö<EFBFBD><C3B6>뷽ʽ
|
|
|
|
|
|
/// @param align <20><><EFBFBD>뷽ʽ
|
2020-01-21 10:09:55 +08:00
|
|
|
|
void SetAlignment(TextAlign align);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>еĿ<D0B5><C4BF><EFBFBD>
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetWrapWidth(float wrap_width);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>ࣨĬ<E0A3A8><C4AC>Ϊ 0<><30>
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetLineSpacing(float line_spacing);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仭ˢ
|
|
|
|
|
|
/// @param brush <20><>ˢ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetDefaultFillBrush(BrushPtr brush);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ
|
|
|
|
|
|
/// @param brush <20><>ˢ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetDefaultOutlineBrush(BrushPtr brush);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
|
/// @param stroke <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetDefaultOutlineStrokeStyle(StrokeStylePtr stroke);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20>಼<EFBFBD>ֱ<EFBFBD>־
|
2020-02-16 12:53:18 +08:00
|
|
|
|
enum class DirtyFlag : uint8_t
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-03-19 14:28:50 +08:00
|
|
|
|
Clean = 0, ///< <20>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
Dirty = 1 << 0 ///< <20>಼<EFBFBD><E0B2BC>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2020-02-17 12:06:29 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>಼<EFBFBD>ֱ<EFBFBD>־
|
2020-02-16 12:53:18 +08:00
|
|
|
|
DirtyFlag GetDirtyFlag() const;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
2020-02-17 12:06:29 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>಼<EFBFBD>ֱ<EFBFBD>־
|
2020-02-16 12:53:18 +08:00
|
|
|
|
void SetDirtyFlag(DirtyFlag flag);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
2020-02-17 12:06:29 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>಼<EFBFBD><E0B2BC>
|
|
|
|
|
|
/// @return <20>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
|
2020-02-17 12:06:29 +08:00
|
|
|
|
bool UpdateWhenDirty();
|
|
|
|
|
|
|
2020-01-21 10:09:55 +08:00
|
|
|
|
private:
|
2020-02-16 12:53:18 +08:00
|
|
|
|
DirtyFlag dirty_flag_;
|
2020-02-17 12:06:29 +08:00
|
|
|
|
uint32_t line_count_;
|
|
|
|
|
|
Size size_;
|
2020-02-16 12:53:18 +08:00
|
|
|
|
BrushPtr default_fill_brush_;
|
|
|
|
|
|
BrushPtr default_outline_brush_;
|
|
|
|
|
|
StrokeStylePtr default_outline_stroke_;
|
2020-02-17 12:06:29 +08:00
|
|
|
|
String content_;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
|
|
inline bool TextLayout::IsDirty() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return dirty_flag_ != DirtyFlag::Clean;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
inline void TextLayout::Clear()
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-02-16 20:14:01 +08:00
|
|
|
|
ResetNativePointer();
|
2020-01-21 10:09:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-17 17:01:12 +08:00
|
|
|
|
inline void TextLayout::Reset(const TextStyle& style)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->Reset(content_, style);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline String TextLayout::GetContent() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return content_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline uint32_t TextLayout::GetContentLength() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return uint32_t(content_.size());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
inline TextLayout::DirtyFlag TextLayout::GetDirtyFlag() const
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
return dirty_flag_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
inline void TextLayout::SetDirtyFlag(TextLayout::DirtyFlag flag)
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
dirty_flag_ = flag;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
inline BrushPtr TextLayout::GetDefaultFillBrush() const
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-02-16 12:53:18 +08:00
|
|
|
|
return default_fill_brush_;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
inline BrushPtr TextLayout::GetDefaultOutlineBrush() const
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-02-16 12:53:18 +08:00
|
|
|
|
return default_outline_brush_;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
inline StrokeStylePtr TextLayout::GetDefaultOutlineStrokeStyle() const
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-02-16 12:53:18 +08:00
|
|
|
|
return default_outline_stroke_;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
inline void TextLayout::SetDefaultFillBrush(BrushPtr brush)
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-02-16 12:53:18 +08:00
|
|
|
|
default_fill_brush_ = brush;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
inline void TextLayout::SetDefaultOutlineBrush(BrushPtr brush)
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-02-16 12:53:18 +08:00
|
|
|
|
default_outline_brush_ = brush;
|
2019-08-15 11:22:51 +08:00
|
|
|
|
}
|
2020-02-07 20:50:27 +08:00
|
|
|
|
|
2020-02-16 12:53:18 +08:00
|
|
|
|
inline void TextLayout::SetDefaultOutlineStrokeStyle(StrokeStylePtr stroke)
|
2020-02-07 20:50:27 +08:00
|
|
|
|
{
|
2020-02-16 12:53:18 +08:00
|
|
|
|
default_outline_stroke_ = stroke;
|
2020-02-07 20:50:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-01-21 10:09:55 +08:00
|
|
|
|
} // namespace kiwano
|