Files
ObsidianDragon/src/ui/windows/balance_components.h
DanS b6567ee196 refactor(balance): extract shared rendering components into balance_components.{h,cpp} (audit #10)
First slice of decomposing balance_tab.cpp (3449 lines). The five rendering helpers used by every
balance layout — UpdateBalanceLerp, RenderCompactHero, RenderSharedAddressList (599 lines, the
drag-reorderable address list), RenderSharedRecentTx, RenderSyncBar — are moved verbatim into
balance_components.cpp. balance_tab.cpp is now 2680 lines.

Clean extraction: the helpers' interactive statics (drag/copy/hide/show) are function-local and
move WITH them; the only file-scope state they share is the balance-lerp animation values
(s_dispTotal/Shielded/Transparent/Unconfirmed) and s_generating_z_address, now non-static and
declared `extern` in balance_components.h (defined once in balance_tab.cpp, so both TUs share the
same objects). RenderCompactHero's default arg moved to the header declaration. The layouts (still
in balance_tab.cpp) call the helpers via the new header.

Verified: full-node + Windows + lite build (links cleanly -> extern state resolves), tests,
hygiene. This touches every layout's address list / recent-tx / hero / sync bar, so needs a
hands-on pass across the balance layouts before the next slice.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 19:50:44 -05:00

35 lines
1.3 KiB
C++

// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// Shared rendering components used by every balance-tab layout (the animated hero, the address
// list, the recent-transactions strip, the sync bar) plus the balance-lerp animation state.
// Extracted from balance_tab.cpp so the layouts can be split into their own files later.
#pragma once
#include "imgui.h"
namespace dragonx {
class App;
namespace ui {
// Animated balance display values — lerp toward the wallet's real balances each frame. Defined in
// balance_tab.cpp (the lerp is advanced by UpdateBalanceLerp), shared with the components.
extern double s_dispTotal;
extern double s_dispShielded;
extern double s_dispTransparent;
extern double s_dispUnconfirmed;
// True while an async new-address generation is in flight.
extern bool s_generating_z_address;
void UpdateBalanceLerp(App* app);
void RenderCompactHero(App* app, ImDrawList* dl, float availW, float hs, float vs,
float heroHeightOverride = -1.0f);
void RenderSharedAddressList(App* app, float listH, float availW, float glassRound, float hs, float vs);
void RenderSharedRecentTx(App* app, float recentH, float availW, float hs, float vs);
void RenderSyncBar(App* app, ImDrawList* dl, float vs);
} // namespace ui
} // namespace dragonx