Add a new Choice subclass which lets the UI display a value in addition to the title, similar to other controls.

This commit is contained in:
The Dax committed 2014-07-18 18:45:26 -04:00
1 parent ceb5a94c4a
commit 085faa87cc
2 files changed
+30

No files matched your search

+15
View File
@@ -450,4 +450,19 @@ void TextEditPopupScreen::OnCompleted(DialogResult result) {
}
}
void ChoiceWithValueDisplay::Draw(UIContext &dc) {
Style style = dc.theme->itemStyle;
std::ostringstream valueText;
Choice::Draw(dc);
dc.SetFontStyle(dc.theme->uiFont);
if (sValue_ != nullptr) {
valueText << *sValue_;
} else if (iValue_ != nullptr) {
valueText << *iValue_;
}
dc.DrawText(valueText.str().c_str(), bounds_.x2() - 12, bounds_.centerY(), style.fgColor, ALIGN_RIGHT | ALIGN_VCENTER);
}
} // namespace UI