Decompile 2 functions in Source/UI/Lists/UIComboBoxEx.cpp
Batch #15460 by youko: 0 byte-identical, 2 confirmed by peer review. - fn_11510 UIComboBoxEx::Refresh: logic confirmed by peer review - fn_11530 UIComboBoxEx::Resize: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, Yommy, alisonrag Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
4e5d174f53
commit
725bdaddeb
1 changed files with 16 additions and 11 deletions
|
|
@ -56,11 +56,13 @@ void UIComboBoxEx::OnCreate(int width, int height) {
|
|||
void UIComboBoxEx::Resize(int width, int height) {
|
||||
this->UIListBoxEx::Resize(width, height);
|
||||
this->topLine = 0;
|
||||
this->verticalBar->position = 0;
|
||||
this->verticalBar->Move((width - 13), 0);
|
||||
this->verticalBar->position = this->topLine;
|
||||
|
||||
if (this->verticalOverflow != 0) {
|
||||
this->verticalBar->Move((width - 13), 0);
|
||||
this->verticalBar->Invalidate();
|
||||
} else {
|
||||
this->verticalBar->Move((width - 13), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,24 +110,27 @@ void UIComboBoxEx::Refresh() {
|
|||
const int overflow = std::max((count - visible), 0);
|
||||
this->verticalOverflow = overflow != 0;
|
||||
auto* bar = this->verticalBar;
|
||||
bar->visible = visible;
|
||||
bar->total = count;
|
||||
bar->maximum = overflow != 0 ? (overflow + this->bottomMargin) : 0;
|
||||
bar->Invalidate();
|
||||
|
||||
if (bar->position > bar->maximum) {
|
||||
bar->position = bar->maximum;
|
||||
}
|
||||
|
||||
if (overflow != 0) {
|
||||
bar->SetRange((this->bottomMargin + overflow), visible, count);
|
||||
|
||||
if (this->selected < this->topLine) {
|
||||
this->topLine = this->selected;
|
||||
} else if ((this->topLine + visible) <= this->selected) {
|
||||
this->topLine = ((this->selected - visible) + 1);
|
||||
}
|
||||
|
||||
this->topLine = std::clamp(this->topLine, 0, overflow);
|
||||
if (this->topLine < 0) {
|
||||
this->topLine = 0;
|
||||
}
|
||||
|
||||
if (this->topLine > overflow) {
|
||||
this->topLine = overflow;
|
||||
}
|
||||
|
||||
this->verticalBar->position = this->topLine;
|
||||
} else {
|
||||
bar->SetRange(0, visible, count);
|
||||
}
|
||||
|
||||
this->verticalBar->Invalidate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue