rodecomp/Source/UI/Window/InputFocus.cpp
ragnarok-clanker 65eb389b7b 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).
2026-10-28 20:12:41 +00:00

142 lines
2.8 KiB
C++

#include "UI/Window/InputFocus.h"
#include "UI/Window/UIWindow.h"
// OFFSET: 0x00AA9B40
// FUNCTION: fn_17256
void InputFocus::Set(UIWindow* value) {
if (this->window) {
const bool retained = value && value->Slot06() == this->window;
this->window->Slot24(retained);
}
if (value) {
this->window = value->Slot06();
if (this->window) {
this->window->Slot23();
}
} else {
this->window = nullptr;
}
}
// OFFSET: 0x00AA9BC0
// FUNCTION: fn_17257
void InputFocus::First() {
if (this->window) {
UIWindow* parent = this->window->parent;
for (UIWindow* child : parent->m_children) {
if (!child->Slot05()) {
continue;
}
this->window->Slot24(child->Slot06() == this->window);
this->window = child->Slot06();
if (this->window) {
this->window->Slot23();
}
return;
}
this->window->Slot24(0);
}
this->window = nullptr;
}
// OFFSET: 0x00AA9C70
// FUNCTION: fn_17258
void InputFocus::Last() {
if (this->window) {
UIWindow* parent = this->window->parent;
for (auto it = parent->m_children.rbegin(); it != parent->m_children.rend(); ++it) {
UIWindow* child = *it;
if (child->Slot05()) {
this->Set(child);
return;
}
}
if (this->window) {
this->window->Slot24(0);
}
}
this->window = nullptr;
}
// OFFSET: 0x00AA9D20
// FUNCTION: fn_17259
void InputFocus::Next() {
if (!this->window) {
return;
}
UIWindow* parent = this->window->parent;
bool found = false;
for (UIWindow* child : parent->m_children) {
if (found && child->Slot05()) {
this->window->Slot24(child->Slot06() == this->window);
this->window = child->Slot06();
if (this->window) {
this->window->Slot23();
}
return;
}
if (child == this->window && child->Slot05()) {
found = true;
}
}
this->window->Slot24(0);
this->window = nullptr;
}
// 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) {
return;
}
UIWindow* previous = this->window->parent->PreviousFocusable(this->window);
if (!previous) {
this->Set(nullptr);
return;
}
if (previous->Slot05()) {
this->Set(previous);
}
}
// INLINED
void InputFocus::Refresh(UIWindow* const& excludedRoot) {
if (this->window) {
this->window->Invalidate();
UIWindow* root = this->window->Root();
if (root && root != excludedRoot) {
root->Invalidate();
}
}
}
// OFFSET: 0x00AA9E60
// FUNCTION: fn_17261
void SetPressedWindowRoot(UIWindow*& pressedRoot, UIWindow* window) {
pressedRoot = window ? window->Root() : nullptr;
}