17 static constexpr auto textProperties = [] {
18 using namespace std::literals;
22 "-text"sv,
"-font"sv,
"-size"sv,
23 "-wrap"sv,
"-wrapw"sv,
"-wraprelw"sv,
30 [[nodiscard]] std::span<const std::string_view>
getProperties()
const override {
31 return textProperties;
34 std::string_view name,
const TclObject& value)
override;
36 [[nodiscard]] std::string_view
getType()
const override;
39 void invalidateLocal()
override;
41 [[nodiscard]] uint8_t getFadedAlpha()
const override;
42 [[nodiscard]] std::unique_ptr<GLImage> create(
OutputSurface& output)
override;
44 template<
typename FindSplitPo
intFunc,
typename CantSplitFunc>
45 [[nodiscard]]
size_t split(
const std::string& line,
unsigned maxWidth,
46 FindSplitPointFunc findSplitPoint, CantSplitFunc cantSplit,
47 bool removeTrailingSpaces)
const;
48 [[nodiscard]]
size_t splitAtChar(
const std::string& line,
unsigned maxWidth)
const;
49 [[nodiscard]]
size_t splitAtWord(
const std::string& line,
unsigned maxWidth)
const;
50 [[nodiscard]] std::string getCharWrappedText(
const std::string& txt,
unsigned maxWidth)
const;
51 [[nodiscard]] std::string getWordWrappedText(
const std::string& txt,
unsigned maxWidth)
const;
54 enum WrapMode { NONE, WORD, CHAR };
60 WrapMode wrapMode = NONE;
61 float wrapw = 0.0f, wraprelw = 1.0f;
std::span< const std::string_view > getProperties() const override
void getProperty(std::string_view name, TclObject &result) const override
void setProperty(Interpreter &interp, std::string_view name, const TclObject &value) override
std::string_view getType() const override