Decompile 6 functions in Source/UI/Window/InputFocus.cpp, Source/UI/Window/InputFocus.h, ...
Batch #1689 by ragnarok-clanker: 0 byte-identical, 6 confirmed by peer review. - fn_17197 InputFocus::IsLast: logic confirmed by peer review - fn_17260 InputFocus::Previous: logic confirmed by peer review - fn_16960 UIWindow::NextFocusable: logic confirmed by peer review - fn_16969 UIWindow::PreviousFocusable: logic confirmed by peer review - fn_10911 UIEditCtrl2::SendMsg: logic confirmed by peer review - fn_10913 UIEditCtrl5::SendMsg: logic confirmed by peer review Peer-reviewed-by: eAthena 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
9ad1ef7f75
commit
65eb389b7b
5 changed files with 84 additions and 19 deletions
|
|
@ -16,7 +16,13 @@ int UIEditCtrl2::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
if (message != 0) {
|
||||
this->UIEditCtrl::SendMsg(sender, message, a, b, c, d);
|
||||
} else {
|
||||
this->m_edit->focus.Advance();
|
||||
InputFocus& focus = this->m_edit->focus;
|
||||
if (focus.IsLast(focus.window)) {
|
||||
focus.First();
|
||||
} else {
|
||||
focus.Next();
|
||||
}
|
||||
|
||||
this->UIWindow::SendMsg(sender, message, a, b, c, d);
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +68,13 @@ int UIEditCtrl5::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
if (message != 0) {
|
||||
this->UIEditCtrl::SendMsg(sender, message, a, b, c, d);
|
||||
} else {
|
||||
this->m_edit->focus.Advance();
|
||||
InputFocus& focus = this->m_edit->focus;
|
||||
if (focus.IsLast(focus.window)) {
|
||||
focus.First();
|
||||
} else {
|
||||
focus.Next();
|
||||
}
|
||||
|
||||
this->UIWindow::SendMsg(sender, message, a, b, c, d);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,28 +100,28 @@ void InputFocus::Next() {
|
|||
this->window = nullptr;
|
||||
}
|
||||
|
||||
// INLINED
|
||||
void InputFocus::Advance() {
|
||||
// OFFSET: 0x00A96F60
|
||||
// FUNCTION: fn_17197
|
||||
bool InputFocus::IsLast(UIWindow* value) {
|
||||
return value && value->parent->NextFocusable(value) == nullptr;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00AA9DC0
|
||||
// FUNCTION: fn_17260
|
||||
void InputFocus::Previous() {
|
||||
if (!this->window) {
|
||||
this->Next();
|
||||
return;
|
||||
}
|
||||
|
||||
UIWindow* parent = this->window->parent;
|
||||
bool found = false;
|
||||
|
||||
for (UIWindow* child : parent->m_children) {
|
||||
if (found && child->Slot05()) {
|
||||
this->Next();
|
||||
return;
|
||||
}
|
||||
|
||||
if (child == this->window && child->Slot05()) {
|
||||
found = true;
|
||||
}
|
||||
UIWindow* previous = this->window->parent->PreviousFocusable(this->window);
|
||||
if (!previous) {
|
||||
this->Set(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
this->First();
|
||||
if (previous->Slot05()) {
|
||||
this->Set(previous);
|
||||
}
|
||||
}
|
||||
|
||||
// INLINED
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ struct InputFocus {
|
|||
void First();
|
||||
void Last();
|
||||
void Next();
|
||||
void Advance();
|
||||
bool IsLast(UIWindow* value);
|
||||
void Previous();
|
||||
|
||||
void Refresh(UIWindow* const& excludedRoot);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -575,6 +575,56 @@ UIWindow* UIWindow::Root() {
|
|||
return root;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A7ED50
|
||||
// FUNCTION: fn_16960
|
||||
UIWindow* UIWindow::NextFocusable(UIWindow* child) {
|
||||
auto it = this->m_children.begin();
|
||||
|
||||
for (; it != this->m_children.end(); ++it) {
|
||||
if (*it == child && child->Slot05()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (it == this->m_children.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (++it; it != this->m_children.end(); ++it) {
|
||||
if ((*it)->Slot05()) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A7FF30
|
||||
// FUNCTION: fn_16969
|
||||
UIWindow* UIWindow::PreviousFocusable(UIWindow* child) {
|
||||
auto it = this->m_children.end();
|
||||
|
||||
for (; it != this->m_children.begin(); --it) {
|
||||
UIWindow* window = *std::prev(it);
|
||||
if (window == child && window->Slot05()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (it == this->m_children.begin()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (--it; it != this->m_children.begin(); --it) {
|
||||
UIWindow* window = *std::prev(it);
|
||||
if (window->Slot05()) {
|
||||
return window;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A82DD0
|
||||
// FUNCTION: fn_16995
|
||||
void UIWindow::DeleteChildren() {
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ public:
|
|||
return this->m_uid;
|
||||
}
|
||||
UIWindow* Root();
|
||||
UIWindow* NextFocusable(UIWindow* child);
|
||||
UIWindow* PreviousFocusable(UIWindow* child);
|
||||
void ClearSurface(std::uint32_t color);
|
||||
void SetSize(int width, int height);
|
||||
void DrawBitmap(int x, int y, const BitmapImage* image, bool transparent);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue