![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Modal dialog for adding, removing, and reordering switch cases on a node. More...
#include <SwitchCaseEditorModal.h>
Public Member Functions | |
| SwitchCaseEditorModal () | |
| Constructs the modal. | |
| ~SwitchCaseEditorModal ()=default | |
| SwitchCaseEditorModal (const SwitchCaseEditorModal &)=delete | |
| SwitchCaseEditorModal & | operator= (const SwitchCaseEditorModal &)=delete |
| bool | IsOpen () const |
| Returns true if the modal is currently open. | |
| 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. | |
| bool | IsConfirmed () const |
| Returns true if the modal was closed via "Apply" rather than "Cancel". | |
| const std::vector< SwitchCaseDefinition > & | GetSwitchCases () const |
| Returns the edited switch cases (only valid after IsConfirmed() == true). | |
| void | Render () |
| Renders the modal dialog. | |
Private Member Functions | |
| void | RenderCaseList () |
| Renders the scrollable list of case rows. | |
| bool | RenderCaseRow (size_t caseIndex) |
| Renders a single case row with all controls. | |
| void | RenderActionButtons () |
| Renders the "Add Case" and action buttons (Apply / Cancel). | |
Private Attributes | |
| bool | m_isOpen = false |
| True if the modal is currently open. | |
| bool | m_confirmed = false |
| True if the user clicked "Apply" (set to false on Close) | |
| std::vector< SwitchCaseDefinition > | m_editingCases |
| Working copy of switch cases being edited. | |
| std::vector< std::string > | m_caseValueBuffers |
| Temporary edit buffers for value and label fields. | |
| std::vector< std::string > | m_caseLabelBuffers |
| One per case, synced before render. | |
| std::string | m_switchVarName |
| Variable being switched (e.g. "mHealth") | |
| std::string | m_switchVarType |
| Variable type (e.g. "Int", "String") | |
| std::string | m_currentVarValue |
| Current value for context display. | |
| bool | m_hasValidationError = false |
| Set to true if any case has errors (prevents Apply) | |
Modal dialog for adding, removing, and reordering switch cases on a node.
The modal contains:
Definition at line 57 of file SwitchCaseEditorModal.h.
| Olympe::SwitchCaseEditorModal::SwitchCaseEditorModal | ( | ) |
Constructs the modal.
Definition at line 14 of file SwitchCaseEditorModal.cpp.
|
default |
|
delete |
| void Olympe::SwitchCaseEditorModal::Close | ( | ) |
Closes the modal without confirming changes.
Definition at line 47 of file SwitchCaseEditorModal.cpp.
References m_caseLabelBuffers, m_caseValueBuffers, m_confirmed, m_editingCases, and m_isOpen.
Referenced by Render().
Here is the caller graph for this function:
|
inline |
Returns the edited switch cases (only valid after IsConfirmed() == true).
Definition at line 109 of file SwitchCaseEditorModal.h.
References m_editingCases.
|
inline |
Returns true if the modal was closed via "Apply" rather than "Cancel".
After reading, call Close() to reset the flag for the next edit.
Definition at line 104 of file SwitchCaseEditorModal.h.
References m_confirmed.
|
inline |
Returns true if the modal is currently open.
Definition at line 78 of file SwitchCaseEditorModal.h.
References m_isOpen.
| void Olympe::SwitchCaseEditorModal::Open | ( | const std::vector< SwitchCaseDefinition > & | currentCases, |
| const std::string & | switchVarName = "", |
||
| const std::string & | switchVarType = "", |
||
| const std::string & | currentVarValue = "" |
||
| ) |
Opens the modal, loading the given switch cases for editing.
Resets the confirmed flag and takes a COPY of the cases to edit.
| currentCases | Switch cases from the selected node. |
| switchVarName | Name of the variable being switched (e.g. "mHealth") |
| switchVarType | Type of the variable (e.g. "Int") |
| currentVarValue | Current value of the variable for display (optional) |
Definition at line 20 of file SwitchCaseEditorModal.cpp.
References GetComponentTypeID_Static(), m_caseLabelBuffers, m_caseValueBuffers, m_confirmed, m_currentVarValue, m_editingCases, m_hasValidationError, m_isOpen, m_switchVarName, and m_switchVarType.
Here is the call graph for this function:
|
delete |
| void Olympe::SwitchCaseEditorModal::Render | ( | ) |
Renders the modal dialog.
Must be called once per frame while IsOpen(). Handles ImGui::OpenPopupOnItemClick, ImGui::BeginPopupModal, etc.
Definition at line 56 of file SwitchCaseEditorModal.cpp.
References Close(), GetComponentTypeID_Static(), m_isOpen, RenderActionButtons(), and RenderCaseList().
Here is the call graph for this function:
|
private |
Renders the "Add Case" and action buttons (Apply / Cancel).
Definition at line 323 of file SwitchCaseEditorModal.cpp.
References GetComponentTypeID_Static(), m_caseLabelBuffers, m_caseValueBuffers, m_confirmed, m_editingCases, m_hasValidationError, and m_isOpen.
Referenced by Render().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Renders the scrollable list of case rows.
Definition at line 92 of file SwitchCaseEditorModal.cpp.
References GetComponentTypeID_Static(), m_caseLabelBuffers, m_caseValueBuffers, m_currentVarValue, m_editingCases, m_hasValidationError, m_switchVarName, m_switchVarType, and RenderCaseRow().
Referenced by Render().
Here is the call graph for this function:
Here is the caller graph for this function:Renders a single case row with all controls.
| caseIndex | 0-based index in m_editingCases |
Definition at line 184 of file SwitchCaseEditorModal.cpp.
References GetComponentTypeID_Static(), m_caseLabelBuffers, m_caseValueBuffers, m_editingCases, and m_hasValidationError.
Referenced by RenderCaseList().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
One per case, synced before render.
Definition at line 159 of file SwitchCaseEditorModal.h.
Referenced by Close(), Open(), RenderActionButtons(), RenderCaseList(), and RenderCaseRow().
|
private |
Temporary edit buffers for value and label fields.
One per case, synced before render
Definition at line 158 of file SwitchCaseEditorModal.h.
Referenced by Close(), Open(), RenderActionButtons(), RenderCaseList(), and RenderCaseRow().
True if the user clicked "Apply" (set to false on Close)
Definition at line 152 of file SwitchCaseEditorModal.h.
Referenced by Close(), IsConfirmed(), Open(), and RenderActionButtons().
|
private |
Current value for context display.
Definition at line 164 of file SwitchCaseEditorModal.h.
Referenced by Open(), and RenderCaseList().
|
private |
Working copy of switch cases being edited.
Definition at line 155 of file SwitchCaseEditorModal.h.
Referenced by Close(), GetSwitchCases(), Open(), RenderActionButtons(), RenderCaseList(), and RenderCaseRow().
Set to true if any case has errors (prevents Apply)
Definition at line 165 of file SwitchCaseEditorModal.h.
Referenced by Open(), RenderActionButtons(), RenderCaseList(), and RenderCaseRow().
True if the modal is currently open.
Definition at line 149 of file SwitchCaseEditorModal.h.
Referenced by Close(), IsOpen(), Open(), Render(), and RenderActionButtons().
|
private |
Variable being switched (e.g. "mHealth")
Definition at line 162 of file SwitchCaseEditorModal.h.
Referenced by Open(), and RenderCaseList().
|
private |
Variable type (e.g. "Int", "String")
Definition at line 163 of file SwitchCaseEditorModal.h.
Referenced by Open(), and RenderCaseList().