refactor(ui): add LabeledInputRow + LabeledInputMultiline; complete inputs layer

Extend the inputs layer with the two remaining form-field idioms, pixel-identical:
- material::LabeledInputRow(label, labelPos, ...) — horizontal label-beside-input
  (Text + SameLine + SetNextItemWidth + InputText). Adopt at the settings RPC
  host/port/user/pass rows.
- material::LabeledInputMultiline(label, id, buf, size, flags) — label above a
  sized multiline input. Adopt at the address-book notes and request-payment
  memo (drops the redundant SetNextItemWidth that InputTextMultiline's explicit
  size already governs).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-04 21:41:42 -05:00
parent 840ead3645
commit dfca9bbd92
4 changed files with 34 additions and 24 deletions

View File

@@ -370,6 +370,27 @@ inline bool LabeledInput(const char* label, const char* id, char* buf, size_t bu
return ImGui::InputText(id, buf, bufSize, flags);
}
// Horizontal variant: label on the left, input to its right on the same line (settings-style rows).
// `labelPos` is the SameLine offset the input starts at (0 = default item spacing after the label).
inline bool LabeledInputRow(const char* label, float labelPos, const char* id, char* buf, size_t bufSize,
float width = -1.0f, const char* hint = nullptr, ImGuiInputTextFlags flags = 0)
{
ImGui::Text("%s", label);
ImGui::SameLine(labelPos);
ImGui::SetNextItemWidth(width);
if (hint && hint[0]) return ImGui::InputTextWithHint(id, hint, buf, bufSize, flags);
return ImGui::InputText(id, buf, bufSize, flags);
}
// Multiline variant: label above a multiline input of the given `size` (InputTextMultiline governs its
// own width via size, so no SetNextItemWidth). Returns the input's edited bool.
inline bool LabeledInputMultiline(const char* label, const char* id, char* buf, size_t bufSize,
const ImVec2& size, ImGuiInputTextFlags flags = 0)
{
ImGui::Text("%s", label);
return ImGui::InputTextMultiline(id, buf, bufSize, size, flags);
}
// ── Frameless icon button ────────────────────────────────────────────────
// Style for IconButton. All colors default to 0 (= unset): color falls back to OnSurfaceMedium();
// hoverColor==0 means "no hover recolor"; hoverBg/restBg==0 mean "no background".