9#include "../../third_party/imgui/imgui.h"
44 ImGui::OpenPopup(
"Switch Case Editor##modal");
66 ImGui::SetNextWindowSizeConstraints(
ImVec2(800.0f, 300.0f),
ImVec2(1200.0f, 700.0f));
72 ImGui::Text(
"Edit Switch Cases");
99 ImGui::PopStyleColor();
112 ImGui::TextDisabled(
"Add cases for each value to match below.");
130 ImGui::Columns(5,
"CaseListColumns",
false);
131 ImGui::SetColumnWidth(0, 35.0f);
132 ImGui::SetColumnWidth(1, 140.0f);
133 ImGui::SetColumnWidth(2, 180.0f);
134 ImGui::SetColumnWidth(3, 120.0f);
135 ImGui::SetColumnWidth(4, 110.0f);
137 ImGui::TextDisabled(
"#");
139 ImGui::TextDisabled(
"âī¸ Match Value");
141 ImGui::TextDisabled(
"đī¸ Display Name");
143 ImGui::TextDisabled(
"Pin Name");
145 ImGui::TextDisabled(
"Actions");
152 ImGui::BeginChild(
"CaseListScroll##modal",
ImVec2(0, 300),
true);
158 ImGui::Columns(5,
"CaseListColumns",
false);
159 ImGui::SetColumnWidth(0, 35.0f);
160 ImGui::SetColumnWidth(1, 140.0f);
161 ImGui::SetColumnWidth(2, 180.0f);
162 ImGui::SetColumnWidth(3, 120.0f);
163 ImGui::SetColumnWidth(4, 110.0f);
167 ImGui::PushID(
static_cast<int>(
i));
194 float columnWidth = ImGui::GetColumnWidth() - 35.0f;
204 ImGui::PopStyleColor();
211 ImGui::TextColored(
ImVec4(1.0f, 0.5f, 0.0f, 1.0f),
"â ī¸");
212 if (ImGui::IsItemHovered())
213 ImGui::SetTooltip(
"Match value cannot be empty");
230 ImGui::TextColored(
ImVec4(1.0f, 0.0f, 0.0f, 1.0f),
"â");
231 if (ImGui::IsItemHovered())
232 ImGui::SetTooltip(
"Duplicate value - another case already uses this");
238 ImGui::TextColored(
ImVec4(0.0f, 1.0f, 0.0f, 1.0f),
"â");
259 ImGui::PopStyleColor();
265 ImGui::TextColored(
ImVec4(0.7f, 0.7f, 0.7f, 1.0f),
"âšī¸");
266 if (ImGui::IsItemHovered())
267 ImGui::SetTooltip(
"Display name is optional - will show pin name on canvas");
274 ImGui::TextDisabled(
"%s", pinName.c_str());
276 if (ImGui::SmallButton(
"Copy##pin"))
278 ImGui::SetClipboardText(pinName.c_str());
280 if (ImGui::IsItemHovered())
281 ImGui::SetTooltip(
"Copy pin name to clipboard");
293 if (ImGui::IsItemHovered())
294 ImGui::SetTooltip(
"Move this case up");
304 if (ImGui::IsItemHovered())
305 ImGui::SetTooltip(
"Move this case down");
308 if (ImGui::Button(
"X##delete",
ImVec2(25, 0)))
315 if (ImGui::IsItemHovered())
316 ImGui::SetTooltip(
"Delete this case");
326 if (ImGui::Button(
"Add Case",
ImVec2(100, 0)))
366 ImGui::SetKeyboardFocusHere(-1);
376 ImGui::TextColored(
ImVec4(1.0f, 0.3f, 0.3f, 1.0f),
"â ī¸ Fix errors before applying");
379 ImGui::SameLine(ImGui::GetWindowWidth() - 210);
384 ImGui::BeginDisabled();
386 if (ImGui::Button(
"Apply",
ImVec2(100, 0)))
389 ImGui::CloseCurrentPopup();
394 ImGui::EndDisabled();
396 ImGui::SetTooltip(
"Cannot apply - please fix validation errors (marked with â)");
402 if (ImGui::Button(
"Cancel",
ImVec2(100, 0)))
405 ImGui::CloseCurrentPopup();
ComponentTypeID GetComponentTypeID_Static()
Dedicated modal dialog for editing a Switch node's case definitions (Phase 26).
std::string m_currentVarValue
Current value for context display.
std::vector< SwitchCaseDefinition > m_editingCases
Working copy of switch cases being edited.
void RenderCaseList()
Renders the scrollable list of case rows.
bool m_confirmed
True if the user clicked "Apply" (set to false on Close)
std::vector< std::string > m_caseLabelBuffers
One per case, synced before render.
SwitchCaseEditorModal()
Constructs the modal.
std::vector< std::string > m_caseValueBuffers
Temporary edit buffers for value and label fields.
std::string m_switchVarName
Variable being switched (e.g. "mHealth")
void RenderActionButtons()
Renders the "Add Case" and action buttons (Apply / Cancel).
bool m_hasValidationError
Set to true if any case has errors (prevents Apply)
std::string m_switchVarType
Variable type (e.g. "Int", "String")
void Open(const std::vector< SwitchCaseDefinition > ¤tCases, const std::string &switchVarName="", const std::string &switchVarType="", const std::string ¤tVarValue="")
Opens the modal, loading the given switch cases for editing.
void Close()
Closes the modal without confirming changes.
void Render()
Renders the modal dialog.
bool m_isOpen
True if the modal is currently open.
bool RenderCaseRow(size_t caseIndex)
Renders a single case row with all controls.
< Provides AssetID and INVALID_ASSET_ID
Describes a single case branch on a Switch node.