diff --git a/Source/UI/Lists/UIComboBoxEx.cpp b/Source/UI/Lists/UIComboBoxEx.cpp index e552a68fe..885ccb14e 100644 --- a/Source/UI/Lists/UIComboBoxEx.cpp +++ b/Source/UI/Lists/UIComboBoxEx.cpp @@ -331,16 +331,28 @@ void UIComboBoxEx2::Resize(int width, int height) { void UIComboBoxEx2::Paint() { this->ClearSurface(0xC59582u); this->FillRegion(1, 1, (this->geometry.width - 2), (this->geometry.height - 2), 0xFCF4F0u); - const unsigned end = std::min( - static_cast(this->lines.size()), static_cast((this->topLine + (this->geometry.height / this->lineHeight - this->bottomMargin))) - ); - if (this->selected >= this->topLine && this->selected < static_cast(end)) { - this->FillRegion(3, ((this->lineHeight * (this->selected - this->topLine)) + 1), (this->geometry.width - 6), (this->lineHeight - 2), 0xF8D5C4u); + const int top = this->topLine; + const int end = static_cast(std::min( + static_cast((top + (this->geometry.height / this->lineHeight - this->bottomMargin))), static_cast(this->lines.size()) + )); + + for (int row = top; row < end; ++row) { + if (row == this->selected) { + this->FillRegion(3, ((this->lineHeight * (row - top)) + 1), (this->geometry.width - 6), (this->lineHeight - 2), 0xF8D5C4u); + } } - if (this->alignment == 0 || this->alignment == 1) { - this->DrawRows(this->alignment == 1); + for (int row = top; row < end; ++row) { + if (this->alignment == 0) { + this->DrawTextAt(3 - this->horizontalOffset, this->lineHeight * (row - top) + 2, this->lines[row].text.c_str(), 0, 0, 12, this->lines[row].color, 0, 0); + } else if (this->alignment == 1) { + const int x = static_cast( + static_cast(this->geometry.width) * 0.5f - + static_cast(this->TextWidth(this->lines[row].text.c_str(), 0, 0, 12, 0, 0)) * 0.5f + ); + this->DrawTextAt(x, this->lineHeight * (row - top) + 2, this->lines[row].text.c_str(), 0, 0, 12, this->lines[row].color, 0, 0); + } } if (this->parent) {