using System.Numerics;
namespace AcDream.UI.Abstractions;
///
/// Drawing primitives exposed to panels. The only API panels use to
/// emit pixels. The ImGui backend maps these straight onto ImGui calls; the
/// later custom retail-look backend will map the same primitives onto its
/// own retained-mode toolkit using retail dat-sourced fonts / sprites.
///
///
/// Keep this interface small and retail-friendly. If a widget requires a
/// feature the custom backend couldn't express with dat assets, don't add
/// it — find a different widget shape that both backends can satisfy.
///
///
public interface IPanelRenderer
{
///
/// Begin a top-level window. Matches retail's root UiPanel +
/// ImGui's Begin. Returns false if the window is collapsed
/// — the caller must still call to balance.
///
bool Begin(string title);
/// Close the most recent .
void End();
/// Draw a single line of text. No formatting / markdown.
void Text(string text);
/// Keep the next widget on the same line as the previous one.
void SameLine();
/// Horizontal rule separator.
void Separator();
///
/// A filled progress bar.
/// is clamped by the backend to [0, 1].
/// is the pixel width of the full bar.
/// is optional text (e.g. "54%") rendered on top.
///
void ProgressBar(float fraction, float width, string? overlay = null);
// -- Phase I.1 widget extensions ----------------------------------
///
/// Draw a single line of text in the supplied RGBA color.
/// Used for combat-event color-coding (damage red, heal green) and
/// any other surface where a glance distinguishes severity.
///
void TextColored(Vector4 rgba, string text);
///
/// Open / close section grouping inside a window. Returns
/// true when the section is currently expanded — only render
/// the section's contents in that branch.
///
/// If the user has never toggled the
/// header before, start in this state.
bool CollapsingHeader(string label, bool defaultOpen = true);
///
/// Push an expandable nested node. Pair every successful
/// true return with a matching ;
/// when this returns false do NOT call .
///
bool TreeNode(string label);
/// Pop a previously-pushed .
void TreePop();
///
/// A boolean toggle. Returns true on the frame the user
/// flipped the box (and updates in place);
/// returns false the rest of the time.
///
bool Checkbox(string label, ref bool value);
///
/// A clickable button. Returns true on the single frame the
/// user clicked it; false every other frame.
///
bool Button(string label);
///
/// A drop-down selector. Returns true on the frame the user
/// changed the selection (and updates
/// to the new value); false otherwise.
///
bool Combo(string label, ref int selectedIndex, string[] items);
///
/// A horizontal slider clamped to /
/// . Returns true on frames where the
/// user dragged the value (and updates );
/// false when idle.
///
bool SliderFloat(string label, ref float value, float min, float max);
///
/// Time-series line graph (e.g. fps history). The active window is
/// [..
/// +] interpreted
/// as a ring buffer.
///
/// Header text shown above the plot.
/// Sample buffer (kept by the caller).
/// Number of valid samples in the ring.
/// Index of the oldest sample in
/// .
/// Optional centered overlay text (e.g.
/// "60 fps").
/// Optional fixed lower bound; null = autoscale.
/// Optional fixed upper bound; null = autoscale.
/// Optional pixel size; null = backend default.
void PlotLines(
string label,
float[] values,
int count,
int offset = 0,
string? overlay = null,
float? min = null,
float? max = null,
Vector2? size = null);
///
/// Begin a multi-column table. Pair every call with .
/// Inside the table, advance to each cell with
/// before emitting widgets for it.
///
void BeginTable(string id, int columns);
/// Move to the next cell of the active table.
void TableNextColumn();
/// Close the most recent .
void EndTable();
///
/// A single-line text input that submits on Enter. Returns
/// true on the frame the user pressed Enter; in that case
/// is the value entered and the
/// implementation clears for the next
/// frame. On every other frame returns false and
/// is null; the implementation may
/// still mutate as the user types.
///
/// Maximum characters the buffer may grow to.
bool InputTextSubmit(string label, ref string buffer, int maxLen, out string? submitted);
/// Insert a small vertical gap.
void Spacing();
/// Reserve invisible space of the given size, useful for
/// layout-only padding.
void Dummy(Vector2 size);
///
/// Draw text that wraps at the current content region width.
/// Use for descriptions, error messages, anything multi-line.
///
void TextWrapped(string text);
// -- Phase J Tier 3 — scrollable child region for chat-style layouts --
///
/// Open a scrollable nested region inside the current window.
/// follows ImGui semantics: 0 means "fill
/// available", a positive value is absolute pixels, a negative
/// value means "fill available minus this amount". Pass
/// (0, -footerHeight) to reserve space at the bottom for
/// fixed elements (separator + input field) so the inner content
/// scrolls but the footer stays put across window resizes.
///
bool BeginChild(string id, Vector2 size, bool border = false);
/// Close the most recent .
void EndChild();
///
/// Approximate single-line widget height including ImGui's frame
/// padding + item spacing. Panels use this to compute footer
/// reservations for (e.g. one input
/// field + spacing). Backend-friendly because it returns a
/// scalar that the custom retail-look toolkit can also expose.
///
float FrameHeightWithSpacing();
///
/// Scroll the current scroll region so that the given fractional
/// vertical position is visible, where 0 = top and 1 = bottom.
/// Typical usage: call with 1.0f at the bottom of a
/// chat-tail render block to keep the latest line visible when
/// new entries arrive. No-op when no new content was emitted —
/// callers are expected to skip the call when they don't want
/// to force a scroll.
///
void SetScrollHereY(float ratio);
///
/// Request keyboard focus for the NEXT widget rendered. Used by
/// ChatPanel when Tab fires ToggleChatEntry — the
/// chat input gets focused programmatically so the user can begin
/// typing without clicking the field.
///
void SetKeyboardFocusHere();
// -- Phase K.3 — top-of-screen main menu bar -------------------------
///
/// Open the top-of-screen main menu bar. Returns true if the bar is
/// visible (top-level menus go inside that branch). Always pair with
/// when the call returned true.
///
bool BeginMainMenuBar();
/// Close the menu bar opened by .
void EndMainMenuBar();
///
/// Open a top-level menu within a menu bar. Returns true if the menu
/// is open — the caller emits entries inside
/// that branch, then calls .
///
bool BeginMenu(string label);
/// Close the menu opened by .
void EndMenu();
///
/// A clickable menu item with optional shortcut hint (e.g.
/// "F11") drawn right-aligned. Returns true on the single
/// frame the user clicks the item; false otherwise.
///
bool MenuItem(string label, string? shortcut = null);
// -- Tab bar (Settings panel + future tabbed surfaces) ---------------
///
/// Open a tab bar inside the current window. Returns true
/// when the bar is visible — only emit
/// calls inside that branch. Always pair with
/// when the call returned true. Retail had
/// tab bars in the Options UIs (gmGameplayOptionsUI etc), so
/// this primitive must be expressible by the future custom
/// retail-look backend.
///
bool BeginTabBar(string id);
/// Close the tab bar opened by .
void EndTabBar();
///
/// Begin a single tab inside an open .
/// Returns true when the tab is the currently selected one
/// — only render this tab's content in that branch. Always pair
/// with when the call returned true.
///
bool BeginTabItem(string label);
/// Close the tab opened by .
void EndTabItem();
///
/// Render a read-only multi-line text region the user can
/// select with click+drag and copy with Ctrl+C.
/// Matches the typical "click into a textbox to grab text" UX —
/// chat panels, log viewers, etc. use this to make text
/// extractable without the user having to alt-tab + retype.
///
///
/// The widget is sized to ; pass
/// (0, 0) for "fill the current content region" semantics
/// (matches ImGui defaults). is the ImGui
/// stable identifier — typically "##chatcopy" or similar
/// hidden-label form.
///
///
void TextMultilineReadOnly(string id, string content, Vector2 size);
}