Add an "info textview" with a border.

This commit is contained in:
Henrik Rydgård committed 2026-10-31 00:27:10 +01:00
1 parent 3ddea502dc
commit 67763e48a1
3 files changed
+13 -1

No files matched your search

+3
View File
@@ -1163,6 +1163,9 @@ void TextView::Draw(UIContext &dc) {
style.background.color &= 0x7fffffff;
dc.FillRect(style.background, bounds_);
}
if (frame_) {
dc.Draw()->DrawRoundRect(bounds_, dc.GetTheme().choiceRoundRadius, textColor, RoundRectStyle::OutlineThin);
}
const FontStyle *style = GetTextStyle(dc, textSize_);
dc.SetFontStyle(*style);
+3
View File
@@ -1113,6 +1113,8 @@ public:
void SetBullet(bool bullet) { bullet_ = bullet; }
void SetPadding(Margins padding) { pad_ = padding; }
void SetAlign(int align) { textAlign_ = align; }
// Draws a thin rounded outline around the view. Use padding to keep the text off it.
TextView *SetFrame(bool frame) { frame_ = frame; return this; }
TextView *SetWordWrap();
bool CanBeFocused() const override { return focusable_; }
@@ -1127,6 +1129,7 @@ private:
bool focusable_ = false;
bool clip_ = true;
bool bullet_ = false;
bool frame_ = false;
Margins pad_{};
};
+7 -1
View File
@@ -366,7 +366,13 @@ static UI::View *CreateSettingViewInner(const SettingItem &item, I18NCat pageCat
case SettingType::Hint:
return parent->Add(new SettingHint(text, prevView));
case SettingType::Description:
return parent->Add(new SettingHint(text, nullptr));
{
TextView *description = parent->Add(new TextView(text, FLAG_WRAP_TEXT, false, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, Margins(0, 4))));
description->SetTextSize(TextSize::Small);
description->SetPadding(Margins(12));
description->SetFrame(true);
return description;
}
case SettingType::Custom:
return item.createCustom(parent);
case SettingType::Link: