Extends the labeled "Pending +X" chip (with its awaiting-confirmations tooltip) to three more layouts via a shared DrawPendingChip() helper. It draws on the ticker line (the USD value sits on the line below in these layouts, so there's no overlap) and is skipped if it would overflow the card. The remaining draw-list layouts with right-aligned content (Consolidated, Minimal, the grid variants) are left for a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
48 lines
2.1 KiB
C++
48 lines
2.1 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 <string>
|
|
|
|
#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,
|
|
float reserveBelow = 0.0f);
|
|
void RenderSharedRecentTx(App* app, float recentH, float availW, float hs, float vs);
|
|
void RenderSyncBar(App* app, ImDrawList* dl, float vs);
|
|
|
|
// Draws a labeled "Pending +X" chip (unconfirmed balance) at `pos`, via the draw list only, when there
|
|
// is unconfirmed balance AND it fits left of `maxRight`. Returns the width drawn (0 if skipped). Adds a
|
|
// hover tooltip. Shared by the balance layouts so pending isn't visible in only one of them.
|
|
float DrawPendingChip(ImDrawList* dl, ImVec2 pos, float maxRight, ImFont* font, float fontSize);
|
|
|
|
// Total period-earnings for the whole wallet, formatted per the earnings settings. Returns false
|
|
// (and leaves out* untouched) when the global earnings toggle is off, so layouts show it only when
|
|
// the user has opted into the earnings view. Shared by RenderCompactHero and the layout totals.
|
|
bool FormatTotalEarnings(App* app, std::string& outText, ImU32& outCol);
|
|
|
|
} // namespace ui
|
|
} // namespace dragonx
|