rodecomp/Source/UI/Window/InputFocus.cpp
ragnarok-clanker c932ad6499 Maintenance: Resubmission of 15134 without the 12 struct/type renames (their new names changed mangled symbols in 17 functions). Rena
Batch #15141 by ragnarok-clanker: no function's compiled code changes; checked with 537 compiled unit(s), including every includer of Source/Client/Input/LanguageTC.h, Source/Client/Mode/CGameMode.h, Source/Client/Mode/CLoginMode.h, Source/Client/Replay.h, Source/Client/Session.h, Source/Contents/AchievementMgr.h, Source/Contents/Actors/CharacterRender.h, Source/Contents/Actors/EffectActors.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/Pc.h, Source/Contents/EnchantMgr.h, Source/Contents/GuildInfo.h, Source/Contents/Messenger/MessengerWindows.h, Source/Contents/Schedule/TimeScheduler.h, Source/Contents/Sound/SoundMgr.h, Source/Contents/SpriteLayerDrawing.h, Source/Contents/TableMng.h, Source/Contents/World/SkyBox.h, Source/UI/Chat/UINewChatWnd.h, Source/UI/Text/CreateLineInfo.h, Source/UI/UIGradeEnchantWnd.h, Source/UI/Window/UINewSelectCharWnd.h, Source/UI/Window/UINewSkillListWnd.h, Source/UI/Window/UIPetInfoWnd.h, Source/UI/Window/UIReplayRECControlWnd.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl.
2026-11-09 12:21:09 +00:00

133 lines
2.9 KiB
C++

#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/UIWindow.h"
// OFFSET: 0x00AA9B40
// FUNCTION: fn_17256
void UIWindowMgr::SetFocus(UIWindow* value) {
if (this->hoverWindow) {
const bool retained = value && value->GetEditWindow() == this->hoverWindow;
this->hoverWindow->OnFinishEdit(retained);
}
if (value) {
this->hoverWindow = value->GetEditWindow();
if (this->hoverWindow) {
this->hoverWindow->OnBeginEdit();
}
} else {
this->hoverWindow = nullptr;
}
}
// OFFSET: 0x00AA9BC0
// FUNCTION: fn_17257
void UIWindowMgr::FocusFirst() {
if (this->hoverWindow) {
UIWindow* parent = this->hoverWindow->parent;
for (auto it = parent->m_children.begin(); it != parent->m_children.end(); ++it) {
UIWindow* child = *it;
if (child->IsEditable()) {
this->SetFocus(child);
return;
}
}
if (this->hoverWindow) {
this->hoverWindow->OnFinishEdit(0);
}
}
this->hoverWindow = nullptr;
}
// OFFSET: 0x00AA9C70
// FUNCTION: fn_17258
void UIWindowMgr::FocusLast() {
if (this->hoverWindow) {
UIWindow* parent = this->hoverWindow->parent;
for (auto it = parent->m_children.rbegin(); it != parent->m_children.rend(); ++it) {
UIWindow* child = *it;
if (child->IsEditable()) {
this->SetFocus(child);
return;
}
}
if (this->hoverWindow) {
this->hoverWindow->OnFinishEdit(0);
}
}
this->hoverWindow = nullptr;
}
// OFFSET: 0x00AA9D20
// FUNCTION: fn_17259
void UIWindowMgr::FocusNext() {
if (!this->hoverWindow) {
return;
}
UIWindow* next = this->hoverWindow->parent->NextFocusable(this->hoverWindow);
if (next) {
if (next->IsEditable()) {
this->SetFocus(next);
}
} else {
this->SetFocus(nullptr);
}
}
// OFFSET: 0x00A96F60
// FUNCTION: fn_17197
bool UIWindowMgr::IsLastFocus(UIWindow* value) {
return value && value->parent->NextFocusable(value) == nullptr;
}
// OFFSET: 0x00AA9DC0
// FUNCTION: fn_17260
void UIWindowMgr::FocusPrevious() {
if (!this->hoverWindow) {
return;
}
UIWindow* previous = this->hoverWindow->parent->PreviousFocusable(this->hoverWindow);
if (previous) {
if (previous->IsEditable()) {
this->SetFocus(previous);
}
} else {
this->SetFocus(nullptr);
}
}
// INLINED
void UIWindowMgr::RefreshFocus(UIWindow* const& excludedRoot) {
if (this->hoverWindow) {
this->hoverWindow->Invalidate();
UIWindow* root = this->hoverWindow->Root();
if (root && root != excludedRoot) {
root->Invalidate();
}
}
}
// INLINED
void SetPressedWindowRoot(UIWindow*& pressedRoot, UIWindow* window) {
pressedRoot = window ? window->Root() : nullptr;
}
// OFFSET: 0x00AA9E60
// FUNCTION: fn_17261
void UIWindowMgr::SetPressedWindowRoot(UIWindow* window) {
UIWindow* root = window;
if (root != nullptr) {
while (root->parent != nullptr) {
root = root->parent;
}
}
this->keyboardCommandRootWnd = root;
}