29 #include YFM_YSLib_UI_Label
30 #include YFM_YSLib_Service_TextLayout
31 #include YFM_YSLib_UI_YWidgetEvent
42 AutoWrapLine(false), Text()
65 if(horizontal_offset > 0)
68 horizontal_offset /= 2;
69 ts.
Pen.
X += horizontal_offset;
82 - GetTextLineHeightOf(ts));
84 if(vertical_offset > 0)
88 ts.
Pen.
Y += vertical_offset;
116 hList(h), tsList(
Font)
119 hList = make_shared<ListType>();
125 auto& lst(GetListRef());
127 return IsInInterval<IndexType>(idx, lst.size()) ? &lst[idx] :
nullptr;
132 const auto& lst(GetList());
134 return IsInInterval<IndexType>(idx, lst.size()) ? &lst[idx] :
nullptr;
138 MTextList::GetMaxTextWidth()
const
146 const auto& lst(GetList());
147 const auto i(std::find(lst.begin(), lst.end(), text));
149 return i != lst.end() ? i - lst.begin() :
IndexType(-1);
typename ListType::size_type IndexType
索引类型。
yconstexpr Padding DefaultMargin(2, 2, 2, 2)
默认边距。
pt pt Y const IWidget &wgt const IWidget &wgt GetSizeOf
无效化:使相对于部件的子部件的指定区域在直接和间接的窗口缓冲区中无效。
SDst FetchStringWidth(const Font &fnt, _tIter s)
取迭代器指定的单行字符串在字体指定、无边界限制时的显示宽度。
YF_API Padding FetchMargin(const Rect &, const Size &)
取内边界相对于外边界的边距。
SDst GetVerticalOf(const Padding &m)
取竖直边距和。
SDst FetchMaxTextWidth(const Font &font, _tIter first, _tIter last)
取指定字体显示的迭代器范围中的文本的最大宽度。
IndexType Find(const ItemType &) const
查找项。
YF_API void DrawClippedText(const Graphics &g, const Rect &mask, TextState &ts, const String &str, bool line_wrap)
绘制剪切区域的文本。
DefDeMoveCtor(MTextList) public const ItemType * GetItemPtr(const IndexType &) const
取文本列表。
std::uint16_t SDst
屏幕坐标距离。
Padding Margin
边距:文本区域到显示区域的距离。
const PaintContext &virtual void DrawClippedText(const Graphics &, const Rect &, Drawing::TextState &)
绘制剪切文本:使用指定的图形接口上下文、相对于部件的边界和文本状态。
YSLib 标准字符串(使用 UCS-2 作为内部编码)。
#define yunseq
无序列依赖表达式组求值。
YF_API void DrawText(const Graphics &g, TextState &ts, const String &str, bool line_wrap)
绘制文本。
MTextList(const shared_ptr< ListType > &={}, const Drawing::Font &={})
构造:使用文本列表句柄和字体指针。
TextAlignment HorizontalAlignment
文本水平和竖直对齐属性。
shared_ptr< ListType > hList
文本列表句柄。
Drawing::TextState tsList
列表文本状态。
Drawing::Padding Margin
文本和容器的间距。
virtual void Refresh(PaintEventArgs &&)
刷新:按指定参数绘制界面并更新状态。
MLabel(const Drawing::Font &={}, TextAlignment=TextAlignment::Left)
构造:使用指定字体。
void RefreshTextState()
刷新文本状态。
TextAlignment VerticalAlignment
PDefHOp(TextState &,=, const PenStyle &ps) ImplRet(PenStyle void ResetPen()
赋值:笔样式。